public WriterContext(Stream stream, JSONSettings settings) { this.ignoreNull = settings.IgnoreNull; this.position = 0; this.currentKey = null; this.addComma = false; this.writer = new StreamWriter(stream, settings.Encoding); }
private ISchema GetSchema(JSONSettings settings) { JSONSchema schema; schema = new JSONSchema (settings); schema.OnStreamError += (position, message) => Console.Error.WriteLine ("Stream error at position {0}: {1}", position, message); schema.OnTypeError += (type, value) => Console.Error.WriteLine ("Type error: could not convert \"{1}\" to {0}", type, value); return schema; }
static GlobalSettings() { JSONSettings savedSettings = JsonConvert.DeserializeObject <JSONSettings>(File.ReadAllText((HttpContext.Current.Server.MapPath("~/App_Data/settings.json")))); N = savedSettings._N; D = savedSettings._D; S = savedSettings._S; G = savedSettings._G; P = savedSettings._P; C = savedSettings._C; T = savedSettings._T; }
private void ReadSettings() { if (File.Exists(path)) { using (StreamReader streamReader = File.OpenText(path)) { string file = streamReader.ReadToEnd(); settings = JsonConvert.DeserializeObject<JSONSettings>(file); string outMsg = "SETTINGS: " + settings.nick + ", " + settings.connection.server + ", " + settings.connection.channels[0]; Console.WriteLine(outMsg); Run(); } } }
internal static bool Load(string fileName, out JSONSettings settings) { string text = File.ReadAllText(fileName); if (string.IsNullOrWhiteSpace(text)) { settings = null; return(false); } JSONSettings js = JsonConvert.DeserializeObject <JSONSettings>(text); settings = js; return(js != null); }
public void Init() { // コマンド定義 this.OpenResourceDirectoryCommand.Subscribe(_ => this.openResourceDirectory()); this.TreeItemSelectCommand.Subscribe(this.updatePreviewTab); this.TreeItemDoubleClickCommand.Subscribe(this.addNewTab); this.RenameTabHeaderCommand.Subscribe(this.RenameTabHeaderName); // プロパティ初期化 this._tabSettings = new JSONSettings <ObservableCollection <GroupTabContext> >(@"mltviewer_tabsettings.json"); this._HukuTempPath = new JSONSettings <string>(@"mltviewer_hukutemppath.json"); // 前回値の復帰 this.loadSettings(); }
static GlobalSettings() { JSONSettings savedSettings = JsonConvert.DeserializeObject <JSONSettings>(File.ReadAllText((HttpContext.Current.Server.MapPath("~/App_Data/settings.json")))); N = savedSettings._N; D = savedSettings._D; S = savedSettings._S; G = savedSettings._G; P = savedSettings._P; C = savedSettings._C; T = savedSettings._T; //// default values //N = 10; //D = 60; //S = 10; //G = 20; //P = 40; //C = "RSD"; //T = 1; }
/* Получение настроек пользователя */ public IEnumerator PostTokenForSettings() { using (UnityWebRequest www = UnityWebRequest.Post(protocol + "/api/v1/applications/moneygame/get/settings", "")) { www.SetRequestHeader("x-access-token", jsonData.token); yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { _errorText.text = "Connection error"; } else { string jsonString = www.downloadHandler.text; settings = JsonUtility.FromJson <JSONSettings>(jsonString); _authorizationScreen.SetActive(false); // скрыли экран авторизации _walletScreen.SetActive(true); // открыли экран сбора денег в кошелек } } }
internal static void Save(JSONSettings settings, string fileName) { File.WriteAllText(fileName, JsonConvert.SerializeObject(settings)); }