private void CaptureDone(System.Drawing.Bitmap e) { const float parse_fps = 10.0f; float video_fps = me.fpsVideo; long max_size = me.trocearTamMB * 1048576; if (saving_picture) { saving_picture = false; string path = me.PicturePath; if (path != null && path != "") { DateTime dt = DateTime.Now; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string filename = path + "\\PIC_" + dt.Year.ToString("00") + dt.Month.ToString("00") + dt.Day.ToString("00") + "-" + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00") + ".jpg"; try { e.Save(filename, ImageFormat.Jpeg); } catch (Exception) { } } } if (starting_video) { starting_video = false; string path = me.VideosPath; if (path != null && path != "") { DateTime dt = DateTime.Now; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string filename = path + "\\VID_" + dt.Year.ToString("00") + dt.Month.ToString("00") + dt.Day.ToString("00") + "-" + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00") + ".avi"; avi_writer = new AviWriter(); avi_writer.avi_start(filename); saving_video = true; button15.Image = UAVConsole.Properties.Resources.video_red; } } else if (stoping_video) { saving_video = false; stoping_video = false; avi_writer.avi_close(); avi_writer = null; } else if (saving_video && DateTime.Now.Ticks > video_last_tick) { video_last_tick = DateTime.Now.Ticks + (long)(TimeSpan.TicksPerSecond / video_fps); if (me.trocearVideo && max_size > 0 && avi_writer.current_lenght > max_size) { avi_writer.avi_close(); avi_writer = new AviWriter(); DateTime dt = DateTime.Now; string filename = me.VideosPath + "\\VID_" + dt.Year.ToString("00") + dt.Month.ToString("00") + dt.Day.ToString("00") + "-" + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00") + ".avi"; avi_writer.avi_start(filename); } avi_writer.SaveFrame(e, me.calidadVideo); } if (modem is ModemVideo && DateTime.Now.Ticks > parse_last_tick) { parse_last_tick = DateTime.Now.Ticks + (long)(TimeSpan.TicksPerSecond / parse_fps); ((ModemVideo)modem).SetImage(e); } capture.GrapImg2(); }