Пример #1
0
        public void SaveOptions(string filename)
        {
            JsObject data = new JsObject();
            JsArray  arr  = new JsArray();

            for (int i = 0; i < translators.Count; ++i)
            {
                arr.Add(Json.Parse("{\"id\":" + translators[i].id + ", \"inUse\":" + (translators[i].inUse ? "1" : "0") + "}"));
            }
            data["translators"] = arr;

            foreach (KeyValuePair <string, ColorRecord> kvp in colors)
            {
                data["colors"].num[kvp.Key] = kvp.Value.color.ToArgb();
            }

            saveOpt(data, "wordParseMethod");
            saveOpt(data, "JDicServer");
            saveOpt(data, "alwaysOnTop");
            saveOpt(data, "checkDouble");
            saveOpt(data, "checkRepeatingPhrases");
            saveOpt(data, "checkRepeatingPhrasesAdv");
            saveOpt(data, "replaceSuffixes");
            saveOpt(data, "excludeSpeakers");
            saveOpt(data, "excludeSpeakersPattern");
            saveOpt(data, "messageDelay");
            saveOpt(data, "maxSourceLength");
            data.str["font"]        = new FontConverter().ConvertToString(font);
            data.str["tooltipFont"] = new FontConverter().ConvertToString(tooltipFont);
            saveOpt(data, "translateToOtherLanguage");
            saveOpt(data, "translateLanguage");
            saveOpt(data, "noUseSecondTranslate");
            saveOpt(data, "useCache");
            saveOpt(data, "displayOriginal");
            saveOpt(data, "displayFixed");
            saveOpt(data, "bottomLayerOpacity");
            saveOpt(data, "displayReadings");
            saveOpt(data, "appendBottom");
            saveOpt(data, "dropShadow");
            saveOpt(data, "usePromt");
            saveOpt(data, "furiganaRomaji");
            saveOpt(data, "maxBlocks");
            saveOpt(data, "largeMargins");
            saveOpt(data, "marginSize");
            saveOpt(data, "hivemindServer");
            saveOpt(data, "toolbarVisible");
            saveOpt(data, "monitorNewThreads");
            saveOpt(data, "includeOkurigana");
            saveOpt(data, "clipboardMonitoring");
            saveOpt(data, "clipboardMonitoringJapanese");

            File.WriteAllText(filename, data.Serialize());
        }
Пример #2
0
 public void SaveAppProfiles()
 {
     if (CurrentApp != null)
     {
         SaveAppProfile(CurrentApp);
     }
     try
     {
         string filename = Path.Combine(Global.cfgdir, "apps.txt");
         File.WriteAllText(filename, appProfiles.Serialize());
     }
     catch (Exception)
     { }
 }
Пример #3
0
 public void Save()
 {
     try
     {
         JsObject data = new JsObject();
         data.str["main"]            = MainFormPosition;
         data.str["fullscreen"]      = FullscreenPosition;
         data.str["monitor"]         = MonitorFormPosition;
         data.str["options"]         = OptionsFormPosition;
         data.str["hivemind_submit"] = HivemindSubmitFormPosition;
         File.WriteAllText(cfgFile, data.Serialize());
     }
     catch (Exception)
     { }
 }