public void AddLicenseToConfig(string LoginID, string licenseFile) { Console.WriteLine(string.Format("{0}[{1}]...", Utils.Utils.Translate("许可写入配置文件"), licenseFile)); int nIndex = 1; XML.Clear(ConfigFile); foreach (LicenseInfo licenseInfo in LicenseInfos) { if (string.IsNullOrEmpty(licenseInfo.uuid)) { continue; } if (string.IsNullOrEmpty(licenseInfo.ErrorInfo) == false) { continue; } XML.Insert(ConfigFile, "xml", "LicenseFile" + nIndex, "", "file", licenseInfo.LicenseFilePath); XML.Insert(ConfigFile, "xml", "LicenseFile" + nIndex, "", "isUsed", "true"); nIndex++; } XML.Insert(ConfigFile, "xml", "LicenseFile" + nIndex, "", "file", licenseFile); XML.Insert(ConfigFile, "xml", "LicenseFile" + nIndex, "", "isUsed", "true"); }
// 连接服务器 private void btnConnect_Click(object sender, EventArgs e) { VGridRows rows = this.vGridControl.Rows; if (rows != null) { BaseRow row = rows["itemServer"]; if (row != null && row.Properties.Value != null) { Server = row.Properties.Value.ToString(); } row = rows["itemUserName"]; if (row != null && row.Properties.Value != null) { UserName = row.Properties.Value.ToString(); } row = rows["itemPassword"]; if (row != null && row.Properties.Value != null) { Password = row.Properties.Value.ToString(); } row = rows["itemSavePassword"]; if (row != null && row.Properties.Value != null) { SavePassword = row.Properties.Value.ToString(); } XML.Clear(xmlFile); XML.Update(xmlFile, "Server", "server", Server); int nIndex = 1; for (int i = 1; i < comboBoxServer.Items.Count + 1; i++) { if (comboBoxServer.Items[i - 1].ToString() != Server) { XML.Update(xmlFile, "Server", "server" + nIndex, comboBoxServer.Items[i - 1].ToString()); nIndex++; } } XML.Update(xmlFile, "UserName", "", UserName); XML.Update(xmlFile, "Password", "", Password); XML.Update(xmlFile, "SavePassword", "", SavePassword); } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
void SaveCenterConfig() { int nIndex = 1; XML.Clear(ConfigFile); foreach (LicenseInfo licenseInfo in LicenseInfos) { if (string.IsNullOrEmpty(licenseInfo.uuid)) { continue; } if (string.IsNullOrEmpty(licenseInfo.ErrorInfo) == false) { continue; } XML.Insert(ConfigFile, "xml", "LicenseFile" + nIndex, "", "file", licenseInfo.LicenseFilePath); XML.Insert(ConfigFile, "xml", "LicenseFile" + nIndex, "", "isUsed", "true"); nIndex++; } }