Пример #1
0
        public void load_schedule(string f)
        {
            videoList = new VideoFile[1024];

            for (int i = 0; i < 7; i++)
            {
                dailyList[i] = new DailyVideoFiles();
            }
            Schedule s = new Schedule();
            s = XMLReader.ReadSchedule(f);
            List<DailyVideoFiles> list = s.DailyVideoFilesList;

            list.CopyTo(dailyList, 0);

            foreach (DailyVideoFiles dailyFile in list)
            {
                //MessageBox.Show("how many days?" + dailyFile.VideoFileList.Count);
                foreach (VideoFile v in dailyFile.VideoFileList)
                {
                    int index = v.Index;
                    videoList[index] = v;
                }
            }

            get_diff(dailyList);

        }
Пример #2
0
        public void get_diff(DailyVideoFiles[] list)
        {
            String t1 = "", t2 = "";
            int flag = 1;
            //VideoFile v1;
            VideoFile v2 = null;

            foreach (DailyVideoFiles dailyFile in list)
            {
                foreach (VideoFile v in dailyFile.VideoFileList)
                {
                    int index = v.Index;
                    t1 = v.End_Time;

                    foreach (VideoFile v1 in dailyFile.VideoFileList)
                    {
                        if (v1.Index > index)
                        {
                            flag = 0;
                            t2 = v1.Start_Time;
                            v2 = v1;
                            break;
                        }
                    }
                    if (flag == 0)
                    {
                        flag = 1;
                        String[] time1 = t1.Split(':');
                        String[] time2 = t2.Split(':');
                        TimeSpan ts1 = new TimeSpan(int.Parse(time1[0]), int.Parse(time1[1]), int.Parse(time1[2]));
                        TimeSpan ts2 = new TimeSpan(int.Parse(time2[0]), int.Parse(time2[1]), int.Parse(time2[2]));

                        fill_ads(ts1, ts2, v, v2, list);
                    }
                }
            }
        }
Пример #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);
        }
Пример #4
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;
        }
Пример #5
0
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            /*
            UpdatePlayerUriDelegate update = new UpdatePlayerUriDelegate(UpdateNowPlaying);
            Dispatcher meDispatcher = mediaElement.Dispatcher;
            meDispatcher.BeginInvoke(update, "C:\\1.wmv");
            */
            
            int prevDay;
            string[] timeSplit;
            int[] timeInInt;
            int videoCount;
            bool isNewDay = true;

            UpdatePlayerUriDelegate updateNowPlaying = new UpdatePlayerUriDelegate(UpdateNowPlaying);
            Dispatcher mediaElementDispatcher = mediaElement.Dispatcher;

            UpdateCurrentTimeDelegate updateDisplayTime = new UpdateCurrentTimeDelegate(UpdateDisplayTime);
            Dispatcher displayTimeDispatcher = displayTime.Dispatcher;    

            do
            {
                //get videos ready
                prevDay = DateTime.Now.Day;
                string scheduleFileName = "C:\\PeopleBAWX\\" + Utilities.GetMonday(DateTime.Now) + ".xml";
                dvf = Utilities.GetTodayScheduleList(
                    scheduleFileName, Utilities.FormatDateYMD(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day));

                if (dvf == null)
                {
                    if (isNewDay)
                    {
                        MessageBox.Show("Nothing to broadcast today!");
                        videoCount = 0;
                        isNewDay = false;
                    }
                    displayTimeDispatcher.BeginInvoke(updateDisplayTime,
                            String.Format("{0:00}", DateTime.Now.Hour) + ":" + String.Format("{0:00}", DateTime.Now.Minute) + ":" + String.Format("{0:00}", DateTime.Now.Second));

                    Thread.Sleep(1000); //wait for 1 sec
                }
                else //do the broadcasting
                {
                    isNewDay = false;
                    videoCount = dvf.VideoFileList.Count;
                    filesTime = new DateTime[videoCount];
                    filesLength = new DateTime[videoCount];
                    filesPath = new string[videoCount];

                    for (int i = 0; i < videoCount; i++)
                    {
                        VideoFile vf = dvf.VideoFileList.ElementAt(i);
                        timeSplit = vf.Start_Time.Split(':');
                        timeInInt = new int[3];
                        for (int j = 0; j < 3; j++)
                        {
                            timeInInt[j] = Int32.Parse(timeSplit[j]);
                        }
                        filesTime[i] = new DateTime(
                            DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 
                            timeInInt[0], timeInInt[1], timeInInt[2]);
                        filesPath[i] = vf.Path;

                        timeSplit = vf.Length.Split(':');
                        timeInInt = new int[3];
                        for (int j = 0; j < 3; j++)
                        {
                            timeInInt[j] = Int32.Parse(timeSplit[j]);
                        }
                        filesLength[i] = new DateTime(
                            DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day,
                            timeInInt[0], timeInInt[1], timeInInt[2]);
                    }                                    

                    int videoChecked = 0;

                    while (true)
                    {
                        if (comingUpNext.ToLongTimeString() == DateTime.Now.ToLongTimeString())
                        {
                            string path = Directory.GetCurrentDirectory() + "..\\Assets\\ComingUp.jpg";
                            mediaElementDispatcher.BeginInvoke(updateNowPlaying, path);
                        }

                        if (DateTime.Now.Day != prevDay) //next day reached
                        {
                            isNewDay = true;
                            break;
                        }
                        else if (videoChecked == videoCount)
                        {
                            //all the videos for today have been broadcasted
                            //wait for the next day
                        }
                        else
                        {
                            //the schedule for today came late
                            //some shows scheduled early need not be broadcast
                            if (filesTime[videoChecked].Hour < DateTime.Now.Hour ||
                                (filesTime[videoChecked].Hour == DateTime.Now.Hour &&
                                 filesTime[videoChecked].Minute < DateTime.Now.Minute) ||
                                (filesTime[videoChecked].Hour == DateTime.Now.Hour &&
                                 filesTime[videoChecked].Minute == DateTime.Now.Minute &&
                                 filesTime[videoChecked].Second < DateTime.Now.Second))
                            {
                                videoChecked++;
                                continue; //skip this iteration
                            }

                            //the time for broadcasting this particular video is reached
                            if (filesTime[videoChecked].ToLongTimeString() == DateTime.Now.ToLongTimeString())
                            {
                                mediaElementDispatcher.BeginInvoke(updateNowPlaying, "C:\\PeopleBAWX\\" + filesPath[videoChecked]);
                                comingUpNext = DateTime.Now.Add(new TimeSpan(
                                    filesLength[videoChecked].Hour, filesLength[videoChecked].Minute, filesLength[videoChecked].Second));
                                videoChecked++;
                            }                            
                        }
                        displayTimeDispatcher.BeginInvoke(updateDisplayTime,
                            String.Format("{0:00}", DateTime.Now.Hour) + ":" + String.Format("{0:00}", DateTime.Now.Minute) + ":" + String.Format("{0:00}", DateTime.Now.Second));

                        Thread.Sleep(1000); //wait for 1 sec
                    }
                }                
             
            } while (true);
            
        }
Пример #6
0
        private void UpdateScheduleList(DailyVideoFiles dvf)
        {
            /*
            MessageBox.Show(scheduleList.Children.Count + "");
            string list = "";
            for (int i = 0; i < scheduleList.Children.Count; i++)
            {
                 list += ("i=" + i + ": " + scheduleList.Children[i].ToString() + "\n");
                 if ((i+1) % 40 == 0)
                 {
                     MessageBox.Show(list);
                     list = "";
                 }
            }
            MessageBox.Show(list);
            */
            
            
            foreach (VideoFile vf in dvf.VideoFileList)
            {
                //MessageBox.Show(vf.Row + "");
                TextBlock tb = (TextBlock) scheduleList.Children[24 + vf.Row];
                tb.Text = vf.Path;
                tb.Background = Brushes.DeepPink;

                int noOfTextBlock = GetNoOfOccupiedTextBlock(vf.Length);
                //MessageBox.Show("noOfTextBlock:" + noOfTextBlock);
                if (noOfTextBlock > 1)
                {
                    Grid.SetRowSpan(tb, noOfTextBlock);
                    for (int i = 1; i < noOfTextBlock; i++)
                    {
                        TextBlock tb1 = (TextBlock)scheduleList.Children[24 + vf.Row + i];
                        tb1.Text = "";
                        tb1.Background = Brushes.Transparent;
                    }
                }
            }
             
        }
Пример #7
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);
        }
Пример #8
0
        private void s_save()
        {
            //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();
            }

            foreach (VideoFile video in videoList)
            {
                if (video != null)
                {
                    int day = video.Col - 1;
                    dailyList[day].Date = dates[day];
                    dailyList[day].VideoFileList.Add(video);
                }
            }
            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 + ".xml";
            XMLWriter.WriteSchedule(sc, file);

        }
Пример #9
0
        private void s_loadWeek(DailyVideoFiles[] list)
        {


            foreach (DailyVideoFiles dailyFile in list)
            {
                foreach (VideoFile v in dailyFile.VideoFileList)
                {
                    int index = v.Index;
                    videoList[index] = v;

                    TextBlock t = (TextBlock)table2.Children[index];
                    t.Tag = "hdr" + index + "#" + v.Path + "#" + v.Length;


                    t.Background = brush;
                    t.Foreground = Brushes.White;
                    t.Text = MIExtractor.ExtractInfo(v.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#" + index;
                    menu.Items.Add(del);

                    //Properties
                    MenuItem prop = new MenuItem();
                    prop.Header = "Properties";
                    prop.Click += new RoutedEventHandler(tb_propClick);
                    prop.Tag = v.Path;
                    menu.Items.Add(prop);

                    t.ContextMenu = menu;

                    //----------------update sub_tb------------------------//
                    String[] data = new String[3];
                    data[0] = t.Tag.ToString();
                    data[1] = v.Path;
                    data[2] = v.Length;
                    tb_updateSub(t, data);

                }
            }
        }
Пример #10
0
        private void s_loadDay(DailyVideoFiles[] list, DateTime d)
        {

            int day = DayOfWeek_to_int(d);

            foreach (DailyVideoFiles dailyFile in list)
            {
                foreach (VideoFile v in dailyFile.VideoFileList)
                {
                    videoList[v.Index] = v;

                    int g_index = g_getIndex(v.Index, day);

                    if ((FIRST_ROW <= g_index) && (g_index <= LAST_ROW))
                    {

                        Grid g = (Grid)table1.Children[g_index];
                        //---------------update header--------------------//
                        g.Tag = "hdr" + g_index;
                        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];
                        TextBlock duration = (TextBlock)g.Children[1];
                        TextBlock path = (TextBlock)g.Children[2];
                        name.Text = name.Text = MIExtractor.ExtractInfo(v.Path)[0];
                        duration.Text = v.Length;
                        path.Text = v.Path;


                        //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#" + g_index;
                        menu.Items.Add(del);

                        //Properties
                        MenuItem prop = new MenuItem();
                        prop.Header = "Properties";
                        prop.Click += new RoutedEventHandler(g_propClick);
                        prop.Tag = v.Path;
                        menu.Items.Add(prop);

                        g.ContextMenu = menu;

                        //----------------update sub_tb------------------------//
                        String[] data = new String[3];
                        data[0] = g.Tag.ToString();
                        data[1] = v.Path;
                        data[2] = v.Length;
                        g_updateSub(g, data);
                    }
                }
            }
        }
Пример #11
0
        private void s_init()
        {
            videoList = new VideoFile[table2.Children.Count];

            for (int i = 0; i < 7; i++)
            {
                dailyList[i] = new DailyVideoFiles();
            }
        }
Пример #12
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());
        }
Пример #13
0
        public void save_weekSchedule_with_ads()
        {
            sc.DailyVideoFilesList = new List<DailyVideoFiles>();
            String[] dates = new String[7];

            videoList_with_ads = videoList;
            dailyList_with_ads = dailyList;

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

            foreach (VideoFile video in videoList)
            {
                if (video != null)
                {
                    int day = video.Col - 1;
                    MessageBox.Show(day.ToString());
                    dailyList[day].Date = dates[day];
                    dailyList[day].VideoFileList.Add(video);
                }
            }

            foreach (VideoFile video in videoList_with_ads)
            {
                if (video != null)
                {
                    int day = video.Col - 1;
                    dailyList_with_ads[day].Date = dates[day];
                    dailyList_with_ads[day].VideoFileList.Add(video);
                }
            }

            for (int i = 0; i < 7; i++)
            {
                sc.DailyVideoFilesList.Add(dailyList[i]);
                sc.DailyVideoFilesList.Add(dailyList_with_ads[i]);
            }

            

            string file = schedule_file + "_ads" + ".xml";
            XMLWriter.WriteSchedule(sc, file);
        }