Esempio n. 1
0
        public static bool LoadWithStreamReader(System.IO.Stream stream)
        {
            Encoding enc;

            try
            {
                enc = Encoding.GetEncoding(932);
            }
            catch
            {
                enc = Encoding.UTF8;
            }

            try
            {
                Instance.ChList.Clear();
                Instance.ChListOrderByIndex.Clear();
                using (var reader = new System.IO.StreamReader(stream, enc))
                {
                    for (string buff = reader.ReadLine(); buff != null; buff = reader.ReadLine())
                    {
                        if (buff.StartsWith(";", StringComparison.Ordinal))
                        {
                            //コメント行
                            continue;
                        }
                        string[]   list = buff.Split('\t');
                        ChSet5Item item = new ChSet5Item();
                        try
                        {
                            item.ServiceName = list[0];
                            item.NetworkName = list[1];
                            item.ONID        = Convert.ToUInt16(list[2]);
                            item.TSID        = Convert.ToUInt16(list[3]);
                            item.SID         = Convert.ToUInt16(list[4]);
                            item.ServiceType = Convert.ToUInt16(list[5]);
                            item.PartialFlag = Convert.ToInt32(list[6]) != 0;
                            item.EpgCapFlag  = Convert.ToInt32(list[7]) != 0;
                            item.SearchFlag  = Convert.ToInt32(list[8]) != 0;
                        }
                        catch
                        {
                            //不正
                            continue;
                        }
                        if (Instance.ChList.ContainsKey(item.Key) == false)
                        {
                            Instance.ChList[item.Key] = item;
                            Instance.ChListOrderByIndex.Add(item);
                        }
                    }
                }
            }
            catch
            {
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        private void button_add_Click(object sender, RoutedEventArgs e)
        {
            var item = new ManualAutoAddData();

            item.dayOfWeekFlag = (byte)((checkBox_week0.IsChecked == true ? 0x01 : 0) |
                                        (checkBox_week1.IsChecked == true ? 0x02 : 0) |
                                        (checkBox_week2.IsChecked == true ? 0x04 : 0) |
                                        (checkBox_week3.IsChecked == true ? 0x08 : 0) |
                                        (checkBox_week4.IsChecked == true ? 0x10 : 0) |
                                        (checkBox_week5.IsChecked == true ? 0x20 : 0) |
                                        (checkBox_week6.IsChecked == true ? 0x40 : 0));

            item.startTime      = (uint)(comboBox_startHH.SelectedIndex * 60 * 60 + comboBox_startMM.SelectedIndex * 60 + comboBox_startSS.SelectedIndex);
            item.durationSecond = ((uint)(comboBox_endHH.SelectedIndex * 60 * 60 + comboBox_endMM.SelectedIndex * 60 + comboBox_endSS.SelectedIndex) +
                                   24 * 60 * 60 - item.startTime) % (24 * 60 * 60);

            item.title = textBox_title.Text;

            ChSet5Item chItem = comboBox_service.SelectedItem as ChSet5Item;

            if (chItem != null)
            {
                item.stationName       = chItem.ServiceName;
                item.originalNetworkID = chItem.ONID;
                item.transportStreamID = chItem.TSID;
                item.serviceID         = chItem.SID;
            }
            else if (defKey != null)
            {
                item.stationName       = defKey.stationName;
                item.originalNetworkID = defKey.originalNetworkID;
                item.transportStreamID = defKey.transportStreamID;
                item.serviceID         = defKey.serviceID;
            }
            else
            {
                MessageBox.Show("サービスが未選択です");
                return;
            }
            item.recSetting = recSettingView.GetRecSetting();

            if (defKey != null)
            {
                item.dataID = defKey.dataID;
                CommonManager.CreateSrvCtrl().SendChgManualAdd(new List <ManualAutoAddData>()
                {
                    item
                });
            }
            else
            {
                CommonManager.CreateSrvCtrl().SendAddManualAdd(new List <ManualAutoAddData>()
                {
                    item
                });
            }
            DialogResult = true;
        }
Esempio n. 3
0
        public static byte RemoconID(this ChSet5Item item)
        {
            byte ret = 0;

            if (item.IsDttv)
            {
                Settings.Instance.RemoconIDList.TryGetValue(item.TSID, out ret);
            }
            return(ret);
        }
Esempio n. 4
0
        public static bool LoadFile()
        {
            try
            {
                if (Instance.ChList == null)
                {
                    Instance.ChList = new Dictionary<UInt64, ChSet5Item>();
                }
                else
                {
                    Instance.ChList.Clear();
                }
                String filePath = SettingPath.SettingFolderPath + "\\ChSet5.txt";
                System.IO.StreamReader reader = (new System.IO.StreamReader(filePath, System.Text.Encoding.Default));
                while (reader.Peek() >= 0)
                {
                    string buff = reader.ReadLine();
                    if (buff.IndexOf(";") == 0)
                    {
                        //コメント行
                    }
                    else
                    {
                        string[] list = buff.Split('\t');
                        ChSet5Item item = new ChSet5Item();
                        try
                        {
                            item.ServiceName = list[0];
                            item.NetworkName = list[1];
                            item.ONID = Convert.ToUInt16(list[2]);
                            item.TSID = Convert.ToUInt16(list[3]);
                            item.SID = Convert.ToUInt16(list[4]);
                            item.ServiceType = Convert.ToUInt16(list[5]);
                            item.PartialFlag = Convert.ToByte(list[6]);
                            item.EpgCapFlag = Convert.ToByte(list[7]);
                            item.SearchFlag = Convert.ToByte(list[8]);
                        }
                        finally
                        {
                            UInt64 key = ((UInt64)item.ONID) << 32 | ((UInt64)item.TSID) << 16 | ((UInt64)item.SID);
                            Instance.ChList.Add(key, item);
                        }
                    }
                }

                reader.Close();

            }
            catch
            {
                return false;
            }
            return true;
        }
Esempio n. 5
0
        public static bool LoadFile()
        {
            try
            {
                if (Instance.ChList == null)
                {
                    Instance.ChList = new Dictionary <UInt64, ChSet5Item>();
                }
                else
                {
                    Instance.ChList.Clear();
                }
                String filePath = SettingPath.SettingFolderPath + "\\ChSet5.txt";
                System.IO.StreamReader reader = (new System.IO.StreamReader(filePath, System.Text.Encoding.Default));
                while (reader.Peek() >= 0)
                {
                    string buff = reader.ReadLine();
                    if (buff.IndexOf(";") == 0)
                    {
                        //コメント行
                    }
                    else
                    {
                        string[]   list = buff.Split('\t');
                        ChSet5Item item = new ChSet5Item();
                        try
                        {
                            item.ServiceName = list[0];
                            item.NetworkName = list[1];
                            item.ONID        = Convert.ToUInt16(list[2]);
                            item.TSID        = Convert.ToUInt16(list[3]);
                            item.SID         = Convert.ToUInt16(list[4]);
                            item.ServiceType = Convert.ToUInt16(list[5]);
                            item.PartialFlag = Convert.ToByte(list[6]);
                            item.EpgCapFlag  = Convert.ToByte(list[7]);
                            item.SearchFlag  = Convert.ToByte(list[8]);
                        }
                        finally
                        {
                            UInt64 key = CommonManager.Create64Key(item.ONID, item.TSID, item.SID);
                            Instance.ChList.Add(key, item);
                        }
                    }
                }

                reader.Close();
            }
            catch
            {
                return(false);
            }
            return(true);
        }
Esempio n. 6
0
        private int GetReserveTimeInfo(ref ReserveData resInfo)
        {
            if (resInfo == null)
            {
                return(-1);
            }

            try
            {
                resInfo.Title = textBox_title.Text;
                ChSet5Item ch = comboBox_service.SelectedItem as ChSet5Item;

                resInfo.StationName       = ch.ServiceName;
                resInfo.OriginalNetworkID = ch.ONID;
                resInfo.TransportStreamID = ch.TSID;
                resInfo.ServiceID         = ch.SID;
                //resInfo.EventID = 0xFFFF; 条件付の情報なのでここでは書き換えないことにする

                //深夜時間帯の処理
                DateTime date_start = datePicker_start.SelectedDate.Value.AddDays((int)(comboBox_sh.SelectedIndex / 24));
                DateTime date_end   = datePicker_end.SelectedDate.Value.AddDays((int)(comboBox_eh.SelectedIndex / 24));

                resInfo.StartTime = new DateTime(date_start.Year, date_start.Month, date_start.Day,
                                                 comboBox_sh.SelectedIndex % 24,
                                                 comboBox_sm.SelectedIndex,
                                                 comboBox_ss.SelectedIndex,
                                                 0,
                                                 DateTimeKind.Utc
                                                 );

                DateTime endTime = new DateTime(date_start.Year, date_end.Month, date_end.Day,
                                                comboBox_eh.SelectedIndex % 24,
                                                comboBox_em.SelectedIndex,
                                                comboBox_es.SelectedIndex,
                                                0,
                                                DateTimeKind.Utc
                                                );
                if (resInfo.StartTime > endTime)
                {
                    resInfo.DurationSecond = 0;
                    return(-2);
                }
                else
                {
                    TimeSpan duration = endTime - resInfo.StartTime;
                    resInfo.DurationSecond = (uint)duration.TotalSeconds;
                    return(0);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
            return(-1);
        }
Esempio n. 7
0
        private void listBox_serviceView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            textBox_serviceView1.Text = "";
            if (listBox_serviceView.SelectedItem == null)
            {
                return;
            }
            ChSet5Item info = listBox_serviceView.SelectedItem as ChSet5Item;

            textBox_serviceView1.Text  = info.NetworkName + "\r\n";
            textBox_serviceView1.Text += "OriginalNetworkID : " + info.ONID.ToString() + " (0x" + info.ONID.ToString("X4") + ")\r\n";
            textBox_serviceView1.Text += "TransportStreamID : " + info.TSID.ToString() + " (0x" + info.TSID.ToString("X4") + ")\r\n";
            textBox_serviceView1.Text += "ServiceID : " + info.SID.ToString() + " (0x" + info.SID.ToString("X4") + ")\r\n";
        }
Esempio n. 8
0
        public override AutoAddData GetData()
        {
            try
            {
                var data = new ManualAutoAddData();
                data.dataID = (uint)dataID;

                UInt32 startTime = ((UInt32)comboBox_startHH.SelectedIndex * 60 * 60) + ((UInt32)comboBox_startMM.SelectedIndex * 60) + (UInt32)comboBox_startSS.SelectedIndex;
                UInt32 endTime   = ((UInt32)comboBox_endHH.SelectedIndex * 60 * 60) + ((UInt32)comboBox_endMM.SelectedIndex * 60) + (UInt32)comboBox_endSS.SelectedIndex;
                while (endTime < startTime)
                {
                    endTime += 24 * 60 * 60;
                }
                UInt32 duration = endTime - startTime;
                if (duration >= 24 * 60 * 60)
                {
                    //深夜時間帯の処理の関係で、不可条件が新たに発生しているため、その対応。
                    MessageBox.Show("24時間以上の録画時間は設定出来ません。", "録画時間長の確認", MessageBoxButton.OK);
                    return(null);
                }

                data.startTime      = startTime;
                data.durationSecond = duration;

                //曜日の処理、0~6bit目:日~土
                data.dayOfWeekFlag = 0;
                int val = 0;
                chbxList.ForEach(chbx => data.dayOfWeekFlag |= (byte)((chbx.IsChecked == true ? 0x01 : 0x00) << val++));

                //開始時刻を0~24時に調整する。
                data.RegulateData();

                data.IsEnabled = checkBox_keyDisabled.IsChecked != true;

                data.title = textBox_title.Text;

                ChSet5Item chItem = comboBox_service.SelectedItem as ChSet5Item;
                data.stationName       = chItem.ServiceName;
                data.originalNetworkID = chItem.ONID;
                data.transportStreamID = chItem.TSID;
                data.serviceID         = chItem.SID;
                data.recSetting        = recSettingView.GetRecSetting();

                return(data);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
            return(null);
        }
Esempio n. 9
0
 public static bool Load(StreamReader reader)
 {
     try
     {
         chList             = new Dictionary <UInt64, ChSet5Item>();
         chListOrderByIndex = new List <ChSet5Item>();
         for (string buff = reader.ReadLine(); buff != null; buff = reader.ReadLine())
         {
             if (buff.StartsWith(";", StringComparison.Ordinal))
             {
                 //コメント行
             }
             else
             {
                 string[] list = buff.Split('\t');
                 var      item = new ChSet5Item();
                 try
                 {
                     item.ServiceName = list[0];
                     item.NetworkName = list[1];
                     item.ONID        = Convert.ToUInt16(list[2]);
                     item.TSID        = Convert.ToUInt16(list[3]);
                     item.SID         = Convert.ToUInt16(list[4]);
                     item.ServiceType = Convert.ToUInt16(list[5]);
                     item.PartialFlag = Convert.ToInt32(list[6]) != 0;
                     item.EpgCapFlag  = Convert.ToInt32(list[7]) != 0;
                     item.SearchFlag  = Convert.ToInt32(list[8]) != 0;
                 }
                 catch
                 {
                     //不正
                     continue;
                 }
                 if (chList.ContainsKey(item.Key) == false)
                 {
                     chList[item.Key] = item;
                     chListOrderByIndex.Add(item);
                 }
             }
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Esempio n. 10
0
        private static int BSQuickCh(this ChSet5Item item)
        {
            //BSの連動放送のチャンネルをくくる
            if (item.IsBS == false)
            {
                return(0);
            }
            if (bsmin == null)
            {
                bsmin = (chListOrderByIndex ?? new List <ChSet5Item>()).GroupBy(d => d.TSID, d => d.SID)
                        .ToDictionary(d => d.Key, d => d.Min());
            }
            ushort ret = 0;

            bsmin.TryGetValue(item.TSID, out ret);
            return(ret);
        }
Esempio n. 11
0
        public static EpgServiceInfo ConvertChSet5To(ChSet5Item item)
        {
            EpgServiceInfo info = new EpgServiceInfo();

            {
                info.ONID                  = item.ONID;
                info.TSID                  = item.TSID;
                info.SID                   = item.SID;
                info.network_name          = item.NetworkName;
                info.partialReceptionFlag  = (byte)(item.PartialFlag ? 1 : 0);
                info.remote_control_key_id = 0;
                info.service_name          = item.ServiceName;
                info.service_provider_name = item.NetworkName;
                info.service_type          = (byte)item.ServiceType;
                info.ts_name               = item.NetworkName;
            }
            return(info);
        }
Esempio n. 12
0
 public static bool Load(StreamReader reader)
 {
     try
     {
         chList = new Dictionary <UInt64, ChSet5Item>();
         while (reader.Peek() >= 0)
         {
             string buff = reader.ReadLine();
             if (buff.IndexOf(";") == 0)
             {
                 //コメント行
             }
             else
             {
                 string[] list = buff.Split('\t');
                 var      item = new ChSet5Item();
                 try
                 {
                     item.ServiceName = list[0];
                     item.NetworkName = list[1];
                     item.ONID        = Convert.ToUInt16(list[2]);
                     item.TSID        = Convert.ToUInt16(list[3]);
                     item.SID         = Convert.ToUInt16(list[4]);
                     item.ServiceType = Convert.ToUInt16(list[5]);
                     item.PartialFlag = Convert.ToByte(list[6]);
                     item.EpgCapFlag  = Convert.ToByte(list[7]);
                     item.SearchFlag  = Convert.ToByte(list[8]);
                 }
                 finally
                 {
                     chList.Add(item.Key, item);
                 }
             }
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Esempio n. 13
0
 private static void CheckService(bool apply, ulong id, Action <ulong> SetNewId, ref string log)
 {
     if (ChSet5.ChList.ContainsKey(id) == false)
     {
         ChSet5Item item = ChSet5.ChList.Values.FirstOrDefault(a => (a.Key & 0xFFFF0000FFFF) == (id & 0xFFFF0000FFFF));
         if (item != null)
         {
             if (apply)
             {
                 SetNewId(item.Key);
             }
             else if (log.Count(c => c == '\n') < 5)
             {
                 log += "  ID=0x" + id.ToString("X12") + " -> 0x" + item.Key.ToString("X12") + " (" + item.ServiceName + ")\r\n";
             }
             else if (log.EndsWith(".\r\n", StringComparison.Ordinal) == false)
             {
                 log += "  ...\r\n";
             }
         }
     }
 }
Esempio n. 14
0
 public ServiceViewItem(ChSet5Item info)
 {
     ServiceInfo = info;
 }
Esempio n. 15
0
 /// <summary>
 /// サービス1つ追加
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button_service_add_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (tabItem_bs.IsSelected == true)
         {
             if (listBox_serviceBS.SelectedItem == null)
             {
                 MessageBox.Show("アイテムが選択されていません");
                 return;
             }
             ChSet5Item info = listBox_serviceBS.SelectedItem as ChSet5Item;
             bool       find = false;
             foreach (ChSet5Item info2 in listBox_serviceView.Items)
             {
                 if (info2.Key == info.Key)
                 {
                     find = true;
                     break;
                 }
             }
             if (find == false)
             {
                 listBox_serviceView.Items.Add(info);
             }
         }
         else if (tabItem_cs.IsSelected == true)
         {
             if (listBox_serviceCS.SelectedItem == null)
             {
                 MessageBox.Show("アイテムが選択されていません");
                 return;
             }
             ChSet5Item info = listBox_serviceCS.SelectedItem as ChSet5Item;
             bool       find = false;
             foreach (ChSet5Item info2 in listBox_serviceView.Items)
             {
                 if (info2.Key == info.Key)
                 {
                     find = true;
                     break;
                 }
             }
             if (find == false)
             {
                 listBox_serviceView.Items.Add(info);
             }
         }
         else if (tabItem_tere.IsSelected == true)
         {
             if (listBox_serviceTere.SelectedItem == null)
             {
                 MessageBox.Show("アイテムが選択されていません");
                 return;
             }
             ChSet5Item info = listBox_serviceTere.SelectedItem as ChSet5Item;
             bool       find = false;
             foreach (ChSet5Item info2 in listBox_serviceView.Items)
             {
                 if (info2.Key == info.Key)
                 {
                     find = true;
                     break;
                 }
             }
             if (find == false)
             {
                 listBox_serviceView.Items.Add(info);
             }
         }
         else if (tabItem_other.IsSelected == true)
         {
             if (listBox_serviceOther.SelectedItem == null)
             {
                 MessageBox.Show("アイテムが選択されていません");
                 return;
             }
             ChSet5Item info = listBox_serviceOther.SelectedItem as ChSet5Item;
             bool       find = false;
             foreach (ChSet5Item info2 in listBox_serviceView.Items)
             {
                 if (info2.Key == info.Key)
                 {
                     find = true;
                     break;
                 }
             }
             if (find == false)
             {
                 listBox_serviceView.Items.Add(info);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
     }
 }
Esempio n. 16
0
        private void button_add_Click(object sender, RoutedEventArgs e)
        {
            if (defKey == null)
            {
                defKey = new ManualAutoAddData();
            }
            defKey.dayOfWeekFlag = 0;
            if (checkBox_week0.IsChecked == true)
            {
                defKey.dayOfWeekFlag |= 0x01;
            }
            if (checkBox_week1.IsChecked == true)
            {
                defKey.dayOfWeekFlag |= 0x02;
            }
            if (checkBox_week2.IsChecked == true)
            {
                defKey.dayOfWeekFlag |= 0x04;
            }
            if (checkBox_week3.IsChecked == true)
            {
                defKey.dayOfWeekFlag |= 0x08;
            }
            if (checkBox_week4.IsChecked == true)
            {
                defKey.dayOfWeekFlag |= 0x10;
            }
            if (checkBox_week5.IsChecked == true)
            {
                defKey.dayOfWeekFlag |= 0x20;
            }
            if (checkBox_week6.IsChecked == true)
            {
                defKey.dayOfWeekFlag |= 0x40;
            }

            defKey.startTime = ((UInt32)comboBox_startHH.SelectedIndex * 60 * 60) + ((UInt32)comboBox_startMM.SelectedIndex * 60) + (UInt32)comboBox_startSS.SelectedIndex;
            UInt32 endTime = ((UInt32)comboBox_endHH.SelectedIndex * 60 * 60) + ((UInt32)comboBox_endMM.SelectedIndex * 60) + (UInt32)comboBox_endSS.SelectedIndex;

            if (endTime < defKey.startTime)
            {
                defKey.durationSecond = (24 * 60 * 60 + endTime) - defKey.startTime;
            }
            else
            {
                defKey.durationSecond = endTime - defKey.startTime;
            }

            defKey.title = textBox_title.Text;

            ChSet5Item chItem = comboBox_service.SelectedItem as ChSet5Item;

            defKey.stationName       = chItem.ServiceName;
            defKey.originalNetworkID = chItem.ONID;
            defKey.transportStreamID = chItem.TSID;
            defKey.serviceID         = chItem.SID;

            RecSettingData recSet = new RecSettingData();

            recSettingView.GetRecSetting(ref recSet);
            defKey.recSetting = recSet;

            List <ManualAutoAddData> val = new List <ManualAutoAddData>();

            val.Add(defKey);

            if (changeModeFlag == true)
            {
                cmd.SendChgManualAdd(val);
            }
            else
            {
                cmd.SendAddManualAdd(val);
            }
            DialogResult = true;
        }
Esempio n. 17
0
 public ServiceViewItem(ChSet5Item info)
 {
     ServiceInfo = info;
 }
Esempio n. 18
0
 public static bool Load(StreamReader reader)
 {
     try
     {
         chList = new Dictionary<UInt64, ChSet5Item>();
         while (reader.Peek() >= 0)
         {
             string buff = reader.ReadLine();
             if (buff.IndexOf(";") == 0)
             {
                 //コメント行
             }
             else
             {
                 string[] list = buff.Split('\t');
                 var item = new ChSet5Item();
                 try
                 {
                     item.ServiceName = list[0];
                     item.NetworkName = list[1];
                     item.ONID = Convert.ToUInt16(list[2]);
                     item.TSID = Convert.ToUInt16(list[3]);
                     item.SID = Convert.ToUInt16(list[4]);
                     item.ServiceType = Convert.ToUInt16(list[5]);
                     item.PartialFlag = Convert.ToByte(list[6]);
                     item.EpgCapFlag = Convert.ToByte(list[7]);
                     item.SearchFlag = Convert.ToByte(list[8]);
                 }
                 finally
                 {
                     chList.Add(item.Key, item);
                 }
             }
         }
     }
     catch
     {
         return false;
     }
     return true;
 }
Esempio n. 19
0
        private Dictionary<UInt64, ChSet5Item> LoadFile()
        {
            try
            {
                Dictionary<UInt64, ChSet5Item> chlist = new Dictionary<UInt64, ChSet5Item>();

                // 直接ファイルを読まずに EpgTimerSrv.exe に問い合わせる
                byte[] binData;
                if (CommonManager.Instance.CtrlCmd.SendFileCopy("ChSet5.txt", out binData) == ErrCode.CMD_SUCCESS)
                {
                    System.IO.MemoryStream stream = new System.IO.MemoryStream(binData);
                    System.IO.StreamReader reader = new System.IO.StreamReader(stream, System.Text.Encoding.Default);
                    while (reader.Peek() >= 0)
                    {
                        string buff = reader.ReadLine();
                        if (buff.IndexOf(";") == 0)
                        {
                            //コメント行
                        }
                        else
                        {
                            string[] list = buff.Split('\t');
                            ChSet5Item item = new ChSet5Item();
                            try
                            {
                                item.ServiceName = list[0];
                                item.NetworkName = list[1];
                                item.ONID = Convert.ToUInt16(list[2]);
                                item.TSID = Convert.ToUInt16(list[3]);
                                item.SID = Convert.ToUInt16(list[4]);
                                item.ServiceType = Convert.ToUInt16(list[5]);
                                item.PartialFlag = Convert.ToByte(list[6]);
                                item.EpgCapFlag = Convert.ToByte(list[7]);
                                item.SearchFlag = Convert.ToByte(list[8]);
                            }
                            finally
                            {
                                UInt64 key = item.Key;
                                chlist.Add(key, item);
                            }
                        }
                    }

                    reader.Close();
                }
                HasChanged = false;
                return chlist;
            }
            catch
            {
                HasChanged = false;
                return new Dictionary<UInt64, ChSet5Item>();
            }
        }
Esempio n. 20
0
        private void button_chg_reserve_Click(object sender, RoutedEventArgs e)
        {
            if (checkBox_program.IsChecked == true)
            {
                reserveInfo.Title = textBox_title.Text;
                ChSet5Item ch = comboBox_service.SelectedItem as ChSet5Item;

                reserveInfo.StationName       = ch.ServiceName;
                reserveInfo.OriginalNetworkID = ch.ONID;
                reserveInfo.TransportStreamID = ch.TSID;
                reserveInfo.ServiceID         = ch.SID;
                reserveInfo.EventID           = 0xFFFF;

                reserveInfo.StartTime = new DateTime(datePicker_start.SelectedDate.Value.Year,
                                                     datePicker_start.SelectedDate.Value.Month,
                                                     datePicker_start.SelectedDate.Value.Day,
                                                     comboBox_sh.SelectedIndex,
                                                     comboBox_sm.SelectedIndex,
                                                     comboBox_ss.SelectedIndex,
                                                     0,
                                                     DateTimeKind.Utc
                                                     );

                DateTime endTime = new DateTime(datePicker_end.SelectedDate.Value.Year,
                                                datePicker_end.SelectedDate.Value.Month,
                                                datePicker_end.SelectedDate.Value.Day,
                                                comboBox_eh.SelectedIndex,
                                                comboBox_em.SelectedIndex,
                                                comboBox_es.SelectedIndex,
                                                0,
                                                DateTimeKind.Utc
                                                );
                if (reserveInfo.StartTime > endTime)
                {
                    MessageBox.Show("終了日時が開始日時より前です");
                    return;
                }
                TimeSpan duration = endTime - reserveInfo.StartTime;
                reserveInfo.DurationSecond         = (uint)duration.TotalSeconds;
                reserveInfo.RecSetting             = recSettingView.GetRecSetting();
                reserveInfo.RecSetting.TuijyuuFlag = 0;
                reserveInfo.RecSetting.PittariFlag = 0;
            }
            else
            {
                reserveInfo.RecSetting = recSettingView.GetRecSetting();
            }
            List <ReserveData> list = new List <ReserveData>();

            list.Add(reserveInfo);
            if (manualAddMode == false)
            {
                ErrCode err = CommonManager.CreateSrvCtrl().SendChgReserve(list);
                if (err != ErrCode.CMD_SUCCESS)
                {
                    MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "予約変更でエラーが発生しました。");
                }
            }
            else
            {
                reserveInfo.StartTimeEpg = reserveInfo.StartTime;
                ErrCode err = CommonManager.CreateSrvCtrl().SendAddReserve(list);
                if (err != ErrCode.CMD_SUCCESS)
                {
                    MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "予約追加でエラーが発生しました。");
                }
            }
            if (this.Visibility == System.Windows.Visibility.Visible)
            {
                DialogResult = true;
            }
        }
        private void button_chg_reserve_Click(object sender, RoutedEventArgs e)
        {
            if (checkBox_program.IsChecked == true)
            {
                reserveInfo.Title = textBox_title.Text;
                ChSet5Item ch = comboBox_service.SelectedItem as ChSet5Item;

                reserveInfo.StationName       = ch.ServiceName;
                reserveInfo.OriginalNetworkID = ch.ONID;
                reserveInfo.TransportStreamID = ch.TSID;
                reserveInfo.ServiceID         = ch.SID;
                reserveInfo.EventID           = 0xFFFF;

                reserveInfo.StartTime = new DateTime(datePicker_start.SelectedDate.Value.Year,
                                                     datePicker_start.SelectedDate.Value.Month,
                                                     datePicker_start.SelectedDate.Value.Day,
                                                     comboBox_sh.SelectedIndex,
                                                     comboBox_sm.SelectedIndex,
                                                     comboBox_ss.SelectedIndex,
                                                     0,
                                                     DateTimeKind.Utc
                                                     );

                DateTime endTime = new DateTime(datePicker_end.SelectedDate.Value.Year,
                                                datePicker_end.SelectedDate.Value.Month,
                                                datePicker_end.SelectedDate.Value.Day,
                                                comboBox_eh.SelectedIndex,
                                                comboBox_em.SelectedIndex,
                                                comboBox_es.SelectedIndex,
                                                0,
                                                DateTimeKind.Utc
                                                );
                if (reserveInfo.StartTime > endTime)
                {
                    MessageBox.Show("終了日時が開始日時より前です");
                    return;
                }
                TimeSpan duration = endTime - reserveInfo.StartTime;
                reserveInfo.DurationSecond = (uint)duration.TotalSeconds;

                RecSettingData setInfo = new RecSettingData();
                recSettingView.GetRecSetting(ref setInfo);
                setInfo.TuijyuuFlag    = 0;
                setInfo.PittariFlag    = 0;
                reserveInfo.RecSetting = setInfo;
            }
            else
            {
                RecSettingData setInfo = new RecSettingData();
                recSettingView.GetRecSetting(ref setInfo);
                reserveInfo.RecSetting = setInfo;
            }
            List <ReserveData> list = new List <ReserveData>();

            list.Add(reserveInfo);
            if (manualAddMode == false)
            {
                ErrCode err = (ErrCode)cmd.SendChgReserve(list);
                if (err == ErrCode.CMD_ERR_CONNECT)
                {
                    MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。");
                }
                if (err == ErrCode.CMD_ERR_TIMEOUT)
                {
                    MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。");
                }
                if (err != ErrCode.CMD_SUCCESS)
                {
                    MessageBox.Show("予約変更でエラーが発生しました。");
                }
            }
            else
            {
                reserveInfo.StartTimeEpg = reserveInfo.StartTime;
                ErrCode err = (ErrCode)cmd.SendAddReserve(list);
                if (err == ErrCode.CMD_ERR_CONNECT)
                {
                    MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。");
                }
                if (err == ErrCode.CMD_ERR_TIMEOUT)
                {
                    MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。");
                }
                if (err != ErrCode.CMD_SUCCESS)
                {
                    MessageBox.Show("予約追加でエラーが発生しました。");
                }
            }
            DialogResult = true;
        }
Esempio n. 22
0
 public static int ChNumber(this ChSet5Item item)
 {
     return(item.IsDttv ? item.RemoconID() : item.SID& 0x3FF);
 }
Esempio n. 23
0
        private void button_add_chg(object sender, ExecutedRoutedEventArgs e, bool chgFlag)
        {
            try
            {
                UInt32 startTime = ((UInt32)comboBox_startHH.SelectedIndex * 60 * 60) + ((UInt32)comboBox_startMM.SelectedIndex * 60) + (UInt32)comboBox_startSS.SelectedIndex;
                UInt32 endTime   = ((UInt32)comboBox_endHH.SelectedIndex * 60 * 60) + ((UInt32)comboBox_endMM.SelectedIndex * 60) + (UInt32)comboBox_endSS.SelectedIndex;
                while (endTime < startTime)
                {
                    endTime += 24 * 60 * 60;
                }
                UInt32 duration = endTime - startTime;
                if (duration >= 24 * 60 * 60)
                {
                    //深夜時間帯の処理の関係で、不可条件が新たに発生しているため、その対応。
                    MessageBox.Show("24時間以上の録画時間は設定出来ません。", "録画時間長の確認", MessageBoxButton.OK);
                    return;
                }

                if (CheckAutoAddChange(e, chgFlag == false ? 0 : 1) == false)
                {
                    return;
                }
                //
                if (defKey == null)
                {
                    defKey = new ManualAutoAddData();
                }

                defKey.startTime      = startTime;
                defKey.durationSecond = duration;

                defKey.dayOfWeekFlag = 0;
                if (checkBox_week0.IsChecked == true)
                {
                    defKey.dayOfWeekFlag |= 0x01;
                }
                if (checkBox_week1.IsChecked == true)
                {
                    defKey.dayOfWeekFlag |= 0x02;
                }
                if (checkBox_week2.IsChecked == true)
                {
                    defKey.dayOfWeekFlag |= 0x04;
                }
                if (checkBox_week3.IsChecked == true)
                {
                    defKey.dayOfWeekFlag |= 0x08;
                }
                if (checkBox_week4.IsChecked == true)
                {
                    defKey.dayOfWeekFlag |= 0x10;
                }
                if (checkBox_week5.IsChecked == true)
                {
                    defKey.dayOfWeekFlag |= 0x20;
                }
                if (checkBox_week6.IsChecked == true)
                {
                    defKey.dayOfWeekFlag |= 0x40;
                }

                //開始時刻を0~24時に調整する。
                defKey.RegulateData();

                defKey.IsEnabled = checkBox_keyDisabled.IsChecked != true;

                defKey.title = textBox_title.Text;

                ChSet5Item chItem = comboBox_service.SelectedItem as ChSet5Item;
                defKey.stationName       = chItem.ServiceName;
                defKey.originalNetworkID = chItem.ONID;
                defKey.transportStreamID = chItem.TSID;
                defKey.serviceID         = chItem.SID;
                defKey.recSetting        = recSettingView.GetRecSetting();

                if (chgFlag == true)
                {
                    bool ret = MenuUtil.AutoAddChange(CommonUtil.ToList(defKey));
                    CommonManager.Instance.StatusNotifySet(ret, "プログラム予約登録を変更");
                }
                else
                {
                    bool ret = MenuUtil.AutoAddAdd(CommonUtil.ToList(defKey));
                    CommonManager.Instance.StatusNotifySet(ret, "プログラム予約登録を追加");
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
            DialogResult = true;
        }
Esempio n. 24
0
        private void button_chg_reserve_Click(object sender, RoutedEventArgs e)
        {
            var info = new ReserveData();

            if (reserveInfo != null)
            {
                // 初期値をコピー(予約変更で無視されるフィールドは省略)
                info.Title             = reserveInfo.Title;
                info.StartTime         = reserveInfo.StartTime;
                info.DurationSecond    = reserveInfo.DurationSecond;
                info.StationName       = reserveInfo.StationName;
                info.OriginalNetworkID = reserveInfo.OriginalNetworkID;
                info.TransportStreamID = reserveInfo.TransportStreamID;
                info.ServiceID         = reserveInfo.ServiceID;
                info.EventID           = reserveInfo.EventID;
                info.Comment           = reserveInfo.Comment;
                info.ReserveID         = reserveInfo.ReserveID;
                info.OverlapMode       = reserveInfo.OverlapMode;
                info.StartTimeEpg      = reserveInfo.StartTimeEpg;
            }
            info.RecSetting = recSettingView.GetRecSetting();

            if (checkBox_program.IsChecked == true)
            {
                var startTime = DateTime.MaxValue;
                var endTime   = DateTime.MinValue;
                if (datePicker_start.SelectedDate != null && datePicker_end.SelectedDate != null)
                {
                    startTime = new DateTime(datePicker_start.SelectedDate.Value.Year,
                                             datePicker_start.SelectedDate.Value.Month,
                                             datePicker_start.SelectedDate.Value.Day,
                                             comboBox_sh.SelectedIndex,
                                             comboBox_sm.SelectedIndex,
                                             comboBox_ss.SelectedIndex, 0, DateTimeKind.Utc);
                    endTime = new DateTime(datePicker_end.SelectedDate.Value.Year,
                                           datePicker_end.SelectedDate.Value.Month,
                                           datePicker_end.SelectedDate.Value.Day,
                                           comboBox_eh.SelectedIndex,
                                           comboBox_em.SelectedIndex,
                                           comboBox_es.SelectedIndex, 0, DateTimeKind.Utc);
                }
                if (startTime > endTime)
                {
                    MessageBox.Show("終了日時が開始日時より前です");
                    return;
                }

                info.Title = textBox_title.Text;
                ChSet5Item ch = comboBox_service.SelectedItem as ChSet5Item;
                if (ch != null)
                {
                    info.StationName       = ch.ServiceName;
                    info.OriginalNetworkID = ch.ONID;
                    info.TransportStreamID = ch.TSID;
                    info.ServiceID         = ch.SID;
                }
                else if (reserveInfo == null)
                {
                    MessageBox.Show("サービスが未選択です");
                    return;
                }
                info.EventID = 0xFFFF;

                info.StartTime              = startTime;
                info.DurationSecond         = (uint)(endTime - startTime).TotalSeconds;
                info.RecSetting.TuijyuuFlag = 0;
                info.RecSetting.PittariFlag = 0;
            }

            if (reserveInfo != null)
            {
                ErrCode err = CommonManager.CreateSrvCtrl().SendChgReserve(new List <ReserveData>()
                {
                    info
                });
                if (err != ErrCode.CMD_SUCCESS)
                {
                    MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "予約変更でエラーが発生しました。");
                }
            }
            else
            {
                info.StartTimeEpg = info.StartTime;
                ErrCode err = CommonManager.CreateSrvCtrl().SendAddReserve(new List <ReserveData>()
                {
                    info
                });
                if (err != ErrCode.CMD_SUCCESS)
                {
                    MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "予約追加でエラーが発生しました。");
                }
            }
            DialogResult = true;
        }
Esempio n. 25
0
        private static void CheckServiceSettings(Settings settings, bool apply)
        {
            //サービス一覧に見つからず、TSIDを無視すれば見つかるサービスがないか調べる
            string searchDefault = "";

            for (int i = 0; i < settings.SearchKeyServiceList.Count; i++)
            {
                ulong id = (ulong)settings.SearchKeyServiceList[i];
                if (ChSet5.Instance.ChList.ContainsKey(id) == false)
                {
                    ChSet5Item item = ChSet5.Instance.ChList.Values.FirstOrDefault(a => (a.Key & 0xFFFF0000FFFF) == (id & 0xFFFF0000FFFF));
                    if (item != null)
                    {
                        if (apply)
                        {
                            settings.SearchKeyServiceList[i] = (long)item.Key;
                        }
                        else if (searchDefault.Count(c => c == '\n') < 5)
                        {
                            searchDefault += "  ID=0x" + id.ToString("X12") + " -> 0x" + item.Key.ToString("X12") + " (" + item.ServiceName + ")\r\n";
                        }
                        else if (searchDefault.EndsWith(".\r\n", StringComparison.Ordinal) == false)
                        {
                            searchDefault += "  ...\r\n";
                        }
                    }
                }
            }

            string viewService = "";
            string searchKey   = "";

            foreach (CustomEpgTabInfo info in settings.CustomEpgTabList)
            {
                for (int i = 0; i < info.ViewServiceList.Count; i++)
                {
                    ulong id = info.ViewServiceList[i];
                    if (ChSet5.Instance.ChList.ContainsKey(id) == false)
                    {
                        ChSet5Item item = ChSet5.Instance.ChList.Values.FirstOrDefault(a => (a.Key & 0xFFFF0000FFFF) == (id & 0xFFFF0000FFFF));
                        if (item != null)
                        {
                            if (apply)
                            {
                                info.ViewServiceList[i] = item.Key;
                            }
                            else if (viewService.Count(c => c == '\n') < 5)
                            {
                                viewService += "  ID=0x" + id.ToString("X12") + " -> 0x" + item.Key.ToString("X12") + " (" + item.ServiceName + ")\r\n";
                            }
                            else if (viewService.EndsWith(".\r\n", StringComparison.Ordinal) == false)
                            {
                                viewService += "  ...\r\n";
                            }
                        }
                    }
                }
                for (int i = 0; i < info.SearchKey.serviceList.Count; i++)
                {
                    ulong id = (ulong)info.SearchKey.serviceList[i];
                    if (ChSet5.Instance.ChList.ContainsKey(id) == false)
                    {
                        ChSet5Item item = ChSet5.Instance.ChList.Values.FirstOrDefault(a => (a.Key & 0xFFFF0000FFFF) == (id & 0xFFFF0000FFFF));
                        if (item != null)
                        {
                            if (apply)
                            {
                                info.SearchKey.serviceList[i] = (long)item.Key;
                            }
                            else if (searchKey.Count(c => c == '\n') < 5)
                            {
                                searchKey += "  ID=0x" + id.ToString("X12") + " -> 0x" + item.Key.ToString("X12") + " (" + item.ServiceName + ")\r\n";
                            }
                            else if (searchKey.EndsWith(".\r\n", StringComparison.Ordinal) == false)
                            {
                                searchKey += "  ...\r\n";
                            }
                        }
                    }
                }
            }

            string iepgStation = "";

            foreach (IEPGStationInfo info in settings.IEpgStationList)
            {
                if (ChSet5.Instance.ChList.ContainsKey(info.Key) == false)
                {
                    ChSet5Item item = ChSet5.Instance.ChList.Values.FirstOrDefault(a => (a.Key & 0xFFFF0000FFFF) == (info.Key & 0xFFFF0000FFFF));
                    if (item != null)
                    {
                        if (apply)
                        {
                            info.Key = item.Key;
                        }
                        else if (iepgStation.Count(c => c == '\n') < 5)
                        {
                            iepgStation += "  ID=0x" + info.Key.ToString("X12") + " -> 0x" + item.Key.ToString("X12") + " (" + item.ServiceName + ")\r\n";
                        }
                        else if (iepgStation.EndsWith(".\r\n", StringComparison.Ordinal) == false)
                        {
                            iepgStation += "  ...\r\n";
                        }
                    }
                }
            }

            if (searchDefault != "" || viewService != "" || searchKey != "" || iepgStation != "")
            {
                if (MessageBox.Show("TransportStreamIDの変更を検出しました。\r\n\r\n" +
                                    (searchDefault != "" ? "【検索条件のデフォルト値のサービス絞り込み】\r\n" : "") + searchDefault +
                                    (viewService != "" ? "【番組表の表示条件の表示サービス】\r\n" : "") + viewService +
                                    (searchKey != "" ? "【番組表の表示条件の検索条件のサービス絞り込み】\r\n" : "") + searchKey +
                                    (iepgStation != "" ? "【iEPG Ver.1の放送局リスト】\r\n" : "") + iepgStation +
                                    "\r\n変更を設定ウィンドウに適用しますか?\r\n(設定ウィンドウをOKで閉じるまで変更は保存されません)",
                                    "", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    CheckServiceSettings(settings, true);
                }
            }
        }
Esempio n. 26
0
 public static EpgServiceInfo ConvertChSet5To(ChSet5Item item)
 {
     EpgServiceInfo info = new EpgServiceInfo();
     try
     {
         info.ONID = item.ONID;
         info.TSID = item.TSID;
         info.SID = item.SID;
         info.network_name = item.NetworkName;
         info.partialReceptionFlag = item.PartialFlag;
         info.remote_control_key_id = item.RemoconID;
         info.service_name = item.ServiceName;
         info.service_provider_name = item.NetworkName;
         info.service_type = (byte)item.ServiceType;
         info.ts_name = item.NetworkName;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
     }
     return info;
 }
Esempio n. 27
0
        public static bool LoadFile()
        {
            try
            {
                if (Instance.ChList == null)
                {
                    Instance.ChList = new Dictionary<ulong, ChSet5Item>();
                }
                else
                {
                    Instance.ChList.Clear();
                }
                String filePath = @".\Setting\ChSet5.txt";
                StreamReader reader = new StreamReader(filePath, Encoding.Default);
                while (reader.Peek() >= 0)
                {
                    string buff = reader.ReadLine();
                    if (!buff.StartsWith(";"))
                    {
                        string[] list = buff.Split('\t');
                        ChSet5Item item = new ChSet5Item();
                        item.ServiceName = list[0];
                        item.NetworkName = list[1];
                        item.ONID = ushort.Parse(list[2]);
                        item.TSID = ushort.Parse(list[3]);
                        item.SID = ushort.Parse(list[4]);
                        item.ServiceType = ushort.Parse(list[5]);
                        item.PartialFlag = byte.Parse(list[6]);
                        item.EpgCapFlag = byte.Parse(list[7]);
                        item.SearchFlag = byte.Parse(list[8]);
                        ulong key = ((ulong)item.ONID) << 32 | ((ulong)item.TSID) << 16 | ((ulong)item.SID);
                        Instance.ChList.Add(key, item);
                    }
                }

                reader.Close();
            }
            catch
            {
                return false;
            }
            return true;
        }