mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
upgrade<project>: upgrade to .NET 5
This commit is contained in:
parent
672783390b
commit
c68b333c1d
5 changed files with 20 additions and 18 deletions
5
build.bat
Normal file
5
build.bat
Normal file
|
@ -0,0 +1,5 @@
|
|||
cd src
|
||||
rmdir /s /q bin
|
||||
rmdir /s /q obj
|
||||
dotnet publish -c Release -r win-x64 -p:PublishSingleFile=true --self-contained false
|
||||
cd ..
|
|
@ -1,10 +1,10 @@
|
|||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
@ -79,7 +79,7 @@ namespace SourceGit {
|
|||
var dir = Path.GetDirectoryName(settingFile);
|
||||
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||
|
||||
var data = JsonConvert.SerializeObject(Setting, Formatting.Indented);
|
||||
var data = JsonSerializer.Serialize(Setting, new JsonSerializerOptions() { WriteIndented = true });
|
||||
File.WriteAllText(settingFile, data);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ namespace SourceGit {
|
|||
if (!File.Exists(settingFile)) {
|
||||
Setting = new Preference();
|
||||
} else {
|
||||
Setting = JsonConvert.DeserializeObject<Preference>(File.ReadAllText(settingFile));
|
||||
Setting = JsonSerializer.Deserialize<Preference>(File.ReadAllText(settingFile));
|
||||
}
|
||||
|
||||
// Try auto configure git via registry.
|
||||
|
@ -196,7 +196,7 @@ namespace SourceGit {
|
|||
try {
|
||||
var web = new WebClient() { Encoding = Encoding.UTF8 };
|
||||
var raw = web.DownloadString("https://gitee.com/api/v5/repos/sourcegit/SourceGit/releases/latest");
|
||||
var ver = JsonConvert.DeserializeObject<Git.Version>(raw);
|
||||
var ver = JsonSerializer.Deserialize<Git.Version>(raw);
|
||||
var cur = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
|
||||
var matches = Regex.Match(ver.TagName, @"^v(\d+)\.(\d+).*");
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Threading;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SourceGit.Git {
|
||||
|
||||
|
@ -7,19 +7,19 @@ namespace SourceGit.Git {
|
|||
/// Version information.
|
||||
/// </summary>
|
||||
public class Version {
|
||||
[JsonProperty(PropertyName = "id")]
|
||||
[JsonPropertyName("id")]
|
||||
public ulong Id { get; set; }
|
||||
[JsonProperty(PropertyName = "tag_name")]
|
||||
[JsonPropertyName("tag_name")]
|
||||
public string TagName { get; set; }
|
||||
[JsonProperty(PropertyName = "target_commitish")]
|
||||
[JsonPropertyName("target_commitish")]
|
||||
public string CommitSHA { get; set; }
|
||||
[JsonProperty(PropertyName = "prerelease")]
|
||||
[JsonPropertyName("prerelease")]
|
||||
public bool PreRelease { get; set; }
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty(PropertyName = "body")]
|
||||
[JsonPropertyName("body")]
|
||||
public string Body { get; set; }
|
||||
[JsonProperty(PropertyName = "created_at")]
|
||||
[JsonPropertyName("created_at")]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ApplicationIcon>App.ico</ApplicationIcon>
|
||||
|
@ -18,7 +18,4 @@
|
|||
<DebugType>none</DebugType>
|
||||
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in a new issue