/// <summary> /// Save configuration to file /// </summary> /// <param name="config">QsConfig instance</param> /// <param name="configFile">saved file</param> /// <returns>success:true, failed:false</returns> public static bool SaveConfig(QsConfig config, string configFile = "config.json") { try { using (FileStream stream = new FileStream(configFile, FileMode.OpenOrCreate, FileAccess.Write)) using (StreamWriter w = new StreamWriter(stream)) { var configStr = JsonConvert.SerializeObject(config, Formatting.Indented); w.WriteLine(configStr); return(true); } } catch (Exception e) { return(false); } }
public QsClient(QsConfig config = null) { Config = config; Init(); }