Beispiel #1
0
 void _conn_Join(object sender, ChannelEventArgs e)
 {
     _dispatcher.BeginInvoke((Action)delegate
     {
         var index = _conn.Channels.ToList().IndexOf(e.Channel);
         _buffers.Insert(index, new ChannelViewModel(_dispatcher, e.Channel));
     });
 }
Beispiel #2
0
 static void OnConnect(object sender, ChannelEventArgs e)
 {
     TcpServer.SetKeepAliveValues(e.Channel.Socket, 20000, 5000);
     e.Channel.ChannelError += OnError;
     e.Channel.SetPackage<Logic.HeadSizePage>();
     e.Channel.Package.ReceiveMessage = OnReceive;
     e.Channel.BeginReceive();
     Console.WriteLine("{0} Connected!", e.Channel.EndPoint);
 }
Beispiel #3
0
 protected override void OnConnected(object sender, ChannelEventArgs e)
 {
     base.OnConnected(sender, e);
     e.Channel.EnabledSendCompeletedEvent = true;
     e.Channel.SendMessageCompleted = delegate(object o, SendMessageCompletedArgs m)
     {
         m.Channel.Dispose();
     };
     System.Console.WriteLine("{0} connected!", e.Channel.EndPoint);
 }
Beispiel #4
0
 static void OnDisposed(object sender, ChannelEventArgs e)
 {
     Console.WriteLine("{0}{1} disposed!", e.Channel.Name, e.Channel.EndPoint);
     Logic.UnRegister ur = new Logic.UnRegister();
     ur.User.Name = e.Channel.Name;
     ur.User.IP = e.Channel.EndPoint.ToString();
     foreach (IChannel item in mServer.GetOnlines())
     {
         if (item != e.Channel)
             item.Send(ur);
     }
 }
Beispiel #5
0
        public void OnPeerConnected(object sender, ChannelEventArgs e1)
        {
#if !DEBUG
            var op = e1.Channel.CreateOperation<PluginSynchronizationOperation>(e1.Peer.Identity.Guid);
            op.OnPacketReceived += (o, e) =>
            {
                if (e.Packet is SynchronizationFinalizationPacket)
                    PluginEvents.ForEach(pe => pe(e1));
            };
            op.SendPacket(new FetchPluginMetadataPacket());
#else
            PluginEvents.ForEach(pe => pe(e1));
#endif
            return;
        }
Beispiel #6
0
 public void OnPeerConnected(ChannelEventArgs e)
 {
 }
 public void OnPeerDisconnected(ChannelEventArgs e2)
 {
 }
 void connectionManager_JoinedChannel(object sender, ChannelEventArgs e)
 {
     Application.Current.Dispatcher.InvokeAsync(() =>
     {
         this.Channel = e.Channel;
     });
 }
Beispiel #9
0
 public virtual void OnDialCompleted(ChannelEventArgs e)
 {
 }
Beispiel #10
0
 protected override void OnConnected(object sender, ChannelEventArgs e)
 {
     base.OnConnected(sender, e);
     Console.WriteLine("{0} connected", e.Channel.EndPoint);
 }
Beispiel #11
0
 public void ChannelCreated(ServerBase server, ChannelEventArgs e)
 {
     Utils.GetLog<TrackerServer>().InfoFormat("{0} Connected TrackerServer", e.Channel.EndPoint);
 }
Beispiel #12
0
 public virtual void channelStarted(ChannelEventArgs e)
 {
 }
		private void Channel_Closed(object sender, ChannelEventArgs e)
		{
			var channel = (TcpServerChannel)e.Channel;

			channel.Closed -= Channel_Closed;

			if(_activedChannels.TryRemove(channel.ChannelId, out channel))
				_channelPool.Release(channel);
		}
Beispiel #14
0
 private static string B(ChannelEventArgs e)
 {
     return(e.IsBubbling ? "Bubble" : "Capture");
 }
		private void Server_Accepted(object sender, ChannelEventArgs e)
		{
			_activedChannels.TryAdd(e.Channel.ChannelId, (TcpServerChannel)e.Channel);
		}
Beispiel #16
0
 private void ChannelOnPlayerLeft(object sender, ChannelEventArgs e)
 {
     _messageBus.PublishAsync(new ChannelPlayerLeftMessage(e.Player.Account.Id, e.Channel.Id));
 }
Beispiel #17
0
 private void Server_Accepted(object sender, ChannelEventArgs e)
 {
     _activedChannels.TryAdd(e.Channel.ChannelId, (TcpServerChannel)e.Channel);
 }
 private void Channel_Closed(object sender, ChannelEventArgs e)
 {
     //  TODO:   Do we need to call dispose here ??
     this.Dispose();
 }
Beispiel #19
0
        static void OnDisposed(object sender, ChannelEventArgs e)
        {
            Console.WriteLine("{0} disconnected.", e.Channel.EndPoint);
            if (players_byid.ContainsKey(e.Channel.ClientID))
            {
                Player pn = players_byid[e.Channel.ClientID];
                lock (lockobject)
                {
                    foreach (KeyValuePair<string, Player> sp in players_byname)
                    {
                        if (sp.Value.ClientID != e.Channel.ClientID)
                        {
                            PlayerLogoutMsg plm_sc = new PlayerLogoutMsg();
                            plm_sc.ClientID = e.Channel.ClientID;
                            plm_sc.Name = pn.Name;
                            ProtobufAdapter.Send(sp.Value.Channel, plm_sc);
                        }
                    }
                }

                using (FileStream fs = new FileStream(string.Format(@"accounts/{0:s}.xml", pn.Name), FileMode.Create))
                {
                    PlayerSync ps = new PlayerSync();
                    ps.Name = pn.Name;
                    ps.DEF = pn.DEF;
                    ps.ATK = pn.ATK;
                    ps.MaxHP = pn.MaxHP;
                    ps.HP = pn.HP;
                    ps.Speed = pn.Speed;
                    ps.Position[0] = pn.Position.X;
                    ps.Position[1] = pn.Position.Y;
                    XmlSerializer formatter = new XmlSerializer(typeof(PlayerSync));
                    formatter.Serialize(fs, ps);
                }

                lock (lockobject)
                {
                    players_byname.Remove(pn.Name);
                    players_byid.Remove(e.Channel.ClientID);
                }
                pn = null;
            }
        }
Beispiel #20
0
 public virtual void channelClosed(ChannelEventArgs e)
 {
 }
Beispiel #21
0
 public void ChannelCreated(ServerBase server, ChannelEventArgs e)
 {
     Log.InfoFormat("create channel@{0}", e.Channel.EndPoint);
 }
Beispiel #22
0
 static void OnConnected(object sender, ChannelEventArgs e)
 {
     e.Channel.SetPackage<HeadSizePackage>().ReceiveMessage = OnMessageReceive;
     e.Channel.BeginReceive();
     Console.WriteLine("{0} connected.", e.Channel.EndPoint);
 }
        private void connService_ChannelOpened(object sender, ChannelEventArgs e)
        {
            var terminalChannel = e.Channel as SshWinConsoleChannel;

            terminalChannel.TerminalVisible = showAllTerminalsCheckBox.Checked;
        }
Beispiel #24
0
 private void Channel_Closed(object sender, ChannelEventArgs e)
 {
     this.Dispose();
 }
		protected virtual void OnAccepted(ChannelEventArgs args)
		{
			if(this.Accepted != null)
				this.Accepted(this, args);
		}
Beispiel #26
0
 public void Disposed(IServer server, ChannelEventArgs e)
 {
     Console.WriteLine("{0} disposed", e.Channel.EndPoint);
 }
Beispiel #27
0
 private void OnChannelError(object sender, ChannelEventArgs eventArgs)
 {
     throw new PlcCommunicationException("ASComm Channel Error in TagController", _device.RoutePath, eventArgs.Message);
 }
		private void Channel_Closed(object sender, ChannelEventArgs e)
		{
			var channel = (TcpServerChannel)e.Channel;

			channel.Closed -= Channel_Closed;
			channel.Failed -= Channel_Failed;
			channel.Received -= Channel_Received;
		}
		protected override void OnClosed(ChannelEventArgs args)
		{
			CloseDataChannel();

			if(_pasvDataChannel != null)
				_pasvDataChannel.StopListener();

			var stream = UpFileStream;
			UpFileStream = null;

			if(stream != null)
				stream.Dispose();

			base.OnClosed(args);
		}
 public void OnPeerConnected(ChannelEventArgs e)
 {
 }
Beispiel #31
0
		private void  fireChannelClosed(IChannel c)
		{
			if (this.channelListeners.Count == 0)
				return;

			ChannelEventArgs e = new ChannelEventArgs(c);
			foreach(IChannelListener l in this.channelListeners) 
			{
                l.channelClosed(e);
			}
		}
Beispiel #32
0
 public void TriggerChannelInfoChanged(ChannelEventArgs e)
 {
     OnChannelInfoChanged(e);
 }
Beispiel #33
0
		internal virtual void  fireChannelStarted(IChannel c)
		{
			if (this.channelListeners.Count == 0)
				return;

			ChannelEventArgs e = new ChannelEventArgs(c);
			foreach(IChannelListener l in this.channelListeners) 
			{
				l.channelStarted(e);
			}
		}
 void connectionManager_PartedChannel(object sender, ChannelEventArgs e)
 {
     Application.Current.Dispatcher.InvokeAsync(() =>
     {
         this.Channel = this.Connection.Channels.FirstOrDefault();
     });
 }
Beispiel #35
0
 public void Disposed(IServer server, ChannelEventArgs e)
 {
     Interlocked.Decrement(ref clientCount);
 }