public void LoadConfig(string path) { try { //m_ConfigPath = path; m_Config = new KRTDConfig(); TextReader reader = new StreamReader(path); XmlSerializer serializer = new XmlSerializer(typeof(KRTDConfig)); m_Config = (KRTDConfig)serializer.Deserialize(reader); reader.Close(); try { if (m_Config.IPEndpoint.Server.Length == 0) { m_Config.IPEndpoint.Server = System.Environment.MachineName; } } catch { m_Config.IPEndpoint.Server = System.Environment.MachineName; } m_RTDForm.Config = m_Config; // BasicConfigurator replaced with XmlConfigurator. //string fileName = @"C:\kairoot\K2\RTDLogger.xml"; string fileName = m_Config.LogConfigPath; //XmlConfigurator.Configure(new System.IO.FileInfo(fileName)); } catch (Exception myE) { m_Config.IPEndpoint = new IPEndpoint(); m_Config.IPEndpoint.Server = System.Environment.MachineName; m_Config.IPEndpoint.Port = 11001; m_RTDForm.Config = m_Config; } }
private void btnCreateCfg_Click(object sender, EventArgs e) { try { m_Config = new KRTDConfig(); dialog2Config(); string savePath = m_Client.ConfigPath + "newRtdconf.xml"; SaveConfig(savePath); } catch (Exception myE) { } }