public static void ProcessFiles(FileInfo[] files, int speedupFactor, Rational outputFramesPerSecond) { var i = 1; var filesCount = files.Count(); var engine = new HyperlapseEngine(); engine.ProcessingCancelled += OnEngineProcessingCancelled; engine.ProcessingFailed += OnEngineProcessingFailed; engine.ProcessingFinished += OnEngineProcessingFinished; engine.ProgressChanged += OnEngineProgressChanged; engine.TrialStatusChanged += OnEngineTrialStatusChanged; foreach (var file in files) { var processingMsg = "[Processing file " + i++ + " of " + filesCount + "] - " + file.Name; Console.Title = processingMsg; Console.WriteLine(processingMsg); var fileOutput = new FileInfo(Path.Combine(file.DirectoryName, "Output", file.Name)); if (!fileOutput.Directory.Exists) { fileOutput.Directory.Create(); // create output dir } Process(engine, file, fileOutput, speedupFactor, outputFramesPerSecond); } engine.Dispose(); }
public static void loadAllTextureFilesToManager( ContentManager content, string path, FileInfo[] fileList, GenericManager<string, Texture2D> textureManager, string extension = null, bool append = false ) { // Start loadAllTextureFiles. if ( !append ) { textureManager.unlockList(); textureManager.clearList(); } else textureManager.unlockList(); int listCount = fileList.Count(); for (int i = 0; i < listCount; i++) { if( extension != null ) if( fileList[i].Extension != extension ) return; textureManager.addObject( fileList[i].ToString(), content.Load<Texture2D>( path + fileList[i].Name ) ); } textureManager.lockList(); }
private static bool compareSourceAndTarget(FileInfo[] source, FileInfo[] target) { if (source == null && target == null) return true; if (source.Count() != target.Count()) return false; int files = source.Count(); return true; }
public ResponseMultiFile DownloadFiles(RequestFiles request) { // DirectoryInfo directoryInfo = new DirectoryInfo(@"C:\Users\77\Desktop\PDF"); // FileInfo[] files = directoryInfo.GetFiles("*.*", SearchOption.AllDirectories); SetPath(request.pathflag); FileInfo[] files = new FileInfo[request.FilePath.Count]; for (int i = 0; i < request.FilePath.Count; i++) { files[i] = (new FileInfo(Path.Combine(path, request.FilePath[i].ToString()))); } ResponseMultiFile[] result = new ResponseMultiFile[files.Count<FileInfo>()]; FileStream stream = this.GetFileStream(Path.GetFullPath(files[request.idx].FullName)); stream.Seek(request.byteStart, SeekOrigin.Begin); result[request.idx] = new ResponseMultiFile(); result[request.idx].FileName = files[request.idx].FullName; result[request.idx].Length = stream.Length; result[request.idx].FileByteStream = stream; ResponseMultiFile retval = result[request.idx]; return retval; }
/// <summary> /// reason : To show all frames of video in panel /// </summary> /// <param name="files"></param> /// <param name="imageName"></param> private void ShowAllFramesOnPanel(FileInfo[] files,string imageName) { flowLayoutPanel1.BringToFront(); try { PictureBox[] pics = new PictureBox[files.Count()]; FlowLayoutPanel[] flws = new FlowLayoutPanel[files.Count()]; Label[] lbl = new Label[files.Count()]; _faceDetection = new FaceDetection(appStartPath); int brh = 0; for (int i = 0; i < files.Count(); i++) { if (!File.Exists(files[i].FullName)) continue; noOfFaces = 0; newFrame = null; _faceDetection.DetectFace(appStartPath, files[i].FullName, ref noOfFaces, ref newFrame); flws[i] = new FlowLayoutPanel(); flws[i].Name = "flw" + i; flws[i].Location = new Point(3, brh); flws[i].Size = new Size(217, 210); flws[i].BackColor = Color.DarkCyan; flws[i].BorderStyle = BorderStyle.Fixed3D; lbl[i] = new Label(); lbl[i].Name = files[i].Name; lbl[i].Size = new Size(100, 35); lbl[i].Text = "Frame " + i + " Contains " + noOfFaces + " Face(s)"; pics[i] = new PictureBox(); pics[i].Name = files[i].FullName; pics[i].Size = new Size(217, 175); pics[i].Image = newFrame==null? System.Drawing.Image.FromFile(files[i].FullName): newFrame; pics[i].SizeMode = PictureBoxSizeMode.StretchImage; flws[i].Controls.Add(lbl[i]); flws[i].Controls.Add(pics[i]); this.Controls.Add(flws[i]); flowLayoutPanel1.Controls.Add(flws[i]); } } catch(Exception) { } }