protected override void SendInternal(PosList<ArraySegment<byte>> items)
		{
			foreach (var item in items)
			{
				Client.Send(item.Array);
			}
		}
        private PosList <ArraySegment <byte> > GetSendingItems()
        {
            if (m_SendingItems == null)
            {
                m_SendingItems = new PosList <ArraySegment <byte> >();
            }

            return(m_SendingItems);
        }
Example #3
0
        public void NewPosition(string department, string position)
        {
            Pos p;

            p.Department = this.Department;
            p.Position   = this.Position;
            PosList.Add(p);
            Position   = position;
            Department = department;
        }
Example #4
0
        //LifeMove関数
        private void LifeMove()
        {//Lifeの動きを計算している。
            World.CallLookEnv();
            World.CallMove();
            var actives = World.Actives(true);

            if (actives.Count >= 1)
            {
                PosList.Add(actives);
            }
            if (actives.Count < 1)
            {
                internalMove = false;
                Debug.Log("収束しました!\n是非再生しちゃってくだせえ!!");
            }
            Treadmove = true;
        }
Example #5
0
    private void SetPointinfo()
    {
        PosList.Clear();
        Vector3 dir = mDebugAABB.extents;

        if (dir.Equals(Vector3.zero))
        {
            return;
        }
        float   dirx   = mDebugAABB.extents.x * 2;
        float   diry   = mDebugAABB.extents.y * 2;
        float   dirz   = mDebugAABB.extents.z * 2;
        Vector3 center = mDebugAABB.center;
        Vector3 pos1   = center - dir;
        Vector3 pos2   = center - dir + dirx * Vector3.right;
        Vector3 pos3   = center - dir + diry * Vector3.up;
        Vector3 pos4   = center - dir + dirz * Vector3.forward;
        Vector3 pos5   = center + dir;
        Vector3 pos6   = center + dir - dirx * Vector3.right;
        Vector3 pos7   = center + dir - diry * Vector3.up;
        Vector3 pos8   = center + dir - dirz * Vector3.forward;

        PosList.Add(pos1);
        PosList.Add(pos2);
        PosList.Add(pos7);
        PosList.Add(pos4);
        PosList.Add(pos1);

        PosList.Add(pos1);
        PosList.Add(pos3);
        PosList.Add(pos2);
        PosList.Add(pos8);

        PosList.Add(pos7);
        PosList.Add(pos5);
        PosList.Add(pos4);
        PosList.Add(pos6);

        PosList.Add(pos5);
        PosList.Add(pos6);
        PosList.Add(pos3);
        PosList.Add(pos8);
        PosList.Add(pos5);
    }
		protected override void SendInternal(PosList<ArraySegment<byte>> items)
		{
			if (m_SocketEventArgsSend == null)
			{
				m_SocketEventArgsSend = new SocketAsyncEventArgs();
				m_SocketEventArgsSend.Completed += new EventHandler<SocketAsyncEventArgs>(Sending_Completed);
			}

			bool raiseEvent;

			try
			{
				if (items.Count > 1)
				{
					if (m_SocketEventArgsSend.Buffer != null)
						m_SocketEventArgsSend.SetBuffer(null, 0, 0);

					m_SocketEventArgsSend.BufferList = items;
				}
				else
				{
					var currentItem = items[0];

					try
					{
						if (m_SocketEventArgsSend.BufferList != null)
							m_SocketEventArgsSend.BufferList = null;
					}
					catch//a strange NullReference exception
					{
					}

					m_SocketEventArgsSend.SetBuffer(currentItem.Array, 0, currentItem.Count);
				}


				raiseEvent = Client.SendAsync(m_SocketEventArgsSend);
			}
			catch (SocketException exc)
			{
				if (EnsureSocketClosed() && !IsIgnorableSocketError(exc.ErrorCode))
					OnError(exc);

				return;
			}
			catch (Exception e)
			{
				if (EnsureSocketClosed() && IsIgnorableException(e))
					OnError(e);
				return;
			}

			if (!raiseEvent)
				Sending_Completed(Client, m_SocketEventArgsSend);
		}
        protected override void SendInternal(PosList <ArraySegment <byte> > items)
        {
            if (m_SocketEventArgsSend == null)
            {
                m_SocketEventArgsSend            = new SocketAsyncEventArgs();
                m_SocketEventArgsSend.Completed += new EventHandler <SocketAsyncEventArgs>(Sending_Completed);
            }

            bool raiseEvent;

            try
            {
                if (items.Count > 1)
                {
                    if (m_SocketEventArgsSend.Buffer != null)
                    {
                        m_SocketEventArgsSend.SetBuffer(null, 0, 0);
                    }

                    m_SocketEventArgsSend.BufferList = items;
                }
                else
                {
                    var currentItem = items[0];

                    try
                    {
                        if (m_SocketEventArgsSend.BufferList != null)
                        {
                            m_SocketEventArgsSend.BufferList = null;
                        }
                    }
                    catch//a strange NullReference exception
                    {
                    }

                    m_SocketEventArgsSend.SetBuffer(currentItem.Array, 0, currentItem.Count);
                }


                raiseEvent = Client.SendAsync(m_SocketEventArgsSend);
            }
            catch (SocketException exc)
            {
                int errorCode;

#if !NETFX_CORE
                errorCode = exc.ErrorCode;
#else
                errorCode = (int)exc.SocketErrorCode;
#endif

                if (EnsureSocketClosed() && !IsIgnorableSocketError(errorCode))
                {
                    OnError(exc);
                }

                return;
            }
            catch (Exception e)
            {
                if (EnsureSocketClosed() && IsIgnorableException(e))
                {
                    OnError(e);
                }
                return;
            }

            if (!raiseEvent)
            {
                Sending_Completed(Client, m_SocketEventArgsSend);
            }
        }
 protected abstract void SendInternal(PosList<ArraySegment<byte>> items);
        private PosList<ArraySegment<byte>> GetSendingItems()
        {
            if (m_SendingItems == null)
                m_SendingItems = new PosList<ArraySegment<byte>>();

            return m_SendingItems;
        }
        protected override void SendInternal(PosList<ArraySegment<byte>> items)
        {
            var client = this.Client;

            try
            {
                var item = items[items.Position];
                m_SslStream.BeginWrite(item.Array, item.Offset, item.Count,
                    OnWriteComplete, new SslAsyncState { SslStream = m_SslStream, Client = client, SendingItems = items });
            }
            catch (Exception e)
            {
                if (!IsIgnorableException(e))
                    OnError(e);

                if (EnsureSocketClosed(client))
                    OnClosed();
            }
        }
Example #11
0
 protected override void SendInternal(PosList <ArraySegment <byte> > items)
 {
     SendInternalAsync(items);
 }
 protected abstract void SendInternal(PosList <ArraySegment <byte> > items);
        private async void SendInternalAsync(PosList<ArraySegment<byte>> items)
        {
            try
            {
                for (int i = items.Position; i < items.Count; i++)
                {
                    var item = items[items.Position];
                    await m_SslStream.WriteAsync(item.Array, item.Offset, item.Count, CancellationToken.None);
                }
                
                m_SslStream.Flush();
            }
            catch (Exception e)
            {
                if (!IsIgnorableException(e))
                    OnError(e);

                if (EnsureSocketClosed(Client))
                    OnClosed();
                    
                return;
            }
            
            OnSendingCompleted();
        }
 protected override void SendInternal(PosList<ArraySegment<byte>> items)
 {
     SendInternalAsync(items);
 }