public LicenseResult VerifyLicense() { Random rnd = new Random(); Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); LicenseResult licenseResult = new LicenseResult(); if (_user.Length < 3 || _pass.Length < 3) { licenseResult.Valid = false; licenseResult.Error = "ERR101"; } int randInt = rnd.Next(124, 18724); string randIntHash = GetMd5Hash("S!k@l" + (randInt + 1563).ToString(CultureInfo.InvariantCulture)); string htmlResult = new System.Net.WebClient().DownloadString("http://www.chocobotxiv.com/forum/licensing/action.php?user="******"&pass="******"&action=1&session=" + randInt + "&version=" + fvi.FileMajorPart + "." + fvi.FileMinorPart); bool result = htmlResult == randIntHash; if (result) { //IniParser ini = new IniParser(@"chocobot.ini"); IniParserLegacy.IniFile ini = new IniParserLegacy.IniFile(System.Windows.Forms.Application.StartupPath + "\\chocobot.ini"); ini.IniWriteValue("Credentials", "UserName", _user); ini.IniWriteValue("Credentials", "Password", _pass); //ini.SaveSettings(); } else { licenseResult.Error = htmlResult.Trim(); } licenseResult.Valid = result; return(licenseResult); }
private void btn_SaveRecipe_Click(object sender, RoutedEventArgs e) { SaveFileDialog dlg = new SaveFileDialog(); dlg.Filter = "Crafting Recipe (*.crft)|*.crft"; if (dlg.ShowDialog() == false) { return; } IniParserLegacy.IniFile ini = new IniParserLegacy.IniFile(dlg.FileName); ini.IniWriteValue("Main", "KeyCount", _keyConditions.Count.ToString()); int currkey = 1; foreach (CraftingKey keyCondition in _keyConditions) { ini.IniWriteValue("Key" + currkey, "key", keyCondition.KeyString); ini.IniWriteValue("Key" + currkey, "cp", keyCondition.CP.ToString()); ini.IniWriteValue("Key" + currkey, "cpcondition", keyCondition.CPCondition.ToString()); ini.IniWriteValue("Key" + currkey, "durability", keyCondition.Durability.ToString()); ini.IniWriteValue("Key" + currkey, "durabilitycondition", keyCondition.DurabilityCondition.ToString()); ini.IniWriteValue("Key" + currkey, "progress", keyCondition.Progress.ToString()); ini.IniWriteValue("Key" + currkey, "progresscondition", keyCondition.ProgressCondition.ToString()); ini.IniWriteValue("Key" + currkey, "condition", keyCondition.Condition.ToString()); ini.IniWriteValue("Key" + currkey, "conditioncondition", keyCondition.ConditionCondition.ToString()); ini.IniWriteValue("Key" + currkey, "controlkey", keyCondition.ControlKey.ToString()); currkey++; } }