private void CopyFrames(string resolution, PartsCsv partsCsv, string inputFolder) { Debug.WriteLine($"Processing folder: {inputFolder}, resolution: {resolution}"); resolution = resolution.ToUpper(); var SHD_sourceFolder = FindDirectoryEndingIn($"-{resolution}", inputFolder); var files = Directory.GetFiles(SHD_sourceFolder, "*.png"); foreach (var file in files) { var frame = FrameFile.Parse(file); if (frame == null) { continue; } if (!partsCsv.ShouldCopy(frame.Model)) { continue; } var frame0 = ""; var modelName = GetModelName(inputFolder); var modelConfig = _real3DConfig.FirstOrDefault(dv1 => dv1.Model == modelName); if (modelConfig != null && !string.IsNullOrWhiteSpace(modelConfig.FrameSetup)) { var tmp = modelConfig.FrameSetup.Split(",".ToCharArray()); frame0 = $".{tmp[2].Trim()}."; } else { frame0 = ".8."; } if (file.Contains(frame0)) { File.Copy(file, Path.Combine(inputFolder, "V5", "PACKSOURCE", resolution, "Frame0", Path.GetFileName(file)), true); } else { File.Copy(file, Path.Combine(inputFolder, "V5", "PACKSOURCE", resolution, "Frame1", Path.GetFileName(file)), true); } } }
public static FrameFile Parse(string file) { var rgxNum = new Regex(@"\.(\d+)\.png"); var newFrame = new FrameFile(); newFrame.FileName = file; var rslt = rgxNum.Match(file); if (rslt.Success == false) { return(null); } newFrame.XNumber = rslt.Groups[1].Value; newFrame.FrameName = Path.GetFileName(file).Split(".".ToCharArray())[0]; newFrame.Model = Path.GetFileName(file).Split(".".ToCharArray())[0]; return(newFrame); }