//////////////////////////////////////////////////////////////////////////
        public void SaveSettings(SettingsNode RootNode)
        {
            SettingsNode Section = RootNode.GetNode("General", true, true);

            if (Section == null)
            {
                return;
            }

            Section.Clear();

            Section.SetValue("SelectionColor", SelectionColor);
            Section.SetValue("BoxColor", BoxColor);
            Section.SetValue("BackgroundColor", WindowCanvas.BackColor);
            Section.SetValue("GridWidth", GridSize.Width);
            Section.SetValue("GridHeight", GridSize.Height);

            SettingsNode RecentList = new SettingsNode("RecentFiles");

            foreach (string RecentFile in _RecentFiles)
            {
                RecentList.Children.Add(new SettingsNode("RecentFile", RecentFile));
            }
            Section.Children.Add(RecentList);
        }
Exemple #2
0
        /// <summary>
        /// Saves the current settings to the .ini file
        /// </summary>
        public void SaveSettings()
        {
            // Start by organizing the values into a tree
            SettingsNode baseNode = new SettingsNode();

            foreach (string value in _values.Keys)
            {
                string path = value;

                // Base settings, create values at the base node
                if (path.IndexOf("\\", StringComparison.Ordinal) == -1)
                {
                    baseNode[value] = _values[value];
                }
                else
                {
                    string[] subPath = path.Split('\\');

                    path = "";

                    for (int i = 0; i < subPath.Length - 1; i++)
                    {
                        if (path == "")
                        {
                            path += subPath[i];
                        }
                        else
                        {
                            path += "\\" + subPath[i];
                        }
                    }

                    baseNode.CreateNode(path)[subPath[subPath.Length - 1]] = _values[value];
                }
            }

            // Sort the nodes after they are created
            baseNode.Sort();

            // Mount the settings string
            StringBuilder output = new StringBuilder();

            baseNode.SaveToString(output);

            using (FileStream stream = new FileStream(_filePath, FileMode.OpenOrCreate, FileAccess.Write))
            {
                stream.SetLength(0);

                // Save the settings to the settings file now
                StreamWriter writer = new StreamWriter(stream, Encoding.UTF8);
                writer.Write(output.ToString().Trim());
                writer.Close();
                writer.Dispose();
            }

            baseNode.Clear();
        }
Exemple #3
0
        //////////////////////////////////////////////////////////////////////////
        private void SaveSettings(SettingsNode RootNode)
        {
            SettingsNode Section = RootNode.GetNode(this.Name, true, true);

            if (Section == null)
            {
                return;
            }

            Section.Clear();

            Section.SetValue("ProjectFile", TxtProjectFile.Text);
            Section.SetValue("ScriptExtensions", TxtExtensions.Text);

            foreach (IntegratorModule Mod in modules)
            {
                Mod.SaveSettings(Section);
            }
        }
        //////////////////////////////////////////////////////////////////////////
        public void SaveSettings(SettingsNode RootNode)
        {
            SettingsNode Section = RootNode.GetNode("StringTableMgr", true, true);

            if (Section == null)
            {
                return;
            }

            Section.Clear();

            Section.SetValue("ProjectFile", ProjectFile);
            Section.SetValue("StringTableFile", StringTableFile);
            Section.SetValue("BackupOldFiles", BackupOldFiles);

            SettingsNode IgnoreItems = new SettingsNode("IgnoreList");

            foreach (string Item in IgnoreList)
            {
                IgnoreItems.Children.Add(new SettingsNode("Item", Item));
            }
            Section.Children.Add(IgnoreItems);
        }