public static void PreLoading() { string FileName = Application.StartupPath + "\\" + RdetOutboundAdapterConfigMgt.FileName; //RdetOutboundAdapterConfigMgt.RdetOutAdapterConfig = RdetOutboundAdapterConfigMgt.BuildSampleConfig(); //RdetOutboundAdapterConfigMgt.Save(FileName); //LoadConfigXMLFile(); if (!RdetOutboundAdapterConfigMgt.Load(FileName)) { log.Write(LogType.Error, "Cannot Load Configuration file: " + FileName); if (MessageBox.Show("Cannot load configuration file. Do you want to create an empty configuration file?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { RdetOutboundAdapterConfigMgt.Save(FileName); } } }
private void btBuildEmptyConfiguration_Click(object sender, EventArgs e) { string sConfigFile = Application.StartupPath + "\\" + RdetOutboundAdapterConfigMgt.FileName; string sBakFileName = StarFile.BackupFile(sConfigFile); if (sBakFileName == "") { Program.Log.Write(LogType.Error, "Cannot backup configuration file:" + sConfigFile); } else { Program.Log.Write(LogType.Debug, "Configuration file:" + sConfigFile + " has been backup to " + sBakFileName); } RdetOutboundAdapterConfigMgt.RdetOutAdapterConfig = new RdetOutboundAdapterConfig(); RdetOutboundAdapterConfigMgt.Save(sConfigFile); MessageBox.Show("New Configuration have been built!"); }
private void Save() { #region Server Rdet parameter clientRdetParams.LocalIP = this.txtLocalIP.Text; clientRdetParams.LocalPort = Int32.Parse(this.txtLocalPort.Text); clientRdetParams.ServerIP = this.txtServerIP.Text; clientRdetParams.ServerPort = Int32.Parse(this.txtServerPort.Text); RdetOutboundAdapterConfigMgt.RdetOutAdapterConfig.OutGeneralParams.TimerInterval = Int32.Parse(this.txtInterval.Text); clientRdetParams.ConnectTimeout = Int32.Parse(this.txtConnectTimeout.Text); clientRdetParams.ConnectTryCount = Int32.Parse(this.txtTryCount.Text); clientRdetParams.RecTimeout = Int32.Parse(this.txtReceiveTimeout.Text); clientRdetParams.SendTimeout = Int32.Parse(this.txtSendTimeout.Text); #endregion string FileName = Application.StartupPath + "\\" + RdetOutboundAdapterConfigMgt.FileName; if (!RdetOutboundAdapterConfigMgt.Save(FileName)) { if (RdetOutboundAdapterConfigMgt.LastException != null) { Program.log.Write(LogType.Error, "Cannot save information to configuration file: " + FileName); } MessageBox.Show(RdetOutboundAdapterConfigMgt.LastException.Message); } }