public void Map(MappingsSource source) { MappedFiles = 0; foreach (var mapping in source.Mappings.Where(m => m.HasNewName && File.Exists(m.GetOriginalFileName())) .Select(GetFileInfo)) { File.Move(mapping.Source, mapping.Destination); MappedFiles++; } }
public void Publish(MappingsSource mappingsSource) { var directoryName = mappingsSource.Location; if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } using (var writer = new StreamWriter(mappingsSource.FullName, false)) { PublishLines(writer, SourceTranslator.GetHeaderInformation(mappingsSource)); PublishLines(writer, SourceTranslator.FormatMappings(mappingsSource)); PublishLines(writer, SourceTranslator.GetFooter(mappingsSource)); } }
public IEnumerable <string> FormatMappings(MappingsSource mappings) { return(mappings.Mappings .Select(m => string.Format("{0} {1} {2}", m.GetOriginalFileName(), Separator, m.GetDesiredFileName()))); }
public string[] GetFooter(MappingsSource mappings) { return(null); }
public string[] GetHeaderInformation(MappingsSource mappings) { return(null); }