Versioning (#527)

* Update

* Use GitInfo

* Update ci

* Update

* resolve

* add v prefix

* update

* 修复问题

* disable push build

---------

Co-authored-by: Poker <poker_sang@outlook.com>
This commit is contained in:
Summpot 2024-09-22 21:39:03 +08:00 committed by Poker
parent 359bd9d9be
commit f7322be644
No known key found for this signature in database
GPG Key ID: C65A6AD457D5C8F8
12 changed files with 109 additions and 296 deletions

View File

@ -1,19 +1,17 @@
name: Pixeval Build Pipeline
name: Build
on:
# push:
# branches-ignore:
# - 'dependabot**'
# - "dependabot**"
# tags-ignore:
# - '**'
# - "**"
pull_request:
paths-ignore:
- '**.md'
- '.builds/**'
- '.specs/**'
schedule:
- cron: '0 0 * * *'
- "**.md"
- ".builds/**"
- ".specs/**"
defaults:
run:
shell: pwsh
@ -26,56 +24,56 @@ jobs:
fail-fast: true
matrix:
configuration: [Release]
platform: ['x64','x86','arm64']
platform: ["x64", "x86", "arm64"]
env:
SOLUTION_NAME: 'Pixeval.sln'
PACKAGE_PROJECT_NAME: 'src/Pixeval/Pixeval.csproj'
SOLUTION_NAME: "Pixeval.sln"
PACKAGE_PROJECT_NAME: "src/Pixeval/Pixeval.csproj"
PROJECT_RESTORE_PLATFORM: "x64"
CONFIGURATION: ${{ matrix.configuration }}
PLATFORM: ${{ matrix.platform }}
DEFAULT_DIR: ${{ github.workspace }} # Default: D:\a\Pixeval\Pixeval\
APPX_PACKAGE_DIR: ${{ github.workspace }}\AppxPackages
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup MSBuild
id: setup_msbuild
uses: microsoft/setup-msbuild@v1
- name: Checkout the repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup NuGet
id: setup-nuget
uses: NuGet/setup-nuget@v1.1.1
- name: Setup MSBuild
id: setup_msbuild
uses: microsoft/setup-msbuild@v1
- name: Setup .NET 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore Files
id: restore_project
shell: pwsh
run: |
msbuild $env:SOLUTION_NAME `
-t:Restore `
-p:Platform=$env:PROJECT_RESTORE_PLATFORM `
-p:Configuration=$env:CONFIGURATION `
-p:PublishReadyToRun=true `
- name: Setup NuGet
id: setup-nuget
uses: NuGet/setup-nuget@v1.1.1
- name: Restore NuGet
id: restore_nuget
shell: pwsh
run: 'nuget restore $env:SOLUTION_NAME'
- name: Setup .NET 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"
- name: Build Files (Release)
id: build_app_with_release
shell: pwsh
run: |
msbuild $env:PACKAGE_PROJECT_NAME `
-t:Build `
-p:Platform=$env:PLATFORM `
-p:Configuration=$env:CONFIGURATION `
-p:AppxBundle=Never `
- name: Restore Files
id: restore_project
shell: pwsh
run: |
msbuild $env:SOLUTION_NAME `
-t:Restore `
-p:Platform=$env:PROJECT_RESTORE_PLATFORM `
-p:Configuration=$env:CONFIGURATION `
-p:PublishReadyToRun=true `
- name: Restore NuGet
id: restore_nuget
shell: pwsh
run: "nuget restore $env:SOLUTION_NAME"
- name: Build Files (Release)
id: build_app_with_release
shell: pwsh
run: |
msbuild $env:PACKAGE_PROJECT_NAME `
-t:Build `
-p:Platform=$env:PLATFORM `
-p:Configuration=$env:CONFIGURATION `
-p:AppxBundle=Never `

View File

@ -88,4 +88,4 @@ jobs:
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.create_release.outputs.release_upload_url }}
asset_path: ./output/*
asset_path: ./output/*

View File

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear></clear>
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
<add key="CommunityToolkit-Labs" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" />
<add key="CommunityToolkit-Labs"
value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" />
</packageSources>
</configuration>

View File

@ -26,12 +26,12 @@
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
<PackageReference Include="CommunityToolkit.WinUI.Triggers" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Collections" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Extensions" Version="8.1.240821" />
<PackageReference Include="WinUI3Utilities" Version="1.1.7.7" />
<PackageReference Include="CommunityToolkit.WinUI.Triggers" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.WinUI.Collections" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.WinUI.Extensions" Version="8.1.240916" />
<PackageReference Include="WinUI3Utilities" Version="1.1.7.9" />
<ProjectReference Include="..\Pixeval.Utilities\Pixeval.Utilities.csproj" />
<ProjectReference Include="..\Pixeval.SourceGen\Pixeval.SourceGen.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="False" />

View File

@ -47,7 +47,7 @@ internal class PixivApiHttpMessageHandler(MakoClient makoClient) : MakoClientSup
headers.Authorization = new AuthenticationHeaderValue("Bearer", MakoClient.Session.AccessToken);
break;
case MakoHttpOptions.WebApiHost:
headers.TryAddWithoutValidation("Cookie", makoClient.Configuration.Cookie);
_ = headers.TryAddWithoutValidation("Cookie", MakoClient.Configuration.Cookie);
break;
}

View File

@ -8,6 +8,6 @@
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.3.1" />
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.3.2" />
</ItemGroup>
</Project>

View File

@ -134,5 +134,9 @@ public class ReenterableAwaiter<TResult>(bool initialSignal, TResult resultIniti
public ReenterableAwaiter<TResult> GetAwaiter() => this;
public void Dispose() => _semaphoreSlim.Dispose();
public void Dispose()
{
GC.SuppressFinalize(this);
_semaphoreSlim.Dispose();
}
}

View File

@ -3,35 +3,37 @@ using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Json;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using CommunityToolkit.HighPerformance;
using Semver;
namespace Pixeval.AppManagement;
public class Versioning
{
public Version CurrentVersion { get; } = Version.Parse("4.1.1"/*TODO:GitVersionInformation.AssemblySemVer*/);
public SemVersion CurrentVersion { get; } = SemVersion.Parse(ThisAssembly.Git.Tag, SemVersionStyles.Strict);
public Version? NewestVersion => NewestAppReleaseModel?.Version;
public SemVersion? NewestVersion => NewestAppReleaseModel?.Version;
public AppReleaseModel? NewestAppReleaseModel => AppReleaseModels?[0];
public AppReleaseModel? CurrentAppReleaseModel => AppReleaseModels?.FirstOrDefault(t => t.Version == CurrentVersion);
public UpdateState CompareUpdateState(Version currentVersion, Version? newVersion)
public UpdateState CompareUpdateState(SemVersion currentVersion, SemVersion? newVersion)
{
if (newVersion is null)
return UpdateState.Unknown;
return currentVersion.CompareTo(newVersion) switch
return currentVersion.ComparePrecedenceTo(newVersion) switch
{
> 0 => UpdateState.Insider,
0 => UpdateState.UpToDate,
_ => newVersion.Major > currentVersion.Major ? UpdateState.MajorUpdate :
newVersion.Minor > currentVersion.Minor ? UpdateState.MinorUpdate :
newVersion.Build > currentVersion.Build ? UpdateState.BuildUpdate :
newVersion.Patch > currentVersion.Patch ? UpdateState.BuildUpdate :
UpdateState.SpecifierUpdate
};
}
@ -57,7 +59,7 @@ public class Versioning
var tag = release.TagName;
for (var j = tag.Count('.'); j < 3; ++j)
tag += ".0";
if (Version.TryParse(tag, out var appVersion))
if (SemVersion.TryParse(tag, SemVersionStyles.Strict, out var appVersion))
{
App.AppViewModel.AppSettings.LastCheckedUpdate = DateTimeOffset.Now;
var str = release.Assets.FirstOrDefault(t =>
@ -88,7 +90,7 @@ public class Versioning
}
public record AppReleaseModel(
Version Version,
SemVersion Version,
string ReleaseNote,
Uri? ReleaseUri) : IComparable<AppReleaseModel>
{
@ -98,7 +100,7 @@ public record AppReleaseModel(
return 0;
if (other is null)
return 1;
return Version.CompareTo(other.Version);
return Version.ComparePrecedenceTo(other.Version);
}
}

View File

@ -22,7 +22,6 @@ using Microsoft.UI.Xaml.Controls;
using Pixeval.CoreApi.Model;
using Pixeval.Database;
using Pixeval.Util.UI;
using WinUI3Utilities.Controls;
using Symbol = FluentIcons.Common.Symbol;
namespace Pixeval.Pages;
@ -45,11 +44,11 @@ public record SuggestionModel(string? Name, string? TranslatedName, SuggestionTy
public FontIcon? FontIcon => SuggestionType switch
{
SuggestionType.IllustId or SuggestionType.NovelId or SuggestionType.UserId => Symbol.Open.GetSymbolIcon(FontSizeType.Small),
SuggestionType.Tag or SuggestionType.IllustrationTag or SuggestionType.NovelTag => Symbol.Tag.GetSymbolIcon(FontSizeType.Small),
SuggestionType.UserSearch => Symbol.Person.GetSymbolIcon(FontSizeType.Small),
SuggestionType.Settings => SettingsSymbol.GetSymbolIcon(FontSizeType.Small),
SuggestionType.History => Symbol.History.GetSymbolIcon(FontSizeType.Small),
SuggestionType.IllustId or SuggestionType.NovelId or SuggestionType.UserId => Symbol.Open.GetSymbolIcon(true),
SuggestionType.Tag or SuggestionType.IllustrationTag or SuggestionType.NovelTag => Symbol.Tag.GetSymbolIcon(true),
SuggestionType.UserSearch => Symbol.Person.GetSymbolIcon(true),
SuggestionType.Settings => SettingsSymbol.GetSymbolIcon(true),
SuggestionType.History => Symbol.History.GetSymbolIcon(true),
_ => null
};

View File

@ -1,184 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.22621.38</WindowsSdkPackageVersion>
<RootNamespace>Pixeval</RootNamespace>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Nullable>enable</Nullable>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<EnableDefaultPriItems>false</EnableDefaultPriItems>
<DefaultLanguage>zh-cn</DefaultLanguage>
<LangVersion>preview</LangVersion>
<Configurations>Debug;Release</Configurations>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PublishAot>false</PublishAot>
<WindowsSdkPackageVersion>10.0.22621.38</WindowsSdkPackageVersion>
<PublishProfile Condition="'$(PublishAot)' == 'true'">win-$(Platform).pubxml</PublishProfile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Labs.WinUI.Controls.MarkdownTextBlock" Version="0.1.240517-build.1678" />
<PackageReference Include="CommunityToolkit.Labs.WinUI.Shimmer" Version="0.1.240517-build.1678" />
<PackageReference Include="CommunityToolkit.Labs.WinUI.TitleBar" Version="0.0.1-build.1678" />
<PackageReference Include="CommunityToolkit.Labs.WinUI.TokenView" Version="0.1.240517-build.1678" />
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Collections" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Animations" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.ColorPicker" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.TokenizingTextBox" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Converters" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.3.1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="FluentIcons.WinUI" Version="1.1.258" />
<PackageReference Include="GitVersion.MsBuild" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="LiteDB" Version="5.0.21" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
<PackageReference Condition="'$(PublishAot)' == 'true'" Include="Microsoft.Windows.CsWinRT" Version="2.1.3" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
<PackageReference Include="PininSharp" Version="1.2.0" />
<!--<PackageReference Include="Pixeval.Bypass" Version="1.1.7" />-->
<PackageReference Include="Pixeval.QRCoder" Version="1.4.5" />
<PackageReference Include="QuestPDF" Version="2024.7.3" />
<PackageReference Include="ReverseMarkdown" Version="4.6.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.4" />
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="WinUI3Utilities" Version="1.1.7.7" />
<ProjectReference Include="..\Pixeval.Controls\Pixeval.Controls.csproj" />
<ProjectReference Include="..\Pixeval.CoreApi\Pixeval.CoreApi.csproj" />
<ProjectReference Include="..\Pixeval.Utilities\Pixeval.Utilities.csproj" />
<ProjectReference Include="..\Pixeval.SourceGen\Pixeval.SourceGen.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="False" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<!--Exposes PRI resources-->
<Target Name="InjectAdditionalFiles" BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun">
<RemoveDir Directories="Generated" />
<ItemGroup>
<TextFiles Include="%(TextFile.OutputTarget)">
<Content>{
@(TextFile-&gt;Metadata('Content'), ',
')
}</Content>
</TextFiles>
</ItemGroup>
<WriteLinesToFile Condition="%(TextFiles.Identity) != ''" File="%(TextFiles.Identity)" Overwrite="true" Lines="@(TextFiles->'%(Content)')" />
<ItemGroup>
<PRIResource Include="@(TextFiles)" />
<AdditionalFiles Include="@(PRIResource)" SourceItemGroup="PRIResource" />
</ItemGroup>
</Target>
<ItemGroup>
<CompilerVisibleItemMetadata Include="AdditionalFiles" MetadataName="SourceItemGroup" />
<TextFile Include="Strings\*\*.md">
<OutputTarget>Generated\%(RecursiveDir)\TextGenerated.resjson</OutputTarget>
<Content> "$([System.String]::Concat(%(Filename), '"').Replace('_', '/')) : "$([System.IO.File]::ReadAllText(%(FullPath)).Replace('\', '\\').Replace('
', '\n').Replace('"', '\"'))"</Content>
</TextFile>
<TextFile Include="Strings\*\*.txt">
<OutputTarget>Generated\%(RecursiveDir)\TextGenerated.resjson</OutputTarget>
<Content> "$([System.String]::Concat(%(Filename), '"').Replace('_', '/')) : "$([System.IO.File]::ReadAllText(%(FullPath)).Replace('\', '\\').Replace('
', '\n').Replace('"', '\"'))"</Content>
</TextFile>
</ItemGroup>
<!--PackageManifest-->
<PropertyGroup>
<UpdateVersionProperties>true</UpdateVersionProperties>
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
<GitVersionTargetsBefore>$(GitVersionTargetsBefore);_ValidateWindowsPackageType</GitVersionTargetsBefore>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxPackageSigningEnabled>False</AppxPackageSigningEnabled>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundle>Always</AppxBundle>
<AppInstallerUri>%UserProfile%\Desktop</AppInstallerUri>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<GenerateTemporaryStoreCertificate>True</GenerateTemporaryStoreCertificate>
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
</PropertyGroup>
<Target Name="PrepareForGenerateGitVersionInformation" BeforeTargets="GenerateGitVersionInformation">
<MakeDir Directories="$(OutDir);$(IntermediateOutputPath);@(DocFileItem->'%(RelativeDir)');@(CreateDirectory)" ContinueOnError="True" />
<ItemGroup Condition="'@(AppxManifest)'==''">
<AppxManifest Include="Package.appxmanifest"></AppxManifest>
</ItemGroup>
<PropertyGroup>
<WindowsPackageType>MSIX</WindowsPackageType>
</PropertyGroup>
</Target>
<ItemGroup>
<PRIResource Include="Assets\Svg.resjson" />
<PRIResource Include="Strings\*\*.resjson" />
</ItemGroup>
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
<ItemGroup>
<None Remove="Assets\Images\Icons\bookmarks-128x128.png" />
<None Remove="Assets\Images\Icons\bookmarks-64x64.png" />
<None Remove="Assets\Images\Icons\bookmarks.png" />
<None Remove="Assets\Images\Icons\followings-128x128.png" />
<None Remove="Assets\Images\Icons\followings-64x64.png" />
<None Remove="Assets\Images\Icons\followings.png" />
<None Remove="Assets\Images\Icons\history-128x128.png" />
<None Remove="Assets\Images\Icons\history-64x64.png" />
<None Remove="Assets\Images\Icons\history.png" />
<None Remove="Assets\Images\Icons\new-works-128x128.png" />
<None Remove="Assets\Images\Icons\new-works-64x64.png" />
<None Remove="Assets\Images\Icons\new-works.png" />
<None Remove="Assets\Images\Icons\ranking-128x128.png" />
<None Remove="Assets\Images\Icons\ranking-64x64.png" />
<None Remove="Assets\Images\Icons\ranking.png" />
<None Remove="Assets\Images\Icons\recent-posts-128x128.png" />
<None Remove="Assets\Images\Icons\recent-posts-64x64.png" />
<None Remove="Assets\Images\Icons\recent-posts.png" />
<None Remove="Assets\Images\Icons\recommend-user-128x128.png" />
<None Remove="Assets\Images\Icons\recommend-user-64x64.png" />
<None Remove="Assets\Images\Icons\recommend-user.png" />
<None Remove="Assets\Images\Icons\recommendations-128x128.png" />
<None Remove="Assets\Images\Icons\recommendations-64x64.png" />
<None Remove="Assets\Images\Icons\recommendations.png" />
<None Remove="Assets\Images\Icons\spotlight-128x128.png" />
<None Remove="Assets\Images\Icons\spotlight-64x64.png" />
<None Remove="Assets\Images\Icons\spotlight.png" />
<None Remove="Assets\Images\Icons\tag-128x128.png" />
<None Remove="Assets\Images\Icons\tag-64x64.png" />
<None Remove="Assets\Images\Icons\tag.png" />
<None Remove="Pages\Capability\FeedPage.xaml" />
<None Remove="Pages\Capability\Feeds\CondensedFeedPage.xaml" />
<None Remove="Strings\zh-cn\FeedPage.resjson" />
</ItemGroup>
<ItemGroup>
<Folder Include="Assets\NewFolder\" />
</ItemGroup>
</Project>

View File

@ -6,7 +6,8 @@
<WindowsSdkPackageVersion>10.0.22621.38</WindowsSdkPackageVersion>
<RootNamespace>Pixeval</RootNamespace>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Nullable>enable</Nullable>
<UseWinUI>true</UseWinUI>
@ -19,6 +20,9 @@
<PublishAot>false</PublishAot>
<WindowsSdkPackageVersion>10.0.22621.38</WindowsSdkPackageVersion>
<PublishProfile Condition="'$(PublishAot)' == 'true'">win-$(Platform).pubxml</PublishProfile>
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
<WindowsPackageType>MSIX</WindowsPackageType>
<NoWarn>NU1904;$(NoWarn)</NoWarn>
</PropertyGroup>
<ItemGroup>
@ -26,22 +30,22 @@
<PackageReference Include="CommunityToolkit.Labs.WinUI.Shimmer" Version="0.1.240517-build.1678" />
<PackageReference Include="CommunityToolkit.Labs.WinUI.TitleBar" Version="0.0.1-build.1678" />
<PackageReference Include="CommunityToolkit.Labs.WinUI.TokenView" Version="0.1.240517-build.1678" />
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Collections" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Animations" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.ColorPicker" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.TokenizingTextBox" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Converters" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.1.240821" />
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.3.1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.WinUI.Collections" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.WinUI.Animations" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.ColorPicker" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.TokenizingTextBox" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.WinUI.Converters" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.1.240916" />
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.3.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="FluentIcons.WinUI" Version="1.1.258" />
<PackageReference Include="GitVersion.MsBuild" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PackageReference Include="GitInfo" Version="3.3.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="LiteDB" Version="5.0.21" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
@ -56,10 +60,11 @@
<PackageReference Include="Pixeval.QRCoder" Version="1.4.5" />
<PackageReference Include="QuestPDF" Version="2024.7.3" />
<PackageReference Include="ReverseMarkdown" Version="4.6.0" />
<PackageReference Include="Semver" Version="2.3.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.4" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="WinUI3Utilities" Version="1.1.7.7" />
<PackageReference Include="WinUI3Utilities" Version="1.1.7.9" />
<ProjectReference Include="..\Pixeval.Controls\Pixeval.Controls.csproj" />
<ProjectReference Include="..\Pixeval.CoreApi\Pixeval.CoreApi.csproj" />
@ -102,9 +107,7 @@
<!--PackageManifest-->
<PropertyGroup>
<UpdateVersionProperties>true</UpdateVersionProperties>
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
<GitVersionTargetsBefore>$(GitVersionTargetsBefore);_ValidateWindowsPackageType</GitVersionTargetsBefore>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxPackageSigningEnabled>False</AppxPackageSigningEnabled>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
@ -118,16 +121,6 @@
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
</PropertyGroup>
<Target Name="PrepareForGenerateGitVersionInformation" BeforeTargets="GenerateGitVersionInformation">
<MakeDir Directories="$(OutDir);$(IntermediateOutputPath);@(DocFileItem->'%(RelativeDir)');@(CreateDirectory)" ContinueOnError="True" />
<ItemGroup Condition="'@(AppxManifest)'==''">
<AppxManifest Include="Package.appxmanifest"></AppxManifest>
</ItemGroup>
<PropertyGroup>
<WindowsPackageType>MSIX</WindowsPackageType>
</PropertyGroup>
</Target>
<ItemGroup>
<PRIResource Include="Assets\Svg.resjson" />
<PRIResource Include="Strings\*\*.resjson" />

View File

@ -48,7 +48,6 @@ using Color = Windows.UI.Color;
using Image = SixLabors.ImageSharp.Image;
using Point = Windows.Foundation.Point;
using Pixeval.Controls.Windowing;
using WinUI3Utilities.Controls;
using Size = Windows.Foundation.Size;
using Symbol = FluentIcons.Common.Symbol;
using SymbolIcon = FluentIcons.WinUI.SymbolIcon;
@ -200,20 +199,20 @@ public static partial class UiHelper
_ = frame.Navigate(tag.NavigateTo, tag.Parameter, transitionInfo);
}
public static SymbolIcon GetSymbolIcon(this Symbol symbol, FontSizeType fontSize = FontSizeType.None)
public static SymbolIcon GetSymbolIcon(this Symbol symbol, bool useSmallFontSize = false)
{
var icon = new SymbolIcon()
var icon = new SymbolIcon
{
Symbol = symbol
};
if (fontSize is not FontSizeType.None)
icon.FontSize = (int)fontSize;
if (useSmallFontSize)
icon.FontSize = 16; // 20 is default
return icon;
}
public static SymbolIconSource GetSymbolIconSource(this Symbol symbol, bool isFilled = false, Brush? foregroundBrush = null, FontSizeType fontSize = FontSizeType.None)
public static SymbolIconSource GetSymbolIconSource(this Symbol symbol, bool isFilled = false, Brush? foregroundBrush = null, bool useSmallFontSize = false)
{
var icon = new SymbolIconSource
{
@ -221,8 +220,8 @@ public static partial class UiHelper
Symbol = symbol
};
if (fontSize is not FontSizeType.None)
icon.FontSize = (int)fontSize;
if (useSmallFontSize)
icon.FontSize = 16; // 20 is default
if (foregroundBrush is not null)
icon.Foreground = foregroundBrush;