public void InitiliazeConfig(string path) { var filePath = $"{path}\\PicPrompt.json"; if (!File.Exists(filePath)) { var writer = new LitJson.JsonWriter(); writer.WriteObjectStart(); writer.WritePropertyName("start-with-windows-enabled"); writer.Write(false); writer.WritePropertyName("allow-background-work"); writer.Write(true); writer.WriteObjectEnd(); File.WriteAllText(filePath, writer.ToString()); } Config.Load(filePath); }
static int _m_ToString(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); LitJson.JsonWriter gen_to_be_invoked = (LitJson.JsonWriter)translator.FastGetCSObj(L, 1); { string gen_ret = gen_to_be_invoked.ToString( ); LuaAPI.lua_pushstring(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
private void onSaveClicked(object sender, EventArgs e) { if (string.IsNullOrEmpty(Settings.Default.DataPath)) { if (saveFileDialog1.ShowDialog() != DialogResult.OK) { return; } Settings.Default.DataPath = saveFileDialog1.FileName; } using (StreamWriter streamWriter = new StreamWriter(Settings.Default.DataPath)) { var writer = new LitJson.JsonWriter(); writer.PrettyPrint = true; LitJson.JsonMapper.ToJson(mTableStore, writer); string config = writer.ToString(); streamWriter.Write(config); } Settings.Default.Save(); mDirty = false; }