public ProgramConfig Save() { using (var fs = new IsolatedStream(this.file, true)) { this.config.WriteTo(fs.Stream); } return(this); }
public ProgramConfig(string configName) { this.file = configName + ".cbor"; using (var fs = new IsolatedStream(this.file, false)) { if (fs.Stream != null) { try { this.config = CBORObject.Read(fs.Stream); } catch (CBORException) { this.config = null; } } } this.config = this.config ?? CBORObject.NewMap(); }