public void SaveOptions(CodeAnalysisOptions options) { using (var optionsFile = File.Open(Path.Combine(this.basePath, FileConfigName), FileMode.OpenOrCreate, FileAccess.Write)) { var bytes = Encoding.UTF8.GetBytes(FileConfigurationOptions.GetDefaultJson(options)); optionsFile.Write(bytes, 0, bytes.Length); optionsFile.Flush(); } }
private CodeAnalysisConfigurationProvider(string basePath) : this() { this.basePath = basePath; if (File.Exists(Path.Combine(basePath, FileConfigName)) == false) { using (var optionsFile = File.Open(Path.Combine(basePath, FileConfigName), FileMode.OpenOrCreate, FileAccess.Write)) { var options = CodeAnalysisOptions.Default; var bytes = Encoding.UTF8.GetBytes(FileConfigurationOptions.GetDefaultJson(options)); optionsFile.Write(bytes, 0, bytes.Length); optionsFile.Flush(); } } this.root = new ConfigurationBuilder() .SetBasePath(basePath) .AddJsonFile(FileConfigName, true, true) .Build(); }