示例#1
0
        public static String GetManticorePath(String aPath)
        {
            String path    = "";
            String appData = "";

            switch (aPath)
            {
            case "AppData":
                path  = FileLocator.GetFolderPath(FileLocator.SpecialFolders.ssfAPPDATA);
                path += @"\Manticore\";
                break;

            case "UserPrefs":
                appData = FileLocator.GetManticorePath("AppData");
                path   += appData + @"user-prefs.xml";
                break;

            case "LocalBookmarks":
                appData = FileLocator.GetManticorePath("AppData");
                if (appData != "")
                {
                    path += appData + @"bookmarks.xml";
                }
                break;

            case "Application":
                path = Application.ExecutablePath;
                int lastSlash = path.LastIndexOf(@"\");
                path = path.Substring(0, lastSlash + 1);
                break;
            }
            return(path);
        }
示例#2
0
        public void LoadUserPreferences()
        {
            String manticoreAppData = FileLocator.GetManticorePath("AppData");
            String prefPath         = FileLocator.GetManticorePath("UserPrefs");

            try {
                LoadPreferencesFile(prefPath);
            }
            catch (XmlException) {
                // Something went wrong, we'll just assume a malformed or non-existant
                // preferences file, blow it away and insert a new one. Could potentially
                // be dangerous.
                try {
                    File.Copy(@"defaults\user-prefs.xml", prefPath, true);
                }
                catch (DirectoryNotFoundException) {
                    Directory.CreateDirectory(manticoreAppData);
                    File.Copy(@"defaults\user-prefs.xml", prefPath, true);
                }
                LoadPreferencesFile(prefPath);
            }
        }
示例#3
0
 public void FlushUserPreferences()
 {
     FlushPreferencesFile(FileLocator.GetManticorePath("UserPrefs"));
 }