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