Esempio n. 1
0
        //Reads data from a file history XML file
        public static FileHistory ReadFileHistory(string filePath)
        {
            if (!File.Exists(filePath))
            {
                FileHistory fh = new FileHistory();
                XMLWriter.WriteFileHistory(fh, filePath);
            }

            FileHistory      fileHistory   = new FileHistory();
            List <VideoFile> videoFileList = new List <VideoFile>();

            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(filePath);
            XmlNodeList xmlNodeList = xmldoc.ChildNodes;
            XmlNode     xmlNode     = xmlNodeList[1];

            if (xmlNode.Name == "file_history")
            {
                xmlNodeList = xmlNode.ChildNodes;

                for (int i = 0; i < xmlNodeList.Count; i++)
                {
                    if (i == 0)
                    {
                        xmlNode = xmlNodeList[0];
                        if (xmlNode.Name == "curr_folder")
                        {
                            fileHistory.Curr_Folder = xmlNode.InnerText;
                        }
                        else
                        {
                            throw new XMLFileFormatException("missing \"curr_folder\" element");
                        }
                    }
                    else
                    {
                        xmlNode = xmlNodeList[i];
                        if (xmlNode.Name == "program")
                        {
                            XmlNodeList xmlNodeList1 = xmlNode.ChildNodes;
                            VideoFile   videoFile    = new VideoFile();
                            foreach (XmlNode xmlNode1 in xmlNodeList1)
                            {
                                if (xmlNode1.Name == "path")
                                {
                                    videoFile.Path = xmlNode1.InnerXml;
                                }
                                else if (xmlNode1.Name == "name")
                                {
                                    videoFile.Name = xmlNode1.InnerXml;
                                }
                                else if (xmlNode1.Name == "ext")
                                {
                                    videoFile.Ext = xmlNode1.InnerXml;
                                }
                                else if (xmlNode1.Name == "length")
                                {
                                    videoFile.Length = xmlNode1.InnerXml;
                                }
                                else if (xmlNode1.Name == "subtitles")
                                {
                                    videoFile.Subtitles = xmlNode1.InnerXml;
                                }
                                else
                                {
                                    throw new XMLFileFormatException("unknown \"" + xmlNode1.Name + "\" element");
                                }
                            }
                            videoFileList.Add(videoFile);
                        }
                        else
                        {
                            throw new XMLFileFormatException("missing \"row\" element");
                        }
                    }
                }
                fileHistory.VideoFileList = videoFileList;
            }
            else
            {
                throw new XMLFileFormatException("missing \"file_history\" element");
            }
            return(fileHistory);
        }
Esempio n. 2
0
        //Reads data from a file history XML file
        public static FileHistory ReadFileHistory(string filePath)
        {
            if (!File.Exists(filePath))
            {
                FileHistory fh = new FileHistory();
                XMLWriter.WriteFileHistory(fh, filePath);
            }

            FileHistory fileHistory = new FileHistory();
            List<VideoFile> videoFileList = new List<VideoFile>();

            XmlDocument xmldoc = new XmlDocument();
            xmldoc.Load(filePath);
            XmlNodeList xmlNodeList = xmldoc.ChildNodes;
            XmlNode xmlNode = xmlNodeList[1];
            if (xmlNode.Name == "file_history")
            {
                xmlNodeList = xmlNode.ChildNodes;

                for (int i = 0; i < xmlNodeList.Count; i++)
                {
                    if (i == 0)
                    {
                        xmlNode = xmlNodeList[0];
                        if (xmlNode.Name == "curr_folder")
                            fileHistory.Curr_Folder = xmlNode.InnerText;
                        else throw new XMLFileFormatException("missing \"curr_folder\" element");
                    }
                    else
                    {
                        xmlNode = xmlNodeList[i];
                        if (xmlNode.Name == "program")
                        {
                            XmlNodeList xmlNodeList1 = xmlNode.ChildNodes;
                            VideoFile videoFile = new VideoFile();
                            foreach (XmlNode xmlNode1 in xmlNodeList1)
                            {
                                if (xmlNode1.Name == "path")
                                    videoFile.Path = xmlNode1.InnerXml;
                                else if (xmlNode1.Name == "name")
                                    videoFile.Name = xmlNode1.InnerXml;
                                else if (xmlNode1.Name == "ext")
                                    videoFile.Ext = xmlNode1.InnerXml;
                                else if (xmlNode1.Name == "length")
                                    videoFile.Length = xmlNode1.InnerXml;
                                else if (xmlNode1.Name == "subtitles")
                                    videoFile.Subtitles = xmlNode1.InnerXml;
                                else throw new XMLFileFormatException("unknown \"" + xmlNode1.Name + "\" element");
                            }
                            videoFileList.Add(videoFile);
                        }
                        else
                        {
                            throw new XMLFileFormatException("missing \"row\" element");
                        }
                    }

                }
                fileHistory.VideoFileList = videoFileList;

            }
            else throw new XMLFileFormatException("missing \"file_history\" element");
            return fileHistory;
        }
Esempio n. 3
0
        //Reads data from a schedule XML file
        public static Schedule ReadSchedule(string filePath)
        {
            if (!File.Exists(filePath))
            {
                Schedule s = new Schedule();
                for (int i = 0; i < 7; i++)
                {
                    DailyVideoFiles d = new DailyVideoFiles();
                    s.DailyVideoFilesList.Add(d);
                }
                XMLWriter.WriteSchedule(s, filePath);
            }

            Schedule schedule = new Schedule();
            List <DailyVideoFiles> dailyVideoFilesList = new List <DailyVideoFiles>();


            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(filePath);
            XmlNodeList xmlNodeList_Day = xmldoc.ChildNodes;
            XmlNodeList xmlNodeList_Program;
            XmlNode     xmlNode_Day = xmlNodeList_Day[1];
            XmlNode     xmlNode_Program;

            if (xmlNode_Day.Name == "schedule")
            {
                xmlNodeList_Day = xmlNode_Day.ChildNodes;
                DailyVideoFiles dailyVideoFiles = new DailyVideoFiles();
                for (int i = 0; i < 7; i++)
                {
                    dailyVideoFiles = new DailyVideoFiles();
                    xmlNode_Day     = xmlNodeList_Day[i];

                    if (xmlNode_Day.Name == "day")
                    {
                        //System.Windows.MessageBox.Show("day");
                        List <VideoFile> videoFileList = new List <VideoFile>();
                        xmlNodeList_Program = xmlNode_Day.ChildNodes;
                        for (int j = 0; j < xmlNodeList_Program.Count; j++)
                        {
                            //videoFileList = new List<VideoFile>();
                            if (j == 0)
                            {
                                xmlNode_Program = xmlNodeList_Program[0];
                                if (xmlNode_Program.Name == "date")
                                {
                                    dailyVideoFiles.Date = xmlNode_Program.InnerText;
                                }
                                else
                                {
                                    throw new XMLFileFormatException("missing \"date\" element");
                                }
                            }
                            else
                            {
                                xmlNode_Program = xmlNodeList_Program[j];
                                if (xmlNode_Program.Name == "program")
                                {
                                    //System.Windows.MessageBox.Show("program");
                                    XmlNodeList xmlNodeList1 = xmlNode_Program.ChildNodes;
                                    VideoFile   videoFile    = new VideoFile();
                                    foreach (XmlNode xmlNode1 in xmlNodeList1)
                                    {
                                        if (xmlNode1.Name == "path")
                                        {
                                            videoFile.Path = xmlNode1.InnerXml;
                                        }
                                        else if (xmlNode1.Name == "name")
                                        {
                                            videoFile.Name = xmlNode1.InnerXml;
                                        }
                                        else if (xmlNode1.Name == "ext")
                                        {
                                            videoFile.Ext = xmlNode1.InnerXml;
                                        }
                                        else if (xmlNode1.Name == "length")
                                        {
                                            videoFile.Length = xmlNode1.InnerXml;
                                        }
                                        else if (xmlNode1.Name == "subtitles")
                                        {
                                            videoFile.Subtitles = xmlNode1.InnerXml;
                                        }
                                        else if (xmlNode1.Name == "start_time")
                                        {
                                            videoFile.Start_Time = xmlNode1.InnerXml;
                                        }
                                        else if (xmlNode1.Name == "end_time")
                                        {
                                            videoFile.End_Time = xmlNode1.InnerXml;
                                        }
                                        else if (xmlNode1.Name == "category")
                                        {
                                            videoFile.Category = xmlNode1.InnerXml;
                                        }
                                        else if (xmlNode1.Name == "col")
                                        {
                                            videoFile.Col = int.Parse(xmlNode1.InnerXml);
                                        }
                                        else if (xmlNode1.Name == "row")
                                        {
                                            videoFile.Row = int.Parse(xmlNode1.InnerXml);
                                        }
                                        else if (xmlNode1.Name == "index")
                                        {
                                            videoFile.Index = int.Parse(xmlNode1.InnerXml);
                                        }
                                        else
                                        {
                                            throw new XMLFileFormatException("unknown \"" + xmlNode1.Name + "\" element");
                                        }
                                    }
                                    videoFileList.Add(videoFile);
                                }
                                else
                                {
                                    throw new XMLFileFormatException("missing \"program\" element");
                                }
                            }
                        } //end reading programs in a day
                        dailyVideoFiles.VideoFileList = videoFileList;
                    }
                    else
                    {
                        throw new XMLFileFormatException("missing \"day\" element");
                    }
                    //end reading every day's programs in a week

                    if (dailyVideoFiles.VideoFileList.Count != 0)
                    {
                        schedule.DailyVideoFilesList.Add(dailyVideoFiles);
                    }
                }
            }
            else
            {
                throw new XMLFileFormatException("missing \"schedule\" element");
            }

            return(schedule);
        }
Esempio n. 4
0
        void g_Drop(object sender, DragEventArgs e) {
            
            Grid g = (Grid)sender;
            String[] data = getData(e);
            string tag = data[0];
            string p = data[1];
            string time = data[2];
            //MessageBox.Show(time);
            
            int len = getLength(time);
            int idx = table1.Children.IndexOf(g);

            //delete previous data record
            if (tag.Equals("dgr"))
            {
                //do nothing
            }
            else
            {
                int index = int.Parse(tag.Substring(3));
                int video_idx = index + 48 * previous_day;
                g_cleanPrevious(index, len);
                videoList[video_idx] = null;
            }

            //set new data record
            tag = "hdr" + idx;
            //---------------update header--------------------//
            g.Tag = tag;
            g.Background = brush;
            g.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(ddh.g_PreviewMouseLeftButtonDown);
            g.PreviewMouseMove += new MouseEventHandler(ddh.g_PreviewMouseMove);

            //update three columns inside grid
            TextBlock name = (TextBlock)g.Children[0];
            name.Text = MIExtractor.ExtractInfo(p)[0];

            TextBlock duration = (TextBlock)g.Children[1];
            duration.Text = time;

            TextBlock path = (TextBlock)g.Children[2];
            path.Text = data[1];


            //Right Click Menu
            ContextMenu menu = new System.Windows.Controls.ContextMenu();
            //Delete
            MenuItem del = new MenuItem();
            del.Header = "Delete";
            del.Click += new RoutedEventHandler(g_delClick);
            del.Tag = "delete#" + idx;
            menu.Items.Add(del);

            //Properties
            MenuItem prop = new MenuItem();
            prop.Header = "Properties";
            prop.Click += new RoutedEventHandler(g_propClick);
            prop.Tag = data[1];
            menu.Items.Add(prop);

            g.ContextMenu = menu;

            //----------------update sub_tb------------------------//
            g_updateSub(g, data);

            //------------------Update Video--------------------/*/
            VideoFile v = new VideoFile();

            v.Path = data[1];
            v.Name = data[1].Substring(data[1].LastIndexOf('\\') + 1);
            v.Length = data[2];
            v.Ext = data[1].Substring(data[1].LastIndexOf('.') + 1);
            v.Col = previous_day;
            v.Row = Grid.GetRow(g);
            v.Index = idx + v.Col*48;

            int hr = v.Row / 2;
            int min;
            if (v.Row % 2 == 0)
            {
                min = 0;
            }
            else min = 30;
            v.Start_Time = hr.ToString() + ":" + min.ToString() + ":00";

            int end_hr, end_min, end_sec;

            end_hr = int.Parse(v.Length.Substring(0, 2)) + hr;
            end_min = int.Parse(v.Length.Substring(3, 2)) + min;
            end_sec = int.Parse(v.Length.Substring(6, 2));

            v.End_Time = end_hr.ToString() + ":" + end_min.ToString() + ":" + end_sec.ToString();

            videoList[v.Index] = v;
        
        }
Esempio n. 5
0
        //Reads data from a schedule XML file   
        public static Schedule ReadSchedule(string filePath)
        {
            if (!File.Exists(filePath))
            {
                Schedule s = new Schedule();
                for (int i = 0; i < 7; i++)
                {
                    DailyVideoFiles d = new DailyVideoFiles();
                    s.DailyVideoFilesList.Add(d);
                }
                XMLWriter.WriteSchedule(s, filePath);
            }

            Schedule schedule = new Schedule();
            List<DailyVideoFiles> dailyVideoFilesList = new List<DailyVideoFiles>();


            XmlDocument xmldoc = new XmlDocument();
            xmldoc.Load(filePath);
            XmlNodeList xmlNodeList_Day = xmldoc.ChildNodes;
            XmlNodeList xmlNodeList_Program;
            XmlNode xmlNode_Day = xmlNodeList_Day[1];
            XmlNode xmlNode_Program;
            if (xmlNode_Day.Name == "schedule")
            {
                xmlNodeList_Day = xmlNode_Day.ChildNodes;
                DailyVideoFiles dailyVideoFiles = new DailyVideoFiles();
                for (int i = 0; i < 7; i++)
                {
                    dailyVideoFiles = new DailyVideoFiles();
                    xmlNode_Day = xmlNodeList_Day[i];

                    if (xmlNode_Day.Name == "day")
                    {
                        //System.Windows.MessageBox.Show("day");
                        List<VideoFile> videoFileList = new List<VideoFile>();
                        xmlNodeList_Program = xmlNode_Day.ChildNodes;
                        for (int j = 0; j < xmlNodeList_Program.Count; j++)
                        {
                            //videoFileList = new List<VideoFile>();
                            if (j == 0)
                            {
                                xmlNode_Program = xmlNodeList_Program[0];
                                if (xmlNode_Program.Name == "date")
                                    dailyVideoFiles.Date = xmlNode_Program.InnerText;
                                else throw new XMLFileFormatException("missing \"date\" element");
                            }
                            else
                            {
                                xmlNode_Program = xmlNodeList_Program[j];
                                if (xmlNode_Program.Name == "program")
                                {
                                    //System.Windows.MessageBox.Show("program");
                                    XmlNodeList xmlNodeList1 = xmlNode_Program.ChildNodes;
                                    VideoFile videoFile = new VideoFile();
                                    foreach (XmlNode xmlNode1 in xmlNodeList1)
                                    {
                                        if (xmlNode1.Name == "path")
                                            videoFile.Path = xmlNode1.InnerXml;
                                        else if (xmlNode1.Name == "name")
                                            videoFile.Name = xmlNode1.InnerXml;
                                        else if (xmlNode1.Name == "ext")
                                            videoFile.Ext = xmlNode1.InnerXml;
                                        else if (xmlNode1.Name == "length")
                                            videoFile.Length = xmlNode1.InnerXml;
                                        else if (xmlNode1.Name == "subtitles")
                                            videoFile.Subtitles = xmlNode1.InnerXml;
                                        else if (xmlNode1.Name == "start_time")
                                            videoFile.Start_Time = xmlNode1.InnerXml;
                                        else if (xmlNode1.Name == "end_time")
                                            videoFile.End_Time = xmlNode1.InnerXml;
                                        else if (xmlNode1.Name == "category")
                                            videoFile.Category = xmlNode1.InnerXml;
                                        else if (xmlNode1.Name == "col")
                                            videoFile.Col = int.Parse(xmlNode1.InnerXml);
                                        else if (xmlNode1.Name == "row")
                                            videoFile.Row = int.Parse(xmlNode1.InnerXml);
                                        else if (xmlNode1.Name == "index")
                                            videoFile.Index = int.Parse(xmlNode1.InnerXml);
                                        else throw new XMLFileFormatException("unknown \"" + xmlNode1.Name + "\" element");
                                    }
                                    videoFileList.Add(videoFile);
                                }
                                else
                                {
                                    throw new XMLFileFormatException("missing \"program\" element");
                                }
                            }
                        } //end reading programs in a day
                        dailyVideoFiles.VideoFileList = videoFileList;
                    }
                    else
                    {
                        throw new XMLFileFormatException("missing \"day\" element");
                    }
                    //end reading every day's programs in a week

                    if (dailyVideoFiles.VideoFileList.Count != 0)
                    {
                        schedule.DailyVideoFilesList.Add(dailyVideoFiles);
                    }
                }
            }
            else
                throw new XMLFileFormatException("missing \"schedule\" element");

            return schedule;
        }
Esempio n. 6
0
        void init_dgr2(File_List fl, string dgr_tag)
        {
            foreach (File_List f in safl)
            {
                if (f.path == fl.path)
                    return;
            }

            if (fl.len.Equals("Automati")) return;

            
            DataGridRow dgr = new DataGridRow();
            dgr.Tag = dgr_tag;
            dgr.Background = Brushes.Gray;
            dgr.Item = fl;

            if (File.Exists(fl.path))
            {
                dgr.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(ddh.dataGrid1_PreviewMouseLeftButtonDown);
                dgr.PreviewMouseMove += new MouseEventHandler(ddh.dataGrid1_PreviewMouseMove);
            }
            else dgr.ToolTip = "File Does not exist!";

            //Mouse Over Event Listeners
            dgr.MouseEnter += new MouseEventHandler(dgr_MouseEnter2);
            dgr.MouseLeave += new MouseEventHandler(dgr_MouseLeave);

            dgr.MouseDoubleClick += new MouseButtonEventHandler(dgr_MouseDoubleClick);
            dataGrid2.Items.Add(dgr);
            int dgr_index = dataGrid2.Items.IndexOf(dgr);

            //Right Click Menu
            ContextMenu m = new System.Windows.Controls.ContextMenu();

            //Delete
            MenuItem del = new MenuItem();
            del.Header = "Delete";
            del.Click += new RoutedEventHandler(del_click2);
            del.Tag = "delete#" + dgr_index;
            m.Items.Add(del);

            //Properties
            MenuItem prop = new MenuItem();
            prop.Header = "Properties";
            prop.Click += new RoutedEventHandler(prop_Click);
            prop.Tag = fl.path;
            m.Items.Add(prop);

            //Edit File Name

            VideoFile vfl = new VideoFile();
            vfl.Path = fl.path;
            vfl.Name = fl.Name;
            vfl.Length = fl.len;
            vfl.Ext = fl.path.Substring(fl.path.LastIndexOf('.') + 1);

            fh2.VideoFileList.Add(vfl);
            XMLWriter.WriteFileHistory(fh2, "C:\\PeopleBAWX\\ad_log.xml");

            dgr.ContextMenu = m;
            safl.Add(fl);

        }
Esempio n. 7
0
        void read_adhistory()
        {
            FileHistory fileHistory = new FileHistory();

            fileHistory = XMLReader.ReadFileHistory("C:\\PeopleBAWX\\ad_log.xml");
            VideoFile[] vf = new VideoFile[1024];

            fileHistory.VideoFileList.CopyTo(vf);

            File_List vfl = new File_List();

            for (int i = 0; vf[i] != null; i++)
            {

                Uri src = get_img_src(vf[i].Path);

                //mediaElement1.Source = new Uri(vf[i].Path.ToString());

                vfl = (new File_List()
                {
                    Name = vf[i].Name,
                    path = vf[i].Path,
                    len = vf[i].Length,
                    img = new BitmapImage(src),
                });

                string dgr_tag = vf[i].Path + "#" + vf[i].Length;

                init_dgr2(vfl, dgr_tag);
            }
        }
Esempio n. 8
0
        private void s_save_export()
        {
            //loadig the week schedule copy to the videoList and dailyList
            sc.DailyVideoFilesList = new List<DailyVideoFiles>();
            String[] dates = new String[7];
            dates = generate_dates(schedule_file);

            for (int i = 0; i < 7; i++)
            {
                dailyList[i] = new DailyVideoFiles();
            }

            VideoFile v = new VideoFile();
            foreach (VideoFile video in videoList)
            {
                if (video != null)
                {
                    v.Path = video.Path.Substring(video.Path.LastIndexOf("\\") + 1);
                    v.Name = video.Name;
                    v.Ext = video.Ext;
                    v.Length = video.Length;
                    v.Start_Time = video.Start_Time;
                    v.End_Time = video.End_Time;
                    v.Col = video.Col;
                    v.Row = video.Row;
                    v.Index = video.Index;

                    int day = video.Col - 1;
                    dailyList[day].Date = dates[day];
                    dailyList[day].VideoFileList.Add(v);
                }
            }
            for (int i = 0; i < 7; i++)
            {
                sc.DailyVideoFilesList.Add(dailyList[i]);
            }
            //MessageBox.Show("this is schedule_file " + schedule_file);
            string file = "C:\\PeopleBAWX\\" + schedule_file + "_s.xml";
            XMLWriter.WriteSchedule(sc, file);
        }
Esempio n. 9
0
        private void tb_Drop(object sender, DragEventArgs e)
        {

            TextBlock t = (TextBlock)sender;
            
            String[] data = getData(e);
            string tag = data[0];
            string path = data[1];
            string time = data[2];
            int len = getLength(time);
            int idx = table2.Children.IndexOf(t);

            //delete previous data record
            if (tag.Equals("dgr"))
            {
                //do nothing
            }
            else
            {
                int index = int.Parse(tag.Substring(3));
                tb_cleanPrevious(index, len);
                videoList[index] = null;
            }

            infoBug.Text = "indext of t in table2 " + table2.Children.IndexOf(t);
            //set new data record
            tag = "hdr" + idx;

            //updateData(data, e);
            //---------------update header--------------------//
            t.Tag = tag + "#" + data[1] + "#" + data[2];

            

            t.Background = brush;
            t.Foreground = Brushes.White;
            //MessageBox.Show(path);
            t.Text = MIExtractor.ExtractInfo(path)[0];
            t.TextWrapping = TextWrapping.Wrap;
            t.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(ddh.header_PreviewMouseLeftButtonDown);
            t.PreviewMouseMove += new MouseEventHandler(ddh.header_PreviewMouseMove);

            //Right Click Menu
            ContextMenu menu = new System.Windows.Controls.ContextMenu();
            //Delete
            MenuItem del = new MenuItem();
            del.Header = "Delete";
            del.Click += new RoutedEventHandler(tb_delClick);
            del.Tag = "delete#" + idx;
            menu.Items.Add(del);

            //Properties
            MenuItem prop = new MenuItem();
            prop.Header = "Properties";
            prop.Click += new RoutedEventHandler(tb_propClick);
            prop.Tag = data[1];
            menu.Items.Add(prop);

            t.ContextMenu = menu;

            //----------------update sub_tb------------------------//
            tb_updateSub(t, data);
            
            
            //------------------Update Video--------------------//
            VideoFile v = new VideoFile();

            v.Path = data[1];
            v.Name = data[1].Substring(data[1].LastIndexOf('\\') + 1);
            v.Length = data[2];
            v.Ext = data[1].Substring(data[1].LastIndexOf('.') + 1);
            v.Col = Grid.GetColumn(t);
            v.Row = Grid.GetRow(t);
            v.Index = idx;
            int hr = v.Row / 2;
            int min;
            if (v.Row % 2 == 0)
            {
                min = 0;
            }
            else min = 30;
            v.Start_Time = hr.ToString() + ":" + min.ToString() + ":00";

            int end_hr, end_min, end_sec;

            end_hr = int.Parse(v.Length.Substring(0, 2)) + hr;
            end_min = int.Parse(v.Length.Substring(3, 2)) + min;
            end_sec = int.Parse(v.Length.Substring(6, 2));

            v.End_Time = end_hr.ToString() + ":" + end_min.ToString() + ":" + end_sec.ToString();

            videoList[idx] = v;
        }
Esempio n. 10
0
        private void fill_ads(TimeSpan ts1, TimeSpan ts2, VideoFile v1, VideoFile v2, DailyVideoFiles[] list)
        {
            TimeSpan diff = ts2.Subtract(ts1);

            FileHistory fileHistory = new FileHistory();
            fileHistory = XMLReader.ReadFileHistory("ad_log.xml");
            VideoFile[] vf = new VideoFile[1024];

            TimeSpan[] lengths = new TimeSpan[vf.Count()];
            fileHistory.VideoFileList.CopyTo(vf);

            TimeSpan max = lengths[0];

            VideoFile ad = new VideoFile();

            for (int i = 0; vf[i] != null; i++)
            {
                //MessageBox.Show(vf[i].Col.ToString());
                String[] length = vf[i].Length.Split(':');
                lengths[i] = new TimeSpan(int.Parse(length[0]), int.Parse(length[1]), int.Parse(length[2]));
                if (lengths[i] > max && lengths[i] < diff)
                {
                    max = lengths[i];
                    ad = vf[i];
                }
            }
            MessageBox.Show(max.ToString());
        }