示例#1
0
        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++;
            }
        }
示例#2
0
        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));
            }
        }
示例#3
0
 public IEnumerable <string> FormatMappings(MappingsSource mappings)
 {
     return(mappings.Mappings
            .Select(m => string.Format("{0} {1} {2}", m.GetOriginalFileName(), Separator, m.GetDesiredFileName())));
 }
示例#4
0
 public string[] GetFooter(MappingsSource mappings)
 {
     return(null);
 }
示例#5
0
 public string[] GetHeaderInformation(MappingsSource mappings)
 {
     return(null);
 }