diff --git a/README.md b/README.md
index 19c96c8e6c47f3d04bb51be8e9b7d730da26ac11..f1519aa086bae5ffaacd5002d9c123a5ea50201c 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,6 @@
| 逐版本更新 | 支持 | 客户端当前版本如果与服务器相差多个版本,则根据多个版本的发布日期逐个更新。(引用组件默认生效) |
| 二进制差分更新 | 支持 | 对比新老版本通过差分算法生成补丁文件。(引用组件默认生效) |
| 增量更新功能 | 支持 | 相比上一个版本只更新当前修改过的文件,并且删除当前版本不存在的文件。(引用组件默认生效) |
-| ~~配置文件保留更新~~ | ~~支持~~ | ~~暂时下线该功能,后期考虑开放~~ |
| 强制更新 | 支持 | 打开客户端之后直接强制更新。 |
| 多分支更新 | 支持 | 当一个产品有多个分支时,需要根据不同的分支更新对应的内容。 |
| 最新版本推送 | 支持 | 基于Signal R实现,推送当前最新版本。 |
@@ -29,7 +28,7 @@
| 黑名单 | 支持 | 在更新过程中会跳过黑名单中的文件列表和文件扩展名列表。 |
| OSS | 支持 | 极简化更新,是一套独立的更新机制。只需要在文件服务器中放置version.json的版本配置文件。组件会根据配置文件中的版本信息进行更新下载。(支持Windows,MAUI Android) |
| 回滚 | 待测试 | 逐版本更新时会备份每个版本,如果更新失败则逐版本回滚。 |
-| 驱动更新 | 支持 | 逐版本更新时会备份每个版本的驱动文件(.inf),如果更新失败则逐版本回滚。 |
+| 驱动更新 | 待测试 | 逐版本更新时会备份每个版本的驱动文件(.inf),如果更新失败则逐版本回滚。 |
| 遗言 | 待测试 | 开机时和升级时会检查升级是否成功,如果失败则根据遗言还原之前的备份。遗言是更新之前就已经自动创建在C:\generalupdate_willmessages目录下的will_message.json文件。will_message.json的内容是持久化回滚备份的文件目录相关信息。(需要部署GeneralUpdate.SystemService系统服务) |
| 自定义方法列表 | 支持 | 注入一个自定义方法集合,该集合会在更新启动前执行。执行自定义方法列表如果出现任何异常,将通过异常订阅通知。(推荐在更新之前检查当前软件环境) |
@@ -42,7 +41,6 @@
- 快速启动: https://mp.weixin.qq.com/s/pRKPFe3eC0NSqv9ixXEiTg
- 使用教程视频:https://www.bilibili.com/video/BV1FT4y1Y7hV
- 文档:https://gitee.com/GeneralLibrary/GeneralUpdate/tree/master/doc
-- Tag : https://github.com/GeneralLibrary/GeneralUpdate/tree/master/tag
## 3.开源地址 ##
diff --git a/README_en.md b/README_en.md
index ed1fc80c0da8d0adc52058aed6c2bc1828965fa9..537126a1e947f2114cb379dc51bf2e2b2fa46da5 100644
--- a/README_en.md
+++ b/README_en.md
@@ -15,7 +15,6 @@
| Update version-by-version | yes | If the current version of the client differs from the server by more than one version, it is updated one by one according to the release date of the multiple versions. (Reference components take effect by default) |
| Binary differential update | yes | Compare the old and new versions to generate patch files by differential algorithms. (Reference components take effect by default) |
| Incremental update functionality | yes | Only the currently modified files are updated compared to the previous version,And delete files that do not exist in the current version. (Reference components take effect by default) |
-| ~~The configuration file remains updated~~ | no | ~~This feature is temporarily offline~~ |
| Force an update | yes | Force an update directly after opening the client. |
| Multi-branch updates | yes | When a product has multiple branches, you need to update the corresponding content according to different branches. |
| The latest version push | yes | Based on the SignalR implementation, push the latest version. |
@@ -40,7 +39,6 @@
- Quick Start: https://mp.weixin.qq.com/s/pRKPFe3eC0NSqv9ixXEiTg
- Use the tutorial video:https://www.bilibili.com/video/BV1FT4y1Y7hV
- Doc : https://gitee.com/GeneralLibrary/GeneralUpdate/tree/master/doc
-- Tag : https://github.com/GeneralLibrary/GeneralUpdate/tree/master/tag
### 3.Open source address ###
diff --git a/doc/md/GeneralUpdate.AspNetCore.md b/doc/md/GeneralUpdate.AspNetCore.md
deleted file mode 100644
index 4166d04ea471fd2201cabdb760b374f20f7db5a4..0000000000000000000000000000000000000000
--- a/doc/md/GeneralUpdate.AspNetCore.md
+++ /dev/null
@@ -1,23 +0,0 @@
-## GeneralUpdate.AspNetCore
-
-#### 简介
-
-
-
-#### 提供功能
-
-
-
-#### 使用示例
-
-1.安装
-
-TODO:截图安装,文字解释
-
-2.初始化
-
-TODO:代码
-
-3.启动
-
-TODO:运行效果
\ No newline at end of file
diff --git a/doc/md/GeneralUpdate.ClientCore.md b/doc/md/GeneralUpdate.ClientCore.md
deleted file mode 100644
index a55f7feb881c1dd8134df96ecf09d57420833400..0000000000000000000000000000000000000000
--- a/doc/md/GeneralUpdate.ClientCore.md
+++ /dev/null
@@ -1,34 +0,0 @@
-## GeneralUpdate.ClientCore
-
-#### 简介
-
-GeneralUpdate.ClientCore是最核心的组件之一,提供了大量主要功能。本质和Core没有区别,但是有职责上的区别ClientCore用于主程序中,更新升级助手然后关闭主程序启动升级助手。
-
-#### 提供功能
-
-| **功能** | **是否支持** | **备注** |
-| ---------------- | ------------ | -------------------------------------------------------- |
-| 断点续传 | 支持 | |
-| 逐版本更新 | 支持 | |
-| 二进制差分更新 | 支持 | |
-| 增量更新功能 | 支持 | |
-| 配置文件保留更新 | 支持 | 目前指支持深度为1的json配置文件 |
-| 强制更新 | 支持 | 非强制更新可以弹出选择框供用户选择,强制更新则直接更新 |
-| 多分支更新 | 支持 | 当一个产品有多个分支时,需要根据不同的分支更新对应的内容 |
-| 最新版本推送 | 支持 | 基于SignalR实现 |
-
-
-
-#### 使用示例
-
-1.安装
-
-TODO:截图安装,文字解释
-
-2.初始化
-
-TODO:代码
-
-3.启动
-
-TODO:运行效果
\ No newline at end of file
diff --git a/doc/md/GeneralUpdate.Core.md b/doc/md/GeneralUpdate.Core.md
deleted file mode 100644
index 9bf1cf4fff16e006d1b1d9821d33327916633349..0000000000000000000000000000000000000000
--- a/doc/md/GeneralUpdate.Core.md
+++ /dev/null
@@ -1,33 +0,0 @@
-## GeneralUpdate.Core
-
-#### 简介
-
-GeneralUpdate.Core是最核心的组件之一,提供了大量主要功能。
-
-#### 提供功能
-
-| **功能** | **是否支持** | **备注** |
-| ---------------- | ------------ | -------------------------------------------------------- |
-| 断点续传 | 支持 | |
-| 逐版本更新 | 支持 | |
-| 二进制差分更新 | 支持 | |
-| 增量更新功能 | 支持 | |
-| 配置文件保留更新 | 支持 | 目前指支持深度为1的json配置文件 |
-| 强制更新 | 支持 | 非强制更新可以弹出选择框供用户选择,强制更新则直接更新 |
-| 多分支更新 | 支持 | 当一个产品有多个分支时,需要根据不同的分支更新对应的内容 |
-
-
-
-#### 使用示例
-
-1.安装
-
-TODO:截图安装,文字解释
-
-2.初始化
-
-TODO:代码
-
-3.启动
-
-TODO:运行效果
\ No newline at end of file
diff --git a/doc/md/GeneralUpdate.Differential.md b/doc/md/GeneralUpdate.Differential.md
deleted file mode 100644
index ee1def129cceea4e547b5dcc637e3cf2471c30ed..0000000000000000000000000000000000000000
--- a/doc/md/GeneralUpdate.Differential.md
+++ /dev/null
@@ -1,23 +0,0 @@
-## GeneralUpdate.Differential
-
-#### 简介
-
-
-
-#### 提供功能
-
-
-
-#### 使用示例
-
-1.安装
-
-TODO:截图安装,文字解释
-
-2.初始化
-
-TODO:代码
-
-3.启动
-
-TODO:运行效果
\ No newline at end of file
diff --git a/doc/md/GeneralUpdate.PacketTool.md b/doc/md/GeneralUpdate.PacketTool.md
deleted file mode 100644
index d2a8b153889318426094e4fed453e0d87703b760..0000000000000000000000000000000000000000
--- a/doc/md/GeneralUpdate.PacketTool.md
+++ /dev/null
@@ -1,28 +0,0 @@
-## GeneralUpdate.PacketTool
-
-#### 简介
-
-工具使用.NET MAUI (.NET 6)进行开发,目前只支持桌面端使用。
-
-#### 提供功能
-
-| 功能 | 支持 | 备注 |
-| ------------------ | ------ | ------------------------------------------------------------ |
-| 差分更新包生成 | 是 | 根据上一个版本和当前版本进行对比找出需要更新的文件或新添加文件。 |
-| 自动上传更新包 | 开发中 | 将生成好的差分更新包自动上传至服务器。 |
-| 可编辑选择差分文件 | 开发中 | 可视化查看差分包的打包内容,并可选择打包文件。 |
-| 多平台支持 | 部分 | 仅支持Windows、Linux、MacCatalyst。 |
-
-#### 使用示例
-
-
-
-Source path:表示上一个版本的文件夹路径。
-
-Target path:表示当前版本文件夹路径。
-
-Patch path:表示最终生成差分包的路径。
-
-Is Publish:如果勾选则将生成好的差分包通过HTTP上传,并自动在数据库插入本次发布的版本信息。
-
-Build:通过递归比对Source path和Target path文件夹下所有的工程文件(DLL,exe...等),通过二进制差分检查、增量检查分析出需要更新的文件列表按照文件夹结构,打包更新包。
\ No newline at end of file
diff --git a/doc/md/GeneralUpdate.Single.md b/doc/md/GeneralUpdate.Single.md
deleted file mode 100644
index 8a2cf8fe0e1c8fe751695d72009c6885c0563490..0000000000000000000000000000000000000000
--- a/doc/md/GeneralUpdate.Single.md
+++ /dev/null
@@ -1,23 +0,0 @@
-## GeneralUpdate.Single
-
-#### 简介
-
-
-
-#### 提供功能
-
-
-
-#### 使用示例
-
-1.安装
-
-TODO:截图安装,文字解释
-
-2.初始化
-
-TODO:代码
-
-3.启动
-
-TODO:运行效果
\ No newline at end of file
diff --git a/doc/md/GeneralUpdate.Zip.md b/doc/md/GeneralUpdate.Zip.md
deleted file mode 100644
index 8388d6dd4e484510eb1957e3f7cb519016633223..0000000000000000000000000000000000000000
--- a/doc/md/GeneralUpdate.Zip.md
+++ /dev/null
@@ -1,23 +0,0 @@
-## GeneralUpdate.ZIP
-
-#### 简介
-
-
-
-#### 提供功能
-
-
-
-#### 使用示例
-
-1.安装
-
-TODO:截图安装,文字解释
-
-2.初始化
-
-TODO:代码
-
-3.启动
-
-TODO:运行效果
\ No newline at end of file
diff --git "a/doc/md/\347\273\204\344\273\266\347\256\200\344\273\213.md" "b/doc/md/\347\273\204\344\273\266\347\256\200\344\273\213.md"
deleted file mode 100644
index 6fbf57566f9b282799ca4f87971799bd7aabfa57..0000000000000000000000000000000000000000
--- "a/doc/md/\347\273\204\344\273\266\347\256\200\344\273\213.md"
+++ /dev/null
@@ -1,122 +0,0 @@
-### 1.GeneralUpdate是什么?
-
-GeneralUpdate将被规划为全平台全栈软件,不受限任何语言或技术的自动更新组件。
-
-##### 开源地址
-
-- https://github.com/JusterZhu/GeneralUpdate
-- https://gitee.com/Juster-zhu/GeneralUpdate
-
-##### 帮助文档 #####
-
-- 讲解视频: https://www.bilibili.com/video/BV1aX4y137dd
-- 官方网站: http://justerzhu.cn/
-- 快速启动: https://mp.weixin.qq.com/s/pRKPFe3eC0NSqv9ixXEiTg
-- 使用教程视频:https://www.bilibili.com/video/BV1FT4y1Y7hV
-
-##### 沟通交流
-
-- 免费问题解答: https://github.com/JusterZhu/GeneralUpdate/issues
-- 免费技术交流:
-- 开源项目使用讨论:
-
-
-
-##### 商务合作
-
-定制化二次开发,技术咨询。
-
-- 邮箱:zhuzhen723723@outlook.com
-
-
-
-## 2.统一语言(Unifying Language)
-
-在开始使用GeneralUpdate之前我们需要先知道体系中的一些基础概念。
-
-- Client:是指你的主应用程序,是被更新的客户端。也可理解为是公司的产品。
-
-- Upgrade:是指升级程序,它将是一个独立的进程。需要和Client放在同一级目录下,在使用(或编码)的过程中不可以和任何业务或设计关联、必须保持独立引用。
-- Server:是指服务端应用(ASP.NET)将提供版本更新信息交互、版本验证功能。
-
-
-
-### 3.GeneralUpdate提供什么?
-
-##### 组件功能
-
-| **功能** | **是否支持** | **备注** |
-| ------------------------------ | ------------ | ------------------------------------------------------------ |
-| 断点续传 | 支持 | |
-| 逐版本更新 | 支持 | |
-| 二进制差分更新 | 支持 | |
-| 增量更新功能 | 支持 | |
-| 配置文件保留更新 | 支持 | 目前指支持深度为1的json配置文件 |
-| 强制更新 | 支持 | 非强制更新可以弹出选择框供用户选择,强制更新则直接更新 |
-| 多分支更新 | 支持 | 当一个产品有多个分支时,需要根据不同的分支更新对应的内容 |
-| 版本校验、更新信息 | 支持 | 可验证版本是否需要更新 |
-| 最新版本推送 | 支持 | 基于SignalR实现 |
-| 客户端程序、服务端程序应用更新 | 支持 | C/S和B/S程序均可使用 |
-| 多平台、操作系统 | 部分支持 | Linux、MacCatalyst、Windows |
-| 多语言 | 待验证 | 也可将本组件编写为控制台程序,作为更新“脚本”。供其他语言的应用程序调用更新。 |
-
-
-
-##### 打包工具
-
-GeneralUpdate.PacketTool使用.NET MAUI(.NET 6)编写的桌面端打包程序。
-
-| 功能 | 支持 | 备注 |
-| ------------------ | ------ | ------------------------------------------------------------ |
-| 差分更新包生成 | 是 | 根据上一个版本和当前版本进行对比找出需要更新的文件或新添加文件。 |
-| 自动上传更新包 | 开发中 | 将生成好的差分更新包自动上传至服务器。 |
-| 可编辑选择差分文件 | 开发中 | 可视化查看差分包的打包内容,并可选择打包文件。 |
-| 多平台支持 | 部分 | 仅支持Windows、Linux、MacCatalyst。 |
-
-
-
-### 4.GeneralUpdate支持什么?
-
-##### .NET框架
-
-| 框架名称 | 是否支持 |
-| -------------------- | -------- |
-| .NET Core 2.0 | 支持 |
-| .NET 5 6 7 8 | 支持 |
-| .NET Framework 4.6.1 | 支持 |
-
-
-
-##### UI框架
-
-| UI框架名称 | 是否支持 |
-| ----------------- | ------------------- |
-| WPF | 支持 |
-| UWP | 商店模式下不可更新 |
-| MAUI | 正在兼容(windows) |
-| Avalonia | 支持 |
-| WinUI | 待验证,等待反馈 |
-| Console(控制台) | 支持 |
-| Winform | 支持 |
-
-
-
-##### 服务端框架
-
-| 服务端框架 | 是否支持 |
-| ---------- | -------- |
-| ASP.NET | 待验证 |
-
-
-
-##### 操作系统
-
-| 操作系统名称 | 是否支持 |
-| -------------------------------- | -------- |
-| Windows | 支持 |
-| Linux | 支持 |
-| MacCatalyst | 支持 |
-| iOS | 暂不支持 |
-| Android | 暂不支持 |
-| 树莓派(IoT) | 待验证 |
-| 国产操作系统(华为海思、麒麟等) | 待验证 |
\ No newline at end of file
diff --git a/src/c#/GeneralUpdate.Client/MySample.cs b/src/c#/GeneralUpdate.Client/MySample.cs
index 72e631dacad5fabeb9494c7ffee3973810664778..999b10f7ae2bbf8eeebf47058bf16934f5ebfa68 100644
--- a/src/c#/GeneralUpdate.Client/MySample.cs
+++ b/src/c#/GeneralUpdate.Client/MySample.cs
@@ -1,6 +1,5 @@
using GeneralUpdate.ClientCore;
using GeneralUpdate.Core.Bootstrap;
-using GeneralUpdate.Core.ContentProvider;
using GeneralUpdate.Core.Domain.Entity;
using GeneralUpdate.Core.Domain.Enum;
using GeneralUpdate.Core.Driver;
diff --git a/src/c#/GeneralUpdate.ClientCore/Differential/Config/.gitkeep b/src/c#/GeneralUpdate.ClientCore/Differential/Config/.gitkeep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/src/c#/GeneralUpdate.ClientCore/Differential/Config/Cache/.gitkeep b/src/c#/GeneralUpdate.ClientCore/Differential/Config/Cache/.gitkeep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/src/c#/GeneralUpdate.ClientCore/Differential/Config/Handles/.gitkeep b/src/c#/GeneralUpdate.ClientCore/Differential/Config/Handles/.gitkeep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/src/c#/GeneralUpdate.ClientCore/GeneralUpdate.ClientCore.csproj b/src/c#/GeneralUpdate.ClientCore/GeneralUpdate.ClientCore.csproj
index de6d08b8b4db4e9e2a7dad137a7a1f35c373b269..fffb448fad35788449d7459c0414f92e2d3a5274 100644
--- a/src/c#/GeneralUpdate.ClientCore/GeneralUpdate.ClientCore.csproj
+++ b/src/c#/GeneralUpdate.ClientCore/GeneralUpdate.ClientCore.csproj
@@ -32,9 +32,6 @@
-
-
-
@@ -62,12 +59,9 @@
-
-
-
@@ -142,7 +136,6 @@
-
@@ -157,26 +150,17 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -184,9 +168,7 @@
-
-
@@ -239,7 +221,6 @@
-
@@ -257,31 +238,20 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/c#/GeneralUpdate.ClientCore/Hubs/VersionHub.cs b/src/c#/GeneralUpdate.ClientCore/Hubs/VersionHub.cs
index d8540127169c22e85247fe6dc1e26263252b431d..6b656f141c74613feb7a41bec04c9f562ec5516c 100644
--- a/src/c#/GeneralUpdate.ClientCore/Hubs/VersionHub.cs
+++ b/src/c#/GeneralUpdate.ClientCore/Hubs/VersionHub.cs
@@ -1,4 +1,4 @@
-using GeneralUpdate.Core.Utils;
+using GeneralUpdate.Core.ContentProvider;
using Microsoft.AspNetCore.SignalR.Client;
using System;
using System.Threading.Tasks;
@@ -122,7 +122,7 @@ namespace GeneralUpdate.ClientCore.Hubs
if (_receiveMessageCallback == null || string.IsNullOrWhiteSpace(message)) return;
try
{
- var clientParameter = SerializeUtil.Deserialize(message);
+ var clientParameter = FileProvider.Deserialize(message);
if (clientParameter == null) throw new ArgumentNullException($"'VersionHub' Receiving server push version information deserialization failed , receive content : {message} .");
_receiveMessageCallback.Invoke(clientParameter);
}
diff --git a/src/c#/GeneralUpdate.ClientCore/Utils/.gitkeep b/src/c#/GeneralUpdate.ClientCore/Utils/.gitkeep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/src/c#/GeneralUpdate.ClientCore/ZipFactory/G7z/.gitkeep b/src/c#/GeneralUpdate.ClientCore/ZipFactory/G7z/.gitkeep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/src/c#/GeneralUpdate.ClientCore/ZipFactory/GZip/.gitkeep b/src/c#/GeneralUpdate.ClientCore/ZipFactory/GZip/.gitkeep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/src/c#/GeneralUpdate.Core/Bootstrap/AbstractBootstrap.cs b/src/c#/GeneralUpdate.Core/Bootstrap/AbstractBootstrap.cs
index 081f6ecf9f2beced84a4bd46f79bc2c1144b0a5b..637f467720280fb8347fe63677a790206969c0a9 100644
--- a/src/c#/GeneralUpdate.Core/Bootstrap/AbstractBootstrap.cs
+++ b/src/c#/GeneralUpdate.Core/Bootstrap/AbstractBootstrap.cs
@@ -145,7 +145,7 @@ namespace GeneralUpdate.Core.Bootstrap
Contract.Requires(option != null);
if (value == null)
{
- this._options.TryRemove(option, out UpdateOptionValue removed);
+ this._options.TryRemove(option, out _);
}
else
{
diff --git a/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Comparer.cs b/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Comparer.cs
index ae8cfcda4da6e2e1c63b1a05f46bbf9aacf02b0e..be5f91e732a11ab962567bbb48489242febcdaf8 100644
--- a/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Comparer.cs
+++ b/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Comparer.cs
@@ -64,4 +64,4 @@ namespace GeneralUpdate.Core.ContentProvider
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Filter.cs b/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Filter.cs
index ba44771876aecef5a11fa057599bd37277a0bcea..e399f57468c493edf8e1b859af7b1a0681a26aaa 100644
--- a/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Filter.cs
+++ b/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Filter.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+using System.Collections.Generic;
namespace GeneralUpdate.Core.ContentProvider
{
@@ -31,4 +29,4 @@ namespace GeneralUpdate.Core.ContentProvider
///
public static List GetBlackFileFormats() => _blackFileFormats ?? new List() { ".patch", ".7z", ".zip", ".rar", ".tar", ".json" };
}
-}
+}
\ No newline at end of file
diff --git a/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Manage.cs b/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Manage.cs
index 77fa0b8604e31d3ad9b1f61e2266c4fb139562c2..97580db8837532ce2d9267c5c7abb2945f6ad78e 100644
--- a/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Manage.cs
+++ b/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Manage.cs
@@ -1,6 +1,4 @@
-using GeneralUpdate.Core.Exceptions;
-using GeneralUpdate.Core.HashAlgorithms;
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
diff --git a/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Serialization.cs b/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Serialization.cs
index 4a03e465486c88a1c1109194e433d0b68a1d5bb0..ebf0a6de1c501082f7f684d76b95156b76d5efbb 100644
--- a/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Serialization.cs
+++ b/src/c#/GeneralUpdate.Core/ContentProvider/FileProvider-Serialization.cs
@@ -1,5 +1,7 @@
using Newtonsoft.Json;
+using System;
using System.IO;
+using System.Text;
namespace GeneralUpdate.Core.ContentProvider
{
@@ -25,5 +27,35 @@ namespace GeneralUpdate.Core.ContentProvider
}
return default(T);
}
+
+ ///
+ /// Convert object to base64 string.
+ ///
+ ///
+ ///
+ public static string Serialize(object obj)
+ {
+ if (obj == null) return string.Empty;
+ var json = JsonConvert.SerializeObject(obj);
+ var bytes = Encoding.Default.GetBytes(json);
+ var base64str = Convert.ToBase64String(bytes);
+ return base64str;
+ }
+
+ ///
+ /// Convert base64 object to string.
+ ///
+ ///
+ ///
+ ///
+ public static T Deserialize(string str)
+ {
+ var obj = default(T);
+ if (string.IsNullOrEmpty(str)) return obj;
+ byte[] bytes = Convert.FromBase64String(str);
+ var json = Encoding.Default.GetString(bytes);
+ var result = JsonConvert.DeserializeObject(json);
+ return result;
+ }
}
}
\ No newline at end of file
diff --git a/src/c#/GeneralUpdate.Core/Domain/Entity/Assembler/ProcessAssembler.cs b/src/c#/GeneralUpdate.Core/Domain/Entity/Assembler/ProcessAssembler.cs
index 39a1c69ab1fc46cb846cb1d2a549ae10ce522215..88eb236c251998df96eef8cccaf96b71b1aa37a7 100644
--- a/src/c#/GeneralUpdate.Core/Domain/Entity/Assembler/ProcessAssembler.cs
+++ b/src/c#/GeneralUpdate.Core/Domain/Entity/Assembler/ProcessAssembler.cs
@@ -1,4 +1,4 @@
-using GeneralUpdate.Core.Utils;
+using GeneralUpdate.Core.ContentProvider;
using System;
using System.Text;
@@ -9,13 +9,13 @@ namespace GeneralUpdate.Core.Domain.Entity.Assembler
public static string ToBase64(ProcessInfo info)
{
if (info == null) throw new ArgumentNullException(nameof(info));
- return SerializeUtil.Serialize(info);
+ return FileProvider.Serialize(info);
}
public static string ToBase64(ParamsOSS info)
{
if (info == null) throw new ArgumentNullException(nameof(info));
- return SerializeUtil.Serialize(info);
+ return FileProvider.Serialize(info);
}
public static Packet ToPacket(ProcessInfo info)
diff --git a/src/c#/GeneralUpdate.Core/GeneralUpdateBootstrap.cs b/src/c#/GeneralUpdate.Core/GeneralUpdateBootstrap.cs
index 8b4965b51c0d9c9c9239bf476dffc1a42ac27c60..67913d5413881fb2c541e190524b5cb8cbae7c70 100644
--- a/src/c#/GeneralUpdate.Core/GeneralUpdateBootstrap.cs
+++ b/src/c#/GeneralUpdate.Core/GeneralUpdateBootstrap.cs
@@ -4,7 +4,6 @@ using GeneralUpdate.Core.Domain.Entity;
using GeneralUpdate.Core.Domain.Entity.Assembler;
using GeneralUpdate.Core.Domain.Enum;
using GeneralUpdate.Core.Strategys;
-using GeneralUpdate.Core.Utils;
using System;
using System.IO;
using System.Threading.Tasks;
@@ -23,7 +22,7 @@ namespace GeneralUpdate.Core
try
{
var base64 = Environment.GetEnvironmentVariable("ProcessBase64", EnvironmentVariableTarget.User);
- var processInfo = SerializeUtil.Deserialize(base64);
+ var processInfo = FileProvider.Deserialize(base64);
Packet = ProcessAssembler.ToPacket(processInfo);
Packet.AppType = AppType.UpgradeApp;
Packet.TempPath = $"{FileProvider.GetTempDirectory(processInfo.LastVersion)}{Path.DirectorySeparatorChar}";
diff --git a/src/c#/GeneralUpdate.Core/Pipelines/Middleware/ConfigMiddleware.cs b/src/c#/GeneralUpdate.Core/Pipelines/Middleware/ConfigMiddleware.cs
deleted file mode 100644
index 8d5046639a71463872976ab7548ef9ee150d3614..0000000000000000000000000000000000000000
--- a/src/c#/GeneralUpdate.Core/Pipelines/Middleware/ConfigMiddleware.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using GeneralUpdate.Core.Domain.Enum;
-using GeneralUpdate.Core.Events;
-using GeneralUpdate.Core.Events.MultiEventArgs;
-using GeneralUpdate.Core.Pipelines.Context;
-using GeneralUpdate.Differential.Config;
-using System;
-using System.Threading.Tasks;
-
-namespace GeneralUpdate.Core.Pipelines.Middleware
-{
- [Obsolete("This feature is temporarily deprecated in the current version pending refactoring.")]
- public class ConfigMiddleware : IMiddleware
- {
- public async Task InvokeAsync(BaseContext context, MiddlewareStack stack)
- {
- EventManager.Instance.Dispatch>(this, new MultiDownloadProgressChangedEventArgs(context.Version, ProgressType.Hash, "Update configuration file ..."));
- await ConfigFactory.Instance.Deploy();
- var node = stack.Pop();
- if (node != null) await node.Next.Invoke(context, stack);
- }
- }
-}
\ No newline at end of file
diff --git a/src/c#/GeneralUpdate.Core/Utils/SerializeUtil.cs b/src/c#/GeneralUpdate.Core/Utils/SerializeUtil.cs
deleted file mode 100644
index 14d5a27ad2ab5b801b46a2499cd954308ffd7021..0000000000000000000000000000000000000000
--- a/src/c#/GeneralUpdate.Core/Utils/SerializeUtil.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using Newtonsoft.Json;
-using System;
-using System.Text;
-
-namespace GeneralUpdate.Core.Utils
-{
- ///
- /// Arbitrary object serialization.
- ///
- public class SerializeUtil
- {
- ///
- /// Convert object to base64 string.
- ///
- ///
- ///
- public static string Serialize(object obj)
- {
- if (obj == null) return string.Empty;
- var json = JsonConvert.SerializeObject(obj);
- var bytes = Encoding.Default.GetBytes(json);
- var base64str = Convert.ToBase64String(bytes);
- return base64str;
- }
-
- ///
- /// Convert base64 object to string.
- ///
- ///
- ///
- ///
- public static T Deserialize(string str)
- {
- var obj = default(T);
- if (string.IsNullOrEmpty(str)) return obj;
- byte[] bytes = Convert.FromBase64String(str);
- var json = Encoding.Default.GetString(bytes);
- var result = JsonConvert.DeserializeObject(json);
- return result;
- }
- }
-}
\ No newline at end of file
diff --git a/src/c#/GeneralUpdate.Differential/Config/Cache/ConfigCache.cs b/src/c#/GeneralUpdate.Differential/Config/Cache/ConfigCache.cs
deleted file mode 100644
index bcd62a64db0ff70f3cd57136f7b6038d1cd6ce8e..0000000000000000000000000000000000000000
--- a/src/c#/GeneralUpdate.Differential/Config/Cache/ConfigCache.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System.Collections.Immutable;
-
-namespace GeneralUpdate.Differential.Config.Cache
-{
- public class ConfigCache : ICache where TEntity : class
- {
- #region Private Members
-
- private ImmutableDictionary _cache = null;
- private ImmutableDictionary.Builder _cacheBuilder = null;
-
- #endregion Private Members
-
- #region Constructors
-
- public ConfigCache()
- {
- _cacheBuilder = ImmutableDictionary.Create().ToBuilder();
- }
-
- #endregion Constructors
-
- #region Public Properties
-
- public ImmutableDictionary Cache { get => _cache; private set => _cache = value; }
-
- #endregion Public Properties
-
- #region Public Methods
-
- public void TryAdd(string key, TEntity entity)
- {
- if (!_cacheBuilder.ContainsKey(key)) _cacheBuilder.Add(key, entity);
- }
-
- public TEntity TryGet(string key)
- {
- TEntity result = null;
- if (_cacheBuilder.ContainsKey(key)) _cacheBuilder.TryGetValue(key, out result);
- return result;
- }
-
- public bool TryRemove(string key)
- {
- bool isRemove = false;
- if (_cacheBuilder.ContainsKey(key)) isRemove = _cacheBuilder.Remove(key);
- return isRemove;
- }
-
- public void Build()
- {
- if (Cache == null) Cache = _cacheBuilder.ToImmutableDictionary();
- }
-
- public void Dispose()
- {
- if (Cache != null)
- {
- Cache.Clear();
- Cache = null;
- }
-
- if (_cacheBuilder != null)
- {
- _cacheBuilder.Clear();
- _cacheBuilder = null;
- }
- }
-
- #endregion Public Methods
- }
-}
\ No newline at end of file
diff --git a/src/c#/GeneralUpdate.Differential/Config/Cache/ConfigEntity.cs b/src/c#/GeneralUpdate.Differential/Config/Cache/ConfigEntity.cs
deleted file mode 100644
index c81f6d712c74a1d700c68810a1d210e267c6b261..0000000000000000000000000000000000000000
--- a/src/c#/GeneralUpdate.Differential/Config/Cache/ConfigEntity.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using GeneralUpdate.Differential.Config.Handles;
-
-namespace GeneralUpdate.Differential.Config.Cache
-{
- public class ConfigEntity
- {
- ///
- /// file name
- ///
- public string Name { get; set; }
-
- ///
- /// file hash code .
- ///
- public string Hash { get; set; }
-
- ///
- /// configuation file content.
- ///
- public object Content { get; set; }
-
- ///
- /// configuration file path.
- ///
- public string Path { get; set; }
-
- public string OldPath { get; set; }
-
- ///
- /// handle type (.json .ini .xml .db) .
- ///
- public HandleEnum Handle { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/c#/GeneralUpdate.Differential/Config/Cache/ICache.cs b/src/c#/GeneralUpdate.Differential/Config/Cache/ICache.cs
deleted file mode 100644
index a0e11d471129c6bba7df2cb9ff2768a8bb042d1b..0000000000000000000000000000000000000000
--- a/src/c#/GeneralUpdate.Differential/Config/Cache/ICache.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-namespace GeneralUpdate.Differential.Config.Cache
-{
- ///
- /// Cache operation class.
- ///
- ///
- public interface ICache where TEntity : class
- {
- ///
- /// add cache.
- ///
- /// file hash
- /// configuration file content.
- void TryAdd(string key, TEntity entity);
-
- ///
- /// remove cache.
- ///
- /// file hash
- ///
- bool TryRemove(string key);
-
- ///
- /// get cache configuration file content.
- ///
- /// file hash
- /// configuration file content.
- TEntity TryGet(string key);
- }
-}
\ No newline at end of file
diff --git a/src/c#/GeneralUpdate.Differential/Config/ConfigFactory.cs b/src/c#/GeneralUpdate.Differential/Config/ConfigFactory.cs
deleted file mode 100644
index 5033c1cb8a0688b4acb8a27d4f1fb2d39e53c71f..0000000000000000000000000000000000000000
--- a/src/c#/GeneralUpdate.Differential/Config/ConfigFactory.cs
+++ /dev/null
@@ -1,276 +0,0 @@
-using GeneralUpdate.Core.ContentProvider;
-using GeneralUpdate.Core.HashAlgorithms;
-using GeneralUpdate.Differential.Config.Cache;
-using GeneralUpdate.Differential.Config.Handles;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Threading.Tasks;
-
-namespace GeneralUpdate.Differential.Config
-{
- ///
- /// Update local configuration file.[Currently only files with a depth of 1 are supported.]
- /// Currently only json files are supported.
- ///
- public sealed class ConfigFactory : IDisposable
- {
- #region Private Members
-
- private ConfigCache _configCache;
- private string _appPath, _scanPath;
- private List _files;
- private bool _disposed = false;
- private static readonly object _locker = new object();
- private static ConfigFactory _instance;
-
- #endregion Private Members
-
- #region Constructors
-
- private ConfigFactory()
- {
- _configCache = new ConfigCache();
- }
-
- ~ConfigFactory()
- {
- Dispose();
- }
-
- #endregion Constructors
-
- #region Public Properties
-
- public static ConfigFactory Instance
- {
- get
- {
- if (_instance == null)
- {
- lock (_locker)
- {
- if (_instance == null) _instance = new ConfigFactory();
- }
- }
- return _instance;
- }
- }
-
- #endregion Public Properties
-
- #region Public Methods
-
- ///
- /// Deploy configuration file.
- ///
- public async Task Deploy()
- {
- try
- {
- if (_configCache.Cache != null)
- {
- foreach (var cacheItem in _configCache.Cache)
- {
- var value = cacheItem.Value;
- if (value == null) continue;
- var hashAlgorithm = new Sha256HashAlgorithm();
- var hash = hashAlgorithm.ComputeHash(value.OldPath);
- var oldEntity = await Handle(value.OldPath, hash);
- await InitHandle(value.Handle).Write(oldEntity, value);
- }
- Dispose();
- }
- }
- catch (Exception ex)
- {
- throw new Exception($"Deploy config error : {ex.Message} .", ex.InnerException);
- }
- }
-
- ///
- /// Scan configuration files and cache, backup.
- ///
- /// The application directory that needs to be updated.
- /// update package directory.
- ///
- ///
- public async Task Scan(string appPath = null, string scanPath = null)
- {
- try
- {
- _disposed = false;
- _appPath = appPath ?? Environment.CurrentDirectory;
- _scanPath = scanPath ?? Environment.CurrentDirectory;
- if (!Directory.Exists(_appPath) || !Directory.Exists(_scanPath)) return;
- List files = new List();
- Find(_scanPath, ref files);
- if (files.Count == 0) return;
- await Cache(_files = files);
- }
- catch (Exception ex)
- {
- throw new Exception($"Scan config files error : {ex.Message} .", ex.InnerException);
- }
- }
-
- ///
- /// release all resources.
- ///
- /// dispose exception
- public void Dispose()
- {
- if (_disposed) return;
-
- try
- {
- if (_configCache != null)
- {
- _configCache.Dispose();
- _configCache = null;
- }
- if (_files != null)
- {
- _files.Clear();
- _files = null;
- }
- _disposed = true;
- }
- catch (Exception ex)
- {
- _disposed = false;
- throw new Exception($"'Dispose' error :{ex.Message} .", ex.InnerException);
- }
- }
-
- #endregion Public Methods
-
- #region Private Methods
-
- ///
- /// Find matching files recursively.
- ///
- /// root directory
- /// result file list
- private void Find(string rootDirectory, ref List files)
- {
- var rootDirectoryInfo = new DirectoryInfo(rootDirectory);
- foreach (var file in rootDirectoryInfo.GetFiles())
- {
- var extensionName = Path.GetExtension(file.Name);
- if (!FileProvider.GetBlackFileFormats().Contains(extensionName)) continue;
- var fullName = file.FullName;
- files.Add(fullName);
- }
- foreach (var dir in rootDirectoryInfo.GetDirectories())
- {
- Find(dir.FullName, ref files);
- }
- }
-
- ///
- /// All resources are cached and backed up.
- ///
- ///
- ///
- private async Task Cache(IEnumerable files)
- {
- if (_files == null) return;
- try
- {
- foreach (var file in files)
- {
- var hashAlgorithm = new Sha256HashAlgorithm();
- var hash = hashAlgorithm.ComputeHash(file);
- var entity = await Handle(file, hash);
- _configCache.TryAdd(hash, entity);
- }
- _configCache.Build();
- }
- catch (Exception ex)
- {
- throw new Exception($"'Cache' error :{ex.Message} .", ex.InnerException);
- }
- }
-
- ///
- /// Process file content.
- ///
- /// file path
- /// hash
- ///
- private async Task Handle(string file, string hash)
- {
- var entity = new ConfigEntity();
- entity.Path = file;
- entity.Name = Path.GetFileName(file);
- entity.OldPath = Path.Combine(_appPath, entity.Name);
- entity.Hash = hash;
- entity.Handle = ToEnum(file);
- entity.Content = await InitHandle