public static DvdWrapper Create(string fullFilePath) { DvdWrapper wrapper = new DvdWrapper(); wrapper.Type = StringEnum.GetFileType(Path.GetExtension(fullFilePath)); if (wrapper.Type == FileType.VideoTs) { try { if (Path.GetFileName(fullFilePath).ToLower() != "video_ts.ifo") { return(null); } string rootPath = Path.GetDirectoryName(Path.GetDirectoryName(fullFilePath)); //EX: C:\\test\\BATMAN_3\\VIDEO_TS\Video_ts.ifo Turns into C:\\test\\BATMAN_3 if (rootPath != null) { string[] splitPath = rootPath.Split('\\'); //EX: [c:, test, BATMAN_3] wrapper.DisplayName = splitPath[splitPath.Length - 1]; //EX: Gets BATMAN_3 } wrapper.PathName = Path.GetDirectoryName(fullFilePath); } catch (Exception) { return(null); } } else if (wrapper.Type == FileType.BluRay) { try { string rootPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(fullFilePath))); //EX: C:\\test\\the dark knight\bdmv\stream\file.m2ts string[] splitPath = rootPath.Split('\\'); //EX: [c:, test, the dark knight] wrapper.DisplayName = splitPath[splitPath.Length - 1]; wrapper.PathName = rootPath; } catch (Exception) { return(null); } } else { wrapper.DisplayName = Path.GetFileName(fullFilePath); wrapper.PathName = fullFilePath; } wrapper.Progress = "Ready"; return(wrapper); }
public void AddFile(string fullFilePath) { DvdWrapper wrapper = DvdWrapper.Create(fullFilePath); if (wrapper == null) { return; } switch (wrapper.Type) { case FileType.Iso: IsoCount++; break; case FileType.BluRay: BdCount++; break; case FileType.VideoTs: IfoCount++; break; } DvdFolders.Add(wrapper); }