本文整理汇总了C#中JsObject.Serialize方法的典型用法代码示例。如果您正苦于以下问题:C# JsObject.Serialize方法的具体用法?C# JsObject.Serialize怎么用?C# JsObject.Serialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsObject
的用法示例。
在下文中一共展示了JsObject.Serialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
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)
{ }
}
示例2: SaveOptions
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());
}