public void ClearRecentFiles()
        {
            RecentFiles.Clear();

            Save();
            Updated?.Invoke(this, EventArgs.Empty);
        }
Exemple #2
0
        public void Check()
        {
            string[] ar = RecentFiles.FileNames;

            for (int i = 0; i < ar.Length; i++)
            {
                try
                {
                    if (!new System.IO.FileInfo(ar[i]).Exists)
                    {
                        ar[i] = "";
                    }
                }
                catch (Exception)
                {
                    ar[i] = "";
                }
            }

            var v1 = ar.Where((s) => !s.Equals("")).Select((s, index) => new { s, index });
            var v2 = v1.Distinct();
            var v3 = v2.OrderBy((index) => index);
            var v4 = v3.Take(Count);

            RecentFiles.Clear();
            v2.Take(20).ForEach((v) => RecentFiles.Add(v.s));

            LastOpenFile = CheckFileName(LastOpenFile);
            LastOpenDir  = CheckDirectory(LastOpenDir);
        }
        private static void LoadRecentFileList()
        {
            var folder     = ApplicationData.Current.LocalFolder;
            var serializer = new XmlSerializer(typeof(List <FileModel>));

            try
            {
                List <FileModel> recentFiles;
                using (var fileStream = new FileStream(folder.Path + "\\recent.xml", FileMode.Open))
                {
                    recentFiles = serializer.Deserialize(fileStream) as List <FileModel>;
                }

                RecentFiles.Clear();

                foreach (var file in recentFiles)
                {
                    RecentFiles.Add(file);
                }
            }
            catch
            {
                RecentFiles = new ObservableCollection <FileModel>();
            }
        }
Exemple #4
0
        private void PopulateRecentFilesMethod(IEnumerable <SavedFileInfo> recentFiles)
        {
            RecentFiles.Clear();

            if (recentFiles != null)
            {
                foreach (var file in recentFiles)
                {
                    var fileInfo = new FileInfo(file.FilePath);
                    var menuItem = new MenuItem {
                        Header = fileInfo.FullName, Tag = file.FilePath
                    };
                    menuItem.Click += OnRecentFileClick;
                    RecentFiles.Add(menuItem);
                }
            }

            RecentFiles.Add(new Separator());
            var clearListMenuItem = new MenuItem {
                Header = "Clear Recent File List"
            };

            clearListMenuItem.Click += (sender, args) => ClearRecentFiles();
            RecentFiles.Add(clearListMenuItem);

            RaisePropertyChanged("RecentFiles");
        }
Exemple #5
0
        public async Task LoadDefaults(MainWindowViewModel m)
        {
            try
            {
                var l = new GeneratorPreferencesLoader(Preferences);
                l.Load();
            }
            catch
            {
                // ignored too
            }

            var path = RecentFilesStorageLocation;

            if (File.Exists(path))
            {
                try
                {
                    var lines = await File.ReadAllLinesAsync(path);

                    foreach (var file in lines)
                    {
                        RecentFiles.Clear();
                        if (File.Exists(file))
                        {
                            RecentFiles.Add(new RecentFileViewModel(m, file));
                        }
                    }
                }
                catch (Exception e)
                {
                    // ignored
                }
            }
        }
Exemple #6
0
        private void SaveRecentFile(string fileName)
        {
            // Clear the recent files list
            // and add this file to the top.
            RecentFiles.Clear();
            RecentFiles.Add(fileName);

            var i = 0;

            while (i < 2 &&
                   Settings.Default.recentFiles != null &&
                   Settings.Default.recentFiles.Count > i)
            {
                var recentPath = Settings.Default.recentFiles[i];

                // Only add the path if it isn't already
                // in the list.
                if (!RecentFiles.Contains(recentPath))
                {
                    RecentFiles.Add(Settings.Default.recentFiles[i]);
                }

                i++;
            }

            var sc = new StringCollection();

            sc.AddRange(RecentFiles.ToArray());
            Settings.Default.recentFiles = sc;
            Settings.Default.Save();
        }
Exemple #7
0
        private void UpdateRecentFiles()
        {
            RecentFiles.Clear();

            foreach (var recFile in m_RecentFilesMgr.RecentFiles)
            {
                RecentFiles.Add(recFile);
            }
        }
Exemple #8
0
        public void RecentFiles_01()
        {
            var x = new RecentFiles();

            x.Clear();
            x.Push(@"C:\test.txt");
            x.Push(@"C:\test.txt");
            Assert.AreEqual(1, x.Count);
            Assert.AreEqual(@"C:\test.txt", x[0].FileName);
        }
Exemple #9
0
        private void UpdateRecentFiles()
        {
            RecentFiles.Clear();

            foreach (var item in MRU.MostRecentlyUsedFiles.Take(10))
            {
                RecentFiles.Add(new MostRecentlyUsedFile()
                {
                    FilePath = item.FilePath, Timestamp = item.Timestamp, Version = item.Version
                });
            }
        }
Exemple #10
0
        private void UpdateRecentFiles()
        {
            RecentFiles.Clear();

            // Get only files that is current version or older
            foreach (var item in MRU.MostRecentlyUsedFiles.Where(x => string.Compare(x.Version, EditorVersionMajor, StringComparison.Ordinal) <= 0).Take(10))
            {
                RecentFiles.Add(new MostRecentlyUsedFile()
                {
                    FilePath = item.FilePath, Timestamp = item.Timestamp, Version = item.Version
                });
            }
        }
Exemple #11
0
        public static ToolStripItem[] RecentMenu(this RecentFiles recent, Action <string> loadFileCallback, bool autoload = false)
        {
            var items = new List <ToolStripItem>();

            if (recent.Empty)
            {
                var none = new ToolStripMenuItem {
                    Enabled = false, Text = "None"
                };
                items.Add(none);
            }
            else
            {
                foreach (var filename in recent)
                {
                    var temp = filename;
                    var item = new ToolStripMenuItem {
                        Text = temp
                    };
                    item.Click += (o, ev) => loadFileCallback(temp);
                    items.Add(item);
                }
            }

            items.Add(new ToolStripSeparator());

            var clearitem = new ToolStripMenuItem {
                Text = "&Clear", Enabled = !recent.Frozen
            };

            clearitem.Click += (o, ev) => recent.Clear();
            items.Add(clearitem);

            var freezeitem = new ToolStripMenuItem {
                Text = recent.Frozen ? "&Unfreeze" : "&Freeze"
            };

            freezeitem.Click += (o, ev) => recent.Frozen ^= true;
            items.Add(freezeitem);

            if (autoload)
            {
                var auto = new ToolStripMenuItem {
                    Text = "&Autoload", Checked = recent.AutoLoad
                };
                auto.Click += (o, ev) => recent.ToggleAutoLoad();
                items.Add(auto);
            }

            return(items.ToArray());
        }
Exemple #12
0
        public void RecentFiles_04()
        {
            var x = new RecentFiles();

            x.Clear();
            Medo.Configuration.RecentFiles.NoRegistryWrites = true;
            x.Push(@"C:\testA.txt");
            x.Push(@"C:\testB.txt");
            x.Push(@"C:\testA.txt");
            Assert.AreEqual(2, x.Count);
            Assert.AreEqual(@"C:\testA.txt", x[0].FileName);
            Assert.AreEqual(@"C:\testB.txt", x[1].FileName);
            x.Load();
            Assert.AreEqual(0, x.Count);
        }
Exemple #13
0
        internal static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");

            Medo.Application.UnhandledCatch.ThreadException += new EventHandler <ThreadExceptionEventArgs>(UnhandledCatch_ThreadException);
            Medo.Application.UnhandledCatch.Attach();


            var recentLegacy = new RecentFiles();

            if (recentLegacy.Count > 0)
            {
                var fileList = new List <string>();
                foreach (var item in recentLegacy.Items)
                {
                    fileList.Add(item.FileName);
                }
                Recent = new RecentlyUsed(fileList);
                Config.Write("RecentFile", Recent.FileNames);
                recentLegacy.Clear();
            }
            else
            {
                Recent = new RecentlyUsed(Config.Read("RecentFile"));
            }
            Recent.Changed += (o, i) => {
                Config.Write("RecentFile", Recent.FileNames);
            };

            if (!Config.IsAssumedInstalled)
            {
                Medo.Windows.Forms.State.ReadState += delegate(object sender, Medo.Windows.Forms.StateReadEventArgs e) {
                    e.Value = Config.Read("State!" + e.Name.Replace("Bimil.", ""), e.DefaultValue);
                };
                Medo.Windows.Forms.State.WriteState += delegate(object sender, Medo.Windows.Forms.StateWriteEventArgs e) {
                    Config.Write("State!" + e.Name.Replace("Bimil.", ""), e.Value);
                };
            }

            App.MainForm = new MainForm();
            Application.Run(App.MainForm);

            SetupMutex.Close();
        }
Exemple #14
0
        public void RecentFiles_05()
        {
            var recentFiles = new RecentFiles();

            recentFiles.Clear();
            RecentFiles.NoRegistryWrites = true;
            recentFiles.Push(@"3");
            recentFiles.Push(@"2");
            recentFiles.Push(@"1");
            Assert.AreEqual(3, recentFiles.Count);

            var i = 0;

            foreach (var file in recentFiles)
            {
                i++;
                Assert.AreEqual(i.ToString(CultureInfo.InvariantCulture), file.FileName);
            }
        }
Exemple #15
0
        public void Load()
        {
            SettingsXml settings;

            try
            {
                XmlSerializer ser = new XmlSerializer(typeof(SettingsXml));
                using (Stream stream = File.OpenRead(SettingsFilename))
                {
                    settings = (SettingsXml)ser.Deserialize(stream);
                }
            }
            catch (Exception)
            {
                return;
            }
            RecentFiles.Clear();
            foreach (string recentFile in settings.RecentFiles)
            {
                RecentFiles.Add(recentFile);
            }
        }
 private static void ClearRecentFiles()
 {
     RecentFiles.Clear();
     SaveRecentFileList();
 }
Exemple #17
0
 private void ClearRecentFiles_Click(object sender, EventArgs e)
 {
     RecentFiles.Clear();
 }
Exemple #18
0
        public static ToolStripItem[] RecentMenu(this RecentFiles recent, Action <string> loadFileCallback, bool autoload = false, bool romloading = false)
        {
            var items = new List <ToolStripItem>();

            if (recent.Empty)
            {
                var none = new ToolStripMenuItem {
                    Enabled = false, Text = "None"
                };
                items.Add(none);
            }
            else
            {
                foreach (var filename in recent)
                {
                    string caption      = filename;
                    string path         = filename;
                    string physicalPath = filename;
                    bool   crazyStuff   = true;

                    //sentinel for newer format OpenAdvanced type code
                    if (romloading)
                    {
                        if (filename.StartsWith("*"))
                        {
                            var oa = OpenAdvancedSerializer.ParseWithLegacy(filename);
                            caption = oa.DisplayName;

                            crazyStuff = false;
                            if (oa is OpenAdvanced_OpenRom)
                            {
                                crazyStuff   = true;
                                physicalPath = ((oa as OpenAdvanced_OpenRom).Path);
                            }
                        }
                    }

                    //TODO - do TSMI and TSDD need disposing? yuck
                    var item = new ToolStripMenuItem {
                        Text = caption
                    };
                    items.Add(item);

                    item.Click += (o, ev) =>
                    {
                        loadFileCallback(path);
                    };

                    var tsdd = new ToolStripDropDownMenu();

                    if (crazyStuff)
                    {
                        //TODO - use standard methods to split filename (hawkfile acquire?)
                        var hf = new HawkFile();
                        hf.Parse(physicalPath);
                        bool canExplore = true;
                        if (!File.Exists(hf.FullPathWithoutMember))
                        {
                            canExplore = false;
                        }

                        if (canExplore)
                        {
                            //make a menuitem to show the last modified timestamp
                            var timestamp     = File.GetLastWriteTime(hf.FullPathWithoutMember);
                            var tsmiTimestamp = new ToolStripLabel {
                                Text = timestamp.ToString()
                            };

                            tsdd.Items.Add(tsmiTimestamp);
                            tsdd.Items.Add(new ToolStripSeparator());

                            if (hf.IsArchive)
                            {
                                //make a menuitem to let you copy the path
                                var tsmiCopyCanonicalPath = new ToolStripMenuItem {
                                    Text = "&Copy Canonical Path"
                                };
                                tsmiCopyCanonicalPath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(physicalPath); };
                                tsdd.Items.Add(tsmiCopyCanonicalPath);

                                var tsmiCopyArchivePath = new ToolStripMenuItem {
                                    Text = "Copy Archive Path"
                                };
                                tsmiCopyArchivePath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(hf.FullPathWithoutMember); };
                                tsdd.Items.Add(tsmiCopyArchivePath);

                                var tsmiOpenArchive = new ToolStripMenuItem {
                                    Text = "Open &Archive"
                                };
                                tsmiOpenArchive.Click += (o, ev) => { System.Diagnostics.Process.Start(hf.FullPathWithoutMember); };
                                tsdd.Items.Add(tsmiOpenArchive);
                            }
                            else
                            {
                                //make a menuitem to let you copy the path
                                var tsmiCopyPath = new ToolStripMenuItem {
                                    Text = "&Copy Path"
                                };
                                tsmiCopyPath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(physicalPath); };
                                tsdd.Items.Add(tsmiCopyPath);
                            }

                            tsdd.Items.Add(new ToolStripSeparator());

                            //make a menuitem to let you explore to it
                            var tsmiExplore = new ToolStripMenuItem {
                                Text = "&Explore"
                            };
                            string explorePath = "\"" + hf.FullPathWithoutMember + "\"";
                            tsmiExplore.Click += (o, ev) => { System.Diagnostics.Process.Start("explorer.exe", "/select, " + explorePath); };
                            tsdd.Items.Add(tsmiExplore);

                            var tsmiCopyFile = new ToolStripMenuItem {
                                Text = "Copy &File"
                            };
                            var lame = new System.Collections.Specialized.StringCollection();
                            lame.Add(hf.FullPathWithoutMember);
                            tsmiCopyFile.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetFileDropList(lame); };
                            tsdd.Items.Add(tsmiCopyFile);

                            var tsmiTest = new ToolStripMenuItem {
                                Text = "&Shell Context Menu"
                            };
                            tsmiTest.Click += (o, ev) =>
                            {
                                var si    = new GongSolutions.Shell.ShellItem(hf.FullPathWithoutMember);
                                var scm   = new GongSolutions.Shell.ShellContextMenu(si);
                                var tsddi = o as ToolStripDropDownItem;
                                tsddi.Owner.Update();
                                scm.ShowContextMenu(tsddi.Owner, new System.Drawing.Point(0, 0));
                            };
                            tsdd.Items.Add(tsmiTest);

                            tsdd.Items.Add(new ToolStripSeparator());
                        }
                        else
                        {
                            //make a menuitem to show the last modified timestamp
                            var tsmiMissingFile = new ToolStripLabel {
                                Text = "-Missing-"
                            };
                            tsdd.Items.Add(tsmiMissingFile);
                            tsdd.Items.Add(new ToolStripSeparator());
                        }
                    }                     //crazystuff

                    //in any case, make a menuitem to let you remove the item
                    var tsmiRemovePath = new ToolStripMenuItem {
                        Text = "&Remove"
                    };
                    tsmiRemovePath.Click += (o, ev) => {
                        recent.Remove(path);
                    };
                    tsdd.Items.Add(tsmiRemovePath);

                    ////experiment of popping open a submenu. doesnt work well.
                    //item.MouseDown += (o, mev) =>
                    //{
                    //  if (mev.Button != MouseButtons.Right) return;
                    //  //location of the menu containing this item that was just rightclicked
                    //  var pos = item.Owner.Bounds.Location;
                    //  //the offset within that menu of this item
                    //  var tsddi = item as ToolStripDropDownItem;
                    //  pos.Offset(tsddi.Bounds.Location);
                    //  //the offset of the click
                    //  pos.Offset(mev.Location);
                    //	//tsdd.OwnerItem = item; //has interesting promise, but breaks things otherwise
                    //  tsdd.Show(pos);
                    //};

                    //just add it to the submenu for now. seems to work well enough, even though its a bit odd
                    item.MouseDown += (o, mev) =>
                    {
                        if (mev.Button != MouseButtons.Right)
                        {
                            return;
                        }
                        if (item.DropDown != null)
                        {
                            item.DropDown = tsdd;
                        }
                        item.ShowDropDown();
                    };
                }
            }

            items.Add(new ToolStripSeparator());

            var clearitem = new ToolStripMenuItem {
                Text = "&Clear", Enabled = !recent.Frozen
            };

            clearitem.Click += (o, ev) => recent.Clear();
            items.Add(clearitem);

            var freezeitem = new ToolStripMenuItem {
                Text = recent.Frozen ? "&Unfreeze" : "&Freeze"
            };

            freezeitem.Click += (o, ev) => recent.Frozen ^= true;
            items.Add(freezeitem);

            if (autoload)
            {
                var auto = new ToolStripMenuItem {
                    Text = "&Autoload", Checked = recent.AutoLoad
                };
                auto.Click += (o, ev) => recent.ToggleAutoLoad();
                items.Add(auto);
            }

            var settingsitem = new ToolStripMenuItem {
                Text = "&Recent Settings..."
            };

            settingsitem.Click += (o, ev) =>
            {
                using (var prompt = new InputPrompt
                {
                    TextInputType = InputPrompt.InputType.Unsigned,
                    Message = "Number of recent files to track",
                    InitialValue = recent.MAX_RECENT_FILES.ToString()
                })
                {
                    var result = prompt.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        int val = int.Parse(prompt.PromptText);
                        if (val > 0)
                        {
                            recent.MAX_RECENT_FILES = val;
                        }
                    }
                }
            };
            items.Add(settingsitem);

            return(items.ToArray());
        }
Exemple #19
0
        public void Load()
        {
            var table = new DataTable("Settings");

            try
            {
                if (!Directory.Exists(FileName))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(FileName));
                }
                table.ReadXml(FileName);
            }
            catch
            {
            }

            if (table.Rows.Count <= 0)
            {
                return;
            }
            DataRow row = table.Rows[0];

            if (table.Columns.Contains("X"))
            {
                X = row.Field <int>("X");
            }
            if (table.Columns.Contains("Y"))
            {
                Y = row.Field <int>("Y");
            }
            if (table.Columns.Contains("Width"))
            {
                Width = row.Field <int>("Width");
            }
            if (table.Columns.Contains("Height"))
            {
                Height = row.Field <int>("Height");
            }
            if (table.Columns.Contains("Maximized"))
            {
                Maximized = row.Field <bool>("Maximized");
            }
            if (table.Columns.Contains("TextColor1"))
            {
                TextColor1 = row.Field <int>("TextColor1");
            }
            if (table.Columns.Contains("TextColor2"))
            {
                TextColor2 = row.Field <int>("TextColor2");
            }
            if (table.Columns.Contains("BackColor1"))
            {
                BackColor1 = row.Field <int>("BackColor1");
            }
            if (table.Columns.Contains("BackColor2"))
            {
                BackColor2 = row.Field <int>("BackColor2");
            }
            if (table.Columns.Contains("ColorSet"))
            {
                ColorSet = row.Field <int>("ColorSet");
            }

            RecentFiles.Clear();
            for (int i = 1; i <= MaxRecentFiles; i++)
            {
                if (table.Columns.Contains($"RecentFiles{i}"))
                {
                    RecentFiles.Add(row.Field <string>($"RecentFiles{i}"));
                }
            }
        }
Exemple #20
0
        public void ProcessIni(AppIniFile ini, bool allowSessionSettings)
        {
            var iniAction = ini.GetActionType("General", "ActionType");
            var iniAddNewDocumentsToFile = ini.GetBool("General", "AddNewDocumentsToFile");
            var iniAfterExtractHook      = ini.GetString("Hooks", "AfterExtract");
            var iniAutoRun                 = ini.GetBool("General", "AutoRun");
            var iniBeforePublishHook       = ini.GetString("Hooks", "BeforePublish");
            var iniDeleteDocumentsFromFile = ini.GetBool("General", "DeleteDocumentsFromFile");
            var iniDiffTool                = ini.GetString("DiffTool", "Path");
            var iniDiffToolParameters      = ini.GetString("DiffTool", "Parameters");
            var iniIgnoreEmpty             = ini.GetBool("General", "IgnoreEmpty");
            var iniFilePath                = ini.GetString("General", "FilePath");
            var iniFolderPath              = ini.GetString("General", "FolderPath");
            var iniLanguage                = ini.GetString("General", "Language");
            var iniPortable                = ini.GetBool("General", "Portable");
            var iniSearchSubdirectories    = ini.GetBool("General", "SearchRepositorySubdirectories");

            if (iniAction.HasValue && allowSessionSettings)
            {
                Action = iniAction.Value;
            }

            if (iniAddNewDocumentsToFile.HasValue && allowSessionSettings)
            {
                AddNewDocumentsToFile = iniAddNewDocumentsToFile.Value;
            }

            if (iniAfterExtractHook != null && allowSessionSettings)
            {
                AfterExtractHook = _hookFactory(iniAfterExtractHook);
            }

            if (iniAutoRun.HasValue && allowSessionSettings)
            {
                AutoRun = iniAutoRun.Value;
            }

            if (iniBeforePublishHook != null && allowSessionSettings)
            {
                BeforePublishHook = _hookFactory(iniBeforePublishHook);
            }

            if (iniDeleteDocumentsFromFile.HasValue && allowSessionSettings)
            {
                DeleteDocumentsFromFile = iniDeleteDocumentsFromFile.Value;
            }

            if (iniDiffTool != null)
            {
                DiffTool = iniDiffTool;
            }

            if (iniDiffToolParameters != null)
            {
                DiffToolParameters = iniDiffToolParameters;
            }

            if (iniIgnoreEmpty.HasValue && allowSessionSettings)
            {
                IgnoreEmpty = iniIgnoreEmpty.Value;
            }

            if (iniFilePath != null && allowSessionSettings)
            {
                FilePath = iniFilePath;
            }

            if (iniFolderPath != null && allowSessionSettings)
            {
                FolderPath = iniFolderPath;
            }

            if (iniLanguage != null)
            {
                Language = iniLanguage;
            }

            if (iniPortable.HasValue)
            {
                Portable = iniPortable.Value;
            }

            if (iniSearchSubdirectories.HasValue)
            {
                SearchRepositorySubdirectories = iniSearchSubdirectories.Value;
            }

            if (ini.GetString("RecentFiles", "1") != null)
            {
                RecentFiles.Clear();
                var j = 1;
                while (j <= 5 && !string.IsNullOrEmpty(ini.GetString("RecentFiles", j.ToString(CultureInfo.InvariantCulture))))
                {
                    RecentFiles.Add(ini.GetString("RecentFiles", j.ToString(CultureInfo.InvariantCulture)));
                    ++j;
                }
            }
        }
Exemple #21
0
 /// <summary>
 /// Callback to clear all recent files.
 /// </summary>
 private void ClearRecentFilesButton_Click(object sender, EventArgs e) => RecentFiles.Clear();
Exemple #22
0
        public static void Read()
        {
            Builds.Clear();
            Games.Clear();
            RecentFiles.Clear();
            Settings.Clear();
            Hotkeys.Clear();
            AdditionalSettings.Clear();
            FavouriteTextureFolders.Clear();

            var root = ReadSettingsFile();

            if (root == null)
            {
                return;
            }

            var settings = root.Children.FirstOrDefault(x => x.Name == "Settings");

            if (settings != null)
            {
                foreach (var key in settings.GetPropertyKeys())
                {
                    Settings.Add(new Setting {
                        Key = key, Value = settings[key]
                    });
                }
            }
            var recents = root.Children.FirstOrDefault(x => x.Name == "RecentFiles");

            if (recents != null)
            {
                foreach (var key in recents.GetPropertyKeys())
                {
                    int i;
                    if (int.TryParse(key, out i))
                    {
                        RecentFiles.Add(new RecentFile {
                            Location = recents[key], Order = i
                        });
                    }
                }
            }
            var games = root.Children.Where(x => x.Name == "Game");

            foreach (var game in games)
            {
                var g = new Game();
                g.Read(game);
                Games.Add(g);
            }
            var builds = root.Children.Where(x => x.Name == "Build");

            foreach (var build in builds)
            {
                var b = new Build();
                b.Read(build);
                Builds.Add(b);
            }
            var hotkeys = root.Children.FirstOrDefault(x => x.Name == "Hotkeys");

            if (hotkeys != null)
            {
                foreach (var key in hotkeys.GetPropertyKeys())
                {
                    var spl = key.Split(':');
                    Hotkeys.Add(new Hotkey {
                        ID = spl[0], HotkeyString = hotkeys[key]
                    });
                }
            }

            Serialise.DeserialiseSettings(Settings.ToDictionary(x => x.Key, x => x.Value));
            Sledge.Settings.Hotkeys.SetupHotkeys(Hotkeys);

            var additionalSettings = root.Children.FirstOrDefault(x => x.Name == "AdditionalSettings");

            if (additionalSettings != null)
            {
                foreach (var child in additionalSettings.Children)
                {
                    if (child.Children.Count > 0)
                    {
                        AdditionalSettings.Add(child.Name, child.Children[0]);
                    }
                }
            }

            var favTextures = root.Children.FirstOrDefault(x => x.Name == "FavouriteTextures");

            if (favTextures != null && favTextures.Children.Any())
            {
                try
                {
                    var ft = GenericStructure.Deserialise <List <FavouriteTextureFolder> >(favTextures.Children[0]);
                    if (ft != null)
                    {
                        FavouriteTextureFolders.AddRange(ft);
                    }
                    FixFavouriteNames(FavouriteTextureFolders);
                }
                catch
                {
                    // Nope
                }
            }

            if (!File.Exists(SettingsFile))
            {
                Write();
            }
        }
 public void ClearRecentFiles()
 {
     RecentFiles.Clear();
 }