public void Load() { try { System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(XmlPreferences)); System.IO.StreamReader file = new System.IO.StreamReader(_xmlConfigFile); _pref = (XmlPreferences)reader.Deserialize(file); file.Close(); } catch (FileNotFoundException) { // Set default values _pref.VST2Extension = "*.dll"; _pref.VST3Extension = "*.vst3"; resetVST2FolderList(); resetVST3FolderList(); _pref.SteinbergConfigPath = @"%AppData%\Roaming\Steinberg"; _pref.SearchEngineBaseUrl = "https://duckduckgo.com"; _pref.DownloadFolder = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "{374DE290-123F-4565-9164-39C4925E467B}", String.Empty).ToString(); _pref.ExcludedFolders.Add(Environment.GetEnvironmentVariable("windir").ToLower()); _pref.ExcludedFolders.Add(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86).ToLower()); _pref.ExcludedFolders.Add(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache).ToLower()); } catch (Exception e) { MessageBox.Show(e.Message); } }
public Preferences() { _pref = new XmlPreferences(); _xmlConfigFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "//VSTManager//preferences.xml"; Load(); }