Skip to content

Commit

Permalink
feature: 删除遗言机制冗余代码
Browse files Browse the repository at this point in the history
  • Loading branch information
JusterZhu committed Sep 3, 2024
1 parent b91cdf8 commit a42bdc8
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 278 deletions.
23 changes: 0 additions & 23 deletions src/c#/GeneralUpdate.Client/MySample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using GeneralUpdate.Core.Events.CommonArgs;
using GeneralUpdate.Core.Events.MultiEventArgs;
using GeneralUpdate.Core.Strategys.PlatformWindows;
using GeneralUpdate.Core.WillMessage;
using GeneralUpdate.Differential;
using System.Diagnostics;
using System.Text;
Expand Down Expand Up @@ -294,28 +293,6 @@ private bool IsDriverFile(string filePath) =>

#endregion 测试驱动功能

#region 测试WillMessage

public void TestWillMessage()
{
var path1 = "D:\\packet\\source";
var path2 = "D:\\packet\\target";
var hash = "28d10f1fc2a23dd1afe0af40d132b25c72ea56005963f653c27889f03d381c8d";

for (int i = 0; i < 1; i++)
{
var version = "1.0.0." + i;
WillMessageManager.Instance.Backup(path1, path2, version, hash, 1);
}
WillMessageManager.Instance.Builder();
var obj = WillMessageManager.Instance.GetWillMessage();
WillMessageManager.Instance.Check();
WillMessageManager.Instance.Restore();
//WillMessageManager.Instance.Clear();
}

#endregion 测试WillMessage

#region 文件管理测试

public void TestFileProvider()
Expand Down
20 changes: 0 additions & 20 deletions src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using GeneralUpdate.Core.Exceptions.CustomArgs;
using GeneralUpdate.Core.Exceptions.CustomException;
using GeneralUpdate.Core.Strategys;
using GeneralUpdate.Core.WillMessage;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -267,25 +266,6 @@ private void ClearEnvironmentVariable()
}
}

/// <summary>
/// When the update version information requested by the server contains the update failed version, the update execution flow is directly interrupted
/// </summary>
/// <returns></returns>
private bool CheckWillMessage()
{
var willMessage = WillMessageManager.Instance.GetWillMessage();
if (willMessage == null) return true;
foreach (var item in Packet.UpdateVersions)
{
var msg = willMessage.Message.Peek();
if (string.Equals(msg.Version, item.Version, StringComparison.OrdinalIgnoreCase))
{
return false;
}
}
return true;
}

#endregion Private Methods
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
<Compile Include="..\GeneralUpdate.Core\Pipelines\Middleware\MiddlewareExtensions.cs" Link="Pipelines\Middleware\MiddlewareExtensions.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\Middleware\MiddlewareStack.cs" Link="Pipelines\Middleware\MiddlewareStack.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\Middleware\PatchMiddleware.cs" Link="Pipelines\Middleware\PatchMiddleware.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\Middleware\WillMessageMiddleware.cs" Link="Pipelines\Middleware\WillMessageMiddleware.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\Middleware\ZipMiddleware.cs" Link="Pipelines\Middleware\ZipMiddleware.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\PipelineBuilder.cs" Link="Pipelines\PipelineBuilder.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\Pipeline\IPipelineBuilder.cs" Link="Pipelines\Pipeline\IPipelineBuilder.cs" />
Expand Down Expand Up @@ -256,11 +255,4 @@
<Folder Include="ZipFactory\CompressProvider\" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\..\imgs\GeneralUpdate128.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

</Project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using GeneralUpdate.Core.Pipelines;
using GeneralUpdate.Core.Pipelines.Context;
using GeneralUpdate.Core.Pipelines.Middleware;
using GeneralUpdate.Core.WillMessage;
using System;
using System.Diagnostics;
using System.IO;
Expand Down Expand Up @@ -60,7 +59,6 @@ public override void Execute()
var pipelineBuilder = new PipelineBuilder<BaseContext>(context)
.UseMiddleware<HashMiddleware>().UseMiddleware<ZipMiddleware>()
.UseMiddlewareIf<DriveMiddleware>(Packet.DriveEnabled)
.UseMiddlewareIf<WillMessageMiddleware>(Packet.WillMessageEnabled)
.UseMiddleware<PatchMiddleware>();
await pipelineBuilder.Build();
}
Expand Down Expand Up @@ -88,11 +86,11 @@ public override bool StartApp(string appName, int appType)
{
case AppType.ClientApp:
Environment.SetEnvironmentVariable("ProcessBase64", Packet.ProcessBase64, EnvironmentVariableTarget.User);
WaitForProcessToStart(path, 20, () => WillMessageManager.Instance.Check());
WaitForProcessToStart(path, 20);
break;

case AppType.UpgradeApp:
WaitForProcessToStart(path, 20, () => WillMessageManager.Instance.Check());
WaitForProcessToStart(path, 20);
break;
}
return true;
Expand Down
205 changes: 0 additions & 205 deletions src/c#/GeneralUpdate.Core/WillMessage/WillMessageManager.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
<Compile Include="..\GeneralUpdate.Core\HashAlgorithms\Md5HashAlgorithm.cs" Link="HashAlgorithms\Md5HashAlgorithm.cs" />
<Compile Include="..\GeneralUpdate.Core\HashAlgorithms\Sha1HashAlgorithm.cs" Link="HashAlgorithms\Sha1HashAlgorithm.cs" />
<Compile Include="..\GeneralUpdate.Core\HashAlgorithms\Sha256HashAlgorithm.cs" Link="HashAlgorithms\Sha256HashAlgorithm.cs" />
<Compile Include="..\GeneralUpdate.Core\WillMessage\WillMessageManager.cs" Link="WillMessage\WillMessageManager.cs" />
</ItemGroup>

<ItemGroup>
Expand All @@ -76,7 +75,6 @@
<Folder Include="CustomAwaiter\" />
<Folder Include="CustomAwaiter\" />
<Folder Include="HashAlgorithms\" />
<Folder Include="WillMessage\" />
</ItemGroup>

<ItemGroup>
Expand Down
Empty file.

0 comments on commit a42bdc8

Please sign in to comment.