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);
            }
        }
 public void AddChannelsFromMessage(string[] message, ChannelList channels)
 {
     for(int i = 2; i < message.Length; i++)
     {
         channels.Add(IrcBot.MakeValidChannel(message[i]));
     }
 }
Example #3
0
        public void AddChannel(string name)
        {
            var length = ChannelList.Count();

            length++;
            Channel newChannel = new Channel(length, name);

            ChannelList.Add(newChannel);
        }
Example #4
0
        public void LoadFollowingChannels(string p_channelname)
        {
            List <IChannel> result       = new List <IChannel>();
            string          uri          = String.Format(GET_FOLLOWING_CHANNEL, p_channelname);
            FollowResult    followResult = ModelFactory.GetFollowResult(Utility.GetJson(uri));

            foreach (Follow follow in followResult.follows)
            {
                IChannel ichannel = GetIChannel(follow.channel);
                ChannelList.Add(ichannel);
            }
        }
        public void GetChannels()
        {
            var channels = dataFile.Channels;

            for (int i = 1; i <= channels.Count; i++)
            {
                var channel = channels[i];
                ChannelList.Add(channel.Name);
            }

            // set first channel by default
            SelectedChannelIndex = 0;

            // Channel index starts from 1
            GetChannelInfo(SelectedChannelIndex + 1);
        }
        private async Task GetChannels()
        {
            var channelGroupList = await _channelSerivce.GetAppChannels();

            if (channelGroupList != null)
            {
                ChannelList.Clear();
                foreach (var group in channelGroupList.Groups)
                {
                    foreach (var channel in group.Channels)
                    {
                        ChannelList.Add(channel);
                    }
                }
            }
            this.CurrentChannel = ChannelList.FirstOrDefault();
        }
Example #7
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)));
            }
        }
Example #8
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
             });
         }
     }
 }
Example #9
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,
                });
            }
        }
Example #10
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);
        }
Example #11
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 = "";
        }
Example #12
0
        public void loadConfig()
        {
            {
                XmlDocument xd = new XmlDocument();
                xd.Load(Path.Combine(Application.StartupPath, "config/channelList.xml"));

                XmlNodeList xnList = xd.SelectNodes("config/channelList/channel");

                ChannelList.Clear();
                foreach (XmlNode xn in xnList)
                {
                    ChannelItem item = new ChannelItem();
                    item.ChannelName = xn.SelectSingleNode("channelName").InnerText;
                    item.ChannelId   = xn.SelectSingleNode("channelId").InnerText;
                    ChannelList.Add(item);
                }
            }

            {
                XmlDocument xd = new XmlDocument();
                xd.Load(Path.Combine(Application.StartupPath, "config/packageList.xml"));

                XmlNodeList xnList = xd.SelectNodes("config/packageList/package");
                PackageList.Clear();
                foreach (XmlNode xn in xnList)
                {
                    PackageItem item = new PackageItem();
                    item.Title               = xn.SelectSingleNode("pkgTitle").InnerText;
                    item.PackageName         = xn.SelectSingleNode("pkgName").InnerText;
                    item.AppName             = xn.SelectSingleNode("AppName").InnerText;
                    item.ResourceDelete      = xn.SelectSingleNode("ResourceDelete").InnerText;
                    item.ResourceEncrypt     = xn.SelectSingleNode("ResourceEncrypt").InnerText;
                    item.ResourceNormal      = xn.SelectSingleNode("ResourceNormal").InnerText;
                    item.WinPhoneDescription = xn.SelectSingleNode("WinPhoneDescription").InnerText;
                    item.WinPhoneProductID   = xn.SelectSingleNode("WinPhoneProductID").InnerText;

                    XmlNodeList metaDataList = xn.SelectNodes("metaData/item");
                    foreach (XmlNode metaData in metaDataList)
                    {
                        string k = metaData.Attributes["name"].Value;
                        string v = metaData.Attributes["value"].Value;
                        item.MetaData.Add(k, v);
                    }

                    PackageList.Add(item);
                }
            }


            {
                XmlDocument xd = new XmlDocument();
                xd.Load(Path.Combine(Application.StartupPath, "config/enableList.xml"));

                XmlNodeList xnList = xd.SelectNodes("config/enableList/item");
                foreach (XmlNode xn in xnList)
                {
                    switch (xn.Attributes["name"].Value)
                    {
                    case "EnableMM":
                        EnableMM = xn.Attributes["value"].Value.Equals("true");
                        break;

                    case "EnableCopyFile":
                        EnableCopyFile = xn.Attributes["value"].Value.Equals("true");
                        break;

                    case "DeleteTemp":
                        DeleteTemp = xn.Attributes["value"].Value.Equals("true");
                        break;

                    default:
                        break;
                    }
                }

                xnList = xd.SelectNodes("config/encryptConfig/item");
                foreach (XmlNode xn in xnList)
                {
                    switch (xn.Attributes["name"].Value)
                    {
                    case "AllExts":
                    {
                        EncryptCfg.AllExts.Clear();
                        string   attrValue = xn.Attributes["value"].Value;
                        string[] strArr    = attrValue.Split(';');
                        foreach (string item in strArr)
                        {
                            EncryptCfg.AllExts.Add("." + item);
                        }
                    }
                    break;

                    case "PartExts":
                    {
                        EncryptCfg.PartExts.Clear();
                        string   attrValue = xn.Attributes["value"].Value;
                        string[] strArr    = attrValue.Split(';');
                        foreach (string item in strArr)
                        {
                            EncryptCfg.PartExts.Add("." + item);
                        }
                    }
                    break;

                    case "PartLength":
                        EncryptCfg.PartLength = Convert.ToInt32(xn.Attributes["value"].Value);
                        break;

                    default:
                        break;
                    }
                }


                CopyFileList.Clear();
                xnList = xd.SelectNodes("config/copyFileList/item");
                foreach (XmlNode xn in xnList)
                {
                    CopyFileList.Add(xn.Attributes["name"].Value);
                }

                ResourceFileList.Clear();
                xnList = xd.SelectNodes("config/resourceFileList/item");
                foreach (XmlNode xn in xnList)
                {
                    ResourceFileList.Add(xn.Attributes["name"].Value);
                }

                WinPhoneFileList.Clear();
                xnList = xd.SelectNodes("config/winPhoneFileList/item");
                foreach (XmlNode xn in xnList)
                {
                    WinPhoneFileList.Add(xn.Attributes["name"].Value);
                }
            }
        }
Example #13
0
 private static ChannelList TableToList(DataTable tbl)
 {
     ChannelList list = new ChannelList();
     foreach (DataRow r in tbl.Rows)
     {
         list.Add(DataRowToChannel(r));
     }
     return list;
 }
Example #14
0
 public void AddChannel(Channel channel)
 {
     Debug.Assert(!CheckChannel(channel));
     ChannelList.Add(channel);
 }
Example #15
0
        public ServerViewModel()
        {
            typingThrottler.Action += (sender, e) => {
                DispatcherHelper.CheckBeginInvokeOnUI(async() => {
                    await(LocatorService.DiscordSocketClient.GetChannel(channelId) as SocketTextChannel).TriggerTypingAsync();
                });
            };

            LocatorService.DiscordSocketClient.MessageReceived += DiscordClient_MessageReceived;
            LocatorService.DiscordSocketClient.MessageUpdated  += DiscordClient_MessageUpdated;
            LocatorService.DiscordSocketClient.MessageDeleted  += DiscordClient_MessageDeleted;
            LocatorService.DiscordSocketClient.UserUpdated     += DiscordClient_UserUpdated;

            this.LoadJoinedServersList = new DelegateCommand(() => {
                ServerListModelList.Clear();
                var servers = LocatorService.DiscordSocketClient.Guilds;

                foreach (var server in servers)
                {
                    ServerListModelList.Add(new ServerListModel {
                        ServerId       = server.Id,
                        ServerName     = server.Name,
                        ServerImageUri = server.IconUrl,
                    });
                }
            });

            this.LoadCurrentUserAvatar = new DelegateCommand(() => {
                CurrentUserAvatarUrl = LocatorService.DiscordSocketClient.CurrentUser.GetAvatarUrlOrDefault();
            });

            this.SendMessageToCurrentChannel = new DelegateCommand(async() => {
                var message = currentChatMessage;
                if (String.IsNullOrEmpty(message))
                {
                    return;
                }
                if (channelId == 0)
                {
                    return;
                }
                var channel = LocatorService.DiscordSocketClient.GetChannel(channelId) as SocketTextChannel;
                await channel.SendMessageAsync(message);

                CurrentChatMessage = String.Empty;
            });

            this.ToggleUserListCommand = new DelegateCommand(() => {
                ShowUserList = !ShowUserList;
            });

            this.UserClick = new DelegateCommand <ulong>((userId) => {
                // 0 for now should mean its the role header
                if (userId != 0)
                {
                    LocatorService.NavigationService.NavigateTo("userProfile", userId);
                }
            });

            this.ServerListToggle = new DelegateCommand(() => {
                ShowServerPane = !ShowServerPane;
            });

            this.PinnedMessagesCommand = new DelegateCommand(() => {
                LocatorService.NavigationService.NavigateTo("pinnedMessages",
                                                            new PinnedMessagesNavData {
                    ChannelId = channelId,
                    GuildId   = selectedGuildId,
                });
            });

            this.LinkClickCommand = new DelegateCommand <LinkClickedEventArgs>(async(args) => {
                // todo: rest of these
                if (args.Link.StartsWith("http"))
                {
                    await Windows.System.Launcher.LaunchUriAsync(new Uri(args.Link));
                }
            });

            this.OpenDMCommand = new DelegateCommand(() => {
                ChannelList.Clear();
                selectedGuildId = 0L;

                foreach (var channel in LocatorService.DiscordSocketClient.DMChannels)
                {
                    string temp = channel.Recipient.Username;
                    ChannelList.Add(new ChannelListModel {
                        ChannelId   = channel.Id,
                        ChannelName = temp,
                    });
                }
            });
        }
Example #16
0
        public void Evaluate(int SpreadMax)
        {
            #region Reset the mixer
            if (this.FPinInChanCount.PinIsChanged || this.FPinInIsDecoding.PinIsChanged)
            {
                while (this.FMixerInfo.Streams.Count > 0)
                {
                    this.FMixerInfo.DetachChannel(this.FMixerInfo.Streams[0]);
                }

                if (this.FMixerInfo.InternalHandle != 0)
                {
                    if (this.FMixerInfo.BassHandle != null)
                    {
                        bool free = Bass.BASS_StreamFree(this.FMixerInfo.BassHandle.Value);
                    }
                    this.manager.Delete(this.FMixerInfo.InternalHandle);
                }

                ChannelList channels = this.ListChannels();

                double numchans;
                this.FPinInChanCount.GetValue(0, out numchans);

                double decoding;
                this.FPinInIsDecoding.GetValue(0, out decoding);

                double isplay;
                this.FPinInPlay.GetValue(0, out isplay);

                MixerChannelInfo newmixerinfo = new MixerChannelInfo();
                newmixerinfo.IsDecoding = decoding == 1;
                newmixerinfo.NumChans   = Convert.ToInt32(numchans);
                newmixerinfo.Play       = isplay == 1;
                this.manager.CreateChannel(newmixerinfo);

                this.FMixerInfo = newmixerinfo;

                foreach (ChannelInfo info in this.ListChannels())
                {
                    this.FMixerInfo.AttachChannel(info);
                }

                this.FPinOutHandle.SetValue(0, this.FMixerInfo.InternalHandle);
            }
            #endregion

            #region Update Mixer pins
            bool update = false;
            foreach (IValueIn pin in this.FPinHandles)
            {
                if (pin.PinIsChanged)
                {
                    update = true;
                }
            }

            #region Update Channels
            if (update)
            {
                ChannelList channels = this.ListChannels();

                ChannelList todetach = new ChannelList();

                foreach (ChannelInfo info in this.FMixerInfo.Streams)
                {
                    if (!channels.Contains(info))
                    {
                        todetach.Add(info);
                    }
                }

                foreach (ChannelInfo info in todetach)
                {
                    this.FMixerInfo.DetachChannel(info);
                }

                foreach (ChannelInfo info in channels)
                {
                    if (!this.FMixerInfo.Streams.Contains(info))
                    {
                        this.FMixerInfo.AttachChannel(info);
                        UpdateMatrix(this.FMixerInfo.Streams.IndexOf(info));
                    }
                }
            }
            #endregion


            for (int i = 0; i < this.FPinLevels.Count; i++)
            {
                if (this.FPinLevels[i].PinIsChanged)
                {
                    UpdateMatrix(i);
                }
            }
            #endregion

            if (this.FPinInPlay.PinIsChanged)
            {
                double isplay;
                this.FPinInPlay.GetValue(0, out isplay);
                this.FMixerInfo.Play = isplay == 1;
            }
        }