Ejemplo n.º 1
0
        private void Eval_VC_PM_First(TCPPacketReader packet)
        {
            VoicePlayerInboundItem item = new VoicePlayerInboundItem(packet, this.crypto, this.EndPoint);

            VoicePlayer.Inbound.RemoveAll(x => x.Ident == item.Ident && x.EndPoint.Equals(this.EndPoint));

            if (item.Received)
            {
                item.Save();

                if (!String.IsNullOrEmpty(item.FileName))
                {
                    VoicePlayerItem vc = item.ToVoicePlayerItem(++VoicePlayer.NEXT_SHORTCUT, this.BlackBG);
                    VoicePlayer.Records.Add(vc);
                    User u = this.users.Find(x => x.Name == vc.Sender);

                    if (u != null)
                    {
                        if (!u.Ignored)
                        {
                            if (ScriptEvents.OnVoiceClipReceiving(this, u, true))
                            {
                                this.Panel.PMTextReceived(this, u, vc.Sender, GlobalSettings.GetDefaultColorString(GlobalSettings.DefaultColorType.Server, this.BlackBG) + "--- \\\\voice_clip_#" + vc.ShortCut + " " + StringTemplate.Get(STType.Messages, 8).Replace("+x", vc.Sender), null, PMTextReceivedType.Announce);
                                ScriptEvents.OnVoiceClipReceived(this, u, true);
                            }
                        }
                    }
                }
            }
            else
            {
                VoicePlayer.Inbound.Add(item);
            }
        }
Ejemplo n.º 2
0
        private void Eval_VC_Chunk(TCPPacketReader packet)
        {
            String sender = packet.ReadString(this.crypto);
            uint   ident  = packet;
            int    index  = VoicePlayer.Inbound.FindIndex(x => x.EndPoint.Equals(this.EndPoint) && x.Ident == ident);

            byte[] chunk = packet;

            if (index > -1)
            {
                VoicePlayerInboundItem item = VoicePlayer.Inbound[index];
                item.AddChunk(chunk);

                if (item.Received)
                {
                    VoicePlayer.Inbound.RemoveAt(index);
                    item.Save();

                    if (!String.IsNullOrEmpty(item.FileName))
                    {
                        VoicePlayerItem vc = item.ToVoicePlayerItem(++VoicePlayer.NEXT_SHORTCUT, this.BlackBG);
                        VoicePlayer.Records.Add(vc);
                        User u = this.users.Find(x => x.Name == vc.Sender);

                        if (u != null)
                        {
                            if (!u.Ignored)
                            {
                                if (ScriptEvents.OnVoiceClipReceiving(this, u, false))
                                {
                                    if (this.CanAutoPlayVC)
                                    {
                                        vc.Auto = true;
                                        VoicePlayer.QueueItem(vc);
                                    }
                                    else
                                    {
                                        this.Panel.ShowVoice(vc.Sender, vc.ShortCut);
                                    }

                                    ScriptEvents.OnVoiceClipReceived(this, u, false);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void Eval_VC_First(TCPPacketReader packet)
        {
            VoicePlayerInboundItem item = new VoicePlayerInboundItem(packet, this.crypto, this.EndPoint);

            VoicePlayer.Inbound.RemoveAll(x => x.Ident == item.Ident && x.EndPoint.Equals(this.EndPoint));

            if (item.Received)
            {
                item.Save();

                if (!String.IsNullOrEmpty(item.FileName))
                {
                    VoicePlayerItem vc = item.ToVoicePlayerItem(++VoicePlayer.NEXT_SHORTCUT, this.BlackBG);
                    VoicePlayer.Records.Add(vc);
                    User u = this.users.Find(x => x.Name == vc.Sender);

                    if (u != null)
                    {
                        if (!u.Ignored)
                        {
                            if (ScriptEvents.OnVoiceClipReceiving(this, u, false))
                            {
                                if (this.CanAutoPlayVC)
                                {
                                    vc.Auto = true;
                                    VoicePlayer.QueueItem(vc);
                                }
                                else
                                {
                                    this.Panel.ShowVoice(vc.Sender, vc.ShortCut);
                                }

                                ScriptEvents.OnVoiceClipReceived(this, u, false);
                            }
                        }
                    }
                }
            }
            else
            {
                VoicePlayer.Inbound.Add(item);
            }
        }