Beispiel #1
0
        private void frmRviewMain_Load(object sender, EventArgs e)
        {
            //read config
            string FilePath = IniHelper.IniPath;

            if (!System.IO.File.Exists(FilePath))
            {
                return;
            }
            System.Text.StringBuilder temp = new System.Text.StringBuilder(1024);
            // section=配置节,key=键名,temp=上面,FilePath=路径
            string section = "文本编码格式";
            string key     = "TextEncoding";

            PubData.DefaulTextEncoding = IniHelper.GetFromIniFile(section, key, FilePath);

            section = "循环读取目录";
            key     = "AutoReadChildDir";
            PubData.DefaultReadChildDir = Convert.ToBoolean(IniHelper.GetFromIniFile(section, key, FilePath));

            section = "自动保存工程";
            key     = "AutoClose";
            PubData.IsAutoSaveProject = Convert.ToBoolean(IniHelper.GetFromIniFile(section, key, FilePath));

            //read items from xml list
            using (XmlHelper xml = new XmlHelper())
            {
                XmlNode parNode = xml.GetNode(@"/TextListItem");
                if (parNode != null)
                {
                    TreeNode TParNode = tvMenu.Nodes["RootNode"];
                    foreach (XmlNode childNode in parNode.ChildNodes)
                    {
                        AddToTree(TParNode, childNode.Attributes["Path"].Value);
                    }
                    TParNode.ExpandAll();
                }
            }
        }
Beispiel #2
0
        private void btnSaveSetting_Click(object sender, EventArgs e)
        {
            string FilePath = IniHelper.IniPath;
            // section=配置节,key=键名,value=键值,FilePath=路径
            string section = "文本编码格式";
            string key     = "TextEncoding";
            string value   = txtTextEncoding.Text.Trim();

            IniHelper.SaveToIniFile(section, key, value, FilePath);
            PubData.DefaulTextEncoding = txtTextEncoding.Text.Trim();

            section = "循环读取目录";
            key     = "AutoReadChildDir";
            value   = chbReadChildDir.Checked.ToString();
            IniHelper.SaveToIniFile(section, key, value, FilePath);
            PubData.DefaultReadChildDir = chbReadChildDir.Checked;

            section = "自动保存工程";
            key     = "AutoClose";
            value   = chbAutoSave.Checked.ToString();
            IniHelper.SaveToIniFile(section, key, value, FilePath);
            PubData.IsAutoSaveProject = chbAutoSave.Checked;
            this.Close();
        }