/// <summary> /// 初始化数据 /// </summary> private void Init() { StreamReader reader; string filePath = Path.Combine(Application.StartupPath, "AutoFillConfig.ini"); string content = null; if (File.Exists(filePath)) { try { reader = new StreamReader(filePath, Encoding.GetEncoding("gb2312")); content = reader.ReadToEnd(); reader.Close(); } catch (IOException ex) { MessageBox.Show(string.Format("在读取配置文件时产生异常:{0}", ex.ToString()), "读取配置文件", MessageBoxButtons.OK, MessageBoxIcon.Information); } } if (content != null) { IniHandler.IniStructure m_inis = new IniHandler.IniStructure(); m_inis = IniHandler.IniStructure.ReadIniWithContent(content); clientFolder = m_inis.GetValue("General", "ClientFolder"); dataFilePath = m_inis.GetValue("General", "DataFilePath"); textBoxX1.Text = clientFolder; textBoxX2.Text = dataFilePath; } }
/// <summary> /// 初始化数据 /// </summary> private void Init() { StreamReader reader; string filePath = Path.Combine(Application.StartupPath, "AutoFillConfig.ini"); string content = null; if (File.Exists(filePath)) { try { reader = new StreamReader(filePath, Encoding.GetEncoding("gb2312")); content = reader.ReadToEnd(); reader.Close(); } catch (IOException ex) { MessageBox.Show(string.Format("在读取配置文件时产生异常:{0}", ex.ToString()), "读取配置文件", MessageBoxButtons.OK, MessageBoxIcon.Information); } } if (content != null) { IniHandler.IniStructure m_inis = new IniHandler.IniStructure(); m_inis = IniHandler.IniStructure.ReadIniWithContent(content); clientFolder = m_inis.GetValue("General", "ClientFolder"); dataFilePath = m_inis.GetValue("General", "DataFilePath"); textBoxX1.Text = clientFolder; textBoxX2.Text = dataFilePath; } }