Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: ⬆️ 修改installer,grpc和playback版本至.net 8.0。 #33

Merged
merged 29 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
992a706
build: :arrow_up: 修改installer,grpc和playback版本至.net 8.0。
DreamEnderKing Nov 18, 2023
8eb6a5d
build: :arrow_up: 修改installer,grpc和playback版本至.net 8.0。
DreamEnderKing Nov 18, 2023
5423b36
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 18, 2023
7c97cf6
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 18, 2023
b61a2ff
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 18, 2023
31c98e3
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 18, 2023
c0a6661
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 18, 2023
fc92ec6
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 18, 2023
d6c2771
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 18, 2023
50f9a9c
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 18, 2023
7c98348
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 18, 2023
e4569d6
Merge branch 'dev' into dev
panxuc Nov 19, 2023
1cafd06
Merge branch 'dev' into dev
DragonAura Nov 23, 2023
00ee58e
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 18, 2023
d24ee7b
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
ede4fd0
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
0626ce9
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
d97bfe0
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
961c84f
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
4bdde25
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
0395671
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
3bc6b1c
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
3a321c2
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
4d214df
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
ef105d5
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
23fe6f5
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
02b7cda
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
8478bd0
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
97f4b2e
Merge branch 'dev' of https://github.com/DreamEnderKing/THUAI7 into dev
DreamEnderKing Nov 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 10 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x

- name: Install Workloads
run: dotnet workload restore "./logic/logic.sln"
- name: Build Logic
run: dotnet build "./logic/logic.sln" -c Release
run: dotnet build "./logic/logic.sln" -c Debug

dotnet-build-install:
if: true
Expand All @@ -22,10 +24,11 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

dotnet-version: 8.0.x
- name: Install Workloads
run: dotnet workload restore "./installer/installer.sln"
- name: Build Installer
run: dotnet build "./installer/installer.sln" -c Release -f net7.0-windows10.0.19041.0
run: dotnet build "./installer/installer.sln" -c Release -f net8.0-windows10.0.19041.0

dotnet-build-launcher:
if: true
Expand All @@ -35,20 +38,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x

- name: Build Launcher
run: dotnet build "./launcher/launcher.sln" -c Release

dotnet-build-playback:
if: true
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Build Playback
run: dotnet build "./playback/playback.sln" -c Release
run: dotnet build "./launcher/launcher.sln" -c Release
16 changes: 1 addition & 15 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,4 @@ jobs:
- name: Check Launcher
run: |
dotnet restore "./launcher/launcher.sln"
dotnet format "./launcher/launcher.sln" --severity error --no-restore --verify-no-changes

dotnet-format-checking-playback:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Check Playback
run: |
dotnet restore "./playback/playback.sln"
dotnet format "./playback/playback.sln" --severity error --no-restore --verify-no-changes
dotnet format "./launcher/launcher.sln" --severity error --no-restore --verify-no-changes
25 changes: 0 additions & 25 deletions dependency/proto/Proto.sln

This file was deleted.

4 changes: 2 additions & 2 deletions dependency/proto/Protos.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.25.1" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.24.4" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.25.1" />
<PackageReference Include="Grpc" Version="2.46.6" />
<PackageReference Include="Grpc.Core" Version="2.46.6" />
<PackageReference Include="Grpc.Tools" Version="2.59.0">
Expand Down
6 changes: 3 additions & 3 deletions installer/Model/Downloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void ResetDownloadFailedInfo()
downloadFailed.Clear();
}

private int filenum = 0; // 总文件个数
//private int filenum = 0; 总文件个数

public string Route { get; set; }
public string Username { get; set; } = string.Empty;
Expand All @@ -70,7 +70,7 @@ public enum UsingOS { Win, Linux, OSX };
public UsingOS usingOS { get; set; }
public class Updater
{
public string Message;
public string Message = string.Empty;
public bool Working { get; set; }
public bool CombatCompleted { get => false; }
public bool UploadReady { get; set; } = false;
Expand All @@ -88,7 +88,7 @@ public Downloader()
Route = Data.InstallPath;
Cloud = new Tencent_Cos("1314234950", "ap-beijing", "thuai6");
Web.Token_Changed += SaveToken;
string temp;
string? temp;
if (Data.Config.TryGetValue("Remembered", out temp))
{
if (Convert.ToBoolean(temp))
Expand Down
13 changes: 6 additions & 7 deletions installer/Model/EEsast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,30 @@ record LoginResponse

class EEsast
{
public enum language { cpp, py };
public enum LangUsed { cpp, py };
private string token = string.Empty;
public string Token
{
get => token; protected set
{
if (token != value)
Token_Changed.Invoke(this, new EventArgs());
Token_Changed?.Invoke(this, new EventArgs());
token = value;
}
}
public event EventHandler Token_Changed;
public string ID { get; protected set; }
public string Email { get; protected set; }
public event EventHandler? Token_Changed;
public string ID { get; protected set; } = string.Empty;
public string Email { get; protected set; } = string.Empty;

public ConcurrentQueue<Exception> Exceptions = new ConcurrentQueue<Exception>();
public enum WebStatus
{
disconnected, offline, logined
}
public WebStatus Status = WebStatus.disconnected;
public Tencent_Cos EEsast_Cos { get; protected set; }
public Tencent_Cos EEsast_Cos { get; protected set; } = new Tencent_Cos("1255334966", "ap-beijing", "eesast");
public async Task LoginToEEsast(HttpClient client, string useremail, string userpassword)
{
EEsast_Cos = new Tencent_Cos("1255334966", "ap-beijing", "eesast");
try
{
using (var response = await client.PostAsync("https://api.eesast.com/users/login", JsonContent.Create(new
Expand Down
13 changes: 9 additions & 4 deletions installer/Model/Local_Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class Local_Data
public Dictionary<string, string> Config
{
get; protected set;
}
} = new Dictionary<string, string>();
public Dictionary<string, string> MD5Data
{
get; protected set;
}// 路径为尽可能相对路径
} = new Dictionary<string, string>(); // 路径为尽可能相对路径
public ConcurrentBag<string> MD5Update
{
get; set;
Expand Down Expand Up @@ -84,9 +84,14 @@ public Local_Data()

public void ResetInstallPath(string newPath)
{
if (!Directory.Exists(Path.GetDirectoryName(newPath)))
string? dirName = Path.GetDirectoryName(newPath);
if (dirName is null)
{
return;
}
if (!Directory.Exists(dirName))
{
Directory.CreateDirectory(Path.GetDirectoryName(newPath));
Directory.CreateDirectory(dirName);
}
if (Installed)
{
Expand Down
24 changes: 13 additions & 11 deletions installer/Model/Tencent_Cos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
using COSXML.Auth;
using COSXML.CosException;
using COSXML.Model.Object;
using ICSharpCode.SharpZipLib;
using ICSharpCode.SharpZipLib.Tar;
using ICSharpCode.SharpZipLib.GZip;
using Newtonsoft.Json;
using System.Collections.Concurrent;
using System.IO.Compression;
using System.Formats.Tar;
using COSXML.Common;
using COSXML.Transfer;

// 禁用对没有调用异步API的异步函数的警告
#pragma warning disable CS1998

namespace installer.Model
{
public class Tencent_Cos
Expand Down Expand Up @@ -51,7 +53,7 @@ public void UpdateSecret(QCloudCredentialProvider credential)
cosXml = new CosXmlServer(config, credential);
}

public async Task DownloadFileAsync(string savePath, string remotePath = null)
public async Task DownloadFileAsync(string savePath, string? remotePath = null)
{
// download_dir标记根文件夹路径,key为相对根文件夹的路径(不带./)
// 创建存储桶
Expand Down Expand Up @@ -88,8 +90,10 @@ public async Task DownloadQueueAsync(ConcurrentQueue<string> queue, ConcurrentQu
ThreadPool.SetMaxThreads(20, 20);
for (int i = 0; i < queue.Count; i++)
{
string item;
string? item;
queue.TryDequeue(out item);
if (item == null)
continue;
ThreadPool.QueueUserWorkItem(async _ =>
{
try
Expand All @@ -98,6 +102,7 @@ public async Task DownloadQueueAsync(ConcurrentQueue<string> queue, ConcurrentQu
}
catch (Exception ex)
{
Exceptions.Push(ex);
downloadFailed.Enqueue(item);
}
});
Expand All @@ -108,16 +113,14 @@ public void ArchieveUnzip(string zipPath, string targetDir)
{
Stream? inStream = null;
Stream? gzipStream = null;
TarArchive? tarArchive = null;
try
{
using (inStream = File.OpenRead(zipPath))
{
using (gzipStream = new GZipInputStream(inStream))

using (gzipStream = new GZipStream(inStream, CompressionMode.Decompress))
{
tarArchive = TarArchive.CreateInputTarArchive(gzipStream);
tarArchive.ExtractContents(targetDir);
tarArchive.Close();
TarFile.ExtractToDirectory(gzipStream, targetDir, true);
}
}
}
Expand All @@ -127,7 +130,6 @@ public void ArchieveUnzip(string zipPath, string targetDir)
}
finally
{
if (tarArchive != null) tarArchive.Close();
if (gzipStream != null) gzipStream.Close();
if (inStream != null) inStream.Close();
}
Expand Down
7 changes: 0 additions & 7 deletions installer/Page/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@
{
public partial class MainPage : ContentPage
{
int count = 0;

public MainPage()
{
InitializeComponent();
}

private void OnSliderChanged(object sender, ValueChangedEventArgs e)
{
//Txt_Slider1.Text = e.NewValue.ToString();
}
}
}
14 changes: 14 additions & 0 deletions installer/Platforms/MacCatalyst/Entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- See https://aka.ms/maui-publish-app-store#add-entitlements for more information about adding entitlements.-->
<dict>
<!-- App Sandbox must be enabled to distribute a MacCatalyst app through the Mac App Store. -->
<key>com.apple.security.app-sandbox</key>
<true/>
<!-- When App Sandbox is enabled, this value is required to open outgoing network connections. -->
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

18 changes: 9 additions & 9 deletions installer/ViewModel/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ namespace installer.ViewModel
public abstract class NotificationObject : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
///< summary>
/// announce notification
/// </summary>
///< param name="propertyName">property name</param>
///<summary>
///announce notification
///</summary>
///<param name="propertyName">property name</param>
public void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
///< summary>
/// BaseCommand
/// </summary>
///<summary>
///BaseCommand
///</summary>
public class BaseCommand : ICommand
{
private Func<object?, bool>? _canExecute;
Expand Down Expand Up @@ -78,7 +78,7 @@ public void Execute(object? parameter)

public class RadioConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value == null || parameter == null)
{
Expand All @@ -105,10 +105,10 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
}
}

/*
/// <summary>
/// Password 附加属性,来自https://blog.csdn.net/qq_43562262/article/details/121786337
/// </summary>
/*
public class PasswordHelper
{
public static readonly DependencyProperty PasswordProperty = DependencyProperty.RegisterAttached("Password", typeof(string), typeof(PasswordHelper),
Expand Down
4 changes: 2 additions & 2 deletions installer/ViewModel/LoginViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public string Txt1

public LoginViewModel()
{
BtnClickedCommand = new AsyncRelayCommand(BtnClicked);
BtnClickedCommand = new RelayCommand(BtnClicked);
}

private async Task BtnClicked()
private void BtnClicked()
{
enabled = !enabled;
Txt1 = enabled.ToString();
Expand Down
4 changes: 2 additions & 2 deletions installer/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public string Slider_Txt

public MainViewModel()
{
CounterClickedCommand = new AsyncRelayCommand(CounterClicked);
CounterClickedCommand = new RelayCommand(CounterClicked);
}

private async Task CounterClicked()
private void CounterClicked()
{
count++;

Expand Down
Loading
Loading