From 7d6d8a78f0d109b2b5bf36a1710e529529e34221 Mon Sep 17 00:00:00 2001 From: Juster Zhu Date: Mon, 19 Feb 2024 22:28:04 +0800 Subject: [PATCH] remove config handle --- .../Config/Cache/ConfigCache.cs | 72 ----- .../Config/Cache/ConfigEntity.cs | 34 --- .../Config/Cache/ICache.cs | 30 -- .../Config/ConfigFactory.cs | 276 ------------------ .../Config/Handles/DBHandle.cs | 31 -- .../Config/Handles/HandleEnum.cs | 11 - .../Config/Handles/IHandle.cs | 22 -- .../Config/Handles/IniHandle.cs | 130 --------- .../Config/Handles/JsonHandle.cs | 163 ----------- .../Config/Handles/XmlHandle.cs | 31 -- .../GeneralUpdate.Differential.csproj | 6 + .../GeneralUpdate.Maui.OSS.csproj | 15 + .../GeneralUpdateOSS.cs | 12 +- 13 files changed, 24 insertions(+), 809 deletions(-) delete mode 100644 src/c#/GeneralUpdate.Differential/Config/Cache/ConfigCache.cs delete mode 100644 src/c#/GeneralUpdate.Differential/Config/Cache/ConfigEntity.cs delete mode 100644 src/c#/GeneralUpdate.Differential/Config/Cache/ICache.cs delete mode 100644 src/c#/GeneralUpdate.Differential/Config/ConfigFactory.cs delete mode 100644 src/c#/GeneralUpdate.Differential/Config/Handles/DBHandle.cs delete mode 100644 src/c#/GeneralUpdate.Differential/Config/Handles/HandleEnum.cs delete mode 100644 src/c#/GeneralUpdate.Differential/Config/Handles/IHandle.cs delete mode 100644 src/c#/GeneralUpdate.Differential/Config/Handles/IniHandle.cs delete mode 100644 src/c#/GeneralUpdate.Differential/Config/Handles/JsonHandle.cs delete mode 100644 src/c#/GeneralUpdate.Differential/Config/Handles/XmlHandle.cs 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 bcd62a64..00000000 --- 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 c81f6d71..00000000 --- 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 a0e11d47..00000000 --- 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 5033c1cb..00000000 --- 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(entity.Handle).Read(file); - return entity; - } - - /// - /// Initialize the corresponding file processing object. - /// - /// file entity - /// handle enum - /// handle - private IHandle InitHandle(HandleEnum handleEnum) where TEntity : class - { - IHandle handle = null; - switch (handleEnum) - { - case HandleEnum.DB: - handle = new DBHandle(); - break; - - case HandleEnum.INI: - handle = new IniHandle(); - break; - - case HandleEnum.JSON: - handle = new JsonHandle(); - break; - - case HandleEnum.XML: - handle = new XmlHandle(); - break; - } - return handle; - } - - /// - /// Convert enumeration value according to file type. - /// - /// file path - /// handle enum - private HandleEnum ToEnum(string file) - { - var fileExtension = Path.GetExtension(file); - var handleEnum = HandleEnum.NONE; - switch (fileExtension) - { - case ".db": - handleEnum = HandleEnum.DB; - break; - - case ".ini": - handleEnum = HandleEnum.INI; - break; - - case ".json": - handleEnum = HandleEnum.JSON; - break; - - case ".xml": - handleEnum = HandleEnum.XML; - break; - } - return handleEnum; - } - - #endregion Private Methods - } -} \ No newline at end of file diff --git a/src/c#/GeneralUpdate.Differential/Config/Handles/DBHandle.cs b/src/c#/GeneralUpdate.Differential/Config/Handles/DBHandle.cs deleted file mode 100644 index 9cbc13de..00000000 --- a/src/c#/GeneralUpdate.Differential/Config/Handles/DBHandle.cs +++ /dev/null @@ -1,31 +0,0 @@ -using GeneralUpdate.Core.CustomAwaiter; -using System; -using System.Threading.Tasks; - -namespace GeneralUpdate.Differential.Config.Handles -{ - public class DBHandle : IHandle, IAwaiter where TEntity : class - { - public bool IsCompleted => throw new NotImplementedException(); - - public TEntity GetResult() - { - throw new NotImplementedException(); - } - - public void OnCompleted(Action continuation) - { - throw new NotImplementedException(); - } - - public Task Read(string path) - { - throw new NotImplementedException(); - } - - public Task Write(TEntity oldEntity, TEntity newEntity) - { - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/src/c#/GeneralUpdate.Differential/Config/Handles/HandleEnum.cs b/src/c#/GeneralUpdate.Differential/Config/Handles/HandleEnum.cs deleted file mode 100644 index ee5c9061..00000000 --- a/src/c#/GeneralUpdate.Differential/Config/Handles/HandleEnum.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace GeneralUpdate.Differential.Config.Handles -{ - public enum HandleEnum - { - NONE = 0, - INI, - JSON, - XML, - DB - } -} \ No newline at end of file diff --git a/src/c#/GeneralUpdate.Differential/Config/Handles/IHandle.cs b/src/c#/GeneralUpdate.Differential/Config/Handles/IHandle.cs deleted file mode 100644 index 6d0839b1..00000000 --- a/src/c#/GeneralUpdate.Differential/Config/Handles/IHandle.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Threading.Tasks; - -namespace GeneralUpdate.Differential.Config.Handles -{ - public interface IHandle where TEntity : class - { - /// - /// Write the cache content to the file to be updated. - /// - /// - /// - /// - Task Write(TEntity oldEntity, TEntity newEntity); - - /// - /// read file content. - /// - /// file path - /// - Task Read(string path); - } -} \ No newline at end of file diff --git a/src/c#/GeneralUpdate.Differential/Config/Handles/IniHandle.cs b/src/c#/GeneralUpdate.Differential/Config/Handles/IniHandle.cs deleted file mode 100644 index 2ea2cb0c..00000000 --- a/src/c#/GeneralUpdate.Differential/Config/Handles/IniHandle.cs +++ /dev/null @@ -1,130 +0,0 @@ -using GeneralUpdate.Core.CustomAwaiter; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace GeneralUpdate.Differential.Config.Handles -{ - public class IniHandle : IHandle, IAwaiter where TEntity : class - { - public bool IsCompleted => throw new NotImplementedException(); - - public TEntity GetResult() - { - throw new NotImplementedException(); - } - - public void OnCompleted(Action continuation) - { - throw new NotImplementedException(); - } - - public Task Read(string path) - { - throw new NotImplementedException(); - } - - public Task Write(TEntity oldEntity, TEntity newEntity) - { - throw new NotImplementedException(); - } - - private Dictionary> ParseIniFile(string filePath) - { - Dictionary> iniData = new Dictionary>(); - string currentSection = ""; - - foreach (string line in File.ReadLines(filePath)) - { - string trimmedLine = line.Trim(); - - if (trimmedLine.StartsWith("[") && trimmedLine.EndsWith("]")) - { - currentSection = trimmedLine.Substring(1, trimmedLine.Length - 2); - iniData[currentSection] = new Dictionary(); - } - else if (!string.IsNullOrEmpty(trimmedLine) && trimmedLine.Contains("=")) - { - string[] parts = trimmedLine.Split('='); - string key = parts[0].Trim(); - string value = parts[1].Trim(); - iniData[currentSection][key] = value; - } - } - - return iniData; - } - - private static Dictionary> GetIniFileDiff( - Dictionary> originalIni, - Dictionary> targetIni) - { - Dictionary> diffIni = new Dictionary>(); - - foreach (var sectionKey in originalIni.Keys) - { - if (!targetIni.ContainsKey(sectionKey)) - { - diffIni[sectionKey] = originalIni[sectionKey]; - } - else - { - Dictionary originalSection = originalIni[sectionKey]; - Dictionary targetSection = targetIni[sectionKey]; - Dictionary diffSection = originalSection - .Where(kv => !targetSection.ContainsKey(kv.Key) || targetSection[kv.Key] != kv.Value) - .ToDictionary(kv => kv.Key, kv => kv.Value); - - if (diffSection.Count > 0) - { - diffIni[sectionKey] = diffSection; - } - } - } - - return diffIni; - } - - private void MergeIniFiles( - Dictionary> targetIni, - Dictionary> diffIni) - { - foreach (var sectionKey in diffIni.Keys) - { - if (!targetIni.ContainsKey(sectionKey)) - { - targetIni[sectionKey] = new Dictionary(); - } - - Dictionary targetSection = targetIni[sectionKey]; - Dictionary diffSection = diffIni[sectionKey]; - - foreach (var keyValue in diffSection) - { - targetSection[keyValue.Key] = keyValue.Value; - } - } - } - - private void SaveIniFile(string filePath, Dictionary> iniData) - { - using (StreamWriter writer = new StreamWriter(filePath, false, Encoding.UTF8)) - { - foreach (var sectionKey in iniData.Keys) - { - writer.WriteLine($"[{sectionKey}]"); - - foreach (var keyValue in iniData[sectionKey]) - { - writer.WriteLine($"{keyValue.Key}={keyValue.Value}"); - } - - writer.WriteLine(); // 空行分隔不同的部分 - } - } - } - } -} \ No newline at end of file diff --git a/src/c#/GeneralUpdate.Differential/Config/Handles/JsonHandle.cs b/src/c#/GeneralUpdate.Differential/Config/Handles/JsonHandle.cs deleted file mode 100644 index 2c5a9cb5..00000000 --- a/src/c#/GeneralUpdate.Differential/Config/Handles/JsonHandle.cs +++ /dev/null @@ -1,163 +0,0 @@ -using GeneralUpdate.Core.CustomAwaiter; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.ExceptionServices; -using System.Threading.Tasks; - -namespace GeneralUpdate.Differential.Config.Handles -{ - /// - /// JSON configuration file processing class . - /// - /// json configuration file content. - public class JsonHandle : IHandle, IAwaiter> where TContent : class - { - private bool _isCompleted; - private Exception _exception; - - public bool IsCompleted { get => _isCompleted; private set => _isCompleted = value; } - - public void OnCompleted(Action continuation) - { - if (continuation != null) continuation.Invoke(); - } - - /// - /// Read the content of the configuration file according to the path . - /// - /// file path. - /// file content. - public Task Read(string path) - { - try - { - var jsonText = File.ReadAllText(path); - return Task.FromResult(JsonConvert.DeserializeObject(jsonText)); - } - catch (Exception ex) - { - throw new Exception($"read config error : {ex.Message} !", ex.InnerException); - } - finally - { - IsCompleted = true; - } - } - - /// - /// Write the processed content to the configuration file . - /// - /// file path. - /// file content. - /// is done. - public async Task Write(TContent oldEntity, TContent newEntity) - { - try - { - var oldResult = GetPropertyValue(oldEntity, "Content"); - var newResult = GetPropertyValue(newEntity, "Content"); - var oldPath = GetPropertyValue(oldEntity, "Path"); - string json = string.Empty; - CopyValue(oldResult, newResult, ref json); - File.WriteAllText(oldPath, json); - return await Task.FromResult(true); - } - catch (Exception ex) - { - _exception = ex; - } - finally - { - IsCompleted = true; - } - return await Task.FromResult(false); - } - - /// - /// Iterate over objects and copy values . - /// - /// json object . - /// original configuration file . - /// latest configuration file . - /// result json. - private void CopyValue(T source, T target, ref string json) where T : class - { - try - { - JObject jSource = JObject.Parse(source.ToString()); - JObject jTarget = JObject.Parse(target.ToString()); - foreach (JProperty jProperty in jSource.Properties()) - { - var jFindObj = jTarget.Properties().FirstOrDefault(j => j.Name.Equals(jProperty.Name)); - if (jFindObj != null) - { - jFindObj.Value = jProperty.Value; - } - } - json = JsonConvert.SerializeObject(jTarget); - } - catch (Exception ex) - { - _exception = ex; - } - } - - private TResult GetPropertyValue(TContent entity, string propertyName) - { - TResult result = default(TResult); - Type entityType = typeof(TContent); - try - { - PropertyInfo info = entityType.GetProperty(propertyName); - result = (TResult)info.GetValue(entity); - } - catch (ArgumentNullException ex) - { - throw _exception = new ArgumentNullException("'GetPropertyValue' The method executes abnormally !", ex); - } - catch (AmbiguousMatchException ex) - { - throw _exception = new AmbiguousMatchException("'GetPropertyValue' The method executes abnormally !", ex); - } - return result; - } - - private void Read(string originalJson, string diffJson) - { - JObject originalObject = JObject.Parse(originalJson); - JObject diffObject = JObject.Parse(diffJson); - } - - private string MergeJsonObjects(JObject original, JObject diff) - { - foreach (var property in diff.Properties()) - { - // 如果差分对象中的属性值不为 null,则更新原始对象的属性值 - if (property.Value.Type != JTokenType.Null) - { - original[property.Name] = property.Value; - } - else - { - // 如果差分对象中的属性值为 null,则从原始对象中删除该属性 - original.Remove(property.Name); - } - } - return original.ToString(Formatting.Indented); - } - - public JsonHandle GetAwaiter() => this; - - public JsonHandle GetResult() - { - if (_exception != null) ExceptionDispatchInfo.Capture(_exception).Throw(); - return this; - } - - public async Task AsTask(JsonHandle awaiter) => await awaiter; - } -} \ No newline at end of file diff --git a/src/c#/GeneralUpdate.Differential/Config/Handles/XmlHandle.cs b/src/c#/GeneralUpdate.Differential/Config/Handles/XmlHandle.cs deleted file mode 100644 index e4f9267f..00000000 --- a/src/c#/GeneralUpdate.Differential/Config/Handles/XmlHandle.cs +++ /dev/null @@ -1,31 +0,0 @@ -using GeneralUpdate.Core.CustomAwaiter; -using System; -using System.Threading.Tasks; - -namespace GeneralUpdate.Differential.Config.Handles -{ - public class XmlHandle : IHandle, IAwaiter where TEntity : class - { - public bool IsCompleted => throw new NotImplementedException(); - - public TEntity GetResult() - { - throw new NotImplementedException(); - } - - public void OnCompleted(Action continuation) - { - throw new NotImplementedException(); - } - - public Task Read(string path) - { - throw new NotImplementedException(); - } - - public Task Write(TEntity oldEntity, TEntity newEntity) - { - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/src/c#/GeneralUpdate.Differential/GeneralUpdate.Differential.csproj b/src/c#/GeneralUpdate.Differential/GeneralUpdate.Differential.csproj index cb3eba97..87164b70 100644 --- a/src/c#/GeneralUpdate.Differential/GeneralUpdate.Differential.csproj +++ b/src/c#/GeneralUpdate.Differential/GeneralUpdate.Differential.csproj @@ -13,6 +13,12 @@ Copyright © 2023 + + + + + + diff --git a/src/c#/GeneralUpdate.Maui.OSS/GeneralUpdate.Maui.OSS.csproj b/src/c#/GeneralUpdate.Maui.OSS/GeneralUpdate.Maui.OSS.csproj index fde0276d..ed412e67 100644 --- a/src/c#/GeneralUpdate.Maui.OSS/GeneralUpdate.Maui.OSS.csproj +++ b/src/c#/GeneralUpdate.Maui.OSS/GeneralUpdate.Maui.OSS.csproj @@ -28,18 +28,33 @@ + + + + + + + + + + + + + + + diff --git a/src/c#/GeneralUpdate.Maui.OSS/GeneralUpdateOSS.cs b/src/c#/GeneralUpdate.Maui.OSS/GeneralUpdateOSS.cs index 5523a4f5..30e16c3c 100644 --- a/src/c#/GeneralUpdate.Maui.OSS/GeneralUpdateOSS.cs +++ b/src/c#/GeneralUpdate.Maui.OSS/GeneralUpdateOSS.cs @@ -31,27 +31,21 @@ private GeneralUpdateOSS() /// Updated version configuration file name. /// Method entry parameter is null exception. public static async Task Start(ParamsAndroid parameter) where TStrategy : AbstractStrategy, new() - { - await BaseStart(parameter); - } + => await BaseStart(parameter); /// /// Monitor download progress. /// /// public static void AddListenerDownloadProcess(Action callbackAction) - { - AddListener(callbackAction); - } + => AddListener(callbackAction); /// /// Listen for internal exception information. /// /// public static void AddListenerException(Action callbackAction) - { - AddListener(callbackAction); - } + => AddListener(callbackAction); #endregion Public Methods