internal static bool CheckForUpdate() { try { string version = wb.DownloadString("http://client.greedingames.com/updates/ver.txt"); GIGV versi = new GIGV(); URL = "http://client.greedingames.com/updates/" + version.Replace("/", "-") + "/update.xml"; uver = version; if (versi.Parse(version)) { return(GIGV.Compare(versi, CurrentVersion) == 1); } else { return(false); } } catch { return(false); } }
internal static bool Initialize() { try { // Parse Definitions if (!File.Exists(Application.StartupPath + @"\Data\PDEF.dat")) { PDef.Add("$.curdir.$", Application.StartupPath); if (Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\Rockstar Games\GTA San Andreas")) { PDef.Add("$.gtapath.$", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\Rockstar Games\GTA San Andreas"); } else if (Directory.Exists(@"C:\Program Files (x86)\Rockstar Games\GTA San Andreas")) { PDef.Add("$.gtapath.$", @"C:\Program Files (x86)\Rockstar Games\GTA San Andreas"); } else { MessageBoxEx.Show(@"Vous devez prèciser l'emplacement de GTA SA. \n Exemple : C:\Program Files\Rockstar Games\GTA San Andreas", "Emplacement GTA", MessageBoxButtons.OK, MessageBoxIcon.Information); FolderBrowserDialog fw = new FolderBrowserDialog(); if (fw.ShowDialog() == DialogResult.OK) { while (!Directory.Exists(fw.SelectedPath) || !File.Exists(fw.SelectedPath + @"\samp.exe")) { MessageBoxEx.Show(@"Verifier que vous avez choisi le bon répértoire et que vous avez installè SA-MP Client 0.3x \n Exemple : C:\Program Files\Rockstar Games\GTA San Andreas", "Emplacement GTA", MessageBoxButtons.OK, MessageBoxIcon.Information); fw.ShowDialog(); } PDef.Add("$.gtapath.$", fw.SelectedPath); } else { Process.GetProcessById(LauncherID).Kill(); Process.GetCurrentProcess().Kill(); } } List <string> ls = new List <string>(); foreach (KeyValuePair <string, string> p in PDef) { ls.Add(p.Key + "=" + p.Value); } File.WriteAllLines(Application.StartupPath + @"\Data\PDEF.dat", ls.ToArray()); } else { string[] ln = File.ReadAllLines(Application.StartupPath + @"\Data\PDEF.dat"); foreach (string line in ln) { string[] s = line.Split('='); if (!PDef.ContainsKey(s[0])) { PDef.Add(s[0], s[1]); } } } string v = File.ReadAllText(Application.StartupPath + @"\Data\GV.dat"); CurrentVersion = new GIGV(); return(CurrentVersion.Parse(v)); } catch { return(false); } }