/// <summary> /// 异步 反序列化JSON文件成对象 /// </summary> /// <typeparam name="T">要反序列化成对象的 对象类型</typeparam> /// <param name="jsonFileFullPath">要反序列化处理的JSON文件</param> /// <param name="encoding">编码 Null 使用默认编码</param> /// <returns></returns> public virtual async Task <T> DeserializeFromJsonFileAsync <T>(string jsonFileFullPath, Encoding encoding = null) where T : class { return(await GenericityHelper.DoTaskWorkAsync(DeserializeFromJsonFile <T>, jsonFileFullPath, encoding)); }
/// <summary> /// 异步对象序列化成Json /// </summary> /// <typeparam name="T">要序列化的对象类型</typeparam> /// <param name="t">要序列化的对象</param> /// <returns></returns> public virtual async Task <string> SerializeToJsonAsync <T>(T t) where T : class { return(await GenericityHelper.DoTaskWorkAsync(SerializeToJson, t)); }
/// <summary> /// 异步反序列化Json成对象 /// </summary> /// <typeparam name="T">反序列化成对象的对象类型</typeparam> /// <param name="json">要反序列化的Json字符串</param> /// <returns></returns> public virtual async Task <T> DeserializeFromJsonAsync <T>(string json) where T : class { return(await GenericityHelper.DoTaskWorkAsync(DeserializeFromJson <T>, json)); }
/// <summary> /// 异步 序列化对象成JSON文件 /// </summary> /// <typeparam name="T">要序列化的对象类型</typeparam> /// <param name="jsonFileFullPath">要保存序列化成的JSON文件全路径</param> /// <param name="t">要序列化的对象实例</param> /// <param name="encoding">编码 Null 使用默认编码</param> public virtual async Task SerializeToJsonFileAsync <T>(T t, string jsonFileFullPath, Encoding encoding = null) where T : class { await GenericityHelper.DoTaskWorkAsync(SerializeToJsonFile <T>, t, jsonFileFullPath, encoding); }
/// <summary> /// 异步解压缩文件 /// </summary> /// <param name="sourceFileFullPath">解压缩后 源文件 全路径</param> /// <param name="compressFileFullPath">要解压缩的文件</param> public virtual async Task DecompressSourceFileFromCompressFileAsync(string sourceFileFullPath, string compressFileFullPath) { await GenericityHelper.DoTaskWorkAsync(DecompressSourceFileFromCompressFile, sourceFileFullPath, compressFileFullPath); }
/// <summary> /// 异步 压缩字节数组 返回压缩后的 字节数组 /// </summary> /// <param name="compressBytes">要压缩的字节数组</param> /// <returns></returns> public virtual async Task <byte[]> CompressBytesToBytesAsync(byte[] compressBytes) { return(await GenericityHelper.DoTaskWorkAsync(CompressBytesToBytes, compressBytes)); }
/// <summary> /// 异步 压缩字符串 返回 压缩后的Base64 字符串 /// </summary> /// <param name="compressString">要压缩的字符串</param> /// <param name="encoding">编码 Null 使用默认编码</param> /// <returns></returns> public virtual async Task <string> CompressStringToBase64StringAsync(string compressString, Encoding encoding = null) { return(await GenericityHelper.DoTaskWorkAsync(CompressStringToBase64String, compressString, encoding)); }
/// <summary> /// 异步 解压缩 Base64 字符串 返回 解压缩后的字符串 /// </summary> /// <param name="decompressString">要解压缩的Base64字符串</param> /// <param name="encoding">编码 Null 使用默认编码</param> /// <returns></returns> public virtual async Task <string> DecompressStringFromBase64StringAsync(string decompressString, Encoding encoding = null) { return(await GenericityHelper.DoTaskWorkAsync(DecompressStringFromBase64String, decompressString, encoding)); }
/// <summary> /// 异步 解压缩字节数组 返回 解压缩后的字符串 /// </summary> /// <param name="decompressBytes">要解压缩的字节数组</param> /// <param name="encoding">编码 Null 使用默认编码</param> /// <returns></returns> public virtual async Task <string> DecompressStringFromBytesAsync(byte[] decompressBytes, Encoding encoding = null) { return(await GenericityHelper.DoTaskWorkAsync(DecompressStringFromBytes, decompressBytes, encoding)); }
/// <summary> /// 异步 压缩字符串 返回 压缩后的 字节数组 /// </summary> /// <param name="compressString">要压缩的字符串</param> /// <param name="encoding">编码 Null 使用默认编码</param> /// <returns></returns> public virtual async Task <byte[]> CompressStringToBytesAsync(string compressString, Encoding encoding = null) { return(await GenericityHelper.DoTaskWorkAsync(CompressStringToBytes, compressString, encoding)); }
/// <summary> /// 异步 解压缩 Base64 字符串 返回解压缩后的 字节数组 /// </summary> /// <param name="decompressString"></param> /// <returns></returns> public virtual async Task <byte[]> DecompressBytesFromBase64StringAsync(string decompressString) { return(await GenericityHelper.DoTaskWorkAsync(DecompressBytesFromBase64String, decompressString)); }
/// <summary> /// 异步 压缩字节数组 返回 压缩后字节数组生成的 Base64 字符串 /// </summary> /// <param name="compressBytes">要压缩的字节数组</param> /// <returns></returns> public virtual async Task <string> CompressBytesToBase64StringAsync(byte[] compressBytes) { return(await GenericityHelper.DoTaskWorkAsync(CompressBytesToBase64String, compressBytes)); }
/// <summary> /// 异步 解压缩字节数组 返回解压缩后的 字节数组 /// </summary> /// <param name="decompressBytes">要解压缩的字节数组</param> /// <returns></returns> public virtual async Task <byte[]> DecompressBytesFromBytesAsync(byte[] decompressBytes) { return(await GenericityHelper.DoTaskWorkAsync(DecompressBytesFromBytes, decompressBytes)); }