public static void Load()
        {
            try
            {
                if (!File.Exists(r_FilePath))
                {
                    Current = new Preference();
                    return;
                }

                LoadCore(r_FilePath);
            }
            catch (Exception e)
            {
                try
                {
                    using (var rStreamWriter = new StreamWriter(Logger.GetNewExceptionLogFilename(), false, new UTF8Encoding(true)))
                    {
                        rStreamWriter.WriteLine("Loading preference file error.");
                        rStreamWriter.WriteLine();
                        rStreamWriter.WriteLine(e.ToString());
                    }
                }
                catch { }
            }
            finally
            {
                if (Current == null)
                    Current = new Preference();
            }
        }
예제 #2
0
 public static void Load()
 {
     try
     {
         using (var rReader = new JsonTextReader(File.OpenText(r_FilePath)))
             Current = r_Serializer.Deserialize<Preference>(rReader);
     }
     catch
     {
         Current = new Preference();
     }
 }
 static void LoadCore(string rpPath)
 {
     using (var rReader = new JsonTextReader(File.OpenText(rpPath)))
         Current = r_Serializer.Deserialize<Preference>(rReader);
 }