mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
update<project>: downgrade .NET to 4.6; using Newtonsoft.JSON instead of System.Text.Json; using ILRepack to publish single executable file
This commit is contained in:
parent
dc17bb4b12
commit
0af951bb9a
11 changed files with 30 additions and 45 deletions
|
@ -6,9 +6,6 @@
|
|||
|
||||
[发行版](https://gitee.com/sourcegit/SourceGit/releases/)
|
||||
|
||||
1. `SourceGit.exe`为不包含`.NET 5.0`运行时的可执行文件。如果本机已有`.NET 5.0`可下载使用
|
||||
2. `SourceGit.zip`为`self-contained`包。包含了`.NET 5.0`运行时。
|
||||
|
||||
## 预览
|
||||
|
||||
* DarkTheme
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
cd src
|
||||
|
||||
dotnet publish -c Release -r win-x64 -o ..\publish\ -p:PublishSingleFile=true -p:PublishTrimmed=true -p:TrimMode=link -p:IncludeNativeLibrariesForSelfExtract=true --self-contained=true
|
||||
Compress-Archive -Update -Path ..\publish\SourceGit.exe -DestinationPath ..\publish\SourceGit.zip
|
||||
|
||||
dotnet publish -c Release -r win-x64 -o ..\publish\ -p:PublishSingleFile=true --self-contained=false
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Windows;
|
||||
|
||||
namespace SourceGit {
|
||||
|
@ -55,7 +55,7 @@ namespace SourceGit {
|
|||
var dir = Path.GetDirectoryName(settingFile);
|
||||
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||
|
||||
var data = JsonSerializer.Serialize(Setting, new JsonSerializerOptions() { WriteIndented = true });
|
||||
var data = JsonConvert.SerializeObject(Setting, Formatting.Indented);
|
||||
File.WriteAllText(settingFile, data);
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ namespace SourceGit {
|
|||
if (!File.Exists(settingFile)) {
|
||||
Setting = new Preference();
|
||||
} else {
|
||||
Setting = JsonSerializer.Deserialize<Preference>(File.ReadAllText(settingFile));
|
||||
Setting = JsonConvert.DeserializeObject<Preference>(File.ReadAllText(settingFile));
|
||||
}
|
||||
|
||||
// Try auto configure git via registry.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -15,14 +15,14 @@ namespace SourceGit.Git {
|
|||
public class Repository {
|
||||
|
||||
#region HOOKS
|
||||
public Action<string> OnNavigateCommit = null;
|
||||
public Action OnWorkingCopyChanged = null;
|
||||
public Action OnTagChanged = null;
|
||||
public Action OnStashChanged = null;
|
||||
public Action OnBranchChanged = null;
|
||||
public Action OnCommitsChanged = null;
|
||||
public Action OnSubmoduleChanged = null;
|
||||
public Action OnClosing = null;
|
||||
[JsonIgnore] public Action<string> OnNavigateCommit = null;
|
||||
[JsonIgnore] public Action OnWorkingCopyChanged = null;
|
||||
[JsonIgnore] public Action OnTagChanged = null;
|
||||
[JsonIgnore] public Action OnStashChanged = null;
|
||||
[JsonIgnore] public Action OnBranchChanged = null;
|
||||
[JsonIgnore] public Action OnCommitsChanged = null;
|
||||
[JsonIgnore] public Action OnSubmoduleChanged = null;
|
||||
[JsonIgnore] public Action OnClosing = null;
|
||||
#endregion
|
||||
|
||||
#region PROPERTIES_SAVED
|
||||
|
|
|
@ -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 {
|
||||
[JsonPropertyName("id")]
|
||||
[JsonProperty(PropertyName = "id")]
|
||||
public ulong Id { get; set; }
|
||||
[JsonPropertyName("tag_name")]
|
||||
[JsonProperty(PropertyName = "tag_name")]
|
||||
public string TagName { get; set; }
|
||||
[JsonPropertyName("target_commitish")]
|
||||
[JsonProperty(PropertyName = "target_commitish")]
|
||||
public string CommitSHA { get; set; }
|
||||
[JsonPropertyName("prerelease")]
|
||||
[JsonProperty(PropertyName = "prerelease")]
|
||||
public bool PreRelease { get; set; }
|
||||
[JsonPropertyName("name")]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
[JsonPropertyName("body")]
|
||||
[JsonProperty(PropertyName = "body")]
|
||||
public string Body { get; set; }
|
||||
[JsonPropertyName("created_at")]
|
||||
[JsonProperty(PropertyName = "created_at")]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<TargetFramework>net46</TargetFramework>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ApplicationIcon>App.ico</ApplicationIcon>
|
||||
|
@ -18,10 +18,7 @@
|
|||
<DebugType>none</DebugType>
|
||||
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<TrimmerRootAssembly Include="System.Runtime" />
|
||||
<TrimmerRootAssembly Include="System.Runtime.Extensions" />
|
||||
<TrimmerRootAssembly Include="System.Diagnostics.Debug" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -93,8 +93,7 @@ namespace SourceGit.UI {
|
|||
FlowDirection.LeftToRight,
|
||||
new Typeface(blame.FontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
|
||||
12.0,
|
||||
Brushes.Black,
|
||||
VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
||||
Brushes.Black);
|
||||
|
||||
var lineNumberWidth = formatted.Width + 16;
|
||||
var minWidth = area.ActualWidth - lineNumberWidth;
|
||||
|
|
|
@ -437,8 +437,7 @@ namespace SourceGit.UI {
|
|||
FlowDirection.LeftToRight,
|
||||
new Typeface(new FontFamily("Consolas"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
|
||||
12.0,
|
||||
Brushes.Black,
|
||||
VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
||||
Brushes.Black);
|
||||
|
||||
var grid = new DataGrid();
|
||||
grid.SetValue(Grid.RowProperty, 1);
|
||||
|
|
|
@ -492,8 +492,7 @@ namespace SourceGit.UI {
|
|||
FlowDirection.LeftToRight,
|
||||
new Typeface(FontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
|
||||
12.0,
|
||||
Brushes.Black,
|
||||
VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
||||
Brushes.Black);
|
||||
|
||||
return formatted.Width + 16;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using Newtonsoft.Json;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
@ -138,7 +138,7 @@ namespace SourceGit.UI {
|
|||
try {
|
||||
var web = new WebClient();
|
||||
var raw = web.DownloadString("https://gitee.com/api/v5/repos/sourcegit/SourceGit/releases/latest");
|
||||
var ver = JsonSerializer.Deserialize<Git.Version>(raw);
|
||||
var ver = JsonConvert.DeserializeObject<Git.Version>(raw);
|
||||
var cur = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
|
||||
var matches = Regex.Match(ver.TagName, @"^v(\d+)\.(\d+).*");
|
||||
|
|
|
@ -238,13 +238,13 @@ namespace SourceGit.UI {
|
|||
mark.Header = $"{i}";
|
||||
|
||||
var refIdx = i;
|
||||
mark.Click += (o, e) => {
|
||||
mark.Click += (o, ev) => {
|
||||
var repo = App.Setting.FindRepository(node.Id);
|
||||
if (repo != null) {
|
||||
repo.Color = refIdx;
|
||||
UpdateTree();
|
||||
}
|
||||
e.Handled = true;
|
||||
ev.Handled = true;
|
||||
};
|
||||
|
||||
bookmark.Items.Add(mark);
|
||||
|
|
Loading…
Reference in a new issue