Beispiel #1
0
        private Stream Base64ToStream(Stream responseStream, string decode)
        {
            StreamReader reader         = new StreamReader(responseStream, System.Text.Encoding.UTF8);
            string       responseString = reader.ReadToEnd();

            responseStream = CryptUtils.Decode(responseString, decode);
            return(responseStream);
        }
Beispiel #2
0
 private void ReadConfigSettings()
 {
     SetLocaleCode();
     if (!SetWorkDir(GetConfigValue("WORK_DIR")))
     {
         string md5Name = CryptUtils.ComputeHash(GetConfigValue(ConfigConsts.PRODUCT_TITLE), CryptUtils.Hash.MD5);
         SetWorkDir(Path.Combine(KnownFolders.GetTempFolderSafe(), "Temp\\" + md5Name + "_files\\"));
     }
 }
Beispiel #3
0
 internal static string Process(string action, string value)
 {
     return((action.ToLower()) switch
     {
         CryptUtils.Hash.SHA1 => CryptUtils.ComputeHash(value, CryptUtils.Hash.SHA1),
         CryptUtils.Hash.MD5 => CryptUtils.ComputeHash(value, CryptUtils.Hash.MD5),
         Prefix.Encode + CryptUtils.EncDec.BASE62 => new StreamReader(CryptUtils.Encode(value, CryptUtils.EncDec.BASE62)).ReadToEnd(),
         Prefix.Decode + CryptUtils.EncDec.BASE62 => new StreamReader(CryptUtils.Decode(value, CryptUtils.EncDec.BASE62)).ReadToEnd(),
         Prefix.Encode + CryptUtils.EncDec.BASE64 => new StreamReader(CryptUtils.Encode(value, CryptUtils.EncDec.BASE64)).ReadToEnd(),
         Prefix.Decode + CryptUtils.EncDec.BASE64 => new StreamReader(CryptUtils.Decode(value, CryptUtils.EncDec.BASE64)).ReadToEnd(),
         _ => string.Empty,
     });