Exemplo n.º 1
0
        private void workerParse_DoWork(object sender, DoWorkEventArgs e)
        {
            iParser = new INIParser(Program.DataPath);

            iParser.MatchBlocks(xParser);

            iParser.INIChanged      += new EventHandler(iParser_INIChanged);
            iParser.INIChangedStart += new EventHandler(iParser_INIChangedStart);
        }
Exemplo n.º 2
0
        private void workerParse_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                DisplayBlocks();
            }
            else
            {
                MessageBox.Show("An error occured during parsing: " + e.Error.Message, "Parsing Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (iParser != null)
                {
                    iParser = null;
                }
            }

            progress.Visible = false;
        }
Exemplo n.º 3
0
        public void Initialization( string path )
        {
            DataList.Clear();

            Document = new INIParser(path);

            var sections = Document.GetSections();

            foreach (var section in sections)
            {
                var newSection = section;
                foreach (var key in Document.GetKeys(section))
                {
                    Data newData = new Data();
                    newData.Section = newSection;
                    newData.Parameter = key;
                    newData.SetValue( Document[section, key] );
                    DataList.Add(newData);
                }
            }
        }
Exemplo n.º 4
0
        public void INISave()
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.FilterIndex = 1;
            saveFileDialog.Filter = "Setting Files|*.ini|All Files (*.*)|*.*";
            bool? result = saveFileDialog.ShowDialog();
            if (result == true)
            {
                INIParser iniSave = new INIParser(saveFileDialog.FileName);

                foreach (var data in DataList)
                {
                    if (data.ValueBool.Visibility == Visibility.Visible)
                    {
                        iniSave[data.Section, data.Parameter] = data.ValueBool.ToString();
                    }
                    if (data.ValueString.Visibility == Visibility.Visible)
                    {
                        iniSave[data.Section, data.Parameter] = data.ValueString.ToString();
                    }
                    if (data.ValueInt.Visibility == Visibility.Visible)
                    {
                        iniSave[data.Section, data.Parameter] = data.ValueInt.ToString();
                    }
                    if (data.ValueDouble.Visibility == Visibility.Visible)
                    {
                        iniSave[data.Section, data.Parameter] = data.ValueDouble.ToString();
                    }
                }
            }
        }