mirror of
https://github.com/leiurayer/downkyi.git
synced 2024-04-21 12:41:55 +00:00
重写AppInfo中的版本号
This commit is contained in:
@@ -561,6 +561,9 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json">
|
||||||
|
<Version>13.0.2</Version>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Prism.DryIoc" Version="8.1.97" />
|
<PackageReference Include="Prism.DryIoc" Version="8.1.97" />
|
||||||
<PackageReference Include="System.Data.SQLite.Core">
|
<PackageReference Include="System.Data.SQLite.Core">
|
||||||
<Version>1.0.112.2</Version>
|
<Version>1.0.112.2</Version>
|
||||||
@@ -573,6 +576,10 @@
|
|||||||
<Resource Include="Resources\default_header.jpg" />
|
<Resource Include="Resources\default_header.jpg" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Brotli.Core\Brotli.Core.csproj">
|
||||||
|
<Project>{3107CD63-E257-455E-AE81-1FD3582B067A}</Project>
|
||||||
|
<Name>Brotli.Core</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\DownKyi.Core\DownKyi.Core.csproj">
|
<ProjectReference Include="..\DownKyi.Core\DownKyi.Core.csproj">
|
||||||
<Project>{4fde0364-f65b-4812-bfe8-34e886624fbd}</Project>
|
<Project>{4fde0364-f65b-4812-bfe8-34e886624fbd}</Project>
|
||||||
<Name>DownKyi.Core</Name>
|
<Name>DownKyi.Core</Name>
|
||||||
|
|||||||
@@ -1,15 +1,53 @@
|
|||||||
namespace DownKyi.Models
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace DownKyi.Models
|
||||||
{
|
{
|
||||||
public class AppInfo
|
public class AppInfo
|
||||||
{
|
{
|
||||||
public string Name { get; } = "哔哩下载姬";
|
public string Name { get; } = "哔哩下载姬";
|
||||||
public int VersionCode { get; } = 513;
|
public int VersionCode { get; }
|
||||||
|
public string VersionName { get; }
|
||||||
|
|
||||||
|
const int a = 1;
|
||||||
|
const int b = 5;
|
||||||
|
const int c = 6;
|
||||||
|
|
||||||
|
public AppInfo()
|
||||||
|
{
|
||||||
|
VersionCode = a * 10000 + b * 100 + c;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public string VersionName { get; } = "1.5.6 Debug";
|
VersionName = $"{a}.{b}.{c}-debug";
|
||||||
#else
|
#else
|
||||||
public string VersionName { get; } = "1.5.6";
|
VersionName = $"{a}.{b}.{c}";
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int VersionNameToCode(string versionName)
|
||||||
|
{
|
||||||
|
int code = 0;
|
||||||
|
|
||||||
|
var isMatch = Regex.IsMatch(versionName, @"^v?([1-9]\d|\d).([1-9]\d|\d).([1-9]\d|\d)$");
|
||||||
|
if (!isMatch)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
string pattern = @"([1-9]\d|\d)";
|
||||||
|
var m = Regex.Matches(versionName, pattern);
|
||||||
|
if (m.Count == 3)
|
||||||
|
{
|
||||||
|
int i = 2;
|
||||||
|
foreach (var item in m)
|
||||||
|
{
|
||||||
|
code += int.Parse(item.ToString()) * (int)Math.Pow(100, i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using DownKyi.Utils;
|
|||||||
using Prism.Commands;
|
using Prism.Commands;
|
||||||
using Prism.Events;
|
using Prism.Events;
|
||||||
using Prism.Regions;
|
using Prism.Regions;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
|
||||||
namespace DownKyi.ViewModels.Settings
|
namespace DownKyi.ViewModels.Settings
|
||||||
{
|
{
|
||||||
@@ -46,7 +47,7 @@ namespace DownKyi.ViewModels.Settings
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public ViewAboutViewModel(IEventAggregator eventAggregator) : base(eventAggregator)
|
public ViewAboutViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator, dialogService)
|
||||||
{
|
{
|
||||||
|
|
||||||
#region 属性初始化
|
#region 属性初始化
|
||||||
|
|||||||
Reference in New Issue
Block a user