public TapeMappingEx(TapeMapping tapeMapping)
 {
     foreach (var property in typeof(TapeMapping).GetTypeInfo().GetProperties(BindingFlags.Public | BindingFlags.Instance))
     {
         property.SetValue(this, property.GetValue(tapeMapping));
     }
 }
        public IEnumerable <TapeMapping> GetTapeMappings(string directoryPath)
        {
            List <TapeMapping> tapeMappings = new List <TapeMapping>();
            var srcdi = new DirectoryInfo(directoryPath);

            foreach (var subdi in srcdi.GetDirectories())
            {
                var renamesFileInfo = new FileInfo(Path.Combine(subdi.FullName, this.Settings.RenamesLogFileName));
                if (!renamesFileInfo.Exists)
                {
                    continue;
                }

                var content = string.Empty;
                using (var str = renamesFileInfo.OpenText())
                {
                    content = str.ReadToEnd();
                }
                var renames = JsonConvert.DeserializeObject <RenameResult[]>(content);


                foreach (var rename in renames)
                {
                    var tapeMapping = new TapeMapping();
                    tapeMapping.OriginalFileName = Path.GetFileName(rename.OldFilePath);
                    tapeMapping.OriginalTapeName = new FileInfo(rename.OldFilePath).Directory.Name;
                    tapeMapping.NewFileName      = Path.GetFileName(rename.NewFilePath);
                    tapeMapping.NewTapeName      = new FileInfo(rename.NewFilePath).Directory.Name;
                    tapeMapping.NewFilePath      = Path.Combine(subdi.FullName, tapeMapping.NewFileName);

                    tapeMappings.Add(tapeMapping);
                }
            }

            return(tapeMappings);
        }