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 Evaluate(int SpreadMax) { #region Pin Device Changed if (this.FPinInDevice.PinIsChanged) { double dbldevice; this.FPinInDevice.GetValue(0, out dbldevice); int devid = Convert.ToInt32(dbldevice); //0 is for no sound device, so redirect to default if (devid <= 0) { devid = -1; } IntPtr ptr = IntPtr.Zero; Bass.BASS_Init(devid, 44100, BASSInit.BASS_DEVICE_DEFAULT, ptr, null); this.FDevice = devid; foreach (ChannelInfo channel in this.FChannels) { if (channel.BassHandle.HasValue) { //Update all channels in the device int chandevid = Bass.BASS_ChannelGetDevice(channel.BassHandle.Value); if (this.FDevice != chandevid) { Bass.BASS_ChannelSetDevice(channel.BassHandle.Value, chandevid); } } } } #endregion if (this.FPinInBuffer.PinIsChanged) { double db; this.FPinInBuffer.GetValue(0, out db); Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, Convert.ToInt32(db)); } if (this.FPInInLoop.PinIsChanged) { double db; this.FPInInLoop.GetValue(0, out db); Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, Convert.ToInt32(db)); } #region Handle Pin Changed if (this.FPinInHandle.PinIsChanged) { //Make sure we use the proper device Bass.BASS_SetDevice(this.FDevice); ChannelList oldchannels = new ChannelList(); oldchannels.AddRange(this.FChannels); this.FChannels.Clear(); for (int i = 0; i < this.FPinInHandle.SliceCount; i++) { double dblhandle; this.FPinInHandle.GetValue(0, out dblhandle); int hid = Convert.ToInt32(dblhandle); if (this.manager.Exists(hid)) { //Get the channel in the list ChannelInfo channel = this.manager.GetChannel(hid); if (channel.BassHandle == null) { //Initialize channel channel.Initialize(this.FDevice); } else { //Check if wrong device, if yes, update it int chandevid = Bass.BASS_ChannelGetDevice(channel.BassHandle.Value); if (this.FDevice != chandevid) { Bass.BASS_ChannelSetDevice(channel.BassHandle.Value, chandevid); } } this.FChannels.Add(channel); //Little trick to refresh channel.Play = channel.Play; } } //Pause the old channels not in it anymore foreach (ChannelInfo info in oldchannels) { if (this.FChannels.GetByID(info.InternalHandle) == null) { if (info.BassHandle.HasValue) { Bass.BASS_ChannelPause(info.BassHandle.Value); } } } } #endregion #region Updated if pin connected if (this.FHandleConnected != this.FPinInHandle.IsConnected) { if (this.FPinInHandle.IsConnected) { this.FChannels.RefreshPlay(); } else { this.FChannels.PauseAll(); } this.FHandleConnected = this.FPinInHandle.IsConnected; } #endregion }