private void AddModification(BitTunnelServerProtocol protocol, FileModificationDescriptor modification)
        {
            if (InvokeRequired)
            {
                Invoke((MethodInvoker)delegate
                {
                    AddModification(protocol, modification);
                });
            }
            else
            {
                FileDescriptor descriptor = modification.ToFileDescriptor();

                ListViewItem item = GetListViewItem(descriptor.Hash);
                string client = "";

                if (item == null)
                {
                    item = new ListViewItem(new string[]{
                        descriptor.FileName,
                        "",
                        string.Format("{0} kb", Math.Round((double)descriptor.Size / 1024, 2)),
                        modification.Hash
                    });

                    item.Tag = new List<FileDescriptor>();

                    _availableFilesView.Items.Add(item);

                    client = protocol.ClientDetails.PublicName;

                    item.ImageIndex = 0;
                }

                (item.Tag as List<FileDescriptor>).Add(descriptor);
                SetClientText(item);
            }
        }
        protected override BitTunnelProtocol CreateProtocol()
        {
            BitTunnelServerProtocol protocol = new BitTunnelServerProtocol(this);

            protocol.ClientConnected += new EventHandler<IdentificationEventArgs>(protocol_ClientConnected);
            protocol.LostConnection +=new EventHandler(protocol_LostConnection);
            protocol.ClientIdentified += new EventHandler<IdentificationEventArgs>(protocol_ClientIdentified);
            protocol.AvailableFilesUpdated += new EventHandler<FileListModificationEventArgs>(protocol_AvailableFilesUpdated);
            return protocol;
        }
        private void RemoveModification(BitTunnelServerProtocol protocol, FileModificationDescriptor modification)
        {
            if (InvokeRequired)
            {
                Invoke((MethodInvoker)delegate
                {
                    RemoveModification(protocol, modification);
                });
            }
            else
            {
                FileDescriptor file = modification.ToFileDescriptor();

                ListViewItem item = GetListViewItem(file.Hash);

                List<FileDescriptor> files = item.Tag as List<FileDescriptor>;

                if (files == null) throw new InvalidOperationException("Tag on available server file not List of File Descriptors");

                files.Remove(file);

                if (files.Count == 0)
                {
                    _availableFilesView.Items.Remove(item);
                }
                else
                {
                    item.Tag = files;

                    SetClientText(item);
                }
            }
        }
        internal void Broadcast(IMessage message)
        {
            BitTunnelServerProtocol[] asNow = new BitTunnelServerProtocol[ProtocolList.Count];

            ProtocolList.CopyTo(asNow);

            for (int i = 0; i < asNow.Length; i++)
            {
                asNow[i].SendMessage(message);
            }
        }