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