Esempio n. 1
0
 private void channelsMapItem_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
 {
     if (!AskQuestion(string.Format("Create {0} in output directory?", Settings.Default.ChannelsXmlFileName)))
     {
         return;
     }
     try
     {
         var listConfigurations = new ListConfigurations(Locations.UserConfigDirectory);
         listConfigurations.StatusChanged += OnStatusChanged;
         var configList = listConfigurations.Execute();
         var map        = new ChannelMap();
         map.Configurations = configList;
         var mapFileName = Path.Combine(Locations.OutputDirectory.FullName, Settings.Default.ChannelsXmlFileName);
         map.SaveToFile(mapFileName);
     }
     catch (Exception ex)
     {
         Log.Error(string.Format("Failed to create channels map.{0}{1}", Environment.NewLine, ex.Message), ex);
         XtraMessageBox.Show(string.Format("Failed to create channels map.{0}{1}", Environment.NewLine, ex.Message), "Error");
     }
     finally
     {
         SplashManager.CloseSplashScreen();
     }
 }
Esempio n. 2
0
        private void mpButtonUnmap_Click(object sender, EventArgs e)
        {
            NotifyForm dlg = new NotifyForm("Unmapping selected channels from TV-Card...",
                                            "This can take some time\n\nPlease be patient...");

            dlg.Show(this);
            dlg.WaitForDisplay();
            mpListViewChannels.BeginUpdate();
            mpListViewMapped.BeginUpdate();

            try
            {
                ListView.SelectedListViewItemCollection selectedItems = mpListViewMapped.SelectedItems;

                foreach (ListViewItem item in selectedItems)
                {
                    ChannelMap map = (ChannelMap)item.Tag;
                    mpListViewMapped.Items.Remove(item);
                    Channel      referencedChannel = map.ReferencedChannel();
                    ListViewItem newItem           = mpListViewChannels.Items.Add(referencedChannel.DisplayName, item.ImageIndex);
                    newItem.Tag = referencedChannel;
                    map.Remove();
                }
                mpListViewChannels.Sort();
                mpListViewMapped.Sort();
                dlg.Close();
            }
            finally
            {
                mpListViewChannels.EndUpdate();
                mpListViewMapped.EndUpdate();
            }
            // DatabaseManager.Instance.SaveChanges();
        }
        private void mpButtonMap_Click_1(object sender, EventArgs e)
        {
            NotifyForm dlg = new NotifyForm("Mapping selected channels to TV-Card...",
                                            "This can take some time\n\nPlease be patient...");

            dlg.Show(this);
            dlg.WaitForDisplay();
            Card card = ((CardInfo)mpComboBoxCard.SelectedItem).Card;

            mpListViewChannels.BeginUpdate();
            mpListViewMapped.BeginUpdate();
            try
            {
                ListView.SelectedListViewItemCollection selectedItems = mpListViewChannels.SelectedItems;
                TvBusinessLayer layer = new TvBusinessLayer();
                foreach (ListViewItem item in selectedItems)
                {
                    Channel    channel = (Channel)item.Tag;
                    ChannelMap map     = layer.MapChannelToCard(card, channel, false);
                    mpListViewChannels.Items.Remove(item);
                    ListViewItem newItem = mpListViewMapped.Items.Add(channel.DisplayName, item.ImageIndex);
                    newItem.Tag = map;
                }
                dlg.Close();
            }
            finally
            {
                mpListViewChannels.EndUpdate();
                mpListViewMapped.EndUpdate();
            }
        }
Esempio n. 4
0
 private void ChannelMap_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
 {
     if (Settings.IsLoading == false)
     {
         List <int> listofmap = new List <int>();
         if (ChannelMap.Items.Count > 0)
         {
             for (int a = 0; a <= ChannelMap.Items.Count - 1; a++)
             {
                 try
                 {
                     //   MsgBox(e.Index & " : " & e.NewValue)
                     if (e.Index == a)
                     {
                         if ((e.NewValue == System.Windows.Forms.CheckState.Checked))
                         {
                             listofmap.Add(a);
                         }
                     }
                     else
                     {
                         if (ChannelMap.GetItemChecked(a))
                         {
                             listofmap.Add(a);
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                 }
             }
         }
         Settings.CardMap = listofmap;
     }
 }
Esempio n. 5
0
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            Card card = (Card)mpListView1.SelectedItems[0].Tag;

            DialogResult res = MessageBox.Show(this,
                                               "Are you sure you want to delete this card along with all the channel mappings? (channels will not be deleted)",
                                               "Delete card?", MessageBoxButtons.YesNo);

            if (res == DialogResult.Yes)
            {
                if (card.ReferringCardGroupMap().Count > 0)
                {
                    for (int i = card.ReferringCardGroupMap().Count - 1; i > -1; i--)
                    {
                        CardGroupMap map = card.ReferringCardGroupMap()[i];
                        map.Remove();
                    }
                }

                if (card.ReferringChannelMap().Count > 0)
                {
                    for (int i = card.ReferringChannelMap().Count - 1; i > -1; i--)
                    {
                        ChannelMap map = card.ReferringChannelMap()[i];
                        map.Remove();
                    }
                }

                RemoteControl.Instance.CardRemove(card.IdCard);
                mpListView1.Items.Remove(mpListView1.SelectedItems[0]);
                _needRestart = true;
            }
        }
        //TODO: move these helpers to other static classes

        private void SetupChannelMapping(ITvCardHandler cardHandler1, ChannelMap channelMap, TvBusinessLayer businessLayer, Channel channel)
        {
            Isolate.WhenCalled(() => channelMap.EpgOnly).WillReturn(false);
            Isolate.WhenCalled(() => channelMap.ReferencedCard().DevicePath).WillReturn(cardHandler1.DataBaseCard.DevicePath);

            TvDatabase.Card card = cardHandler1.DataBaseCard;
            Isolate.WhenCalled(() => businessLayer.IsChannelMappedToCard(channel, card, false)).WillReturn(true);
        }
Esempio n. 7
0
 /// <summary>
 /// 取得文章标题
 /// </summary>
 /// <param name="id">文章ID</param>
 /// <returns></returns>
 public string GetUrl(string id)
 {
     if (!ChannelMap.ContainsKey(BindColumnID))
     {
         ChannelMap[BindColumnID] = ChannelHelper.GetChannel(BindColumnID, null).FullUrl;
     }
     return(String.Format("{0}{1}.html", ChannelMap[BindColumnID], id.Trim('{').Trim('}').Replace("-", "_")));
 }
Esempio n. 8
0
        public virtual EngineError open(string nameAndPath, AssetDescriptor ad, ChannelMap map)
        {
            EngineError ret = (EngineError)Audio360CSharpPINVOKE.NativeSpatDecoderFile_open__SWIG_2(swigCPtr, nameAndPath, AssetDescriptor.getCPtr(ad), (int)map);

            if (Audio360CSharpPINVOKE.SWIGPendingException.Pending)
            {
                throw Audio360CSharpPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 9
0
        /// <summary>
        /// 按ID取得详细页的Url
        /// </summary>
        /// <param name="id">条目ID</param>
        /// <returns></returns>
        public string GetUrl(object id)
        {
            if (!ChannelMap.ContainsKey(BindColumnID))
            {
                ChannelMap.Add(BindColumnID, ChannelHelper.GetChannel(BindColumnID, null));
            }
            GeneralConfigInfo si  = GeneralConfigs.GetConfig();
            string            ext = si.UrlFormat;

            return(String.Format("{0}{1}.{2}", ChannelMap.ContainsKey(BindColumnID) && ChannelMap[BindColumnID] != null ? ChannelMap[BindColumnID].FullUrl : "", We7Helper.GUIDToFormatString(ToStr(id)), ext));
        }
Esempio n. 10
0
        public static TvDatabase.Channel GetChannel(out ChannelMap channelMap)
        {
            channelMap = Isolate.Fake.Instance <ChannelMap>();
            List <ChannelMap> channelMaps = new List <ChannelMap>();

            channelMaps.Add(channelMap);
            TvDatabase.Channel channel = Isolate.Fake.Instance <TvDatabase.Channel>();
            Isolate.WhenCalled(() => channel.DisplayName).WillReturn("Test Channel");
            Isolate.WhenCalled(() => channel.ReferringChannelMap()).WillReturn(channelMaps);
            return(channel);
        }
Esempio n. 11
0
        /// <summary>
        /// Helper method to create an instance of SpatDecoderFile on a GameObject
        /// </summary>
        /// <param name="ga">GameObject instance</param>
        /// <param name="file">File to be played back</param>
        /// <param name="map">Channel map/spatial format of the file</param>
        /// <returns></returns>
        static public TBE.SpatDecoderFile createOnObject(GameObject ga, string file, ChannelMap map = TBE.ChannelMap.TBE_8_2)
        {
            var obj = ga.AddComponent <SpatDecoderFile>();

            if (!obj.open(file, map))
            {
                Utils.logError("Failed to open " + file, ga);
                Destroy(obj);
                return(null);
            }
            return(obj);
        }
Esempio n. 12
0
 /// <summary>
 /// Opens an asset for playback with additional information, such as the size and offset specified through
 /// assetDescriptor. Currently .wav and .tbe file formats are supported. If no path is specified,
 /// the asset will be loaded from Assets/StreamingAssets.
 /// While the asset is opened synchronously, it is loaded into the streaming buffer asynchronously. An
 /// event (Event.DECODER_INIT) will be dispatched to the event listener when the streaming buffer is ready for the
 /// asset to play.
 /// </summary>
 /// <param name="fileToplay">Name of the file in StreamAssets or the full path</param>
 /// <param name="assetDescriptor">Custom file offset and size. Any or both values can be zero if unknown.</param>
 /// <param name="map">Channel map/conifiguration of the file</param>
 /// <returns>true if the file was found and successfully opened</returns>
 public bool open(string fileToplay, AssetDescriptor assetDescriptor, ChannelMap map = ChannelMap.TBE_8_2)
 {
     if (isValid())
     {
         if (spat_.open(Utils.resolvePath(fileToplay, PathType.STREAMING_ASSETS), assetDescriptor, map) == EngineError.OK)
         {
             file = fileToplay;
             return(true);
         }
     }
     return(false);
 }
        public Category Sync(string channelCategoryId, string channelCategoryName)
        {
            if (string.IsNullOrWhiteSpace(channelCategoryId) || string.IsNullOrWhiteSpace(channelCategoryName))
            {
                Log.WarnFormat("分类参数错误,categoryId:{0},categoryName:{1}", channelCategoryId, channelCategoryName);
                return(null);
            }

            using (var db = new YintaiHZhouContext())
            {
                // 查找分类映射关系
                var categoryMapExt = _channelMapper.GetMapByChannelValue(channelCategoryId, ChannelMapType.CategoryId);

                if (categoryMapExt == null)
                {
                    var newCategory = new Category()
                    {
                        ExCatCode  = string.Empty,
                        Name       = channelCategoryName,
                        Status     = 1,
                        UpdateDate = DateTime.Now
                    };

                    db.Categories.Add(newCategory);
                    db.SaveChanges();

                    // 添加映射关系
                    var newChannelMap = new ChannelMap()
                    {
                        LocalId       = newCategory.Id,
                        ChannnelValue = channelCategoryId,
                        MapType       = ChannelMapType.CategoryId
                    };

                    _channelMapper.CreateMap(newChannelMap);

                    return(newCategory);
                }

                var categoryExt = db.Categories.FirstOrDefault(b => b.Id == categoryMapExt.LocalId);

                // 更新品牌
                if (categoryExt != null)
                {
                    categoryExt.Name = channelCategoryName ?? string.Empty;
                    db.SaveChanges();
                }

                return(categoryExt);
            }
        }
Esempio n. 14
0
        public static decimal?GetFrequency(int channelId)
        {
            if (channelId < MinChannel || channelId > MaxChannel)
            {
                throw new ArgumentOutOfRangeException(nameof(channelId));
            }

            if (!ChannelMap.ContainsKey(channelId))
            {
                return(null);
            }

            return(ChannelMap[channelId]);
        }
Esempio n. 15
0
 public static void Register()
 {
     ChannelMap.Register <string>((uint)ChannelID.Error, Event.Error);
     ChannelMap.Register <Struct.TechniteStateChunk>((uint)ChannelID.TechniteStateChunk, Event.TechniteStateChunk);
     ChannelMap.Register <Struct.InstructTechnites>((uint)ChannelID.InstructTechnites, Event.InstructTechnites);
     ChannelMap.Register <Struct.GridConfig>((uint)ChannelID.GridConfig, Event.GridConfig);
     ChannelMap.Register <Struct.NodeChunk>((uint)ChannelID.NodeChunk, Event.NodeChunk);
     ChannelMap.Register <Struct.GridDelta>((uint)ChannelID.GridDelta, Event.GridDelta);
     ChannelMap.Register <Struct.WorldInfo>((uint)ChannelID.WorldInfo, Event.WorldInfo);
     ChannelMap.Register <Struct.ControlMarker>((uint)ChannelID.CreateControlMarker, Event.CreateControlMarker);
     ChannelMap.Register <Struct.GameObject>((uint)ChannelID.CreateGameObject, Event.CreateGameObject);
     ChannelMap.Register <UInt32>((uint)ChannelID.RemoveControlMarker, Event.RemoveControlMarker);
     ChannelMap.Register <Struct.GameObjectID>((uint)ChannelID.RemoveGameObject, Event.RemoveGameObject);
     ChannelMap.Register <Struct.BeginSession>((uint)ChannelID.BeginSession, Event.BeginSession);
 }
        /// <summary>
        /// 取得当前记录的Url
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public string GetUrl(Article a)
        {
            string key = a.ModelName + "$modelchannelurl$const";

            if (!ChannelMap.ContainsKey(key))
            {
                lock (Page)
                {
                    if (!ChannelMap.ContainsKey(key))
                    {
                        List <Channel> chs = ChannelHelper.GetChannelByModelName(a.ModelName);
                        ChannelMap.Add(key, chs != null && chs.Count > 0 ? chs[0].FullUrl : "");
                    }
                }
            }
            return(String.Format("{0}{1}", ChannelMap[key], a.FullUrl));
        }
Esempio n. 17
0
 public void RemoveMap(ChannelMap channelMap)
 {
     using (var db = new YintaiHZhouContext())
     {
         var innverValue = channelMap.LocalId.ToString();
         var map         =
             db.OPC_ChannelMap.FirstOrDefault(
                 x =>
                 x.Channel == SystemDefine.IntimeChannel && x.ChannelValue == channelMap.ChannnelValue &&
                 x.MapType == (int)channelMap.MapType && x.InnerValue == innverValue);
         if (map != null)
         {
             db.OPC_ChannelMap.Remove(map);
             db.SaveChanges();
         }
     }
 }
Esempio n. 18
0
        /// <summary>
        /// 按ID取得详细页的Url
        /// </summary>
        /// <param name="id">条目ID</param>
        /// <returns></returns>
        public string GetUrl(object id, object ChannelID)
        {
            if (ChannelID == null)
            {
                return("");
            }
            string strChannelID = ChannelID.ToString();

            if (!ChannelMap.ContainsKey(strChannelID))
            {
                ChannelMap.Add(strChannelID, ChannelHelper.GetChannel(strChannelID, null));
            }
            GeneralConfigInfo si  = GeneralConfigs.GetConfig();
            string            ext = si.UrlFormat;

            return(String.Format("{0}{1}.{2}", ChannelMap.ContainsKey(strChannelID) && ChannelMap[strChannelID] != null ? ChannelMap[strChannelID].FullUrl : "", We7Helper.GUIDToFormatString(ToStr(id)), ext));
        }
Esempio n. 19
0
        private void mpListViewMapped_DoubleClick(object sender, EventArgs e)
        {
            if (mpListViewMapped.SelectedItems.Count == 0)
            {
                return;
            }
            ListViewItem item    = mpListViewMapped.SelectedItems[0];
            ChannelMap   map     = (ChannelMap)item.Tag;
            Channel      channel = map.ReferencedChannel();

            if (map.EpgOnly)
            {
                item.Text   = channel.DisplayName;
                map.EpgOnly = false;
            }
            else
            {
                item.Text   = channel.DisplayName + " (EPG Only)";
                map.EpgOnly = true;
            }
            map.Persist();
        }
Esempio n. 20
0
        private void mpButtonMap_Click(object sender, EventArgs e)
        {
            NotifyForm dlg = new NotifyForm("Mapping selected channels to TV-Card...",
                                            "This can take some time\n\nPlease be patient...");

            dlg.Show(this);
            dlg.WaitForDisplay();
            Card card = ((CardInfo)mpComboBoxCard.SelectedItem).Card;

            mpListViewChannels.BeginUpdate();
            mpListViewMapped.BeginUpdate();
            try
            {
                ListView.SelectedListViewItemCollection selectedItems = mpListViewChannels.SelectedItems;
                TvBusinessLayer layer = new TvBusinessLayer();
                foreach (ListViewItem item in selectedItems)
                {
                    Channel    channel = (Channel)item.Tag;
                    ChannelMap map     = layer.MapChannelToCard(card, channel, mpCheckBoxMapForEpgOnly.Checked);
                    mpListViewChannels.Items.Remove(item);
                    string displayName = channel.DisplayName;
                    if (mpCheckBoxMapForEpgOnly.Checked)
                    {
                        displayName = channel.DisplayName + " (EPG Only)";
                    }
                    ListViewItem newItem = mpListViewMapped.Items.Add(displayName, item.ImageIndex);
                    newItem.Tag = map;
                }
                mpListViewMapped.Sort();
                dlg.Close();
            }
            finally
            {
                mpListViewChannels.EndUpdate();
                mpListViewMapped.EndUpdate();
            }
            //DatabaseManager.Instance.SaveChanges();
        }
Esempio n. 21
0
        private static void PopulateMaps()
        {
            foreach (var band in ChannelBands)
            {
                for (var channelId = band.MinChannel; channelId <= band.MaxChannel; channelId++)
                {
                    var frequency = CalculateFrequency(channelId, band);

                    if (ChannelMap.ContainsKey(channelId))
                    {
                        throw new Exception($"Channel ID overlap detected for channel {channelId}. Please check channel bands.");
                    }

                    if (FrequencyMap.ContainsKey(frequency))
                    {
                        throw new Exception($"Frequency overlap detected for frequency {frequency}Mhz. Please check channel bands.");
                    }

                    ChannelMap[channelId]   = frequency;
                    FrequencyMap[frequency] = channelId;
                }
            }
        }
        private static IDictionary <int, IList <int> > GetChannelMapping()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();
            Dictionary <int, IList <int> > result      = new Dictionary <int, IList <int> >();
            IList <ChannelMap>             channelMaps = ChannelMap.ListAll();

            foreach (ChannelMap map in channelMaps)
            {
                IList <int> cards;
                result.TryGetValue(map.IdChannel, out cards);
                if (cards == null)
                {
                    cards = new List <int>();
                    result.Add(map.IdChannel, cards);
                }
                if (!cards.Contains(map.IdCard))
                {
                    cards.Add(map.IdCard);
                }
            }
            stopwatch.Stop();
            Log.Info("ChannelStates.GetChannelMapping took {0} msec", stopwatch.ElapsedMilliseconds);
            return(result);
        }
Esempio n. 23
0
        private static void RunAll(bool compress, bool channelsMap, bool gzip)
        {
            PreRunTask();
            var listConfigurations = new ListConfigurations(Locations.UserConfigDirectory);
            var configList         = listConfigurations.Execute();
            var runConfigsCommand  = new RunAllConfigurations();

            runConfigsCommand.Execute(configList, true);
            if (compress)
            {
                foreach (var file in Locations.OutputDirectory.GetFiles("*.xml"))
                {
                    if (!gzip)
                    {
                        using (ZipFile zip = new ZipFile())
                        {
                            var zipFileName = Path.Combine(Locations.OutputDirectory.FullName, Path.GetFileNameWithoutExtension(file.Name) + ".zip");
                            zip.AddFile(file.FullName, "");
                            zip.Save(zipFileName);
                        }
                    }
                    else
                    {
                        GZip(file.FullName, true);
                    }
                }
            }
            if (channelsMap)
            {
                var map = new ChannelMap();
                map.Configurations = configList;
                var mapFileName = Path.Combine(Locations.OutputDirectory.FullName, Settings.Default.ChannelsXmlFileName);
                map.SaveToFile(mapFileName);
            }
            PostRunTask();
        }
Esempio n. 24
0
        private void LoadSetting()
        {
            TvBusinessLayer layer   = new TvBusinessLayer();
            int             id      = -1;
            int             checker = 0;

            foreach (Card card_1 in Card.ListAll())
            {
                if (RemoteControl.Instance.Type(card_1.IdCard) == CardType.DvbS)
                {
                    ChannelMap.Items.Add(card_1.Name);
                }
            }
            Settings.IsLoading = true;
            List <int> listofmap = Settings.CardMap;

            if (listofmap.Count > 0 & ChannelMap.Items.Count > 0)
            {
                foreach (int num in listofmap)
                {
                    try
                    {
                        ChannelMap.SetItemChecked(num, true);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            Settings.IsLoading = false;
            layer = null;

            List <string> ttt = new List <string>();

            string[] lines = SkyUtils.REGIONS.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string str in lines)
            {
                ttt.Add(str);
            }

            int trt = -1;

            foreach (string yt in ttt)
            {
                trt += 1;
                string[] split  = new string[1];
                string[] Split2 = new string[1];
                split = yt.Split('=');
                SkyUK_Region.Items.Add(split[1]);
                Split2 = split[0].Split('-');
                Region bad = new Region();
                bad.BouquetID = Convert.ToInt32(Split2[0]);
                bad.RegionID  = Convert.ToInt32(Split2[1]);
                regions.Add(trt, bad);
            }

            if (Settings.GetSkySetting(CatByte1.Name, CatByte1.Text) == "-1")
            {
                CatByte1.Text = "";
                CatText1.Text = "";
            }
            else
            {
                CatByte1.Text = Settings.GetSkySetting(CatByte1.Name, "-1");
                CatText1.Text = Settings.GetSkySetting(CatText1.Name, CatText1.Text);
            }

            if (Settings.GetSkySetting(CatByte2.Name, CatByte2.Text) == "-1")
            {
                CatByte2.Text = "";
                CatText2.Text = "";
            }
            else
            {
                CatByte2.Text = Settings.GetSkySetting(CatByte2.Name, "-1");
                CatText2.Text = Settings.GetSkySetting(CatText2.Name, CatText2.Text);
            }


            if (Settings.GetSkySetting(CatByte3.Name, CatByte3.Text) == "-1")
            {
                CatByte3.Text = "";
                CatText3.Text = "";
            }
            else
            {
                CatByte3.Text = Settings.GetSkySetting(CatByte3.Name, "-1");
                CatText3.Text = Settings.GetSkySetting(CatText3.Name, CatText3.Text);
            }
            if (Settings.GetSkySetting(CatByte4.Name, CatByte4.Text) == "-1")
            {
                CatByte4.Text = "";
                CatText4.Text = "";
            }
            else
            {
                CatByte4.Text = Settings.GetSkySetting(CatByte4.Name, "-1");
                CatText4.Text = Settings.GetSkySetting(CatText4.Name, CatText4.Text);
            }

            if (Settings.GetSkySetting(CatByte5.Name, CatByte5.Text) == "-1")
            {
                CatByte5.Text = "";
                CatText5.Text = "";
            }
            else
            {
                CatByte5.Text = Settings.GetSkySetting(CatByte5.Name, "-1");
                CatText5.Text = Settings.GetSkySetting(CatText5.Name, CatText5.Text);
            }

            if (Settings.GetSkySetting(CatByte6.Name, CatByte6.Text) == "-1")
            {
                CatByte6.Text = "";
                CatText6.Text = "";
            }
            else
            {
                CatByte6.Text = Settings.GetSkySetting(CatByte6.Name, "-1");
                CatText6.Text = Settings.GetSkySetting(CatText6.Name, CatText6.Text);
            }

            if (Settings.GetSkySetting(CatByte7.Name, CatByte7.Text) == "-1")
            {
                CatByte7.Text = "";
                CatText7.Text = "";
            }
            else
            {
                CatByte7.Text = Settings.GetSkySetting(CatByte7.Name, "-1");
                CatText7.Text = Settings.GetSkySetting(CatText7.Name, CatText7.Text);
            }

            if (Settings.GetSkySetting(CatByte8.Name, CatByte8.Text) == "-1")
            {
                CatByte8.Text = "";
                CatText8.Text = "";
            }
            else
            {
                CatByte8.Text = Settings.GetSkySetting(CatByte8.Name, "-1");
                CatText8.Text = Settings.GetSkySetting(CatText8.Name, CatText8.Text);
            }

            if (Settings.GetSkySetting(CatByte9.Name, CatByte9.Text) == "-1")
            {
                CatByte9.Text = "";
                CatText9.Text = "";
            }
            else
            {
                CatByte9.Text = Settings.GetSkySetting(CatByte9.Name, "-1");
                CatText9.Text = Settings.GetSkySetting(CatText9.Name, CatText9.Text);
            }

            if (Settings.GetSkySetting(CatByte10.Name, CatByte10.Text) == "-1")
            {
                CatByte10.Text = "";
                CatText10.Text = "";
            }
            else
            {
                CatByte10.Text = Settings.GetSkySetting(CatByte10.Name, "-1");
                CatText10.Text = Settings.GetSkySetting(CatText10.Name, CatText10.Text);
            }

            if (Settings.GetSkySetting(CatByte11.Name, CatByte11.Text) == "-1")
            {
                CatByte11.Text = "";
                CatText11.Text = "";
            }
            else
            {
                CatByte11.Text = Settings.GetSkySetting(CatByte11.Name, "-1");
                CatText11.Text = Settings.GetSkySetting(CatText11.Name, CatText11.Text);
            }

            if (Settings.GetSkySetting(CatByte12.Name, CatByte12.Text) == "-1")
            {
                CatByte12.Text = "";
                CatText12.Text = "";
            }
            else
            {
                CatByte12.Text = Settings.GetSkySetting(CatByte12.Name, "-1");
                CatText12.Text = Settings.GetSkySetting(CatText12.Name, CatText12.Text);
            }

            if (Settings.GetSkySetting(CatByte13.Name, CatByte13.Text) == "-1")
            {
                CatByte13.Text = "";
                CatText13.Text = "";
            }
            else
            {
                CatByte13.Text = Settings.GetSkySetting(CatByte13.Name, "-1");
                CatText13.Text = Settings.GetSkySetting(CatText13.Name, CatText13.Text);
            }

            if (Settings.GetSkySetting(CatByte14.Name, CatByte14.Text) == "-1")
            {
                CatByte14.Text = "";
                CatText14.Text = "";
            }
            else
            {
                CatByte14.Text = Settings.GetSkySetting(CatByte14.Name, "-1");
                CatText14.Text = Settings.GetSkySetting(CatText14.Name, CatText14.Text);
            }

            if (Settings.GetSkySetting(CatByte15.Name, CatByte15.Text) == "-1")
            {
                CatByte15.Text = "";
                CatText15.Text = "";
            }
            else
            {
                CatByte15.Text = Settings.GetSkySetting(CatByte15.Name, "-1");
                CatText15.Text = Settings.GetSkySetting(CatText15.Name, CatText15.Text);
            }

            if (Settings.GetSkySetting(CatByte16.Name, CatByte16.Text) == "-1")
            {
                CatByte16.Text = "";
                CatText16.Text = "";
            }
            else
            {
                CatByte16.Text = Settings.GetSkySetting(CatByte16.Name, "-1");
                CatText16.Text = Settings.GetSkySetting(CatText16.Name, CatText16.Text);
            }

            if (Settings.GetSkySetting(CatByte17.Name, CatByte17.Text) == "-1")
            {
                CatByte17.Text = "";
                CatText17.Text = "";
            }
            else
            {
                CatByte17.Text = Settings.GetSkySetting(CatByte17.Name, "-1");
                CatText17.Text = Settings.GetSkySetting(CatText17.Name, CatText17.Text);
            }

            if (Settings.GetSkySetting(CatByte18.Name, CatByte18.Text) == "-1")
            {
                CatByte18.Text = "";
                CatText18.Text = "";
            }
            else
            {
                CatByte18.Text = Settings.GetSkySetting(CatByte18.Name, "-1");
                CatText18.Text = Settings.GetSkySetting(CatText18.Name, CatText18.Text);
            }

            if (Settings.GetSkySetting(CatByte19.Name, CatByte19.Text) == "-1")
            {
                CatByte19.Text = "";
                CatText19.Text = "";
            }
            else
            {
                CatByte19.Text = Settings.GetSkySetting(CatByte19.Name, "-1");
                CatText19.Text = Settings.GetSkySetting(CatText19.Name, CatText19.Text);
            }

            if (Settings.GetSkySetting(CatByte20.Name, CatByte20.Text) == "-1")
            {
                CatByte20.Text = "";
                CatText20.Text = "";
            }
            else
            {
                CatByte20.Text = Settings.GetSkySetting(CatByte20.Name, "-1");
                CatText20.Text = Settings.GetSkySetting(CatText20.Name, CatText20.Text);
            }
            TextBox6.Text               = Settings.frequency.ToString();
            chk_AutoUpdate.Checked      = Settings.UpdateChannels;
            chk_SkyNumbers.Checked      = Settings.UseSkyNumbers;
            chk_SkyCategories.Checked   = Settings.UseSkyCategories;
            chk_SkyRegions.Checked      = Settings.UseSkyRegions;
            chk_DeleteOld.Checked       = Settings.DeleteOldChannels;
            chk_MoveOld.Checked         = !Settings.DeleteOldChannels;
            CheckBox1.Checked           = Settings.ReplaceSDwithHD;
            CheckBox2.Checked           = Settings.UpdateEPG;
            useThrottleCheckBox.Checked = Settings.UseThrottle;
            updateLogosCheckBox.Checked = Settings.UpdateLogos;
            logoDirectoryTextBox.Text   = Settings.LogoDirectory;

            //TextBox1.Text = Settings.SwitchingFrequency
            txt_Move_Old_Group.Text    = Settings.OldChannelFolder;
            SkyUK_Region.SelectedIndex = Settings.RegionIndex;
            Settings.RegionIndex       = SkyUK_Region.SelectedIndex;
            TextBox10.Text             = Settings.SymbolRate.ToString();
            TextBox5.Text           = Settings.TransportID.ToString();
            TextBox4.Text           = Settings.ServiceID.ToString();
            mpDisEqc1.SelectedIndex = Settings.DiseqC;
            if (mpDisEqc1.SelectedIndex == -1)
            {
                mpDisEqc1.SelectedIndex = 0;
                Settings.DiseqC         = 0;
            }
            MpComboBox2.SelectedIndex = Settings.polarisation;
            if (MpComboBox2.SelectedIndex == -1)
            {
                MpComboBox2.SelectedIndex = 0;
                Settings.polarisation     = 0;
            }
            MpComboBox1.SelectedIndex = Settings.modulation;
            if (MpComboBox1.SelectedIndex == -1)
            {
                MpComboBox1.SelectedIndex = 0;
                Settings.modulation       = 0;
            }
            TextBox6.Text     = Settings.frequency.ToString();
            CheckBox4.Checked = Settings.AutoUpdate;
            CheckBox5.Checked = Settings.EveryHour;
            CheckBox6.Checked = Settings.OnDaysAt;
            if (Settings.UpdateInterval == 0)
            {
                Settings.UpdateInterval = 1;
            }
            CheckBox3.Checked = Settings.useExtraInfo;
            CheckBox7.Checked = Settings.UseNotSetModSD;
            CheckBox9.Checked = Settings.UseNotSetModHD;
            CheckBox8.Checked = Settings.IgnoreScrambled;

            NumericUpDown2.Value  = Settings.GrabTime;
            NumericUpDown1.Value  = Settings.UpdateInterval;
            Panel1.Visible        = Settings.AutoUpdate;
            DateTimePicker1.Value = Settings.UpdateTime;

            Mon.Checked = Settings.Mon;
            Tue.Checked = Settings.Tue;
            Wed.Checked = Settings.Wed;
            Thu.Checked = Settings.Thu;
            Fri.Checked = Settings.Fri;
            Sat.Checked = Settings.Sat;
            Sun.Checked = Settings.Sun;

            if (CatByte1.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte1.Text), CatText1.Text);
            }
            if (CatByte2.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte2.Text), CatText2.Text);
            }
            if (CatByte3.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte3.Text), CatText3.Text);
            }
            if (CatByte8.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte8.Text), CatText8.Text);
            }
            if (CatByte4.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte4.Text), CatText4.Text);
            }
            if (CatByte5.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte5.Text), CatText5.Text);
            }
            if (CatByte6.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte6.Text), CatText6.Text);
            }
            if (CatByte10.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte10.Text), CatText10.Text);
            }
            if (CatByte7.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte7.Text), CatText7.Text);
            }
            if (CatByte9.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte9.Text), CatText9.Text);
            }
            if (CatByte11.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte11.Text), CatText11.Text);
            }
            if (CatByte12.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte12.Text), CatText12.Text);
            }
            if (CatByte13.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte13.Text), CatText13.Text);
            }
            if (CatByte14.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte14.Text), CatText14.Text);
            }
            if (CatByte15.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte15.Text), CatText15.Text);
            }
            if (CatByte16.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte16.Text), CatText16.Text);
            }
            if (CatByte17.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte17.Text), CatText17.Text);
            }
            if (CatByte18.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte18.Text), CatText18.Text);
            }
            if (CatByte19.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte19.Text), CatText19.Text);
            }
            if (CatByte20.Text != "")
            {
                Settings.SetCategory(Convert.ToByte(CatByte11.Text), CatText20.Text);
            }
        }
Esempio n. 25
0
        void FormatArticle(Article article)
        {
            if (IsImage)
            {
                article.TagThumbnail = article.GetTagThumbnail(ThumbnailTag);
            }
            if (!ChannelMap.ContainsKey(article.OwnerID))
            {
                Channel ch = ChannelHelper.GetChannel(article.OwnerID, null);
                ChannelMap.Add(article.OwnerID, ch);
            }

            if (!String.IsNullOrEmpty(ShowChannel))
            {
                Channel ch          = ChannelMap[article.OwnerID];
                string  channelName = ch.Name;
                if (ChannelHasLink)
                {
                    channelName = string.Format("<a href='{1}' target='{2}'>{0}</a>", ch.Name, article.ChannelFullUrl, LinkTarget);
                }

                article.FullChannelPath = string.Format(ShowChannel, channelName);
            }

            article.Icon = GetIcon(article.State);

            if (NoLink)
            {
                article.LinkUrl = "";
            }
            else
            {
                if (article.ContentType == (int)TypeOfArticle.LinkArticle)
                {
                    article.LinkUrl = article.ContentUrl;
                }
                else
                {
                    if (We7Helper.IsEmptyID(article.OwnerID))
                    {
                        string key = article.ModelName + "$modelchannelurl$const";
                        if (!ChannelMap.ContainsKey(key))
                        {
                            List <Channel> chs = ChannelHelper.GetChannelByModelName(article.ModelName);
                            article.LinkUrl = String.Format("{0}{1}", chs != null && chs.Count > 0?chs[0].FullUrl:"", article.FullUrl);
                        }
                    }
                    else
                    {
                        article.LinkUrl = String.Format("{0}{1}", article.ChannelFullUrl, article.FullUrl);
                    }
                }
            }

            if (DateFormat == null || DateFormat == "")
            {
                TimeSpan ts = DateTime.Now - article.Updated;
                article.TimeNote = GetTimeNote(ts);
            }
            else
            {
                article.TimeNote = article.Updated.ToString(DateFormat);
            }

            if (ShowField("ToolTip"))
            {
                article.FullTitle  = article.Title;
                article.FullTitle += "," + article.TimeNote;
                if (article.Clicks > 0)
                {
                    article.FullTitle += ",阅读量:" + article.Clicks;
                }
            }
            else
            {
                article.FullTitle = article.Title;
            }

            if (TitleMaxLength > 0 && article.Title.Length > TitleMaxLength)
            {
                article.Title = article.Title.Substring(0, TitleMaxLength) + "...";
            }

            if (!string.IsNullOrEmpty(KeyWord))
            {
                article.Title = article.Title.Replace(KeyWord, "<em>" + KeyWord + "</em>");
            }

            if (Show("Description"))
            {
                if (SummaryMaxLength > 0 && article.Description != null &&
                    article.Description.Length > SummaryMaxLength)
                {
                    article.Description = article.Description.Substring(0, SummaryMaxLength) + "...";
                }

                if (string.IsNullOrEmpty(article.Description) && !string.IsNullOrEmpty(article.Content))
                {
                    string content = We7Helper.RemoveHtml(article.Content);
                    if (content.Length > summaryMaxLength)
                    {
                        article.Description = content.Substring(0, SummaryMaxLength) + "...";
                    }
                    else
                    {
                        article.Description = content;
                    }
                }

                if (!string.IsNullOrEmpty(KeyWord) && !string.IsNullOrEmpty(article.Description))
                {
                    article.Description = article.Description.Replace(KeyWord, "<em>" + KeyWord + "</em>");
                }
            }
        }
Esempio n. 26
0
        public static int getNumChannelsForMap(ChannelMap map)
        {
            int ret = Audio360CSharpPINVOKE.getNumChannelsForMap((int)map);

            return(ret);
        }
Esempio n. 27
0
        public virtual int enqueueSilence(int numTotalSamples, ChannelMap channelMap)
        {
            int ret = Audio360CSharpPINVOKE.NativeSpatDecoderQueue_enqueueSilence(swigCPtr, numTotalSamples, (int)channelMap);

            return(ret);
        }
Esempio n. 28
0
        public virtual int enqueueData(short[] interleavedBuffer, int numTotalSamples, ChannelMap channelMap)
        {
            int ret = Audio360CSharpPINVOKE.NativeSpatDecoderQueue_enqueueData__SWIG_1(swigCPtr, interleavedBuffer, numTotalSamples, (int)channelMap);

            return(ret);
        }
Esempio n. 29
0
        public virtual int getQueueSize(ChannelMap channelMap)
        {
            int ret = Audio360CSharpPINVOKE.NativeSpatDecoderQueue_getQueueSize(swigCPtr, (int)channelMap);

            return(ret);
        }
Esempio n. 30
0
        public ProductPropertyValue Sync(int productId, string channelPropertyValueName, string channelPropertyValueId, ProductPropertyType productPropertyType)
        {
            using (var db = new YintaiHZhouContext())
            {
                // 是否为颜色
                var isColor = productPropertyType == ProductPropertyType.Color;

                // 映射类型
                var mapType = isColor ? ChannelMapType.ColorId : ChannelMapType.SizeId;


                /**
                 * 映射商品颜色或尺寸的属性值Id
                 * 映射关系{productId}+{propertyValueId}
                 */
                var mapKey           = Utils.GetProductProprtyMapKey(productId, channelPropertyValueId);
                var propertyValueMap = _channelMapper.GetMapByChannelValue(mapKey, mapType);
                var valueDesc        = string.IsNullOrWhiteSpace(channelPropertyValueName)
                    ? channelPropertyValueId
                    : channelPropertyValueName;
                if (propertyValueMap == null)
                {
                    // 检查当前商品是否存在颜色或尺寸的属性
                    var propertyExt =
                        GetProductProperty(productId, mapType);

                    if (propertyExt == null)
                    {
                        // 没有映射关系进行创建属性
                        propertyExt = new ProductProperty()
                        {
                            IsColor           = isColor,
                            IsSize            = !isColor,
                            ChannelPropertyId = 0,
                            ProductId         = productId,
                            PropertyDesc      = isColor ? "颜色" : "尺寸",
                            SortOrder         = 0,
                            Status            = 1,
                            UpdateDate        = DateTime.Now,
                            UpdateUser        = SystemDefine.SystemUser
                        };

                        db.ProductProperties.Add(propertyExt);

                        // 必须先进性保存,获取上面的Last_Update_id
                        db.SaveChanges();
                    }

                    var ppv =
                        db.ProductPropertyValues.FirstOrDefault(
                            p => p.PropertyId == propertyExt.Id && p.ValueDesc == valueDesc);

                    if (ppv == null)
                    {
                        var newProductPropertyValue = new ProductPropertyValue()
                        {
                            PropertyId = propertyExt.Id,
                            CreateDate = DateTime.Now,
                            Status     = 1,
                            UpdateDate = DateTime.Now,
                            ValueDesc  = valueDesc
                        };

                        db.ProductPropertyValues.Add(newProductPropertyValue);
                        // 保存属性值
                        db.SaveChanges();
                        ppv = newProductPropertyValue;
                        // 保存映射关系
                        var newChannelMap = new ChannelMap()
                        {
                            LocalId       = ppv.Id,
                            ChannnelValue = Utils.GetProductProprtyMapKey(productId, channelPropertyValueId),
                            MapType       = mapType
                        };

                        _channelMapper.CreateMap(newChannelMap);
                    }

                    return(ppv);
                }

                var propertyValueExt = GetProductPropertyValue(productId, propertyValueMap.LocalId, mapType);

                if (propertyValueExt == null)
                {
                    _channelMapper.RemoveMap(propertyValueMap);
                    Log.ErrorFormat("属性数据错误,映射关系存在,数据不存在, property value id {0}", propertyValueMap.LocalId);
                    return(null);
                }

                propertyValueExt.ValueDesc  = valueDesc;
                propertyValueExt.UpdateDate = DateTime.Now;

                db.SaveChanges();

                return(propertyValueExt);
            }
        }