示例#1
0
//        public OutQueueDAO(ISession session) : base(session) { }

        public IList <OutQueue> GetNovedades(int empresa, int linea, string query, string server)
        {
            OutQueue q  = null;
            OutState s  = null;
            var      sq = QueryOver.Of(() => s)
                          .Where(Restrictions.EqProperty(Projections.Property(() => q.Id), Projections.Property(() => s.OutQueue.Id)))
                          .And(Restrictions.Eq(Projections.Property(() => s.Server), server))
                          .And(Restrictions.Eq(Projections.Property(() => s.Sincronizado), true));


            var qy = Session.QueryOver(() => q);

            if (empresa > 0)
            {
                qy = qy.Where(Restrictions.Or(Restrictions.Eq(Projections.Property(() => q.Empresa.Id), empresa),
                                              Restrictions.IsNull(Projections.Property(() => q.Empresa))));
                if (linea > 0)
                {
                    qy = qy.And(Restrictions.Or(Restrictions.Eq(Projections.Property(() => q.Linea.Id), linea),
                                                Restrictions.IsNull(Projections.Property(() => q.Linea))));
                }
            }
            return(qy.WithSubquery.WhereNotExists(sq.Select(x => x.Id))
                   .OrderBy(Projections.Property <OutQueue>(p => p.Prioridad)).Desc
                   .ThenBy(Projections.Property <OutQueue>(p => p.FechaAlta)).Asc
                   .List());
        }
示例#2
0
        public DetectorFocus()
        {
            _stateOut    = new OutState(this, this);
            _stateFirst  = new FirstState(this, this);
            _stateEquals = new EqualsState(this, this);
            _stateChange = new ChangeState(this, this);

            _stateCurrent = _stateOut;
        }
示例#3
0
        public void sendMsg(K3pMsg msg)
        {
            outState = OutState.Sending;
            MemoryStream s = new MemoryStream();

            msg.ToStream(s);
            outBuf = s.ToArray();
            outPos = 0;
        }
示例#4
0
    private void Awake()
    {
        sleepState  = new SleepState(this);
        outState    = new OutState(this);
        useState    = new UseState(this);
        wanderState = new WanderState(this);

        timesRefused = 1;
        navMeshAgent = GetComponent <NavMeshAgent>();
        time         = clock.GetComponent <DigitalGameTimeClock>().currentTime;

        prefKeys = new float[activities.Length];
        SortPreferences();
    }
示例#5
0
        public void doXfer()
        {
            bool loop = true;

            while (loop)
            {
                loop = false;

                if (inState == InState.RecvHdr)
                {
                    int r = KSocket.SockRead(sock, inBuf, inPos, inBuf.Length - inPos);

                    if (r > 0)
                    {
                        loop = true;
                        inPos += r;

                        if (inPos == inBuf.Length)
                        {
                            inMsg = new K3pElement();

                            inMsg.ParseType(inBuf);

                            switch (inMsg.Type)
                            {
                                case K3pElement.K3pType.INS:
                                    inState = InState.RecvIns;
                                    inPos = 0;
                                    inBuf = new byte[8];
                                    break;
                                case K3pElement.K3pType.INT:
                                    inState = InState.RecvInt;
                                    inPos = 0;
                                    inBuf = new byte[20];
                                    break;
                                case K3pElement.K3pType.STR:
                                    inState = InState.RecvStrSize;
                                    inBuf = new byte[20];
                                    inPos = 0;
                                    break;
                            }
                        }
                    }
                }

                if (inState == InState.RecvIns)
                {
                    int r = KSocket.SockRead(sock, inBuf, inPos, inBuf.Length - inPos);

                    if (r > 0)
                    {
                        loop = true;
                        inPos += r;

                        if (inPos == inBuf.Length)
                        {
                            inMsg.ParseIns(inBuf);
                            inState = InState.Received;
                        }
                    }
                }

                if (inState == InState.RecvInt || inState == InState.RecvStrSize)
                {
                    int r = KSocket.SockRead(sock, inBuf, inPos, 1);

                    if (r > 0)
                    {
                        loop = true;
                        inPos += r;

                        if ((char)inBuf[inPos - 1] == '>')
                        {
                            byte[] tmpInBuf = new byte[inPos];
                            for (int i = 0; i < inPos; i++)
                            {
                                tmpInBuf[i] = inBuf[i];
                            }
                            inMsg.ParseInt(tmpInBuf);
                            if (inState == InState.RecvStrSize)
                            {
                                inState = InState.RecvStr;
                                inBuf = new byte[inMsg.Int];
                                inPos = 0;

                                if (inMsg.Int == 0)
                                {
                                    inMsg.ParseStr(inBuf);
                                    inState = InState.Received;
                                }
                            }
                            else
                                inState = InState.Received;
                        }
                        else if (inPos == inBuf.Length)
                        {
                            throw new K3pException("Expecting a '>' to end an INT in k3p message");
                        }
                    }
                }

                if (inState == InState.RecvStr)
                {
                    int r = KSocket.SockRead(sock, inBuf, inPos, inBuf.Length - inPos);

                    if (r > 0)
                    {
                        loop = true;
                        inPos += r;

                        if (inPos == inBuf.Length)
                        {
                            inMsg.ParseStr(inBuf);
                            inState = InState.Received;
                        }
                    }
                }

                if (outState == OutState.Sending)
                {
                    int r = KSocket.SockWrite(sock, outBuf, outPos, outBuf.Length - outPos);

                    if (r > 0)
                    {
                        loop = true;
                        outPos += r;

                        if (outPos == outBuf.Length)
                        {
                            outState = OutState.NoPacket;
                            break;
                        }
                    }
                }
            }
        }
示例#6
0
 public void sendMsg(K3pMsg msg)
 {
     outState = OutState.Sending;
     MemoryStream s = new MemoryStream();
     msg.ToStream(s);
     outBuf = s.ToArray();
     outPos = 0;
 }
示例#7
0
 public void flushSend()
 {
     outState = OutState.NoPacket;
 }
示例#8
0
        public void doXfer()
        {
            bool loop = true;

            while (loop)
            {
                loop = false;

                if (inState == InState.RecvHdr)
                {
                    int r = Base.SockRead(sock, inBuf, inPos, inBuf.Length - inPos);

                    if (r > 0)
                    {
                        loop = true;
                        inPos += r;

                        if (inPos == inBuf.Length)
                        {
                            inMsg = new AnpMsg();

                            UInt32 size = 0;
                            AnpMsg.ParseHdr(inBuf, ref inMsg.Major, ref inMsg.Minor, ref inMsg.Type, ref inMsg.ID, ref size);

                            if (size > AnpMsg.MaxSize)
                            {
                                throw new AnpException("ANP message is too large");
                            }

                            if (size > 0)
                            {
                                inState = InState.RecvPayload;
                                inBuf = new byte[size];
                                inPos = 0;
                            }

                            else
                            {
                                inState = InState.Received;
                            }
                        }
                    }
                }

                if (inState == InState.RecvPayload)
                {
                    int r = Base.SockRead(sock, inBuf, inPos, inBuf.Length - inPos);

                    if (r > 0)
                    {
                        loop = true;
                        inPos += r;

                        if (inPos == inBuf.Length)
                        {
                            inMsg.Elements = AnpMsg.ParsePayload(inBuf);
                            inState = InState.Received;
                        }
                    }
                }

                if (outState == OutState.Sending)
                {
                    int r = Base.SockWrite(sock, outBuf, outPos, outBuf.Length - outPos);

                    if (r > 0)
                    {
                        loop = true;
                        outPos += r;

                        if (outPos == outBuf.Length)
                        {
                            outState = OutState.NoPacket;
                            break;
                        }
                    }
                }
            }
        }
示例#9
0
 public void sendMsg(AnpMsg msg)
 {
     outState = OutState.Sending;
     outBuf = msg.ToByteArray(true);
     outPos = 0;
 }
示例#10
0
        public void doXfer()
        {
            bool loop = true;

            while (loop)
            {
                loop = false;

                if (inState == InState.RecvHdr)
                {
                    int r = Base.SockRead(sock, inBuf, inPos, inBuf.Length - inPos);

                    if (r > 0)
                    {
                        loop   = true;
                        inPos += r;

                        if (inPos == inBuf.Length)
                        {
                            inMsg = new AnpMsg();

                            UInt32 size = 0;
                            AnpMsg.ParseHdr(inBuf, ref inMsg.Major, ref inMsg.Minor, ref inMsg.Type, ref inMsg.ID, ref size);

                            if (size > AnpMsg.MaxSize)
                            {
                                throw new AnpException("ANP message is too large");
                            }

                            if (size > 0)
                            {
                                inState = InState.RecvPayload;
                                inBuf   = new byte[size];
                                inPos   = 0;
                            }

                            else
                            {
                                inState = InState.Received;
                            }
                        }
                    }
                }

                if (inState == InState.RecvPayload)
                {
                    int r = Base.SockRead(sock, inBuf, inPos, inBuf.Length - inPos);

                    if (r > 0)
                    {
                        loop   = true;
                        inPos += r;

                        if (inPos == inBuf.Length)
                        {
                            inMsg.Elements = AnpMsg.ParsePayload(inBuf);
                            inState        = InState.Received;
                        }
                    }
                }

                if (outState == OutState.Sending)
                {
                    int r = Base.SockWrite(sock, outBuf, outPos, outBuf.Length - outPos);

                    if (r > 0)
                    {
                        loop    = true;
                        outPos += r;

                        if (outPos == outBuf.Length)
                        {
                            outState = OutState.NoPacket;
                            break;
                        }
                    }
                }
            }
        }
示例#11
0
 public void sendMsg(AnpMsg msg)
 {
     outState = OutState.Sending;
     outBuf   = msg.ToByteArray(true);
     outPos   = 0;
 }
示例#12
0
 public void flushSend()
 {
     outState = OutState.NoPacket;
 }
示例#13
0
        public void doXfer()
        {
            bool loop = true;

            while (loop)
            {
                loop = false;

                if (inState == InState.RecvHdr)
                {
                    int r = KSocket.SockRead(sock, inBuf, inPos, inBuf.Length - inPos);

                    if (r > 0)
                    {
                        loop   = true;
                        inPos += r;

                        if (inPos == inBuf.Length)
                        {
                            inMsg = new K3pElement();

                            inMsg.ParseType(inBuf);

                            switch (inMsg.Type)
                            {
                            case K3pElement.K3pType.INS:
                                inState = InState.RecvIns;
                                inPos   = 0;
                                inBuf   = new byte[8];
                                break;

                            case K3pElement.K3pType.INT:
                                inState = InState.RecvInt;
                                inPos   = 0;
                                inBuf   = new byte[20];
                                break;

                            case K3pElement.K3pType.STR:
                                inState = InState.RecvStrSize;
                                inBuf   = new byte[20];
                                inPos   = 0;
                                break;
                            }
                        }
                    }
                }

                if (inState == InState.RecvIns)
                {
                    int r = KSocket.SockRead(sock, inBuf, inPos, inBuf.Length - inPos);

                    if (r > 0)
                    {
                        loop   = true;
                        inPos += r;

                        if (inPos == inBuf.Length)
                        {
                            inMsg.ParseIns(inBuf);
                            inState = InState.Received;
                        }
                    }
                }

                if (inState == InState.RecvInt || inState == InState.RecvStrSize)
                {
                    int r = KSocket.SockRead(sock, inBuf, inPos, 1);

                    if (r > 0)
                    {
                        loop   = true;
                        inPos += r;

                        if ((char)inBuf[inPos - 1] == '>')
                        {
                            byte[] tmpInBuf = new byte[inPos];
                            for (int i = 0; i < inPos; i++)
                            {
                                tmpInBuf[i] = inBuf[i];
                            }
                            inMsg.ParseInt(tmpInBuf);
                            if (inState == InState.RecvStrSize)
                            {
                                inState = InState.RecvStr;
                                inBuf   = new byte[inMsg.Int];
                                inPos   = 0;

                                if (inMsg.Int == 0)
                                {
                                    inMsg.ParseStr(inBuf);
                                    inState = InState.Received;
                                }
                            }
                            else
                            {
                                inState = InState.Received;
                            }
                        }
                        else if (inPos == inBuf.Length)
                        {
                            throw new K3pException("Expecting a '>' to end an INT in k3p message");
                        }
                    }
                }

                if (inState == InState.RecvStr)
                {
                    int r = KSocket.SockRead(sock, inBuf, inPos, inBuf.Length - inPos);

                    if (r > 0)
                    {
                        loop   = true;
                        inPos += r;

                        if (inPos == inBuf.Length)
                        {
                            inMsg.ParseStr(inBuf);
                            inState = InState.Received;
                        }
                    }
                }

                if (outState == OutState.Sending)
                {
                    int r = KSocket.SockWrite(sock, outBuf, outPos, outBuf.Length - outPos);

                    if (r > 0)
                    {
                        loop    = true;
                        outPos += r;

                        if (outPos == outBuf.Length)
                        {
                            outState = OutState.NoPacket;
                            break;
                        }
                    }
                }
            }
        }