private void btnAramBoost_Click(object sender, EventArgs e) { if (LCU.LCU.CheckParams()) { Process[] p = Process.GetProcessesByName("LeagueClientUx"); if (p.Length != 0) { if (MD5Hash.GetMD5HashFromFile(Process.GetProcessesByName("LeagueClientUx").FirstOrDefault().MainModule.FileName) == "44F82D6EF65F513CD6539C195264DC7F") { LCU.LCU.tRequest gameflowReq = LCU.LCU.Request(RestSharp.Method.GET, "/lol-gameflow/v1/gameflow-phase"); if (gameflowReq.IsAvaible()) { if (gameflowReq.Content.Contains("ChampSelect")) { LCU.LCU.tRequest skinBoost = LCU.LCU.Request(RestSharp.Method.POST, "lol-champ-select/v1/team-boost/purchase"); if (skinBoost.IsAvaible()) { MessageBox.Show("ARAM/URF Skin boost has been activated!", "LFPeasy", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("You are not in Champion Selection Phase!", "LFPeasy", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MessageBox.Show("ARAM/URF Skin boost feature needs client hotfix!", "LFPeasy", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
public void TestMD5MissingFile() { string tempFolder = Path.GetTempPath(); Guid temp = Guid.NewGuid(); string file = Path.Combine(tempFolder, temp + ".txt"); string hash = MD5Hash.GetMD5HashFromFile(file); Assert.IsNull(hash); }
public static bool CheckHotfix() { string hash = MD5Hash.GetMD5HashFromFile(lolPath + @"\LeagueClientUx.exe"); if (hash == "44F82D6EF65F513CD6539C195264DC7F") { return(true); } else { return(false); } }
public void TestMD5File() { string tempFolder = Path.GetTempPath(); Guid temp = Guid.NewGuid(); string file = Path.Combine(tempFolder, temp + ".txt"); string text = "This is a test of the emergency broadcast system."; File.WriteAllText(file, text); string hash = MD5Hash.GetMD5HashFromFile(file); Assert.IsNotNull(hash); }
private void GetFiles(string filePath, TreeNode node) { DirectoryInfo folder = new DirectoryInfo(filePath); treeView1.Invoke(new Action(delegate { node.Text = folder.Name; node.Tag = "Folder"; node.Name = folder.FullName.Replace(selectPath, string.Empty); })); FileInfo[] chldFiles = folder.GetFiles(); foreach (FileInfo chlFile in chldFiles) { FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(chlFile.FullName); UpdateFileInfo fileInfo = new UpdateFileInfo { FileName = chlFile.Name, FilePath = chlFile.FullName.Replace(selectPath, string.Empty), FileSize = chlFile.Length, MD5HashStr = MD5Hash.GetMD5HashFromFile(chlFile.FullName), FileVersion = fvi.FileVersion, VerificationType = MD5Hashs.Contains(chlFile.FullName.ToLower()) ? VerificationType.MD5Hash : VerificationType.Version }; string config = string.Empty; if (chlFile.Name.ToLower().EndsWith("exe.config")) { if (MainExe.ToLower() + ".config" == chlFile.Name.ToLower()) { config = $"(配置文件,已忽略,配置项已记录)"; ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap() { ExeConfigFilename = chlFile.FullName }; Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var kv in configuration.AppSettings.Settings.AllKeys) { dictionary.Add(kv, configuration.AppSettings.Settings[kv].Value); } updateInfo.Configurations = dictionary; } else { config = $"(配置文件,已忽略)"; } } else { fileinfos.Add(fileInfo); } TreeNode chldNode = new TreeNode(); string verification = string.Empty; if (fileInfo.VerificationType == VerificationType.MD5Hash) { verification = $":{fileInfo.MD5HashStr}"; } string nodeText = !string.IsNullOrWhiteSpace(config) ? config : $"({fileInfo.FileVersion})({fileInfo.VerificationType}{verification})"; chldNode.Text = $"{chlFile.Name} {nodeText}"; chldNode.Tag = fileInfo; treeView1.Invoke(new Action(delegate { node.Nodes.Add(chldNode); treeView1.ExpandAll(); })); } DirectoryInfo[] chldFolders = folder.GetDirectories(); foreach (DirectoryInfo chldFolder in chldFolders) { TreeNode chldNode = new TreeNode { Text = folder.Name, Tag = "Folder", Name = folder.FullName.Replace(selectPath, string.Empty) }; treeView1.Invoke(new Action(delegate { node.Nodes.Add(chldNode); treeView1.ExpandAll(); })); GetFiles(chldFolder.FullName, chldNode); } }