Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b47c264
commit
BlameTwo Mar 21, 2026
e3a11e9
构建基础发布订阅模型,后续将继续修改分布方法中使用IProgress更新进度
BlameTwo Mar 21, 2026
ceea431
commit 下载提示结束,复用UpdateProgress方法生成结果
BlameTwo Mar 21, 2026
b7b10be
增加下载追踪器,移植下载/暂停/限速功能测试
BlameTwo Mar 22, 2026
c0ade6d
增加一些进度跟踪细节
BlameTwo Mar 22, 2026
fc1ec0b
commit
BlameTwo Mar 22, 2026
60ede70
commit 增加是否同步方法
BlameTwo Mar 22, 2026
3af69b5
commit 下载更新文件重构完毕
Mar 23, 2026
d8b9ee7
优化下载方法
BlameTwo Mar 23, 2026
26b80de
commit 修改更新逻辑
BlameTwo Mar 23, 2026
dbdb9d8
卸载程序增加文件记录
Mar 24, 2026
f0e9d47
commit 解压增量文件与解压增量组重构
Mar 24, 2026
3104a3d
commit 差压缩包方法重写
Mar 26, 2026
0b976b6
调整结构
Mar 26, 2026
0464e98
commit
BlameTwo Mar 26, 2026
5d4d8c4
commit
Mar 27, 2026
ee65a3e
commit 压缩包更新方式测试完毕
BlameTwo Mar 27, 2026
f205bc0
commit
BlameTwo Mar 28, 2026
9a0a094
commit 初步重构完成,等待边界测试修复BUG
BlameTwo Mar 28, 2026
d393e88
commit 提交
BlameTwo Mar 29, 2026
75e0385
修复测试BUG
BlameTwo Mar 29, 2026
8a702c7
commit
BlameTwo Mar 30, 2026
34af2db
commit
Mar 30, 2026
ccd7b81
commit
BlameTwo Mar 30, 2026
059fce4
commit
BlameTwo Mar 30, 2026
39bced3
commit
Mar 31, 2026
fd816cd
commit
Mar 31, 2026
094c231
commit
BlameTwo Apr 1, 2026
544e2cf
安装后删除临时资源、预下载代码编写完毕,等待编写测试环境测试
BlameTwo Apr 1, 2026
35c493c
commit 解耦消息接口
BlameTwo Apr 1, 2026
70aa9b4
commit 更新依赖
BlameTwo Apr 2, 2026
6900e91
内核预下载测试与安装结束
BlameTwo Apr 2, 2026
136b72f
清理代码
BlameTwo Apr 2, 2026
dc97f41
commit
Apr 3, 2026
953f660
commit
BlameTwo Apr 3, 2026
f35b5dd
Merge branch 'newCoreTask' of https://github.com/HaiyuGame/Haiyu into…
BlameTwo Apr 3, 2026
99c6217
commit
Apr 3, 2026
6c2dd2c
commit 还原测试入口
BlameTwo Apr 3, 2026
995b8eb
commit 提交,下次再写
BlameTwo Apr 3, 2026
e6bf509
推送
BlameTwo Apr 6, 2026
57fbb6d
Merge pull request #49 from HaiyuGame/newCoreTask
BlameTwo Apr 6, 2026
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
18 changes: 0 additions & 18 deletions src/Haiyu.Run/Haiyu.Run.csproj

This file was deleted.

9 changes: 0 additions & 9 deletions src/Haiyu.Run/Program.cs

This file was deleted.

Binary file not shown.
8 changes: 7 additions & 1 deletion src/KuroGameDownloadProgram/KuroGameDownloadProgram.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
Expand All @@ -23,4 +23,10 @@
<Folder Include="Services\" />
</ItemGroup>

<ItemGroup>
<None Update="Assets\HpatchzResource\hpatchz.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
128 changes: 113 additions & 15 deletions src/KuroGameDownloadProgram/Program.cs
Original file line number Diff line number Diff line change
@@ -1,41 +1,139 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System.Text.Json;
using CommunityToolkit.Mvvm.ComponentModel;
using Haiyu.Plugin.Services;
using Haiyu.RpcClient;
using KuroGameDownloadProgram;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Text.Json;
using Waves.Api.Models;
using Waves.Api.Models.GameWikiiClient;
using Waves.Core;
using Waves.Core.Common;
using Waves.Core.Contracts;
using Waves.Core.GameContext;
using Waves.Core.GameContext.Contexts;
using Waves.Core.GameContext.ContextsV2;
using Waves.Core.Helpers;
using Waves.Core.Models;
using Waves.Core.Models.CoreApi;
using Waves.Core.Models.Downloader;
using Waves.Core.Models.Enums;
using Waves.Core.Services;
using Waves.Core.Settings;

GameContextFactory.GameBassPath =
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Waves";

IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddGameContext();
services.AddSingleton<CloudGameService>();
services.AddSingleton<CloudConfigManager>((s) =>
{
return new CloudConfigManager(AppSettings.CloudFolderPath);
});
services.AddSingleton<IHttpClientService,HttpClientService>();
services.AddSingleton<CloudConfigManager>(
(s) =>
{
return new CloudConfigManager(AppSettings.CloudFolderPath);
}
);
services.AddSingleton<IHttpClientService, HttpClientService>();
services.AddSingleton<AppSettings>();
services.AddKeyedSingleton<LoggerService>(
"AppLog",
(s, e) =>
{
var logger = new LoggerService();
logger.InitLogger(AppSettings.LogPath, Serilog.RollingInterval.Day);
return logger;
}
);
})
.Build();
GameContextFactory.GameBassPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Waves";
var mainGame = host.Services.GetRequiredKeyedService<IGameContext>(nameof(PunishMainGameContext));
await mainGame.InitAsync();
var launcher = await mainGame.GetGameLauncherSourceAsync(null);
var previous = launcher
.ResourceDefault.Config.PatchConfig.Last();

Console.ReadLine();

var v2 = host.Services.GetRequiredKeyedService<IGameContextV2>(nameof(WavesMainGameContextV2));
await v2.InitAsync();
v2.ProgressState.OnProgressChanged += (t) =>
{
int oldLeft = Console.CursorLeft;
int oldTop = Console.CursorTop;
try
{
Console.SetCursorPosition(0, 0);
double percentage = t.Percentage;
string progressBar = "[";
int filledTabs = (int)(percentage / 2);
progressBar += new string('=', filledTabs);
progressBar += new string(' ', 50 - filledTabs);
progressBar += $"] {percentage,6:F2}%";
Console.Write(progressBar.PadRight(Console.WindowWidth - 1));
Console.SetCursorPosition(0, 1);
string stepInfo =
$"IsProd:{t.Prod} Step {t.CurrentStepIndex + 1}/{t.TotalSteps}: {t.StepName} | Action: {t.CurrentAction} | {t.CurrentStepTip}";
Console.Write(stepInfo.PadRight(Console.WindowWidth - 1));
Console.SetCursorPosition(0, 2);
string currentFile =
$"Current File: {System.IO.Path.GetFileName(t.FilePath)} | {GameProgressTracker.FormatBytes(t.FileCurrentSize)} / {GameProgressTracker.FormatBytes(t.FileTotalSize)}";
Console.Write(currentFile.PadRight(Console.WindowWidth - 1));
Console.SetCursorPosition(0, 3);
string speedInfo =
$"Speed: {t.GetSpeedText()} | Bytes: {GameProgressTracker.FormatBytes(t.CurrentBytes)} / {GameProgressTracker.FormatBytes(t.TotalBytes)}";
Console.Write(speedInfo.PadRight(Console.WindowWidth - 1));
int line = 4;
Console.SetCursorPosition(0, line++);
Console.Write("Active Files:".PadRight(Console.WindowWidth - 1));
var activeSnap = t.ActiveFiles.ToArray();
foreach (var file in activeSnap)
{
Console.SetCursorPosition(0, line++);
string fileInfo =
$" -> {file.Key}: {GameProgressTracker.FormatBytes(file.Value.Current)} / {GameProgressTracker.FormatBytes(file.Value.Total)}";
Console.Write(fileInfo.PadRight(Console.WindowWidth - 1));
}
for (int i = 0; i < 5; i++)
{
Console.SetCursorPosition(0, line + i);
Console.Write(new string(' ', Console.WindowWidth - 1));
}
}
catch { }
finally
{
Console.SetCursorPosition(0, 15);
}
};

Console.Clear();
Console.SetCursorPosition(0, 15);
await v2.StartInstallGameResource(true);
while (true)
{
Console.WriteLine("Q停止,P暂停,R恢复,输入数字设定下载速度(MB),回车确认");
var input = Console.ReadLine();
switch (input)
{
case "Q":
await v2.StopCannelTaskAsync();
return;
case "P":
await v2.PauseDownloadAsync();
break;
case "R":
await v2.ResumeDownloadAsync();
break;
case var s when long.TryParse(s, out long speed):
await v2.SetDownloadSpeedAsync(speed);
break;
}
}


public class TestContext : KuroGameContextBaseV2
{
public TestContext(KuroGameApiConfig config, string contextName)
: base(config, contextName) { }

public override string GameContextNameKey => throw new NotImplementedException();

public override GameType GameType => throw new NotImplementedException();

public override Type ContextType => throw new NotImplementedException();
}
2 changes: 1 addition & 1 deletion src/Project.WPFUninstaller/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Project.WPFUninstaller
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow
{
public MainWindow()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Setup/Project.WPFSetup/Common/SetupProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class SetupProperty
public IList<ISetup> UnSetups { get; private set; }
public string InstallExeName { get; internal set; }

public string HelpLink => "https://www.github.com/blametwo/Haiyu.git";
public string HelpLink => "https://github.com/HaiyuGame/Haiyu/issues";

public string UnInstallArgs { get; internal set; }

Expand Down
18 changes: 18 additions & 0 deletions src/Setup/Project.WPFSetup/Common/Setups/DecompressionSetup.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.IO;
using System.IO.Compression;
using System.Text.Json;
using SharpCompress.Archives.SevenZip;

namespace Project.WPFSetup.Common.Setups;
Expand Down Expand Up @@ -30,6 +31,7 @@ public DecompressionSetup() { }
{
try
{
List<string> installFile = new List<string>();
using (var memoryStream = new MemoryStream(fileBuffer))
using (var archive = SharpCompress.Archives.Zip.ZipArchive.Open(memoryStream))
{
Expand Down Expand Up @@ -80,8 +82,24 @@ await fileStream
progress?.Report((percentComplete, SetupName));
}
}
installFile.Add(path);
//创建卸载快照
}
}

var datFile = Path.Combine(rootDir, "unstall.dat");
var unstallexe = Path.Combine(rootDir, "uninstall.exe");
if (File.Exists(datFile))
{
File.Delete(datFile);
}
installFile.Add(datFile);
installFile.Add(unstallexe);
var datFs = File.CreateText(datFile);
var jsonStr = JsonSerializer.Serialize(installFile);
await datFs.WriteLineAsync(jsonStr);
await datFs.FlushAsync();
datFs.Dispose();
}
return ("", true);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.IO;
using System.IO.Compression;
using System.Text.Json;

namespace Project.WPFSetup.Common.Setups;

Expand All @@ -23,58 +24,43 @@ int maxValue

public async Task<bool> Remove(SetupProperty setupProperty, string directoryPath)
{
return await Task.Run(() =>
try
{
try
return await Task.Run(async () =>
{
if (!Directory.Exists(directoryPath))
var installFolder = setupProperty.InstallPath;
var uninstallDat = Path.Combine(installFolder, "unstall.dat");
var unstallexe = Path.Combine(installFolder, "uninstall.exe");
if (File.Exists(uninstallDat))
{
Console.WriteLine("指定的目录不存在。");
return true;
var reader = File.OpenText(uninstallDat);
var list = JsonSerializer.Deserialize<List<string>>(await reader.ReadToEndAsync());
if (list == null)
return true;
try
{
foreach (var file in list)
{
if (File.Exists(file))
{
File.Delete(file);
}
}
}
catch
{
}
reader.Dispose();
}
Directory.Delete(directoryPath, true);
//var bytes = Resources.Resource1.InstallFile;
//using MemoryStream memoryStream = new MemoryStream(bytes);
//using (ZipArchive zipArchive = new ZipArchive(memoryStream))
//{
// var files = zipArchive.Entries.Select(x => x.FullName).ToArray();
// foreach (
// var file in Directory.GetFiles(
// directoryPath,
// "*.*",
// SearchOption.TopDirectoryOnly
// )
// )
// {
// try
// {
// File.Delete(file);
// Console.WriteLine($"已删除文件: {file}");
// }
// catch (Exception ex)
// {
// Console.WriteLine($"无法删除文件 {file}: {ex.Message}");
// }
// }
// foreach (
// var dir in Directory.GetDirectories(
// directoryPath,
// "*",
// SearchOption.TopDirectoryOnly
// )
// )
// {
// try
// {
// Directory.Delete(dir, true);
// }
// catch (Exception) { }
// }
//}

}
catch (Exception ex) { }
return true;
});
File.Delete(uninstallDat);
File.Delete(unstallexe);
return true;
});
}
catch (Exception)
{
return false;
}

}
}
Loading
Loading