Пример #1
0
 public static EncryptDigestInfoModel GetEncryptDigestInfoModelFromEncryptedFile(string encryptedFileFullPath, Encoding encoding = null, ICryptoFile cryptoFile = null)
 {
     return(GenericityHelper.GetInterface(cryptoFile, DefaultLanymyCrypto).GetEncryptDigestInfoModelFromEncryptedFile(encryptedFileFullPath, encoding));
 }
Пример #2
0
 /// <summary>
 /// 数组合并
 /// </summary>
 /// <typeparam name="T">数组元数据类型</typeparam>
 /// <param name="firstArray">第一个数组</param>
 /// <param name="secondArray">第二个数组</param>
 /// <param name="arrayExtension">null 则使用默认数组扩展方法</param>
 /// <param name="arrayParams">其它多个数组</param>
 /// <returns></returns>
 public static T[] MergerArray <T>(T[] firstArray, T[] secondArray, IArrayManipulater arrayExtension = null, params T[][] arrayParams)
 {
     return(GenericityHelper.GetInterface(arrayExtension, DefaultArrayExtension).MergerArray(firstArray, secondArray, arrayParams));
 }
Пример #3
0
 /// <summary>
 /// 数组是否完全相等 (包括数组内的值和顺序是否完全相等)
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="firstArray"></param>
 /// <param name="secondArray"></param>
 /// <param name="arrayExtension">null 则使用默认数组扩展方法</param>
 /// <returns></returns>
 public static bool ArrayEquals <T>(T[] firstArray, T[] secondArray, IArrayManipulater arrayExtension = null)
 {
     return(GenericityHelper.GetInterface(arrayExtension, DefaultArrayExtension).ArrayEquals(firstArray, secondArray));
 }
Пример #4
0
 /// <summary>
 /// 异步反序列化Json成对象
 /// </summary>
 /// <param name="json">字符串序列</param>
 /// <param name="jsonSerializer">反序列化Json使用的序列化器</param>
 public static async Task <T> DeserializeFromJsonAsync <T>(string json, IJsonSerializer jsonSerializer = null) where T : class
 {
     return(await GenericityHelper.GetInterface(jsonSerializer, DefaultJsonSerializer).DeserializeFromJsonAsync <T>(json));
 }
Пример #5
0
 /// <summary>
 /// 异步 序列化对象成JSON文件
 /// </summary>
 /// <typeparam name="T">要序列化的对象类型</typeparam>
 /// <param name="jsonFileFullPath">要保存序列化成的JSON文件全路径</param>
 /// <param name="t">要序列化的对象实例</param>
 /// <param name="encoding">编码 Null 使用默认编码</param>
 /// <param name="jsonSerializer">反序列化Json使用的序列化器</param>
 public static async Task SerializeToJsonFileAsync <T>(T t, string jsonFileFullPath, Encoding encoding = null, IJsonSerializer jsonSerializer = null) where T : class
 {
     await GenericityHelper.GetInterface(jsonSerializer, DefaultJsonSerializer).SerializeToJsonFileAsync(t, jsonFileFullPath, encoding);
 }
Пример #6
0
 public static EncryptStringFileDigestInfoModel DecryptStringFromFile(string encryptedFileFullPath, string secretKey = null, Encoding encoding = null, ICryptoString cryptoString = null)
 {
     return(GenericityHelper.GetInterface(cryptoString, DefaultLanymyCrypto).DecryptStringFromFile(encryptedFileFullPath, secretKey, encoding));
 }
Пример #7
0
 /// <summary>
 /// 反序列化Json成对象
 /// </summary>
 /// <param name="json">字符串序列</param>
 /// <param name="jsonSerializer">反序列化Json使用的序列化器</param>
 public static T DeserializeFromJson <T>(string json, IJsonSerializer jsonSerializer = null) where T : class
 {
     return(json.IfIsNullOrEmpty() ? default(T) : GenericityHelper.GetInterface(jsonSerializer, DefaultJsonSerializer).DeserializeFromJson <T>(json));
 }
Пример #8
0
 public static EncryptModelDigestInfoModel <T> DecryptModelFromBytes <T>(byte[] ecryptedBytes, string secretKey = null, Encoding encoding = null, ICryptoModel cryptoModel = null) where T : class
 {
     return(GenericityHelper.GetInterface(cryptoModel, DefaultLanymyCrypto).DecryptModelFromBytes <T>(ecryptedBytes, secretKey, encoding));
 }
Пример #9
0
 public static EncryptModelFileDigestInfoModel <T> EncryptModelToFile <T>(T t, string encryptFileFullPath, string secretKey = null, bool ifRandom = true, Encoding encoding = null, ICryptoModel cryptoModel = null) where T : class
 {
     return(GenericityHelper.GetInterface(cryptoModel, DefaultLanymyCrypto).EncryptModelToFile(t, encryptFileFullPath, secretKey, ifRandom, encoding));
 }
Пример #10
0
 public static EncryptStringImageFileDigestInfoModel DecryptStringFromImageFile(string imageFileFullPath, string secretKey = null, Encoding encoding = null, ICryptoBitmap cryptoBitmap = null)
 {
     return(GenericityHelper.GetInterface(cryptoBitmap, DefaultLanymyCrypto).DecryptStringFromImageFile(imageFileFullPath, secretKey, encoding));
 }
Пример #11
0
 public static EncryptModelImageFileDigestInfoModel <T> EncryptModelToImageFile <T>(T t, string imageFileFullPath, string secretKey = null, Encoding encoding = null, ICryptoBitmap cryptoBitmap = null) where T : class
 {
     return(GenericityHelper.GetInterface(cryptoBitmap, DefaultLanymyCrypto).EncryptModelToImageFile(t, imageFileFullPath, secretKey, encoding));
 }
Пример #12
0
 public static EncryptModelBitmapDigestInfoModel <T> DecryptModelFromBitmap <T>(Bitmap encryptedBitmap, string secretKey = null, Encoding encoding = null, ICryptoBitmap cryptoBitmap = null) where T : class
 {
     return(GenericityHelper.GetInterface(cryptoBitmap, DefaultLanymyCrypto).DecryptModelFromBitmap <T>(encryptedBitmap, secretKey, encoding));
 }
Пример #13
0
        public static EncryptStringBitmapDigestInfoModel DecryptStringFromBitmap(Bitmap encryptedBitmap, string secretKey = null, Encoding encoding = null, ICryptoBitmap cryptoBitmap = null)

        {
            return(GenericityHelper.GetInterface(cryptoBitmap, DefaultLanymyCrypto).DecryptStringFromBitmap(encryptedBitmap, secretKey, encoding));
        }
Пример #14
0
 public static EncryptStringBitmapDigestInfoModel EncryptStringToBitmap(string strToEncrypt, string secretKey = null, Encoding encoding = null, ICryptoBitmap cryptoBitmap = null)
 {
     return(GenericityHelper.GetInterface(cryptoBitmap, DefaultLanymyCrypto).EncryptStringToBitmap(strToEncrypt, secretKey, encoding));
 }
Пример #15
0
 public static EncryptBase64StringDigestInfoModel DecryptStringFromBase64String(string base64StringToDecrypt, string secretKey = null, Encoding encoding = null, ICryptoString cryptoString = null)
 {
     return(GenericityHelper.GetInterface(cryptoString, DefaultLanymyCrypto).DecryptStringFromBase64String(base64StringToDecrypt, secretKey, encoding));
 }
Пример #16
0
 public static EncryptModelFileDigestInfoModel <T> DecryptModelFromFile <T>(string encryptedFileFullPath, string secretKey = null, Encoding encoding = null, ICryptoModel cryptoModel = null) where T : class
 {
     return(GenericityHelper.GetInterface(cryptoModel, DefaultLanymyCrypto).DecryptModelFromFile <T>(encryptedFileFullPath, secretKey, encoding));
 }
Пример #17
0
 public static EncryptStringFileDigestInfoModel EncryptStringToFile(string sourceString, string encryptFileFullPath, string secretKey = null, bool ifRandom = true, Encoding encoding = null, ICryptoString cryptoString = null)
 {
     return(GenericityHelper.GetInterface(cryptoString, DefaultLanymyCrypto).EncryptStringToFile(sourceString, encryptFileFullPath, secretKey, ifRandom, encoding));
 }
Пример #18
0
 public static EncryptDigestInfoModel EncryptStreamToStream(Stream sourceStream, Stream encryptStream, string secretKey = null, bool ifRandom = true, Encoding encoding = null, ICryptoStream cryptoStream = null)
 {
     return(GenericityHelper.GetInterface(cryptoStream, DefaultLanymyCrypto).EncryptStreamToStream(sourceStream, encryptStream, secretKey, ifRandom, encoding));
 }
Пример #19
0
 /// <summary>
 /// 序列化对象成Json
 /// </summary>
 /// <param name="t">对象</param>
 /// <param name="jsonSerializer">序列化Json使用的序列化器</param>
 public static string SerializeToJson <T>(T t, IJsonSerializer jsonSerializer = null) where T : class
 {
     return(t.IfIsNullOrEmpty() ? string.Empty : GenericityHelper.GetInterface(jsonSerializer, DefaultJsonSerializer).SerializeToJson(t));
 }
Пример #20
0
 public static EncryptDigestInfoModel GetEncryptDigestInfoModelFromEncryptedStream(Stream encryptedStream, Encoding encoding = null, ICryptoStream cryptoStream = null)
 {
     return(GenericityHelper.GetInterface(cryptoStream, DefaultLanymyCrypto).GetEncryptDigestInfoModelFromEncryptedStream(encryptedStream, encoding));
 }
Пример #21
0
 /// <summary>
 /// 异步序列化对象成Json
 /// </summary>
 /// <param name="t">对象</param>
 /// <param name="jsonSerializer">序列化Json使用的序列化器</param>
 public static async Task <string> SerializeToJsonAsync <T>(T t, IJsonSerializer jsonSerializer = null) where T : class
 {
     return(await GenericityHelper.GetInterface(jsonSerializer, DefaultJsonSerializer).SerializeToJsonAsync(t));
 }
Пример #22
0
 public static EncryptDigestInfoModel DencryptStreamFromStream(Stream encryptedStream, Stream sourceStream, string secretKey = null, Encoding encoding = null, ICryptoStream cryptoStream = null)
 {
     return(GenericityHelper.GetInterface(cryptoStream, DefaultLanymyCrypto).DencryptStreamFromStream(encryptedStream, sourceStream, secretKey, encoding));
 }
Пример #23
0
 /// <summary>
 /// 序列化对象成JSON文件
 /// </summary>
 /// <typeparam name="T">要序列化的对象类型</typeparam>
 /// <param name="jsonFileFullPath">要保存序列化成的JSON文件全路径</param>
 /// <param name="t">要序列化的对象实例</param>
 /// <param name="encoding">编码 Null 使用默认编码</param>
 /// <param name="jsonSerializer">反序列化Json使用的序列化器</param>
 public static void SerializeToJsonFile <T>(T t, string jsonFileFullPath, Encoding encoding = null, IJsonSerializer jsonSerializer = null) where T : class
 {
     GenericityHelper.GetInterface(jsonSerializer, DefaultJsonSerializer).SerializeToJsonFile(t, jsonFileFullPath, encoding);
 }
Пример #24
0
 public static EncryptBytesDigestInfoModel EncryptBytesToBytes(byte[] bytesToEncrypt, string secretKey = null, bool ifRandom = true, Encoding encoding = null, ICryptoBytes cryptoBytes = null)
 {
     return(GenericityHelper.GetInterface(cryptoBytes, DefaultLanymyCrypto).EncryptBytesToBytes(bytesToEncrypt, secretKey, ifRandom, encoding));
 }
Пример #25
0
 /// <summary>
 /// 反序列化JSON文件成对象
 /// </summary>
 /// <typeparam name="T">要反序列化成对象的 对象类型</typeparam>
 /// <param name="jsonFileFullPath">要反序列化处理的JSON文件</param>
 /// <param name="encoding">编码 Null 使用默认编码</param>
 /// <param name="jsonSerializer">反序列化Json使用的序列化器</param>
 /// <returns></returns>
 public static T DeserializeFromJsonFile <T>(string jsonFileFullPath, Encoding encoding = null, IJsonSerializer jsonSerializer = null) where T : class
 {
     return(GenericityHelper.GetInterface(jsonSerializer, DefaultJsonSerializer).DeserializeFromJsonFile <T>(jsonFileFullPath, encoding));
 }
Пример #26
0
 public static EncryptBytesDigestInfoModel DecryptBytesFromBytes(byte[] bytesToDecrypt, string secretKey = null, Encoding encoding = null, ICryptoBytes cryptoBytes = null)
 {
     return(GenericityHelper.GetInterface(cryptoBytes, DefaultLanymyCrypto).DecryptBytesFromBytes(bytesToDecrypt, secretKey, encoding));
 }
Пример #27
0
 /// <summary>
 /// 截取数据片段 默认 length=0;  length=0 startIndex 位置开始向左截取到最后 ; length&lt;0 startIndex 位置开始向左截取 length; length&gt;0 startIndex 位置开始向右截取 length;
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="sourceArray">源数组</param>
 /// <param name="startIndex">截取起始索引值</param>
 /// <param name="length">默认 length=0;  length=0 startIndex 位置开始向左截取到最后 ; length&lt;0 startIndex 位置开始向左截取 length; length&gt;0 startIndex 位置开始向右截取 length;</param>
 /// <param name="arrayExtension">null 则使用默认数组扩展方法</param>
 /// <returns></returns>
 public static T[] SubArray <T>(T[] sourceArray, int startIndex, int length = 0, IArrayManipulater arrayExtension = null)
 {
     return(GenericityHelper.GetInterface(arrayExtension, DefaultArrayExtension).SubArray(sourceArray, startIndex, length));
 }
Пример #28
0
 public static EncryptBase64StringDigestInfoModel EncryptStringToBase64String(string strToEncrypt, string secretKey = null, bool ifRandom = true, Encoding encoding = null, ICryptoString cryptoString = null)
 {
     return(GenericityHelper.GetInterface(cryptoString, DefaultLanymyCrypto).EncryptStringToBase64String(strToEncrypt, secretKey, ifRandom, encoding));
 }
Пример #29
0
 /// <summary>
 /// 判断是否是子集  顺序也完全一致的 子集序列
 /// </summary>
 /// <param name="source">源数组</param>
 /// <param name="subset">子数组</param>
 /// <param name="arrayExtension">null 则使用默认数组扩展方法</param>
 /// <returns></returns>
 public static bool IsSubset(byte[] source, byte[] subset, IArrayManipulater arrayExtension = null)
 {
     return(GenericityHelper.GetInterface(arrayExtension, DefaultArrayExtension).IsSubset(source, subset));
 }
Пример #30
0
 /// <summary>
 /// 异步 压缩字节数组 返回 压缩后字节数组生成的 Base64 字符串
 /// </summary>
 /// <param name="compressBytes">要压缩的字节数组</param>
 /// <param name="compresserBytesAndBase64String">压缩器 字节数组 和 Base64字符串 压缩 功能 接口</param>
 /// <returns></returns>
 public static async Task <string> CompressBytesToBase64StringAsync(byte[] compressBytes, ICompresserBytesAndBase64String compresserBytesAndBase64String = null)
 {
     return(await GenericityHelper.GetInterface(compresserBytesAndBase64String, DefaultCompresser).CompressBytesToBase64StringAsync(compressBytes));
 }