Exemplo n.º 1
0
 public void SaveUserData(string path, string LastDUId, Dictionary <string, string> userdict, Dictionary <string, string> otherdict, Dictionary <string, string> locationdict, Dictionary <string, Dictionary <string, string> > shortcutPair)
 {
     try
     {
         SaveArrayInfo arrayInfo = new SaveArrayInfo
         {
             APPVersion            = Globle.APPVersion,
             LastDUID              = LastDUId,
             ModelAlign            = userdict,
             ModelOtherSettings    = otherdict,
             ModelLocationSettings = locationdict,
             ShortcutPair          = shortcutPair
         };
         JsonSerializerSettings settings = new JsonSerializerSettings();
         settings.Formatting = Formatting.Indented;
         var indentFile = JsonConvert.SerializeObject(arrayInfo, settings);
         var savePath   = path + "/AMGSettings.json";
         if (!File.Exists(savePath))
         {
             System.IO.File.Create(savePath).Dispose();
         }
         StreamWriter sw = new StreamWriter(savePath);
         sw.WriteLine(indentFile);
         sw.Close();
         Globle.AddDataLog("Main", Globle.LangController.GetLang("LOG.ModelConfigSaveSuccess", savePath));
     }
     catch (Exception err)
     {
         Globle.AddDataLog("Main", Globle.LangController.GetLang("LOG.ModelConfigSaveException", err.Message));
     }
 }
Exemplo n.º 2
0
 public SaveArrayInfo LoadUserData(string path)
 {
     try
     {
         var savePath = path + "/AMGSettings.json";
         if (System.IO.File.Exists(savePath))
         {
             StreamReader sr   = new StreamReader(savePath, Encoding.Default);
             String       line = sr.ReadToEnd();
             sr.Close();
             SaveArrayInfo arrayInfo = JsonConvert.DeserializeObject <SaveArrayInfo>(line);
             Globle.AddDataLog("Main", Globle.LangController.GetLang("LOG.ModelConfigLoadSuccess"));
             return(arrayInfo);
         }
         else
         {
             Globle.AddDataLog("Main", Globle.LangController.GetLang("LOG.ModelConfigUnisset"));
             return(null);
         }
     }
     catch (Exception err)
     {
         Globle.AddDataLog("Main", Globle.LangController.GetLang("LOG.ModelConfigLoadException", err.Message));
         return(null);
     }
 }