public bool IsGameRunning() { foreach (string executableName in this.executableNames) { if (ProcessTools.IsProcessRunning(executableName)) { return(true); } } return(false); }
private static void AddSteam() { WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); bool hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator); if (!hasAdministrativeRight) { // relaunch the application with admin rights string fileName = Assembly.GetExecutingAssembly().Location; ProcessStartInfo processInfo = new ProcessStartInfo(); processInfo.Arguments = "addsteam"; processInfo.Verb = "runas"; processInfo.FileName = fileName; try { Process.Start(processInfo); } catch (Win32Exception) { // This will be thrown if the user cancels the prompt } return; } string quote = "\""; string space = " "; // Process.Start("taskkill", "/im steam.exe /f").WaitForExit(); if (ProcessTools.IsProcessRunning("steam")) { MessageBox.Show("Please close Steam before continuing"); } if (ProcessTools.IsProcessRunning("steam")) { bool result = MessageBoxUtils.ShowChoiceDialog("Force close Steam? (Not recommended, close Steam manually if possible)", "Close Steam before adding shortcuts to Steam", "Force Close Steam", "I will close Steam manually"); switch (result) { case true: ProcessTools.KillProcess("steam", true, false); break; case false: ProcessTools.KillProcess("steam", true, true); //CloseMainWindow shouldn't close steam, use as a lazy shortcut to process.Wait() break; } } Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Medal of Honor Warfighter" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.MOHW.exe") + quote).WaitForExit(); Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Battlefield 3" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.BF3.exe") + quote).WaitForExit(); Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Battlefield 4" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.BF4.exe") + quote).WaitForExit(); Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Battlefield Hardline Beta" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.BFH.exe") + quote).WaitForExit(); }
/// <param name="iNewIpFrequency">Temps en minutes</param> public WebQueryHideIP(ProgressCancelNotifier iProgressCancelNotifier, bool iWithSafeNetwork, bool iWithIpCheck = true, int iNewIpFrequency = 30) : base(iProgressCancelNotifier) { if (ProcessTools.IsProcessRunning("privoxy") == false) { throw new Exception("Pour effectuer des requetes via proxy, le logiciel 'Privoxy' doit être lancé."); } if (ProcessTools.IsProcessRunning("vidalia") == false) { throw new Exception("Pour effectuer des requetes via proxy, le logiciel 'Vidalia' doit être lancé."); } WebQueryType = WebQueryTypeEnum.WebQueryWithProxy; newIpFrequency = iNewIpFrequency; proxyAdress = PROXYADRESS; proxyPort = PROXYPORT; socksAdress = SOCKSADRESS; socksPort = SOCKSPORT; socksPassword = SOCKSPASSWORD; WithSafeNetwork = iWithSafeNetwork; //Chargement de la liste de user agent userAgentList.Add("Mozilla/5.0 (compatible; MSIE 9.0; AOL 9.7; AOLBuild 4343.19; Windows NT 6.1; WOW64; Trident/5.0; FunWebProducts)"); userAgentList.Add("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0"); userAgentList.Add("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36"); userAgentList.Add("Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25"); userAgentList.Add("Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14"); userAgentList.Add("Mozilla/5.0 (X11; U; Linux i686; fr-fr) AppleWebKit/525.1+ (KHTML, like Gecko, Safari/525.1+) midori/1.19"); //vérification de l'adresse proxy différente de l'adresse réel: if (iWithIpCheck) { string realIp = new WebQueryNoHideIP(Notifier, iWithSafeNetwork).GetMyIp(); string proxyIp = GetMyIp(); if (proxyIp != null && realIp != null && proxyIp != realIp) { using (var sublevel1 = new ProgressCancelNotifier.SubLevel(Notifier)) { Notifier.Report("Ip proxy : {0}, Ip box : {1} ".FormatString(proxyIp, realIp)); } } else { throw new Exception("Error lors de la vérification du proxy. Vérifier si le socks(vidalia) et le proxy(privoxy) sont bien démarrés."); } } }
public WebQuery(ProgressCancelNotifier iNotifier, bool iKeepCookies, bool iSafeNetwork, bool iHideIp = false, bool iIpCheck = true, int iNewIpFrequencyMinutes = 0) : base(iNotifier) { CookieContainer = new CookieContainer(); System.Net.ServicePointManager.DefaultConnectionLimit = DEFAULTCONNECTIONLIMIT; ServicePointManager.CheckCertificateRevocationList = false; //ServicePointManager.MaxServicePointIdleTime = _MaxIdleTime; //ServicePointManager.Expect100Continue = false; _safeNetwork = iSafeNetwork; _hideIp = iHideIp; _newIpFrequencyMinutes = iNewIpFrequencyMinutes; _keepCookies = iKeepCookies; lock (_lastIpChangedDateTimeLocker) { if (_lastIpChangedDateTime == DateTime.MinValue) { _lastIpChangedDateTime = DateTime.Now; } } //Chargement de la liste de user agent _userAgentList = new List <string>(); //_userAgentList.Add("Mozilla/5.0 (compatible; MSIE 9.0; AOL 9.7; AOLBuild 4343.19; Windows NT 6.1; WOW64; Trident/5.0; FunWebProducts)"); //_userAgentList.Add("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0"); _userAgentList.Add("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36"); //_userAgentList.Add("Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25"); //_userAgentList.Add("Mozilla/5.0 (X11; U; Linux i686; fr-fr) AppleWebKit/525.1+ (KHTML, like Gecko, Safari/525.1+) midori/1.19"); if (iHideIp) { if (ProcessTools.IsProcessRunning("privoxy") == false) { throw new Exception("Pour effectuer des requetes via proxy, le processus 'Privoxy' doit être lancé."); } if (ProcessTools.IsProcessRunning("tor") == false) { throw new Exception("Pour effectuer des requetes via proxy, le processus 'TOR' doit être lancé."); } } }