public FileAccessor(string realRootPath, string fallbackRootPath = null) { RealFileAbstractLayer = new FileAbstractLayer(realRootPath, false); if (!string.IsNullOrEmpty(fallbackRootPath) && Directory.Exists(fallbackRootPath)) { FallbackFileAbstractLayer = new FileAbstractLayer(fallbackRootPath, true); CombinedFileAbstractLayer = new[] { RealFileAbstractLayer, FallbackFileAbstractLayer }; } else { CombinedFileAbstractLayer = new[] { RealFileAbstractLayer }; } }
private static void WriteYamlXMLFileMap(string sourceMapFilePath, IDictionary <string, List <string> > xmlYamlFileMap) { if (!string.IsNullOrEmpty(sourceMapFilePath)) { var yamlXMLMapping = new Dictionary <string, string>(); foreach (var singleXMLMapping in xmlYamlFileMap) { var xmlFilePath = FileAbstractLayer.RelativePath(singleXMLMapping.Key, sourceMapFilePath, true); foreach (var yamlFile in singleXMLMapping.Value) { var mapKey = FileAbstractLayer.RelativePath(yamlFile, sourceMapFilePath, true); yamlXMLMapping[mapKey] = xmlFilePath; } } var json = JsonConvert.SerializeObject(new { files = yamlXMLMapping }, Formatting.Indented); File.WriteAllText(sourceMapFilePath, json); } }