Пример #1
0
	public ItemList(ItemView itemView, ChannelList channelList)
	{
	    this.itemView = itemView;
			channelList.ChannelSelectedEvent += channel => CurrentChannel = channel;

        CellRendererPixbuf cell2 = new CellRendererPixbuf();
        iconColumn = new TreeViewColumn();
        iconColumn.PackStart(cell2, true);
        iconColumn.Sizing = TreeViewColumnSizing.GrowOnly;
        iconColumn.Expand = false;
        iconColumn.SetCellDataFunc(cell2,
                   new TreeCellDataFunc(IconCellDataFunc));

        AppendColumn(iconColumn);

	    titleColumn = new TreeViewColumn();
	    CellRendererText cell = new CellRendererText();

	    titleColumn.PackStart(cell, true);
	    titleColumn.SetCellDataFunc(cell, 
					new TreeCellDataFunc(NameCellDataFunc));

	    AppendColumn(titleColumn);

	    this.Selection.Changed += new EventHandler(SelectionChanged);
	    this.Model = new ListStore (typeof(Imendio.Blam.Item));
	    this.HeadersVisible = false;

        (Model as ListStore).DefaultSortFunc = CompareFunc;
        SetSortOrder(Conf.Get(Preference.REVERSE_ENTRIES, false));

	    Conf.AddNotify (Conf.GetFullKey(Preference.REVERSE_ENTRIES), new NotifyEventHandler (ConfNotifyHandler));

	}
Пример #2
0
        public override void Execute(IrcEventArgs args)
        {
            string destination = string.Empty;
            ChannelList channelList = new ChannelList();
            AddChannelsFromMessage(args.Data.MessageArray, channelList);

            if(args.Data.Type == ReceiveType.QueryMessage)
            {
                if (channelList.Count == 0)
                {
                    var channels = TaskListPlugin.Repository.GetChannels();

                    channelList.AddRange(channels);
                }

                destination = args.Data.Nick;
            } else if(args.Data.Type == ReceiveType.ChannelMessage)
            {
                var channel = args.Data.Channel;
                if(channelList.Count == 0)
                {
                    channelList.Add(channel);
                }

                destination = channel;
            }

            foreach (var channel in channelList)
            {
                ShowTaskListForChannel(channel, destination);
            }
        }
Пример #3
0
 public void AddChannelsFromMessage(string[] message, ChannelList channels)
 {
     for(int i = 2; i < message.Length; i++)
     {
         channels.Add(IrcBot.MakeValidChannel(message[i]));
     }
 }
Пример #4
0
        public MyData()
        {
            channelList = new ChannelList();

            tuner = new MyTuner();
            scan = new ScanData(tuner);
            OverlayGraphics = new OverlayGraphics(tuner);
            RemoteControls = new List<RemoteControl>();
            InitRemoteControls();
        }
Пример #5
0
        public MapFile(string filename, SCMFileContentType maptype)
        {
            MapType = maptype;
              Changed = false;
              FileName = filename;
              RegSize = 0;
              RegCount = 1000; // nº of register in a file

              Regtmp = null;
              Channels = new ChannelList();
        }
Пример #6
0
        public void SwitchChannel(string channel)
        {
            if (channel != null && ChannelList.Contains(channel))
            {
                if (currentChannel != null)
                {
                    ChannelList[currentChannel].CurrentlyViewing = false;
                }
                currentChannel = channel;
                ircMessages    = (ChannelList[channel].Buffers as UWPBuffer).Collection;
                ChannelList[channel].CurrentlyViewing = true;
                return;
            }

            currentChannel = "Server";
            ircMessages    = (ChannelList.ServerLog.Buffers as UWPBuffer).Collection;
        }
Пример #7
0
        private void SaveDvbCTChannels(ChannelList list, string path)
        {
            if (!ReadAndValidateChannellibFile(path, out var data, out var recordSize, out _))
            {
                return;
            }

            int         baseOffset;
            DataMapping mapping;

            if (chanLstBin.VersionMajor <= 11)
            {
                mapping    = new DataMapping(this.ini.GetSection("CableDigSrvTable_entry"));
                baseOffset = 20;
            }
            else
            {
                mapping    = new DataMapping(this.ini.GetSection("Map45_CableDb.bin_entry"));
                baseOffset = 12;
            }
            mapping.SetDataPtr(data, baseOffset);
            foreach (var ch in list.Channels)
            {
                if (ch.IsProxy)
                {
                    continue;
                }
                mapping.BaseOffset = baseOffset + (int)ch.RecordIndex * recordSize;
                mapping.SetWord("offProgNr", ch.NewProgramNr);
                mapping.SetByte("offLocked", ch.Lock ? 1 : 0);
                mapping.SetByte("offIsFav", ch.Favorites == 0 ? 0 : 1);

                if (chanLstBin.VersionMajor <= 11)
                {
                    mapping.SetDword("offChecksum", 0);
                    var crc = FaultyCrc32(data, mapping.BaseOffset, recordSize);
                    mapping.SetDword("offChecksum", crc);
                }
                else if (chanLstBin.VersionMajor >= 25 && chanLstBin.VersionMajor <= 45)
                {
                    mapping.SetWord("offServiceEdit", 1);
                }
            }

            File.WriteAllBytes(path, data);
        }
    public static bool UpdateChannel(Constants.Channels channelNumber, UpdateInfo info, bool sendMessage = true)
    {
        if (!currentConfig.ContainsKey((int)channelNumber))
        {
            return(false);
        }
        currentConfig.Remove((int)channelNumber);
        currentConfig.Add((int)channelNumber, info);

        if (sendMessage)
        {
            List <UpdateInfo> infos = new List <UpdateInfo>(currentConfig.Values);
            byte[]            cmd   = ChannelList.GetUpdateCommand(infos);
            RehaStimInterface.sendMessage(cmd);
        }
        return(true);
    }
Пример #9
0
        private void LoadLists(SQLiteCommand cmd)
        {
            cmd.CommandText = "select Pid, Name from FavoriteList";
            using (var r = cmd.ExecuteReader())
            {
                while (r.Read())
                {
                    int    listId = r.GetInt32(0);
                    string name   = r.GetString(1);

                    if (name == "$all")
                    {
                        pidAll = listId;
                    }
                    else if (name == "$av")
                    {
                        pidAv = listId;
                    }
                    else if (name.StartsWith("FAV"))
                    {
                        // all real user favorite lists are using the "userFavList"
                        favListIdToFavIndex.Add(listId, int.Parse(name.Substring(3)) - 1);
                        continue;
                    }

                    // lists for physical channel sources
                    var list = new ChannelList(0, name);
                    list.VisibleColumnFieldNames = ColumnNames;
                    channelLists.Add(listId, list);
                    if (name.StartsWith("$"))
                    {
                        list.ReadOnly = true;
                    }
                    else
                    {
                        DataRoot.AddChannelList(list); // only lists in the DataRoot will be visible in the UI
                    }
                }
            }

            // add the special list for the user favorites 1-4
            userFavList.VisibleColumnFieldNames    = ColumnNames;
            userFavList.IsMixedSourceFavoritesList = true;
            channelLists.Add(0, userFavList);
            DataRoot.AddChannelList(userFavList);
        }
Пример #10
0
 public ReportOptionsDialog(ChannelList channelList, int subListIndex)
 {
     InitializeComponent();
     this.channelList  = channelList;
     this.subListIndex = subListIndex;
     if (Config.Default.PrintSortByName)
     {
         this.rbSortByName.Checked = true;
     }
     else
     {
         this.rbSortByNumber.Checked = true;
     }
     this.fontEdit1.EditValue   = Config.Default.PrintFontName;
     this.spinFontSize.Value    = Config.Default.PrintFontSize;
     this.spinColumnCount.Value = Config.Default.PrintColumnCount;
 }
Пример #11
0
        private void SaveChannels(ZipFile zip, string fileName, ChannelList channels, byte[] fileContent)
        {
            if (fileContent == null)
            {
                return;
            }
            zip.Delete(fileName);

            string tempFilePath = Path.GetTempFileName();

            using (var stream = new FileStream(tempFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite))
            {
                this.WriteChannels(channels, fileContent, stream);
            }

            zip.Add(tempFilePath, fileName);
        }
Пример #12
0
        public ImageChannelData(int depth, byte[] pixels, int rows, int columns, bool compress)
        {
            Encoding = (ushort)(compress ? 1 : 0);

            var alpha = new List <byte>();
            var blue  = new List <byte>();
            var green = new List <byte>();
            var red   = new List <byte>();

            if (depth == 32)
            {
                for (var i = 0; i < pixels.Length - 3; i += 4)
                {
                    blue.Add(pixels[i]);        //Blue
                    green.Add(pixels[i + 1]);   //Green
                    red.Add(pixels[i + 2]);     //Red
                    alpha.Add(pixels[i + 3]);   //Alpha
                }
            }
            else //24
            {
                for (var i = 0; i < pixels.Length - 2; i += 3)
                {
                    blue.Add(pixels[i]);        //Blue
                    green.Add(pixels[i + 1]);   //Green
                    red.Add(pixels[i + 2]);     //Red
                    alpha.Add(255);             //Alpha
                }
            }

            if (Encoding == 0)
            {
                ChannelList.Add(new Channel(alpha.ToArray()));
                ChannelList.Add(new Channel(red.ToArray()));
                ChannelList.Add(new Channel(green.ToArray()));
                ChannelList.Add(new Channel(blue.ToArray()));
            }
            else
            {
                ChannelList.Add(new Channel(RleCompression(alpha.ToArray(), rows, columns)));
                ChannelList.Add(new Channel(RleCompression(red.ToArray(), rows, columns)));
                ChannelList.Add(new Channel(RleCompression(green.ToArray(), rows, columns)));
                ChannelList.Add(new Channel(RleCompression(blue.ToArray(), rows, columns)));
            }
        }
Пример #13
0
        private void PopulateChannelList()
        {
            ChannelList.Clear();
            if (selectedGuildId == 0L)
            {
                return;
            }
            var server = LocatorService.DiscordSocketClient.GetGuild(selectedGuildId);

            foreach (var channel in server.TextChannels.OrderBy(x => x.Position))
            {
                string temp = $"# {channel.Name}";
                ChannelList.Add(new ChannelListModel {
                    ChannelId   = channel.Id,
                    ChannelName = temp,
                });
            }
        }
Пример #14
0
        private ChannelList ListChannels()
        {
            ChannelList result = new ChannelList();

            foreach (IValueIn pin in this.FPinHandles)
            {
                double dhandle;
                pin.GetValue(0, out dhandle);
                int handle = Convert.ToInt32(dhandle);

                if (this.manager.Exists(handle))
                {
                    ChannelInfo info = this.manager.GetChannel(handle);
                    result.Add(info);
                }
            }
            return(result);
        }
Пример #15
0
        public void SwitchChannel(string channel)
        {
            if (channel == null)
            {
                return;
            }

            if (ChannelList.Contains(channel))
            {
                if (currentChannel != null)
                {
                    ChannelList[currentChannel].CurrentlyViewing = false;
                }
                currentChannel = channel;
                ircMessages    = ChannelList[channel].Buffers as MessageCollection;
                ChannelList[channel].CurrentlyViewing = true;
            }
        }
Пример #16
0
        public void ReleaseAll_DoesNotRemoveChannelBeforeDetached()
        {
            // Arrange
            Mock <IConnectionManager> manager = new Mock <IConnectionManager>();
            Mock <IChannelFactory>    factory = new Mock <IChannelFactory>();

            factory.Setup(c => c.Create(It.IsAny <string>())).Returns <string>(c => new Channel(c, "", manager.Object));
            ChannelList target  = new ChannelList(manager.Object, factory.Object);
            var         channel = target.Get("test");

            channel.Attach();

            // Act
            target.ReleaseAll();

            // Assert
            Assert.Same(channel, target.Single());
        }
Пример #17
0
        public void Release_DetachesChannel()
        {
            // Arrange
            Mock <IConnectionManager> manager = new Mock <IConnectionManager>();
            Mock <IChannelFactory>    factory = new Mock <IChannelFactory>();

            factory.Setup(c => c.Create(It.IsAny <string>())).Returns <string>(c => new Channel(c, "", manager.Object));
            ChannelList target  = new ChannelList(manager.Object, factory.Object);
            var         channel = target.Get("test");

            channel.Attach();

            // Act
            target.Release("test");

            // Assert
            Assert.Equal(ChannelState.Detaching, channel.State);
        }
Пример #18
0
 public void OnGet()
 {
     using (var db = new Model.DeviceChannels())
     {
         foreach (var device in db.Devices)
         {
             DeviceList.Add(new SelectListItem {
                 Value = device.DeviceName, Text = device.DeviceName
             });
         }
         foreach (var channel in db.Channels)
         {
             ChannelList.Add(new SelectListItem {
                 Value = channel.ChannelID.ToString(), Text = channel.ChannelName
             });
         }
     }
 }
 /// <summary>
 /// Ends current subscriptions
 /// </summary>
 public void Unsubscribe(IEnumerable <Symbol> symbols)
 {
     if (WebSocket.IsOpen)
     {
         var map = ChannelList.ToDictionary(k => k.Value.Symbol, k => k.Key, StringComparer.InvariantCultureIgnoreCase);
         foreach (var symbol in symbols)
         {
             if (map.ContainsKey(symbol.Value))
             {
                 WebSocket.Send(JsonConvert.SerializeObject(new
                 {
                     @event    = "unsubscribe",
                     channelId = map[symbol.Value]
                 }));
             }
         }
     }
 }
Пример #20
0
        public override List <IRCResponse> GetResponse(BotMessage message)
        {
            if (message.Type != "PRIVMSG" ||
                message.TargetType != IRCMessage.TargetTypes.CHANNEL ||
                ChannelList.ChannelHasMode(message.ReplyTo, 'U'))
            {
                return(null);
            }

            Match match = Regex.Match(message.MessageString, @"https?://[^\s]+", RegexOptions.IgnoreCase);

            if (!match.Success)
            {
                return(null);
            }

            if (Regex.IsMatch(match.Value, @"\.(jpe?g|gif|png|bmp)$"))
            {
                return(null);
            }

            string response = null;

            Match youtubeMatch = Regex.Match(match.Value, @"www\.youtube\.com/watch\?v=([^&]+)");

            if (youtubeMatch.Success)
            {
                response = FollowYouTube(youtubeMatch.Groups[1].Value);
            }
            else
            {
                response = FollowStandard(match.Value);
            }

            if (response == null)
            {
                return(null);
            }

            return(new List <IRCResponse>()
            {
                new IRCResponse(ResponseType.Say, response, message.ReplyTo)
            });
        }
Пример #21
0
        public async void GetPage()
        {
            Owner.Status = "フォローチャンネルを取得中";
            var list = await FollowInstance.GetFollowedChannelAsync(CurrentPage);

            if (list == null)
            {
                return;
            }

            ChannelList.Clear();

            foreach (var entry in list)
            {
                ChannelList.Add(new FollowChannelEntryViewModel(entry));
            }
            IsActive     = false;
            Owner.Status = "";
        }
Пример #22
0
        private void UpdateChannelList(ChannelList list)
        {
            var nodes = this.channeListNodes.TryGet(list);

            if (nodes == null) // this list wasn't present in the file
            {
                return;
            }

            if (this.isEFormat || list.Channels.Any(ch => ch.IsNameModified))
            {
                this.UpdateDataInChildNodes(nodes.Service, list.Channels.OrderBy(c => c.RecordOrder), ch => true, ch => ch.ServiceData, this.GetNewValueForServiceNode);
            }

            if (!this.isEFormat)
            {
                this.UpdateDataInChildNodes(nodes.Programme, list.Channels.OrderBy(c => c.NewProgramNr), ch => !(ch.IsDeleted || ch.NewProgramNr < 0), ch => ch.ProgrammeData, this.GetNewValueForProgrammeNode);
            }
        }
Пример #23
0
        public void ReleaseAll_RemovesChannelWhenFailded()
        {
            // Arrange
            Mock <IConnectionManager> manager = new Mock <IConnectionManager>();
            Mock <IChannelFactory>    factory = new Mock <IChannelFactory>();

            factory.Setup(c => c.Create(It.IsAny <string>())).Returns <string>(c => new Channel(c, "", manager.Object));
            ChannelList target  = new ChannelList(manager.Object, factory.Object);
            var         channel = target.Get("test");

            channel.Attach();
            target.ReleaseAll();

            // Act
            manager.Raise(c => c.MessageReceived += null, new ProtocolMessage(ProtocolMessage.MessageAction.Error, "test"));

            // Assert
            Assert.False(target.Any());
        }
Пример #24
0
        public void AllowsGenericEnumeration()
        {
            // Arrange
            Mock <IConnectionManager> manager = new Mock <IConnectionManager>();
            Mock <IChannelFactory>    factory = new Mock <IChannelFactory>();

            factory.Setup(c => c.Create(It.IsAny <string>())).Returns <string>(c => new Channel(c, "", manager.Object));
            ChannelList target  = new ChannelList(manager.Object, factory.Object);
            var         channel = target.Get("test");

            // Act
            IEnumerator <Realtime.IRealtimeChannel> enumerator = (target as IEnumerable <Realtime.IRealtimeChannel>).GetEnumerator();

            enumerator.MoveNext();

            // Assert
            Assert.Same(channel, enumerator.Current);
            Assert.False(enumerator.MoveNext());
        }
Пример #25
0
        public void GetWillReuseChannelObject_UpdateOptions()
        {
            // Arrange
            Mock <IConnectionManager> manager = new Mock <IConnectionManager>();
            Mock <IChannelFactory>    factory = new Mock <IChannelFactory>();

            factory.Setup(c => c.Create(It.IsAny <string>())).Returns <string>(c => new Channel(c, "", manager.Object));
            ChannelList target = new ChannelList(manager.Object, factory.Object);

            Rest.ChannelOptions options = new Rest.ChannelOptions();
            var channel = target.Get("test");

            // Act
            var channel2 = target.Get("test", options);

            // Assert
            Assert.NotNull(channel2);
            Assert.Same(options, channel2.Options);
        }
Пример #26
0
        public void GetDynamicMenu_ReturnsPostButton_ForSubscribedChannel()
        {
            const string      channelButtonIdPrefix = "channel_id-";
            const string      channelName           = "FunnyChannelName";
            const string      channelId             = "1234";
            const ChannelType publicChannel         = ChannelType.Public;
            var channelList = new ChannelList
            {
                Channels =
                    new List <Channel>
                {
                    new Channel {
                        ChannelName = channelName, ChannelId = channelId, Type = publicChannel
                    }
                }
            };
            var channels = JsonConvert.SerializeObject(channelList);
            var settings = new AddInSettings("http://localhost", "teamId",
                                             "username", channels, It.IsAny <MattermostVersion>());
            var settingsLoadService = new Mock <ISettingsLoadService>();

            settingsLoadService.Setup(x => x.Load()).Returns(settings);

            var classUnderTest = new MailItemContextMenuEntry(
                Mock.Of <IMailExplorer>(),
                settingsLoadService.Object,
                Mock.Of <ISettingsSaveService>(),
                Mock.Of <IErrorDisplay>(),
                Mock.Of <ISettingsUserInterface>(),
                Mock.Of <ISessionRepository>(),
                Mock.Of <IStringProvider>());

            var result = classUnderTest.GetDynamicMenu(Mock.Of <IRibbonControl>());

            result.Should()
            .WithNamespace("ns", "http://schemas.microsoft.com/office/2009/07/customui")
            .ContainXmlNode(@"//ns:button[contains(@label, ""FunnyChannelName"")]",
                            "because there should be one button for each channel");
            result.Should()
            .WithNamespace("ns", "http://schemas.microsoft.com/office/2009/07/customui")
            .ContainXmlNode(@"//ns:button[contains(@id, """ + channelButtonIdPrefix + channelId + @""")]",
                            "because the tag of the button should match the channelId");
        }
Пример #27
0
        private IList <ChannelInfo> Get2ndProgramNumber(ChannelList list)
        {
            var channels = list.GetChannelByNewProgNr(2);

            if (channels.Count == 1)
            {
                return(channels);
            }

            var ch = list.Channels.OrderBy(c => c.NewProgramNr <= 0 ? 10000 : c.NewProgramNr).FirstOrDefault();

            if (ch == null)
            {
                return(null);
            }
            channels = new List <ChannelInfo>();
            channels.Add(ch);
            return(channels);
        }
Пример #28
0
        private void ReadChannel(FileData file, ChannelList curList, XmlNode node, int rowId)
        {
            var setupNode = node["Setup"] ?? throw new FileLoadException("Missing Setup XML element");
            var bcastNode = node["Broadcast"] ?? throw new FileLoadException("Missing Broadcast XML element");
            var data      = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase);

            foreach (var n in new[] { setupNode, bcastNode })
            {
                foreach (XmlAttribute attr in n.Attributes)
                {
                    data.Add(attr.LocalName, attr.Value);
                }
            }

            if (!data.ContainsKey("UniqueID") || !int.TryParse(data["UniqueID"], out var uniqueId)) // UniqueId only exists in ChannelMap_105 and later
            {
                uniqueId = rowId;
            }
            var chan = new Channel(curList.SignalSource & SignalSource.MaskAdInput, rowId, uniqueId, setupNode);

            chan.OldProgramNr = -1;
            chan.IsDeleted    = false;
            if (file.formatVersion == 1)
            {
                this.ParseChannelFormat1(data, chan);
            }
            else if (file.formatVersion == 2)
            {
                this.ParseChannelFormat2(data, chan);
            }

            if ((chan.SignalSource & SignalSource.MaskAdInput) == SignalSource.DvbT)
            {
                chan.ChannelOrTransponder = LookupData.Instance.GetDvbtTransponder(chan.FreqInMhz).ToString();
            }
            else if ((chan.SignalSource & SignalSource.MaskAdInput) == SignalSource.DvbC)
            {
                chan.ChannelOrTransponder = LookupData.Instance.GetDvbcChannelName(chan.FreqInMhz);
            }

            DataRoot.AddChannel(curList, chan);
        }
Пример #29
0
        private void DefaultBtn_Click(object sender, EventArgs e)
        {
            if (ChannelList.SelectedIndex == -1)
            {
                return;
            }

            ChannelData channel = (ChannelData)ChannelList.SelectedItem;

            if (Program.Config.DefaultChannel == channel.name)
            {
                Program.Config.DefaultChannel = string.Empty;
            }
            else
            {
                Program.Config.DefaultChannel = channel.name;
            }
            ChannelList.Refresh();
            Program.SaveConfig(Program.ConfigurationFilename, Program.Config);
        }
Пример #30
0
        private ChannelList ReadChannels(SQLiteCommand cmd, string dbPath, Dictionary <long, string> providers, bool digital)
        {
            var signalSource = DetectSignalSource(cmd, digital);

            string        name        = Path.GetFileName(dbPath);
            ChannelList   channelList = new ChannelList(signalSource, name);
            string        table       = digital ? "SRV_DVB" : "SRV_ANL";
            List <string> fieldNames  = new List <string> {
                "chType", "chNum", "freq",                                                                                        // CHNL
                "SRV.srvId", "major", "progNum", "cast(srvName as blob)", "srvType", "hidden", "scrambled", "lockMode", "numSel", // SRV
            };

            if (digital)
            {
                fieldNames.AddRange(new[] { "onid", "tsid", "vidPid", "provId", "cast(shrtSrvName as blob)", "lcn" }); // SRV_DVB
            }
            var sql    = this.BuildQuery(table, fieldNames);
            var fields = this.GetFieldMap(fieldNames);

            cmd.CommandText = sql;
            using (var r = cmd.ExecuteReader())
            {
                while (r.Read())
                {
                    // 171027 - ohuseyinoglu: With our change in transponder indexing, we can directly look it up by "chNum" now!
                    var tp = this.DataRoot.Transponder.TryGet(r.GetInt32(1));
                    // ... and get the satellite from that transponder - if set
                    // Note that we can have channels from multiple satellites in the same list, so this is a loop variable now
                    var sat     = tp?.Satellite;
                    var channel = new DbChannel(r, fields, this.DataRoot, providers, sat, tp);
                    if (!channel.IsDeleted)
                    {
                        this.DataRoot.AddChannel(channelList, channel);
                        this.channelById.Add(channel.RecordIndex, channel);
                    }
                }
            }

            this.DataRoot.AddChannelList(channelList);
            return(channelList);
        }
Пример #31
0
        private void ipc_MessageReceived(IPC.IPCMessage.IIPCMessage message)
        {
            IPC.IPCMessage.ChannelListIPCMessage    chlistmsg = message as IPC.IPCMessage.ChannelListIPCMessage;
            IPC.IPCMessage.CurrentChannelIPCMessage curchmsg  = message as IPC.IPCMessage.CurrentChannelIPCMessage;
            IPC.IPCMessage.TimeIPCMessage           timemsg   = message as IPC.IPCMessage.TimeIPCMessage;

            if (chlistmsg != null)
            {
                //選択できるチャンネルリストを伝えるメッセージ
                channelList.Clear();
                channelList.AddRange(chlistmsg.ChannelList);
            }
            else if (curchmsg != null)
            {
                //現在のチャンネル・番組情報を伝えるメッセージ
                //NID,TSID,SIDがすべて同じならチャンネルは同じで変わってないと判定する
                if (this.currentChannel.Value == null || (this.currentChannel.Value.NetworkId != curchmsg.Channel.NetworkId ||
                                                          this.currentChannel.Value.TransportStreamId != curchmsg.Channel.TransportStreamId || this.currentChannel.Value.ServiceId != curchmsg.Channel.ServiceId))
                {
                    this.currentChannel.Value = curchmsg.Channel;
                }

                var currentChannel = ChannelList.Select((ch, idx) => new { Channel = ch, Index = idx }).FirstOrDefault((x) =>
                                                                                                                       curchmsg.Channel.NetworkId == x.Channel.NetworkId && curchmsg.Channel.TransportStreamId == x.Channel.TransportStreamId &&
                                                                                                                       curchmsg.Channel.ServiceId == x.Channel.ServiceId);

                //チャンネルリスト内に同じチャンネルがあればそれを今回のメッセージで得たインスタンスに置き換える
                if (currentChannel != null)
                {
                    this.channelList[currentChannel.Index] = this.currentChannel.Value;
                }

                this.currentEvent.Value = curchmsg.Event;
            }
            else if (timemsg != null)
            {
                //TOTを伝えるメッセージ
                //精度は1秒単位で値が変わるごとに来る
                currentTime.Value = timemsg.Time;
            }
        }
Пример #32
0
    public static void InitCM(int nFactor, ChannelMask channelsStim, ChannelMask channelsLowFreq, int groupFrequency, int mainFrequency, int maxPulseGroup = 1)
    {
        // save config
        lastConfig                 = new channelListConfig();
        lastConfig.nFactor         = nFactor;
        lastConfig.channelsStim    = channelsStim;
        lastConfig.channelsLowFreq = channelsLowFreq;
        lastConfig.groupFrequency  = groupFrequency;
        lastConfig.mainFrequency   = mainFrequency;
        lastConfig.maxPulseGroup   = maxPulseGroup;

        int groupTime = ChannelList.HerzToGroupTime(groupFrequency);
        //groupTime needs to be at least max (#channels,#lowFreq)  * 1.5
        int minGroupTime = (int)Mathf.Ceil(
            Mathf.Max(channelsStim.getActiveChannels().Count
                      , channelsLowFreq.getActiveChannels().Count)
            * 1.5f
            );

        groupTime = Mathf.Max(groupTime, minGroupTime);

        int mainTime = ChannelList.HerzToMainTime(mainFrequency);
        //mainTime needs to be at least pusleGroupSize * groupTime + 1.5ms
        int minMainTime = (int)Mathf.Ceil(maxPulseGroup * groupTime + 1.5f);

        mainTime = Mathf.Max(mainTime, minMainTime);

        //Debug.Log(mainTime + "|" +  groupTime);

        byte[] cmd = ChannelList.GetInitCommand(nFactor, channelsStim.toInt(), channelsLowFreq.toInt(), groupTime, mainTime);
        RehaStimInterface.sendMessage(cmd);
        //ChannelList.activeChannels = channelsStim;
        //ChannelList.activeChannelsLowFreq = channelsLowFreq;
        currentConfig = new SortedDictionary <int, UpdateInfo>();
        //init config
        foreach (var channel in channelsStim.getActiveChannels())
        {
            currentConfig.Add(channel, new UpdateInfo(UpdateInfo.MODE_SINGLE, 0, 0));
        }
        isRunning = true;
    }
Пример #33
0
 private void SaveChannelList(ChannelList channelList, string dbPath)
 {
     using (var conn = new SQLiteConnection("Data Source=" + dbPath))
     {
         conn.Open();
         using (var cmdUpdateSrv = PrepareUpdateCommand(conn))
             using (var cmdDeleteSrv = PrepareDeleteCommand(conn, (channelList.SignalSource & SignalSource.Digital) != 0))
                 using (var cmdInsertFav = PrepareInsertFavCommand(conn))
                     using (var cmdUpdateFav = PrepareUpdateFavCommand(conn))
                         using (var cmdDeleteFav = PrepareDeleteFavCommand(conn))
                         {
                             using (var trans = conn.BeginTransaction())
                             {
                                 Editor.SequentializeFavPos(channelList, 5);
                                 this.WriteChannels(cmdUpdateSrv, cmdDeleteSrv, cmdInsertFav, cmdUpdateFav, cmdDeleteFav, channelList);
                                 trans.Commit();
                             }
                             this.RepairCorruptedDatabaseImage(cmdUpdateSrv);
                         }
     }
 }
Пример #34
0
    public void stimulate(Part part, Side side, int width, int current)
    {
        //init channel mode if needed
        initStimulation();

        //update bodypart
        Constants.Channels channel = GetChannel(part, side);

        if (channel == Constants.Channels.ChannelNone)
        {
            return;
        }

        UpdateInfo info = new UpdateInfo();

        info.pulseCurrent = Mathf.Max(0, current);
        info.pulseWidth   = Mathf.Max(0, width);

        //update EMS
        ChannelList.UpdateChannel(channel, info);
    }
        public void GetChannels_GetsChannelsFromRestAndCreateChannelObjects()
        {
            var baseUri     = new Uri("http://localhost/");
            var channelList = new ChannelList
            {
                Channels = new List <Channel>
                {
                    new Channel
                    {
                        ChannelId   = CHANNEL1_ID,
                        ChannelName = CHANNEL1_NAME
                    },
                    new Channel
                    {
                        ChannelId   = CHANNEL2_ID,
                        ChannelName = CHANNEL2_NAME
                    }
                }
            };
            var list = new List <IChatChannel> {
                Mock.Of <IChatChannel>(), Mock.Of <IChatChannel>()
            };
            var restService = new Mock <IRestService>();

            restService.Setup(x => x.GetChannelList(baseUri, TOKEN)).Returns(channelList);
            var channelFactory = new Mock <IChatChannelFactory>();

            channelFactory.Setup(
                x => x.NewInstance(restService.Object, baseUri, TOKEN, USER_ID, channelList.Channels[0]))
            .Returns(list[0]);
            channelFactory.Setup(
                x => x.NewInstance(restService.Object, baseUri, TOKEN, USER_ID, channelList.Channels[1]))
            .Returns(list[1]);
            var sut = new HttpSession(restService.Object, baseUri,
                                      TOKEN, USER_ID, Mock.Of <IChatPostFactory>(), channelFactory.Object);

            var result = sut.GetChannels();

            Assert.True(result.SequenceEqual(list));
        }
Пример #36
0
 public ChannelSearchResult()
 {
     _channels = new ChannelList();
     _stations = new StationList();
 }
Пример #37
0
 private StationList getUniqueStations(ChannelList channels)
 {
     if (channels != null)
     {
         List<int> stIdList = new List<int>();
         StationList stations = new StationList();
         foreach (Channel ch in channels)
         {
             if (!(stIdList.Contains(ch.StationId)))
             {
                 stations.Add(ch.Station);
                 stIdList.Add(ch.StationId);
             }
         }
         return stations;
     }
     return null;
 }
Пример #38
0
 private static ChannelList TableToList(DataTable tbl)
 {
     ChannelList list = new ChannelList();
     foreach (DataRow r in tbl.Rows)
     {
         list.Add(DataRowToChannel(r));
     }
     return list;
 }
Пример #39
0
    ///////////////////////////////////////////////////////////////////////////

    public Layer(PsdFile psdFile)
    {
      PsdFile = psdFile;
      Rect = new Rect();
      Channels = new ChannelList();
      BlendModeKey = PsdBlendMode.Normal;
      AdditionalInfo = new List<LayerInfo>();
    }
Пример #40
0
 public void Start(int fromFreq, int toFreq, int stepFreq, ChannelList channelList, AnalogVideoStandard analogVideoStandart)
 {
     this.fromFreq = fromFreq;
     this.toFreq = toFreq;
     this.stepFreq = stepFreq;
     currFreq = fromFreq;
     tuner.Mute = true;
     terminated = false;
     tuner.AnalogVideoDecoder.put_TVFormat(analogVideoStandart);
     this.analogVideoStandart = analogVideoStandart;
     this.chanList = channelList;
 }
Пример #41
0
 void timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     //if (controller.Data.Scan.IsAlive)
     {
         channelList = controller.Data.Scan.ChannList;
         RefreshGUI();
     }
 }
Пример #42
0
        public IrcConnection(ILoggerFactory loggerFactory, IConnectionFactory connectionFactory, string hostname, bool useSsl = true, int port = 6667, string password = null)
        {
            _botCount = Interlocked.Increment(ref botCount);

            _hostname = hostname;
            _port = port;
            _password = password;
            _useSsl = useSsl;
            _state = State.Offline;
            _logger = new IrcLogger(this, loggerFactory.GetLogger(this));
            _connFactory = connectionFactory;
            _channelList = new ChannelList(this);
            _user = new IrcCurrentUser(this);
        }
Пример #43
0
        public ScanView(MyController controller)
        {
            form = new Scan();
            this.controller = controller;
            timer = new System.Timers.Timer();
            timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
            timer.Interval = 1000;

            channelList = new ChannelList();
            fromFreq = 92250000;
            toFreq = 814250000;
            //stepFreq = 62500;
            stepFreq = 1000000;
            form.cbVideoStandarts.Items.Clear();
            form.cbChanVideoStandart.Items.Clear();
            foreach (AnalogVideoStandard vs in Enum.GetValues(typeof(AnalogVideoStandard)))
            {
                form.cbVideoStandarts.Items.Add(vs.ToString());
                form.cbChanVideoStandart.Items.Add(vs.ToString());
            }
            form.cbVideoStandarts.Text = AnalogVideoStandard.PAL_D.ToString();
            form.cbChanVideoStandart.SelectedValueChanged += new EventHandler(cbChanVideoStandart_SelectedValueChanged);
            BindUI();
        }
Пример #44
0
 public ChannelSearchResult(ChannelList channels)
 {
     _channels = channels;
     _stations = new StationList();
 }
Пример #45
0
 public ChannelSearchResult(StationList stations)
 {
     _channels = new ChannelList();
     _stations = stations;
 }
Пример #46
0
        public DialogResult Show()
        {
            if (!controller.Data.Tuner.IsScanningSupported())
            {
                MessageBox.Show("Unfortunetly you card doesn't support scanning :(", "uTuner");
                return DialogResult.Abort;
            }
            channelList = controller.Data.ChannelList.Fork();

            RefreshGUI();
            var res = form.ShowDialog();
            if (res == DialogResult.OK)
            {
                SetPositions();
                controller.Data.ChannelList.Merge(channelList, true);
                controller.Data.ChannelList.Sort();
                controller.Data.Save();

            }
            return res;
        }
Пример #47
0
        private void PrepareGUI()
        {
            Glade.XML gladeXML = Glade.XML.FromAssembly("blam.glade",
                                                        "mainWindow", null);
            gladeXML.Autoconnect(this);

            channelList = new ChannelList(mCollection);
            ((Container)channelListSw).Child = channelList;

            channelList.ChannelSelectedEvent   += ChannelSelected;
            channelList.EditChannelEvent       += EditChannelActivated;
            channelList.MarkChannelAsReadEvent += MarkChannelAsReadActivated;
            channelList.RemoveChannelEvent     += RemoveChannelActivated;
            channelList.RefreshChannelEvent    += RefreshChannelActivated;

			itemList = new ItemList(itemView, channelList);
			((Container)itemListSw).Child = itemList;

            itemView = new ItemView(itemList);

            Frame f = new Frame ();
            f.Shadow = ShadowType.In;
            f.Add (itemView);
            itemPaned.Add2 (f);
            f.Show ();
            itemView.OnUrl += OnUrl;

			// a bit silly to do it every time, but works
			itemList.PropertyChanged += (sender, e) => printMenuItem.Sensitive = true;

            trayIcon = new TrayIcon (Catalog.GetString ("Blam News Reader"), mCollection);
            trayIcon.ButtonPressEvent += TrayIconButtonPressCb;
            trayIcon.RefreshAllEvent += RefreshAllActivated;
            trayIcon.PreferencesEvent += PreferencesActivated;
            trayIcon.AboutEvent += AboutActivated;
            trayIcon.QuitEvent += QuitActivated;

            channelsLabelText = channelsLabel.Text;
            UpdateTotalNumberOfUnread ();

            printMenuItem.Sensitive = false;
            SensitizeChannelMenuItems(false);

            // Setup drag-n-drop
            Gtk.Drag.DestSet(mainWindow, DestDefaults.All,
                             DragEntries, DragAction.Copy | DragAction.Move);
            mainWindow.DragDataReceived += DragDataReceivedCb;

            RestoreWindowState();

            mainWindow.IconName = "blam";

            mainWindow.ShowAll ();

            bool ShowItemList = Conf.Get(Preference.SHOW_ITEM_LIST, true);
            if(ShowItemList){
                itemPaned.Child1.Visible = true;
            } else {
                itemPaned.Child1.Visible = false;
            }

            channelDialog = new ChannelDialog (this);
            addGroupDialog = new AddGroupDialog (this);
            preferencesDialog = new PreferencesDialog (this.Window);
            opmlDialog = new OpmlDialog (this.Window);
            opmlDialog.ChannelAdded += channel => mCollection.Add(channel, true);
            opmlDialog.ImportFinished += OpmlImportFinished;

        }
Пример #48
0
 public void Load()
 {
     if (File.Exists("channels.json"))
     {
         var ser = new Serializer<ChannelList>();
         channelList = ser.JSON2Serialize("channels.json", true);
         channelList.Sort();
     }
     if (File.Exists("settings.json"))
     {
         var ser = new Serializer<Settings>();
         settings = ser.JSON2Serialize("settings.json", true);
     }
     else
         settings = new Settings();
 }