示例#1
0
        public static bool Resolved()
        {
            UserSettings defaultUserSettings = GetDefaultUserSettingsForPlatform ();
            UserSettings userSettings = UserSettings.Load (defaultUserSettings);

            bool valid =  IsUserSettingsValid (userSettings);

            if (valid)
                mResolvedSettings = userSettings;
            else
                File.Delete (UserSettings.AppUserSettingsFile);
            return valid;
        }
示例#2
0
        private static bool IsUserSettingsValid(UserSettings userSettings)
        {
            if (!File.Exists (userSettings.ConvertLocation))
                return false;

            if (!IsVersionInfoCorrect (userSettings.ConvertLocation))
                return false;

            if (!File.Exists (userSettings.MontageLocation))
                return false;

            if (!IsVersionInfoCorrect (userSettings.MontageLocation))
                return false;

            return true;
        }
示例#3
0
        public static UserSettings Load(UserSettings defaultUserSettings)
        {
            if (!Directory.Exists (AppDataFolder))
                Directory.CreateDirectory (AppDataFolder);

            if (!File.Exists (AppUserSettingsFile)) {
                UserSettings.Write (AppUserSettingsFile, defaultUserSettings);
            }

            DataContractSerializer s = new DataContractSerializer (typeof(UserSettings));

            using (FileStream fs = File.Open(AppUserSettingsFile, FileMode.Open)) {
                object s2 = s.ReadObject (fs);
                if (s2 == null)
                    return null;
                else
                    return (UserSettings)s2;
            }
        }
示例#4
0
 private static void Write(string filename, UserSettings userSettings)
 {
     DataContractSerializer s = new DataContractSerializer (typeof(UserSettings));
     using (FileStream fs = File.Open(filename, FileMode.Create)) {
         s.WriteObject (fs, userSettings);
     }
 }