public async Task ExportAsync(CabinetModelDTO cabinet) { Logger.Debug("JsonExport"); var path = Path.Combine(_config.CabinetFilesDirectory(), cabinet._name + ".json"); using (StreamWriter writer = File.CreateText(path)) { await writer.WriteAsync(JsonConvert.SerializeObject(cabinet, Formatting.Indented)); } //File.WriteAllText(path, JsonConvert.SerializeObject(cabinet, Formatting.Indented)); }
private void ReadCabinetMakerDirectory() { string targetDirectory = _config.CabinetFilesDirectory(); Logger.Info("ReadCabinetMakerDirectory(string targetDirectory)"); Logger.Debug("targetDirectory: {0}", targetDirectory); if (!Directory.Exists(targetDirectory)) { return; } _filenameList.Clear(); string[] fileEntries = Directory.GetFiles(targetDirectory); foreach (string fileName in fileEntries) { _filenameList.Add(Path.GetFileNameWithoutExtension(fileName)); } RaisePropertyChanged(FilenameListPropertyName); }