diff --git a/src/c#/GeneralUpdate.Bowl/Bowl.cs b/src/c#/GeneralUpdate.Bowl/Bowl.cs
index 9e2bc1ea..25d84697 100644
--- a/src/c#/GeneralUpdate.Bowl/Bowl.cs
+++ b/src/c#/GeneralUpdate.Bowl/Bowl.cs
@@ -17,7 +17,7 @@ public Bowl(MonitorParameter parameter = null)
_strategy!.SetParameter(parameter);
}
- private void CreateStrategy()
+ private Bowl CreateStrategy()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
@@ -30,6 +30,8 @@ private void CreateStrategy()
if (_strategy == null)
throw new PlatformNotSupportedException("Unsupported operating system");
+
+ return this;
}
public Bowl SetParameter(MonitorParameter parameter)
@@ -41,5 +43,9 @@ public Bowl SetParameter(MonitorParameter parameter)
return this;
}
- public void Launch() => _strategy.Launch();
+ public Bowl Launch()
+ {
+ _strategy.Launch();
+ return this;
+ }
}
\ No newline at end of file
diff --git a/src/c#/GeneralUpdate.Client/Program.cs b/src/c#/GeneralUpdate.Client/Program.cs
index 8892ff06..354cecb4 100644
--- a/src/c#/GeneralUpdate.Client/Program.cs
+++ b/src/c#/GeneralUpdate.Client/Program.cs
@@ -4,6 +4,7 @@
using GeneralUpdate.Common.Internal;
using GeneralUpdate.Common.Internal.Bootstrap;
using GeneralUpdate.Common.Shared.Object;
+using GeneralUpdate.Differential;
namespace GeneralUpdate.Client
{
@@ -11,7 +12,7 @@ internal class Progra
{
private static void Main(string[] args)
{
- /*Task.Run(async () =>
+ Task.Run(async () =>
{
var source = @"D:\packet\app";
var target = @"D:\packet\release";
@@ -19,7 +20,7 @@ private static void Main(string[] args)
await DifferentialCore.Instance?.Clean(source, target, patch);
await DifferentialCore.Instance?.Dirty(source, patch);
- });*/
+ });
/*Task.Run(() =>
{
diff --git a/src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs b/src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs
index 3c63ac3a..22d7aa1e 100644
--- a/src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs
+++ b/src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs
@@ -7,7 +7,7 @@
using System.Text.Json;
using System.Threading.Tasks;
using GeneralUpdate.ClientCore.Strategys;
-using GeneralUpdate.Common;
+using GeneralUpdate.Common.FileBasic;
using GeneralUpdate.Common.Download;
using GeneralUpdate.Common.Internal;
using GeneralUpdate.Common.Internal.Bootstrap;
diff --git a/src/c#/GeneralUpdate.ClientCore/GeneralClientOSS.cs b/src/c#/GeneralUpdate.ClientCore/GeneralClientOSS.cs
index 6e48c04b..548bac28 100644
--- a/src/c#/GeneralUpdate.ClientCore/GeneralClientOSS.cs
+++ b/src/c#/GeneralUpdate.ClientCore/GeneralClientOSS.cs
@@ -8,7 +8,7 @@
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
-using GeneralUpdate.Common;
+using GeneralUpdate.Common.FileBasic;
using GeneralUpdate.Common.Internal;
using GeneralUpdate.Common.Internal.Event;
using GeneralUpdate.Common.Shared.Object;
diff --git a/src/c#/GeneralUpdate.ClientCore/Pipeline/PatchMiddleware.cs b/src/c#/GeneralUpdate.ClientCore/Pipeline/PatchMiddleware.cs
index c0ea6587..8c9c2ecf 100644
--- a/src/c#/GeneralUpdate.ClientCore/Pipeline/PatchMiddleware.cs
+++ b/src/c#/GeneralUpdate.ClientCore/Pipeline/PatchMiddleware.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-using GeneralUpdate.Common;
+using GeneralUpdate.Common.FileBasic;
using GeneralUpdate.Common.Internal.Pipeline;
using GeneralUpdate.Differential;
diff --git a/src/c#/GeneralUpdate.ClientCore/Strategys/WindowsStrategy.cs b/src/c#/GeneralUpdate.ClientCore/Strategys/WindowsStrategy.cs
index ef92acbc..0edc1c91 100644
--- a/src/c#/GeneralUpdate.ClientCore/Strategys/WindowsStrategy.cs
+++ b/src/c#/GeneralUpdate.ClientCore/Strategys/WindowsStrategy.cs
@@ -3,7 +3,7 @@
using System.IO;
using System.Threading.Tasks;
using GeneralUpdate.ClientCore.Pipeline;
-using GeneralUpdate.Common;
+using GeneralUpdate.Common.FileBasic;
using GeneralUpdate.Common.Internal;
using GeneralUpdate.Common.Internal.Event;
using GeneralUpdate.Common.Internal.Pipeline;
diff --git a/src/c#/GeneralUpdate.Common/Download/DownloadManager.cs b/src/c#/GeneralUpdate.Common/Download/DownloadManager.cs
index 849c14e0..a6694103 100644
--- a/src/c#/GeneralUpdate.Common/Download/DownloadManager.cs
+++ b/src/c#/GeneralUpdate.Common/Download/DownloadManager.cs
@@ -3,7 +3,6 @@
using System.Threading.Tasks;
using System.Collections.Immutable;
using System.Diagnostics;
-using System.Diagnostics.Contracts;
using System.Linq;
namespace GeneralUpdate.Common.Download
diff --git a/src/c#/GeneralUpdate.Common/File/FileNode.cs b/src/c#/GeneralUpdate.Common/File/FileNode.cs
deleted file mode 100644
index 04e1da83..00000000
--- a/src/c#/GeneralUpdate.Common/File/FileNode.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-using System;
-
-namespace GeneralUpdate.Common;
-
- public class FileNode
- {
- #region Public Properties
-
- public long Id { get; set; }
-
- public string Name { get; set; }
-
- public string FullName { get; set; }
-
- public string Path { get; set; }
-
- public string Hash { get; set; }
-
- public FileNode Left { get; set; }
-
- public FileNode Right { get; set; }
-
- public int LeftType { get; set; }
-
- public int RightType { get; set; }
-
- public string RelativePath { get; set; }
-
- #endregion Public Properties
-
- #region Constructors
-
- public FileNode()
- { }
-
- public FileNode(int id)
- {
- Id = id;
- }
-
- #endregion Constructors
-
- #region Public Methods
-
- public void Add(FileNode node)
- {
- if (node == null) return;
-
- if (node.Id < Id)
- {
- if (Left == null)
- {
- Left = node;
- }
- else
- {
- Left.Add(node);
- }
- }
- else
- {
- if (Right == null)
- {
- Right = node;
- }
- else
- {
- Right.Add(node);
- }
- }
- }
-
- public void InfixOrder()
- {
- if (Left != null)
- {
- Left.InfixOrder();
- }
- if (Right != null)
- {
- Right.InfixOrder();
- }
- }
-
- public FileNode Search(long id)
- {
- if (id == Id)
- {
- return this;
- }
- else if (id < Id)
- {
- if (Left == null) return null;
- return Left.Search(id);
- }
- else
- {
- if (Right == null) return null;
- return Right.Search(id);
- }
- }
-
- ///
- /// Find the parent node of the node that you want to delete.
- ///
- ///
- ///
- public FileNode SearchParent(long id)
- {
- if (Left != null && Left.Id == id || Right != null && Right.Id == id)
- {
- return this;
- }
- else
- {
- if (id < Id && Left != null)
- {
- return Left.SearchParent(id);
- }
- else if (id >= Id && Right != null)
- {
- return Right.SearchParent(id);
- }
- else
- {
- return null;
- }
- }
- }
-
- ///
- /// Compare tree nodes equally by Hash and file names.
- ///
- ///
- ///
- public override bool Equals(object obj)
- {
- if (obj == null) return false;
- var tempNode = obj as FileNode;
- if (tempNode == null) throw new ArgumentException(nameof(tempNode));
- return string.Equals(Hash, tempNode.Hash, StringComparison.OrdinalIgnoreCase) && string.Equals(Name, tempNode.Name, StringComparison.OrdinalIgnoreCase);
- }
-
- public override int GetHashCode() => base.GetHashCode();
-
- #endregion Public Methods
- }
diff --git a/src/c#/GeneralUpdate.Common/File/BlackListManager.cs b/src/c#/GeneralUpdate.Common/FileBasic/BlackListManager.cs
similarity index 98%
rename from src/c#/GeneralUpdate.Common/File/BlackListManager.cs
rename to src/c#/GeneralUpdate.Common/FileBasic/BlackListManager.cs
index 1ca7db3c..aea2517d 100644
--- a/src/c#/GeneralUpdate.Common/File/BlackListManager.cs
+++ b/src/c#/GeneralUpdate.Common/FileBasic/BlackListManager.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
-namespace GeneralUpdate.Common;
+namespace GeneralUpdate.Common.FileBasic;
public class BlackListManager
{
diff --git a/src/c#/GeneralUpdate.Common/File/ComparisonResult.cs b/src/c#/GeneralUpdate.Common/FileBasic/ComparisonResult.cs
similarity index 96%
rename from src/c#/GeneralUpdate.Common/File/ComparisonResult.cs
rename to src/c#/GeneralUpdate.Common/FileBasic/ComparisonResult.cs
index 089d54ed..41dbf234 100644
--- a/src/c#/GeneralUpdate.Common/File/ComparisonResult.cs
+++ b/src/c#/GeneralUpdate.Common/FileBasic/ComparisonResult.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace GeneralUpdate.Common;
+namespace GeneralUpdate.Common.FileBasic;
///
/// Result of a comparison between two directories.
diff --git a/src/c#/GeneralUpdate.Common/FileBasic/FileNode.cs b/src/c#/GeneralUpdate.Common/FileBasic/FileNode.cs
new file mode 100644
index 00000000..90b3831a
--- /dev/null
+++ b/src/c#/GeneralUpdate.Common/FileBasic/FileNode.cs
@@ -0,0 +1,150 @@
+using System;
+
+namespace GeneralUpdate.Common.FileBasic;
+
+public class FileNode
+{
+ #region Public Properties
+
+ public long Id { get; set; }
+
+ public string Name { get; set; }
+
+ public string FullName { get; set; }
+
+ public string Path { get; set; }
+
+ public string Hash { get; set; }
+
+ public FileNode Left { get; set; }
+
+ public FileNode Right { get; set; }
+
+ public int LeftType { get; set; }
+
+ public int RightType { get; set; }
+
+ public string RelativePath { get; set; }
+
+ #endregion Public Properties
+
+ #region Constructors
+
+ public FileNode()
+ {
+ }
+
+ public FileNode(int id)
+ {
+ Id = id;
+ }
+
+ #endregion Constructors
+
+ #region Public Methods
+
+ public void Add(FileNode node)
+ {
+ if (node == null) return;
+
+ if (node.Id < Id)
+ {
+ if (Left == null)
+ {
+ Left = node;
+ }
+ else
+ {
+ Left.Add(node);
+ }
+ }
+ else
+ {
+ if (Right == null)
+ {
+ Right = node;
+ }
+ else
+ {
+ Right.Add(node);
+ }
+ }
+ }
+
+ public void InfixOrder()
+ {
+ if (Left != null)
+ {
+ Left.InfixOrder();
+ }
+
+ if (Right != null)
+ {
+ Right.InfixOrder();
+ }
+ }
+
+ public FileNode Search(long id)
+ {
+ if (id == Id)
+ {
+ return this;
+ }
+ else if (id < Id)
+ {
+ if (Left == null) return null;
+ return Left.Search(id);
+ }
+ else
+ {
+ if (Right == null) return null;
+ return Right.Search(id);
+ }
+ }
+
+ ///
+ /// Find the parent node of the node that you want to delete.
+ ///
+ ///
+ ///
+ public FileNode SearchParent(long id)
+ {
+ if (Left != null && Left.Id == id || Right != null && Right.Id == id)
+ {
+ return this;
+ }
+ else
+ {
+ if (id < Id && Left != null)
+ {
+ return Left.SearchParent(id);
+ }
+ else if (id >= Id && Right != null)
+ {
+ return Right.SearchParent(id);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ ///
+ /// Compare tree nodes equally by Hash and file names.
+ ///
+ ///
+ ///
+ public override bool Equals(object obj)
+ {
+ if (obj == null) return false;
+ var tempNode = obj as FileNode;
+ if (tempNode == null) throw new ArgumentException(nameof(tempNode));
+ return string.Equals(Hash, tempNode.Hash, StringComparison.OrdinalIgnoreCase) &&
+ string.Equals(Name, tempNode.Name, StringComparison.OrdinalIgnoreCase);
+ }
+
+ public override int GetHashCode() => base.GetHashCode();
+
+ #endregion Public Methods
+}
diff --git a/src/c#/GeneralUpdate.Common/File/FileTree.cs b/src/c#/GeneralUpdate.Common/FileBasic/FileTree.cs
similarity index 99%
rename from src/c#/GeneralUpdate.Common/File/FileTree.cs
rename to src/c#/GeneralUpdate.Common/FileBasic/FileTree.cs
index c05289c6..085013c7 100644
--- a/src/c#/GeneralUpdate.Common/File/FileTree.cs
+++ b/src/c#/GeneralUpdate.Common/FileBasic/FileTree.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Diagnostics;
-namespace GeneralUpdate.Common;
+namespace GeneralUpdate.Common.FileBasic;
///
/// Simple file binary tree.
diff --git a/src/c#/GeneralUpdate.Common/File/GeneralFileManager.cs b/src/c#/GeneralUpdate.Common/FileBasic/GeneralFileManager.cs
similarity index 99%
rename from src/c#/GeneralUpdate.Common/File/GeneralFileManager.cs
rename to src/c#/GeneralUpdate.Common/FileBasic/GeneralFileManager.cs
index 4a323694..52da377b 100644
--- a/src/c#/GeneralUpdate.Common/File/GeneralFileManager.cs
+++ b/src/c#/GeneralUpdate.Common/FileBasic/GeneralFileManager.cs
@@ -6,7 +6,7 @@
using System.Threading;
using GeneralUpdate.Common.HashAlgorithms;
-namespace GeneralUpdate.Common
+namespace GeneralUpdate.Common.FileBasic
{
public sealed class GeneralFileManager
{
diff --git a/src/c#/GeneralUpdate.Common/Shared/Object/GlobalConfigInfo.cs b/src/c#/GeneralUpdate.Common/Shared/Object/GlobalConfigInfo.cs
index 67fa36c2..96400bc3 100644
--- a/src/c#/GeneralUpdate.Common/Shared/Object/GlobalConfigInfo.cs
+++ b/src/c#/GeneralUpdate.Common/Shared/Object/GlobalConfigInfo.cs
@@ -113,4 +113,6 @@ public class GlobalConfigInfo
public int Platform { get; set; }
public string ProductId { get; set; }
+
+ public Dictionary FieldMappings { get; set; }
}
\ No newline at end of file
diff --git a/src/c#/GeneralUpdate.Core/Driver/DriverCommand.cs b/src/c#/GeneralUpdate.Core/Driver/DriverCommand.cs
index d5c57c3b..00cb4500 100644
--- a/src/c#/GeneralUpdate.Core/Driver/DriverCommand.cs
+++ b/src/c#/GeneralUpdate.Core/Driver/DriverCommand.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using GeneralUpdate.Common;
+using GeneralUpdate.Common.FileBasic;
namespace GeneralUpdate.Core.Driver
{
diff --git a/src/c#/GeneralUpdate.Core/Driver/RestoreDriverCommand.cs b/src/c#/GeneralUpdate.Core/Driver/RestoreDriverCommand.cs
index e30d9b6f..064735b0 100644
--- a/src/c#/GeneralUpdate.Core/Driver/RestoreDriverCommand.cs
+++ b/src/c#/GeneralUpdate.Core/Driver/RestoreDriverCommand.cs
@@ -1,7 +1,7 @@
using System;
using System.Linq;
using System.Text;
-using GeneralUpdate.Common;
+using GeneralUpdate.Common.FileBasic;
namespace GeneralUpdate.Core.Driver
{
diff --git a/src/c#/GeneralUpdate.Core/GeneralUpdateBootstrap.cs b/src/c#/GeneralUpdate.Core/GeneralUpdateBootstrap.cs
index 5437a2fb..33269db9 100644
--- a/src/c#/GeneralUpdate.Core/GeneralUpdateBootstrap.cs
+++ b/src/c#/GeneralUpdate.Core/GeneralUpdateBootstrap.cs
@@ -1,11 +1,12 @@
using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
-using GeneralUpdate.Common;
+using GeneralUpdate.Common.FileBasic;
using GeneralUpdate.Common.Download;
using GeneralUpdate.Common.Internal;
using GeneralUpdate.Common.Internal.Bootstrap;
@@ -73,6 +74,12 @@ public override async Task LaunchAsync()
#region public method
+ public GeneralUpdateBootstrap SetFieldMappings(Dictionary fieldMappings)
+ {
+ _configInfo.FieldMappings = fieldMappings;
+ return this;
+ }
+
public GeneralUpdateBootstrap AddListenerMultiAllDownloadCompleted(
Action