/// <summary> /// XEF files processing method /// </summary> /// <param name="di"></param> public void ParseDirectory(DirectoryInfo di) { MessageShowing("Parsing Directory " + di.Name + ".\n"); var files = from f in di.EnumerateFiles() where f.Extension == ".xef" select f; foreach (FileInfo f in files) { MessageShowing("Processing " + f.Name + ".\n"); // Convert the file using (XEFDataConverter xdc = new XEFDataConverter() { UseVideo = videoFlag, UseSkeleton = skeletonFlag, UseDepth = depthFlag, UseAudio = audioFlag, ResumeConversion = resumeFlag }) { fileSavedName = textBoxSaveFolder.Text + "//" + objectNumber.Text; Thread newExt = new Thread(() => xdc.ConvertFile(f.FullName, fileSavedName)); newExt.Start(); //xdc.ConvertFile(f.FullName, fileSavedName); } MessageShowing("Done!\n"); } foreach (DirectoryInfo d in di.EnumerateDirectories()) { ParseDirectory(d); } }
/// <summary> /// 确认最少有一种模态被选择,且数据将被保存到所选文件夹中; /// </summary> /// <param name="xefFile"></param> public void ModalityCheck(string[] xefFile, string fileName) { if (checkBoxVideo.Checked) { videoFlag = true; } if (checkBoxSkeleton.Checked) { skeletonFlag = true; } if (checkBoxDepth.Checked) { depthFlag = true; } if (checkBoxAudio.Checked) { audioFlag = true; } if (allModalityCheck.Checked) { videoFlag = true; skeletonFlag = true; depthFlag = true; audioFlag = true; } // xef file path var path = xefFile[xefFile.Length - 1]; if (path.StartsWith("-")) { MessageShowing("No input file/directory provided.\n"); } else if (stdinFlag) { using (XEFDataConverter xdc = new XEFDataConverter() { UseVideo = videoFlag, UseSkeleton = skeletonFlag, UseDepth = depthFlag, UseAudio = audioFlag, ResumeConversion = resumeFlag }) { using (Stream stdin = Console.OpenStandardInput()) { Thread newExt = new Thread(() => xdc.ConvertFile(path, fileName, stdin)); newExt.Start(); // xdc.ConvertFile(path, fileName,stdin); } } } else if (Directory.Exists(@path)) { DirectoryInfo di = new DirectoryInfo(path); ParseDirectory(di); } else if (File.Exists(@path)) { FileInfo file = new FileInfo(@path); if (file.Extension != ".xef") { MessageShowing("File " + path + " is not a .xef file.\n"); return; } MessageShowing("Processing " + file.Name + "\n"); // Convert the file using (XEFDataConverter xdc = new XEFDataConverter() { UseVideo = videoFlag, UseSkeleton = skeletonFlag, UseDepth = depthFlag, UseAudio = audioFlag, ResumeConversion = resumeFlag }) { Thread newExt = new Thread(() => xdc.ConvertFile(file.FullName, fileName)); newExt.Start(); // xdc.ConvertFile(file.FullName, fileName); // start processing } // MessageShowing("Done.\n"); } else { MessageShowing("Input " + path + " Does not Exist.\n"); } }