Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "Hi3Helper.Plugin.Core"]
path = Hi3Helper.Plugin.Core
url = https://github.com/CollapseLauncher/Hi3Helper.Plugin.Core
[submodule "SevenZipExtractor"]
path = SevenZipExtractor
url = https://github.com/CollapseLauncher/SevenZipExtractor
2 changes: 2 additions & 0 deletions CompileAOTAndShip.bat
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ dotnet restore --runtime win-x64 ..\Hi3Helper.Plugin.DNA.sln || goto :Error
dotnet clean --configuration %configuration% --runtime win-x64 ..\Hi3Helper.Plugin.DNA.sln || goto :Error
dotnet publish --configuration %configuration% --runtime win-x64 /p:PublishProfile=%publishProfile% -o "%outputDirPath%" || goto :Error

xcopy "..\Lib" "%outputDirPath%\Lib" /E /I /Y /Q || goto :Error

:RemovePDBIfNotDebug
if "%_isRemoveSymbol%" == "true" (
del "%outputDirPath%\*.pdb" || goto :Error
Expand Down
2 changes: 1 addition & 1 deletion Hi3Helper.Plugin.Core
Submodule Hi3Helper.Plugin.Core updated 72 files
+7 −0 .github/workflows/docfx_pageBuilder.yml
+1 −1 ABI/ABI_IFreeWrapper.cs
+21 −21 ABI/ABI_IGameInstallerWrapper.cs
+21 −21 ABI/ABI_IGameManagerWrapper.cs
+3 −3 ABI/ABI_IGameUninstallerWrapper.cs
+3 −3 ABI/ABI_IInitializableTaskWrapper.cs
+11 −10 ABI/ABI_ILauncherApiMediaWrapper.cs
+7 −6 ABI/ABI_ILauncherApiNewsWrapper.cs
+9 −9 ABI/ABI_ILauncherApiWrapper.cs
+13 −12 ABI/ABI_IPluginPresetConfigWrapper.cs
+6 −6 ABI/ABI_IPluginSelfUpdateWrapper.cs
+18 −16 ABI/ABI_IPluginWrapper.cs
+3 −3 ABI/ABI_VTables.cs
+1 −1 ABI/GameInstallerWrappers.cs
+1 −1 ABI/GameManagerWrappers.cs
+1 −1 ABI/LauncherApiWrappers.cs
+1 −1 ABI/PluginPresetConfigWrappers.cs
+1 −1 ABI/PluginSelfUpdateWrappers.cs
+1 −1 ABI/PluginWrappers.cs
+29 −2 ComAsyncResult.cs
+2 −2 Hi3Helper.Plugin.Core.csproj
+2 −2 IPlugin.cs
+8 −0 Management/GameInstallerBase.cs
+36 −6 Management/GameManagerBase.cs
+22 −0 Management/InstallPerFileProgress.cs
+7 −1 Management/InstallProgressState.cs
+4 −4 Management/PresetConfig/IPluginPresetConfig.cs
+2 −1 PluginDisposableMemoryMarshal.cs
+0 −4 PluginTest/PluginTest.csproj
+8 −1 PluginTest/Program.cs
+31 −0 PluginTest/Test.GameSettings.cs
+30 −4 README.md
+2 −0 SharedStatic.V1Ext.cs
+30 −0 SharedStatic.V1Ext_Update1.cs
+13 −38 SharedStatic.V1Ext_Update4.cs
+79 −0 SharedStatic.V1Ext_Update5.cs
+117 −0 SharedStatic.V1Ext_Update6.cs
+1 −1 SharedStatic.cs
+169 −0 UI/Controls/GameEventButtonPosition.cs
+40 −0 UI/DoublePosition.cs
+34 −0 UI/DoubleSize.cs
+24 −0 UI/HorizontalAlignment.cs
+10 −0 UI/Settings/GameSettingChoice.cs
+85 −0 UI/Settings/GameSettingEntry.cs
+13 −0 UI/Settings/GameSettingKind.cs
+12 −0 UI/Settings/GameSettingsPage.cs
+20 −0 UI/Settings/GameSettingsPageSerializer.cs
+13 −0 UI/Settings/GameSettingsSection.cs
+24 −0 UI/VerticalAlignment.cs
+3 −0 Update/PluginManifest.cs
+1 −1 Update/PluginSelfUpdateBase.TryPerformUpdate.cs
+126 −117 Utility/ComAsyncExtension.cs
+11 −3 Utility/GameManagerExtension.cs
+116 −0 Utility/GameSettingsExtension.cs
+213 −0 Utility/Json/Converters/BytesStringToBytesArrayJsonConverter.cs
+1 −1 Utility/Json/Converters/HexStringToArrayJsonConverter.cs
+4 −4 Utility/Mem.String.cs
+126 −0 Utility/PluginPInvokeExtension.UnsafeDelegate.cs
+3 −7 Utility/PluginPInvokeExtension.cs
+12 −3 Utility/RetryableCopyToStreamTask.cs
+9 −1 Utility/RetryableCopyToStreamTaskOptions.cs
+142 −33 Utility/SpeedLimiterService.cs
+2 −2 Utility/Windows/PInvoke.cs
+4 −1 docfx.json
+375 −0 docs/advanced.md
+566 −0 docs/create-plugin.md
+180 −1 docs/getting-started.md
+54 −1 docs/introduction.md
+7 −1 docs/toc.yml
+224 −0 docs/utilities.md
+27 −2 index.md
+9 −9 packages.lock.json
14 changes: 2 additions & 12 deletions Hi3Helper.Plugin.DNA.sln
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35931.197
# Visual Studio Version 18
VisualStudioVersion = 18.12.12405.243
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hi3Helper.Plugin.DNA", "Hi3Helper.Plugin.DNA\Hi3Helper.Plugin.DNA.csproj", "{BA302F46-E800-4F4F-B8DA-29939160448D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hi3Helper.Plugin.Core", "Hi3Helper.Plugin.Core\Hi3Helper.Plugin.Core.csproj", "{6D56B964-1509-482F-4589-C780CDE5C703}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginTest", "Hi3Helper.Plugin.Core\PluginTest\PluginTest.csproj", "{9E58C55F-9D8C-F9CB-F23A-11E336C9D51D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SevenZipExtractor", "SevenZipExtractor\SevenZipExtractor\SevenZipExtractor.csproj", "{672D4FD7-79D4-4DCD-319A-3F59CC670261}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -43,14 +41,6 @@ Global
{9E58C55F-9D8C-F9CB-F23A-11E336C9D51D}.Release|x64.Build.0 = Release|x64
{9E58C55F-9D8C-F9CB-F23A-11E336C9D51D}.ReleaseNoReflection|x64.ActiveCfg = ReleaseNoReflection|x64
{9E58C55F-9D8C-F9CB-F23A-11E336C9D51D}.ReleaseNoReflection|x64.Build.0 = ReleaseNoReflection|x64
{672D4FD7-79D4-4DCD-319A-3F59CC670261}.Debug|x64.ActiveCfg = Debug|x64
{672D4FD7-79D4-4DCD-319A-3F59CC670261}.Debug|x64.Build.0 = Debug|x64
{672D4FD7-79D4-4DCD-319A-3F59CC670261}.DebugNoReflection|x64.ActiveCfg = Debug|x64
{672D4FD7-79D4-4DCD-319A-3F59CC670261}.DebugNoReflection|x64.Build.0 = Debug|x64
{672D4FD7-79D4-4DCD-319A-3F59CC670261}.Release|x64.ActiveCfg = Release|x64
{672D4FD7-79D4-4DCD-319A-3F59CC670261}.Release|x64.Build.0 = Release|x64
{672D4FD7-79D4-4DCD-319A-3F59CC670261}.ReleaseNoReflection|x64.ActiveCfg = Release|x64
{672D4FD7-79D4-4DCD-319A-3F59CC670261}.ReleaseNoReflection|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 0 additions & 3 deletions Hi3Helper.Plugin.DNA.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,4 @@
<Project Path="Hi3Helper.Plugin.DNA/Hi3Helper.Plugin.DNA.csproj">
<Platform Project="x64" />
</Project>
<Project Path="SevenZipExtractor/SevenZipExtractor/SevenZipExtractor.csproj">
<Platform Project="x64" />
</Project>
</Solution>
3 changes: 1 addition & 2 deletions Hi3Helper.Plugin.DNA/Hi3Helper.Plugin.DNA.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
<Company>Collapse Launcher Team</Company>
<Authors>$(Company). neon-nyan, Cry0, bagusnl, shatyuka, gablm.</Authors>
<Copyright>Copyright 2022-2025 $(Company)</Copyright>
<Version>0.6.2</Version>
<Version>0.7.0</Version>
<ApplicationIcon>icon.ico</ApplicationIcon>
<Configurations>Debug;Release;DebugNoReflection;ReleaseNoReflection</Configurations>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Hi3Helper.Plugin.Core\Hi3Helper.Plugin.Core.csproj" />
<ProjectReference Include="..\SevenZipExtractor\SevenZipExtractor\SevenZipExtractor.csproj" />
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)'=='DebugNoReflection'">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// ReSharper disable InconsistentNaming

using System.Text.Json.Serialization;

namespace Hi3Helper.Plugin.DNA.Management.Api;

public class DNAApiResponseHdiffInfo
{
[JsonPropertyName("hdiff_file")]
public DNAApiResponseHdiffFile? HdiffFile { get; set; } = null!;

[JsonPropertyName("new_size")]
public long? NewSize { get; set; } = null!;
}

public class DNAApiResponseHdiffFile
{
[JsonPropertyName("name")]
public string? Name { get; set; } = null!;

[JsonPropertyName("md5")]
public string? MD5 { get; set; } = null!;

[JsonPropertyName("size")]
public long? Size { get; set; } = null!;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// ReSharper disable InconsistentNaming

using System.Text.Json.Serialization;

namespace Hi3Helper.Plugin.DNA.Management.Api;

public class DNAApiResponseVersionManifest
{
[JsonPropertyName("latest_version")]
public string? LatestVersion { get; set; } = null!;

[JsonPropertyName("latest_version_number")]
public string? LatestVersionNumber { get; set; } = null!;

[JsonPropertyName("min_supported_version")]
public string? MinSupportedVersion { get; set; } = null!;
}

73 changes: 73 additions & 0 deletions Hi3Helper.Plugin.DNA/Management/Api/Classes/DNAApiDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using Hi3Helper.Plugin.DNA.Utility;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Hi3Helper.Plugin.DNA.Management.Api;

public class DNAApiDetails
{
public List<string> BaseUrls { get; init; } = null!;

public string BaseUrl {
get
{
int index = (int)Math.Floor((DateTime.Now.Day - 1) / 8.0);
if (index >= BaseUrls.Count) return BaseUrls.First();

return BaseUrls[index];
}
}

public string Region { get; init; } = null!;
public string RegionLong { get; init; } = null!;
public string Tag { get; init; } = null!;

#region URL Formatting Methods

#region Asset URLs
public string GetVersionManifestUrl() => $"{BaseUrl}/Packages/{Region}/WindowsNoEditor/{Tag}/VersionManifest.json ";

protected string GetDiffTag(string? currentVersion, string latestVersion) =>
currentVersion == null ? $"full_{latestVersion}" : $"v{currentVersion}_to_v{latestVersion}";

public string GetHdiffInfoUrl(string versionNumber, string latestVersion, string? currentVersion = null)
{
var diffTag = GetDiffTag(currentVersion, latestVersion);

return $"{BaseUrl}/Packages/{Region}/WindowsNoEditor/{Tag}/{versionNumber}/{latestVersion}/{diffTag}/HPatchDiffMd5.json";
}

public string GetHdiffFileUrl(string versionNumber, string latestVersion, string fileName, string? currentVersion = null)
{
var diffTag = GetDiffTag(currentVersion, latestVersion);

return $"{BaseUrl}/Packages/{Region}/WindowsNoEditor/{Tag}/{versionNumber}/{latestVersion}/{diffTag}/{fileName}";
}

public string GetHdiffFileName(string versionNumber, string latestVersion, string? currentVersion = null)
{
var diffTag = GetDiffTag(currentVersion, latestVersion);

return $"{versionNumber}/{latestVersion}/{diffTag}";
}
#endregion

#region Media URLs
public static string GetBackgroundUrl(string versionNumber) => $"https://cdnstatic.yingxiong.com/dna_hd_{versionNumber.Replace(".","_")}/imgs/home/pc/bg.webp";

public string GetOverlayUrl()
{
string lang = Region == "CN" ? "chs" : DNAUtility.GetOverlayLangFromLauncherLocale();
return $"https://cdnstatic.yingxiong.com/dna_hd_1_7/imgs/home/pc/slogan-{lang}.webp";
}

public string GetNoticesUrl() => $"{BaseUrl}/OperationLauncherNotice/OperationLauncherNoticeProduction{RegionLong}online.json";

public string GetCarouselUrl() => $"{BaseUrl}/OperationLauncherHeadImage/OperationLauncherHeadImageProduction{RegionLong}online.json";

public string GetSocialsUrl() => $"{BaseUrl}/OperationLauncherSocialMedia/OperationLauncherSocialMediaProduction{RegionLong}online.json";
#endregion

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ namespace Hi3Helper.Plugin.DNA.Management.Api;
[JsonSerializable(typeof(DNAApiResponseNotices))]
[JsonSerializable(typeof(DNAApiResponseCarousel))]
[JsonSerializable(typeof(DNAApiResponsePatches))]
[JsonSerializable(typeof(DNAApiResponseVersion))]
[JsonSerializable(typeof(DNAApiResponseHdiffInfo))]
[JsonSerializable(typeof(DNAApiResponseVersionManifest))]
public partial class DNAApiResponseContext : JsonSerializerContext;
24 changes: 0 additions & 24 deletions Hi3Helper.Plugin.DNA/Management/Api/DNAApiResponseDetails.cs

This file was deleted.

70 changes: 0 additions & 70 deletions Hi3Helper.Plugin.DNA/Management/Api/DNAApiResponseVersion.cs

This file was deleted.

Loading
Loading