Example #1
0
 public Criterion(LOP logicOperation, String name, OP operation, Object value)
 {
     this.LogicOperation = logicOperation;
     Name = name;
     Operation = operation;
     Value = value;
 }
Example #2
0
 public Criterion(String name, OP operation, Object value)
 {
     //Criterion(LOP.AND, name, operation, value);
     this.LogicOperation = LOP.AND;
     Name = name;
     Operation = operation;
     Value = value;
 }
Example #3
0
 public IrCJump(AstRelop.OP o, IrExp l, IrExp r, IrName t)
 {
     left = l; right = r; target = t;
     switch (o)
     {
         case AstRelop.OP.EQ: op = OP.EQ; break;
         case AstRelop.OP.NE: op = OP.NE; break;
         case AstRelop.OP.LT: op = OP.LT; break;
         case AstRelop.OP.LE: op = OP.LE; break;
         case AstRelop.OP.GT: op = OP.GT; break;
         case AstRelop.OP.GE: op = OP.GE; break;
         default: Debug.Assert(false, "Encountered unknown binary operator: value = " + o.ToString()); break;
     }
 }
Example #4
0
        public IrBinop(AstBinop.OP b, IrExp l, IrExp r)
        {
            left = l;
            right = r;

            switch (b)
            {
                case AstBinop.OP.ADD: op = OP.ADD; break;
                case AstBinop.OP.SUB: op = OP.SUB; break;
                case AstBinop.OP.MUL: op = OP.MUL; break;
                case AstBinop.OP.DIV: op = OP.DIV; break;
                case AstBinop.OP.AND: op = OP.AND; break;
                case AstBinop.OP.OR: op = OP.OR; break;
                default: Debug.Assert(false, "Encountered unknown binary operator: value = " + b.ToString()); break;
            }
        }
Example #5
0
    public void EnemyTurn()
    {
        foreach (AutonomousCharacter e in enemiesInPlay) {
            e.NewTurn();
        }

        whoseTurn = WHOSETURN.enemy;
        op = OP.neutral;
    }
Example #6
0
 public Stsfld()
 {
     OP.Add(OpCodes.Stsfld);
 }
Example #7
0
 private void Append(OP op)
 {
     switch (op)
     {
         case OP.ADD: Append("+"); break;
         case OP.SUB: Append("-"); break;
         case OP.MUL: Append("*"); break;
         case OP.DIV: Append("/"); break;
         case OP.AND: Append("&&"); break;
         case OP.OR:  Append("||"); break;
         default: Append("?"); break;
     }
 }
Example #8
0
 public int AddOp4Int(OP op, int p1, int p2, int p3, int p4)
 {
     int addr = AddOp3(op, p1, p2, p3);
     ChangeP4(addr, new P4_t { I = p4 }, Vdbe.P4T.INT32);
     return addr;
 }
Example #9
0
 public AstUnop(OP o, AstExp ae)
 {
     op=o; e=ae;
 }
Example #10
0
        private unsafe static int EncryptDecryptHelper(OP op, SSPIInterface secModule, SafeDeleteContext context, SecurityBuffer[] input, uint sequenceNumber)
        {
            Interop.SspiCli.SecBufferDesc sdcInOut = new Interop.SspiCli.SecBufferDesc(input.Length);
            var unmanagedBuffer = new Interop.SspiCli.SecBuffer[input.Length];

            fixed(Interop.SspiCli.SecBuffer *unmanagedBufferPtr = unmanagedBuffer)
            {
                sdcInOut.pBuffers = unmanagedBufferPtr;
                GCHandle[] pinnedBuffers = new GCHandle[input.Length];
                byte[][]   buffers       = new byte[input.Length][];
                try
                {
                    for (int i = 0; i < input.Length; i++)
                    {
                        SecurityBuffer iBuffer = input[i];
                        unmanagedBuffer[i].cbBuffer   = iBuffer.size;
                        unmanagedBuffer[i].BufferType = iBuffer.type;
                        if (iBuffer.token == null || iBuffer.token.Length == 0)
                        {
                            unmanagedBuffer[i].pvBuffer = IntPtr.Zero;
                        }
                        else
                        {
                            pinnedBuffers[i]            = GCHandle.Alloc(iBuffer.token, GCHandleType.Pinned);
                            unmanagedBuffer[i].pvBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(iBuffer.token, iBuffer.offset);
                            buffers[i] = iBuffer.token;
                        }
                    }

                    // The result is written in the input Buffer passed as type=BufferType.Data.
                    int errorCode;
                    switch (op)
                    {
                    case OP.Encrypt:
                        errorCode = secModule.EncryptMessage(context, sdcInOut, sequenceNumber);
                        break;

                    case OP.Decrypt:
                        errorCode = secModule.DecryptMessage(context, sdcInOut, sequenceNumber);
                        break;

                    case OP.MakeSignature:
                        errorCode = secModule.MakeSignature(context, sdcInOut, sequenceNumber);
                        break;

                    case OP.VerifySignature:
                        errorCode = secModule.VerifySignature(context, sdcInOut, sequenceNumber);
                        break;

                    default:
                        if (GlobalLog.IsEnabled)
                        {
                            GlobalLog.Assert("SSPIWrapper::EncryptDecryptHelper", "Unknown OP: " + op);
                        }

                        Debug.Fail("SSPIWrapper::EncryptDecryptHelper", "Unknown OP: " + op);
                        throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException);
                    }

                    // Marshalling back returned sizes / data.
                    for (int i = 0; i < input.Length; i++)
                    {
                        SecurityBuffer iBuffer = input[i];
                        iBuffer.size = unmanagedBuffer[i].cbBuffer;
                        iBuffer.type = unmanagedBuffer[i].BufferType;

                        if (iBuffer.size == 0)
                        {
                            iBuffer.offset = 0;
                            iBuffer.token  = null;
                        }
                        else
                        {
                            checked
                            {
                                // Find the buffer this is inside of.  Usually they all point inside buffer 0.
                                int j;
                                for (j = 0; j < input.Length; j++)
                                {
                                    if (buffers[j] == null)
                                    {
                                        continue;
                                    }

                                    byte *bufferAddress = (byte *)Marshal.UnsafeAddrOfPinnedArrayElement(buffers[j], 0);
                                    if ((byte *)unmanagedBuffer[i].pvBuffer >= bufferAddress &&
                                        (byte *)unmanagedBuffer[i].pvBuffer + iBuffer.size <= bufferAddress + buffers[j].Length)
                                    {
                                        iBuffer.offset = (int)((byte *)unmanagedBuffer[i].pvBuffer - bufferAddress);
                                        iBuffer.token  = buffers[j];
                                        break;
                                    }
                                }

                                if (j >= input.Length)
                                {
                                    if (GlobalLog.IsEnabled)
                                    {
                                        GlobalLog.Assert("SSPIWrapper::EncryptDecryptHelper", "Output buffer out of range.");
                                    }

                                    Debug.Fail("SSPIWrapper::EncryptDecryptHelper", "Output buffer out of range.");
                                    iBuffer.size   = 0;
                                    iBuffer.offset = 0;
                                    iBuffer.token  = null;
                                }
                            }
                        }

                        // Backup validate the new sizes.
                        if (iBuffer.offset < 0 || iBuffer.offset > (iBuffer.token == null ? 0 : iBuffer.token.Length))
                        {
                            if (GlobalLog.IsEnabled)
                            {
                                GlobalLog.AssertFormat("SSPIWrapper::EncryptDecryptHelper|'offset' out of range.  [{0}]", iBuffer.offset);
                            }

                            Debug.Fail("SSPIWrapper::EncryptDecryptHelper|'offset' out of range.  [" + iBuffer.offset + "]");
                        }

                        if (iBuffer.size < 0 || iBuffer.size > (iBuffer.token == null ? 0 : iBuffer.token.Length - iBuffer.offset))
                        {
                            if (GlobalLog.IsEnabled)
                            {
                                GlobalLog.AssertFormat("SSPIWrapper::EncryptDecryptHelper|'size' out of range.  [{0}]", iBuffer.size);
                            }

                            Debug.Fail("SSPIWrapper::EncryptDecryptHelper|'size' out of range.  [" + iBuffer.size + "]");
                        }
                    }

                    if (errorCode != 0 && NetEventSource.Log.IsEnabled())
                    {
                        if (errorCode == Interop.SspiCli.SEC_I_RENEGOTIATE)
                        {
                            NetEventSource.PrintError(NetEventSource.ComponentType.Security, SR.Format(SR.event_OperationReturnedSomething, op, "SEC_I_RENEGOTIATE"));
                        }
                        else
                        {
                            NetEventSource.PrintError(NetEventSource.ComponentType.Security, SR.Format(SR.net_log_operation_failed_with_error, op, String.Format(CultureInfo.CurrentCulture, "0X{0:X}", errorCode)));
                        }
                    }

                    return(errorCode);
                }
                finally
                {
                    for (int i = 0; i < pinnedBuffers.Length; ++i)
                    {
                        if (pinnedBuffers[i].IsAllocated)
                        {
                            pinnedBuffers[i].Free();
                        }
                    }
                }
            }
        }
Example #11
0
        private unsafe static int EncryptDecryptHelper(OP op, SSPIInterface secModule, SafeDeleteContext context, SecurityBuffer[] input, uint sequenceNumber)
        {
            Interop.SspiCli.SecBufferDesc sdcInOut = new Interop.SspiCli.SecBufferDesc(input.Length);
            var unmanagedBuffer = new Interop.SspiCli.SecBuffer[input.Length];

            fixed (Interop.SspiCli.SecBuffer* unmanagedBufferPtr = unmanagedBuffer)
            {
                sdcInOut.pBuffers = unmanagedBufferPtr;
                GCHandle[] pinnedBuffers = new GCHandle[input.Length];
                byte[][] buffers = new byte[input.Length][];
                try
                {
                    for (int i = 0; i < input.Length; i++)
                    {
                        SecurityBuffer iBuffer = input[i];
                        unmanagedBuffer[i].cbBuffer = iBuffer.size;
                        unmanagedBuffer[i].BufferType = iBuffer.type;
                        if (iBuffer.token == null || iBuffer.token.Length == 0)
                        {
                            unmanagedBuffer[i].pvBuffer = IntPtr.Zero;
                        }
                        else
                        {
                            pinnedBuffers[i] = GCHandle.Alloc(iBuffer.token, GCHandleType.Pinned);
                            unmanagedBuffer[i].pvBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(iBuffer.token, iBuffer.offset);
                            buffers[i] = iBuffer.token;
                        }
                    }

                    // The result is written in the input Buffer passed as type=BufferType.Data.
                    int errorCode;
                    switch (op)
                    {
                        case OP.Encrypt:
                            errorCode = secModule.EncryptMessage(context, sdcInOut, sequenceNumber);
                            break;

                        case OP.Decrypt:
                            errorCode = secModule.DecryptMessage(context, sdcInOut, sequenceNumber);
                            break;

                        case OP.MakeSignature:
                            errorCode = secModule.MakeSignature(context, sdcInOut, sequenceNumber);
                            break;

                        case OP.VerifySignature:
                            errorCode = secModule.VerifySignature(context, sdcInOut, sequenceNumber);
                            break;

                        default:
                            NetEventSource.Fail(null, $"Unknown OP: {op}");
                            throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException);
                    }

                    // Marshalling back returned sizes / data.
                    for (int i = 0; i < input.Length; i++)
                    {
                        SecurityBuffer iBuffer = input[i];
                        iBuffer.size = unmanagedBuffer[i].cbBuffer;
                        iBuffer.type = unmanagedBuffer[i].BufferType;

                        if (iBuffer.size == 0)
                        {
                            iBuffer.offset = 0;
                            iBuffer.token = null;
                        }
                        else
                        {
                            checked
                            {
                                // Find the buffer this is inside of.  Usually they all point inside buffer 0.
                                int j;
                                for (j = 0; j < input.Length; j++)
                                {
                                    if (buffers[j] == null)
                                    {
                                        continue;
                                    }

                                    byte* bufferAddress = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(buffers[j], 0);
                                    if ((byte*)unmanagedBuffer[i].pvBuffer >= bufferAddress &&
                                        (byte*)unmanagedBuffer[i].pvBuffer + iBuffer.size <= bufferAddress + buffers[j].Length)
                                    {
                                        iBuffer.offset = (int)((byte*)unmanagedBuffer[i].pvBuffer - bufferAddress);
                                        iBuffer.token = buffers[j];
                                        break;
                                    }
                                }

                                if (j >= input.Length)
                                {
                                    NetEventSource.Fail(null, "Output buffer out of range.");
                                    iBuffer.size = 0;
                                    iBuffer.offset = 0;
                                    iBuffer.token = null;
                                }
                            }
                        }

                        // Backup validate the new sizes.
                        if (iBuffer.offset < 0 || iBuffer.offset > (iBuffer.token == null ? 0 : iBuffer.token.Length))
                        {
                            NetEventSource.Fail(null, $"'offset' out of range.  [{iBuffer.offset}]");
                        }

                        if (iBuffer.size < 0 || iBuffer.size > (iBuffer.token == null ? 0 : iBuffer.token.Length - iBuffer.offset))
                        {
                            NetEventSource.Fail(null, $"'size' out of range.  [{iBuffer.size}]");
                        }
                    }

                    if (NetEventSource.IsEnabled && errorCode != 0)
                    {                         
                        if (errorCode == Interop.SspiCli.SEC_I_RENEGOTIATE)
                        {
                            NetEventSource.Error(null, SR.Format(SR.event_OperationReturnedSomething, op, "SEC_I_RENEGOTIATE"));
                        }
                        else
                        {
                            NetEventSource.Error(null, SR.Format(SR.net_log_operation_failed_with_error, op, $"0x{0:X}"));
                        }
                    }

                    return errorCode;
                }
                finally
                {
                    for (int i = 0; i < pinnedBuffers.Length; ++i)
                    {
                        if (pinnedBuffers[i].IsAllocated)
                        {
                            pinnedBuffers[i].Free();
                        }
                    }
                }
            }
        }
Example #12
0
        private String decompileOpcode(OP op)
        {
            bool   inCodeSegPrev = inCodeSeg;
            String str           = "";

            switch (op)
            {
            case OP.DONE: return(opDONE());

            case OP.MAIN: str = opMAIN(); break;

            case OP.AMEM: str = opAMEM(); break;

            case OP.CLNE: str = opCLNE(); break;

            case OP.SWP: str = opSWP(); break;

            case OP.POP: str = opPOP(); break;

            case OP.JMP: str = opJMP(); break;

            case OP.JMPZ: str = opJMPZ(); break;

            case OP.JMPNZ: str = opJMPNZ(); break;

            case OP.BRZ: str = opBRZ(); break;

            case OP.BRNZ: str = opBRNZ(); break;

            case OP.BRT: str = opBRT(); break;

            case OP.CMB: str = opCMB(); break;

            case OP.CMBZ: str = opCMBZ(); break;

            case OP.CBW: str = opCBW(); break;

            case OP.CBWE: str = opCBWE(); break;

            case OP.CBWS: str = opCBWS(); break;

            case OP.CBCR: str = opCBCR(); break;

            case OP.CBCW: str = opCBCW(); break;

            case OP.CALL: str = opCALL(); break;

            case OP.RET: str = opRET(); break;

            case OP.VRET: str = opVRET(); break;

            case OP.LCB: str = opLCB(); break;

            case OP.LCW: str = opLCW(); break;

            case OP.LPTR: str = opLPTR(); break;

            case OP.LCD: str = opLCD(); break;

            case OP.LDBX:
            case OP.LDB:
            case OP.LDW:
            case OP.LDWX:
            case OP.LDD: str = opLDD(); break;

            case OP.LDBI:
            case OP.LDBIX:
            case OP.LDWI:
            case OP.LDDI: str = opLDDI(); break;

            case OP.MSET: str = opMSET(); break;

            case OP.MCPY: str = opMCPY(); break;

            case OP.STB:
            case OP.STW:
            case OP.STD: str = opSTD(); break;

            case OP.STBI:
            case OP.STWI:
            case OP.STDI: str = opSTDI(); break;

            case OP.STWR: str = opSTWR(); break;

            case OP.INCB:
            case OP.INCW:
            case OP.INCF:     // test
            case OP.INCD: str = opINCD(); break;

            case OP.DECB:
            case OP.DECW:
            case OP.DECF:     // test
            case OP.DECD: str = opDECD(); break;

            case OP.UTOB: str = opUTOB(); break;

            case OP.UTOW: str = opUTOW(); break;

            case OP.ITOB: str = opITOB(); break;

            case OP.ITOW: str = opITOW(); break;

            case OP.DIV: str = opDIV(); break;

            case OP.MOD: str = opMOD(); break;

            case OP.NEG: str = opNEG(); break;

            case OP.COMP: str = opCOMP(); break;

            case OP.INV: str = opINV(); break;

            case OP.ITOF: str = opITOF(); break;

            case OP.FTOI: str = opFTOI(); break;

            case OP.DIVF: str = opDIVF(); break;

            case OP.MUL: str = opMUL(); break;

            case OP.MULF: str = opMULF(); break;

            case OP.SUB: str = opSUB(); break;

            case OP.ADD: str = opADD(); break;

            case OP.SRX:
            case OP.SR: str = opSR(); break;

            case OP.SL: str = opSL(); break;

            case OP.GT: str = opGT(); break;

            case OP.GE: str = opGE(); break;

            case OP.LT: str = opLT(); break;

            case OP.LEX:
            case OP.LE: str = opLE(); break;

            case OP.EQ: str = opEQ(); break;

            case OP.NE: str = opNE(); break;

            case OP.ANDB: str = opANDB(); break;

            case OP.XORB: str = opXORB(); break;

            case OP.ORB: str = opORB(); break;

            case OP.AND: str = opAND(); break;

            case OP.XOR: str = opXOR(); break;

            case OP.OR: str = opOR(); break;

            case OP.ABS: str = opABS(); break;

            case OP.RAND: str = opRAND(); break;

            case OP.FLOOR: str = opFLOOR(); break;

            case OP.CEIL: str = opCEIL(); break;

            case OP.ROUND: str = opROUND(); break;

            case OP.MIN: str = opMIN(); break;

            case OP.MAX: str = opMAX(); break;

            case OP.CLAMP: str = opCLAMP(); break;

            case OP.MODF: str = opMODF(); break;

            case OP.LERP: str = opLERP(); break;

            case OP.SIN: str = opSIN(); break;

            case OP.COS: str = opCOS(); break;

            case OP.TAN: str = opTAN(); break;

            case OP.ASIN: str = opASIN(); break;

            case OP.ACOS: str = opACOS(); break;

            case OP.ATAN: str = opATAN(); break;

            case OP.ATAN2: str = opATAN2(); break;

            case OP.R2D: str = opR2D(); break;

            case OP.D2R: str = opD2R(); break;

            case OP.SQRT: str = opSQRT(); break;

            case OP.SQ: str = opSQ(); break;

            case OP.EXP: str = opEXP(); break;

            case OP.LOG: str = opLOG(); break;

            case OP.LOG2: str = opLOG2(); break;

            case OP.POW: str = opPOW(); break;

            case OP.POWF: str = opPOWF(); break;

            case OP.CRUN: str = opCRUN(); break;

            case OP.CRST: str = opCRST(); break;

            case OP.CPSE: str = opCPSE(); break;

            case OP.CSTP: str = opCSTP(); break;

            case OP.MXYH: str = opMXYH(); break;

            case OP.MXYV: str = opMXYV(); break;

            case OP.MXYC: str = opMXYC(); break;

            case OP.MXYR: str = opMXYR(); break;

            case OP.RMAP: str = opRMAP(); break;

            case OP.RSWP: str = opRSWP(); break;

            case OP.RRST: str = opRRST(); break;

            case OP.KMAP: str = opKMAP(); break;

            case OP.KRST: str = opKRST(); break;

            case OP.MMAP: str = opMMAP(); break;

            case OP.MRST: str = opMRST(); break;

            case OP.RMSK: str = opRMSK(); break;

            case OP.SVAL: str = opSVAL(); break;

            case OP.SVALI: str = opSVALI(); break;

            case OP.GVAL: str = opGVAL(); break;

            case OP.GVALA: str = opGVALA(); break;

            case OP.GPRV: str = opGPRV(); break;

            case OP.ISACT: str = opISACT(); break;

            case OP.ISRES: str = opISRES(); break;

            case OP.TMACT: str = opTMACT(); break;

            case OP.TMRES: str = opTMRES(); break;

            case OP.EVACT: str = opEVACT(); break;

            case OP.EVRES: str = opEVRES(); break;

            case OP.CKACT: str = opCKACT(); break;

            case OP.CKRES: str = opCKRES(); break;

            case OP.INHB: str = opINHB(); break;

            case OP.BATS: str = opBATS(); break;

            case OP.BATG: str = opBATG(); break;

            case OP.BATGA: str = opBATGA(); break;

            case OP.BATR: str = opBATR(); break;

            case OP.LEDS: str = opLEDS(); break;

            case OP.LEDG: str = opLEDG(); break;

            case OP.LEDGA: str = opLEDGA(); break;

            case OP.LEDVS: str = opLEDVS(); break;

            case OP.LEDVG: str = opLEDVG(); break;

            case OP.LEDR: str = opLEDR(); break;

            case OP.FFBS: str = opFFBS(); break;

            case OP.FFBG: str = opFFBG(); break;

            case OP.FFBGA: str = opFFBGA(); break;

            case OP.FFBR: str = opFFBR(); break;

            case OP.KSTS: str = opKSTS(); break;

            case OP.KCHK: str = opKCHK(); break;

            case OP.MSTS: str = opMSTS(); break;

            case OP.KSST: str = opKSST(); break;

            case OP.KPTU: str = opKPTU(); break;

            case OP.MSST: str = opMSST(); break;

            case OP.MPTU: str = opMPTU(); break;

            case OP.KSGT: str = opKSGT(); break;

            case OP.MSGT: str = opMSGT(); break;

            case OP.MRUN: str = opMRUN(); break;

            case OP.MRTM: str = opMRTM(); break;

            case OP.MSTP: str = opMSTP(); break;

            case OP.MREC: str = opMREC(); break;

            case OP.PMSN: str = opPMSN(); break;

            case OP.PMLN: str = opPMLN(); break;

            case OP.PMLD: str = opPMLD(); break;

            case OP.PMSV: str = opPMSV(); break;

            case OP.PMR: str = opPMR(); break;

            case OP.PMRB:
            case OP.PMRW:
            case OP.PMRD: str = opPMRD(); break;

            case OP.PMWB:
            case OP.PMWW:
            case OP.PMWD: str = opPMWD(); break;

            case OP.SCPL: str = opSCPL(); break;

            case OP.MSLG: str = opMSLG(); break;

            case OP.MSLL: str = opMSLL(); break;

            case OP.MSLC: str = opMSLC(); break;

            case OP.SYSTM: str = opSYSTM(); break;

            case OP.ELPTM: str = opELPTM(); break;

            case OP.PWSRC: str = opPWSRC(); break;

            case OP.PSTS: str = opPSTS(); break;

            case OP.PCONN: str = opPCONN(); break;

            case OP.PCONX: str = opPCONX(); break;

            case OP.PDIS: str = opPDIS(); break;

            case OP.PIFFB: str = opPIFFB(); break;

            case OP.PPFFB: str = opPPFFB(); break;

            case OP.PTOFF: str = opPTOFF(); break;

            case OP.PUON: str = opPUON(); break;

            case OP.PUOFF: str = opPUOFF(); break;

            case OP.DOVR: str = opDOVR(); break;

            case OP.PRTF: str = opPRTF(); break;

            default:
                Console.Write("\r\nUknown OP: 0x" + ((byte)op).ToString("X") + " at " + (reader.BaseStream.Position - 1).ToString("X") + "\r\n");
                break;
            }

            if (!inCodeSegPrev && !inCodeSeg)
            {
                str       = "\r\nmain {\r\n" + str;
                inCodeSeg = true;
            }
            if (inCodeSegPrev && !inCodeSeg)
            {
                str = "}\r\n" + str;
            }
            return(str);
        }
Example #13
0
        public void Parse(IEnumerator <HtmlChunk> htmlChunks, int viewportWidth, string id = null, HtFont font = null, HtColor color = default(HtColor), TextAlign align = TextAlign.Left, VertAlign valign = VertAlign.Bottom)
        {
            this.Clear();
            var defaultFont = HtEngine.Device.LoadFont(HtEngine.DefaultFontFace, HtEngine.DefaultFontSize, false, false);

            font  = font == null ? defaultFont : font;
            color = (color.R == 0 && color.G == 0 && color.B == 0 && color.A == 0) ? HtEngine.DefaultColor : color;
            //string id = null;
            //var align = TextAlign.Left;
            //var valign = VertAlign.Bottom;
            DrawTextDeco   deco         = DrawTextDeco.None;
            DrawTextEffect effect       = DrawTextEffect.None;
            HtColor        effectColor  = HtEngine.DefaultColor;
            int            effectAmount = 1;
            string         currentLink  = null;
            bool           prevIsWord   = false;

            DeviceChunkLine     currLine      = null;
            DeviceChunkDrawText lastTextChunk = null;

            //for (int i = 0; i < htmlChunks.Count; i++)
            while (htmlChunks.MoveNext())
            {
                HtmlChunk htmlChunk = htmlChunks.Current;

                var word = htmlChunk as HtmlChunkWord;
                if (word != null)
                {
                    if (currLine == null)
                    {
                        currLine = this.NewLine(null, viewportWidth, align, valign);
                    }

                    if (effect == DrawTextEffect.None)
                    {
                        lastTextChunk = AcquireDeviceChunkDrawText(
                            id,
                            word.Text,
                            font,
                            color,
                            deco,
                            lastTextChunk != null && lastTextChunk.Deco != deco,
                            prevIsWord);
                    }
                    else
                    {
                        lastTextChunk = AcquireDeviceChunkDrawTextEffect(
                            id,
                            word.Text,
                            font,
                            color,
                            deco,
                            lastTextChunk != null && lastTextChunk.Deco != deco,
                            effect,
                            effectAmount,
                            effectColor,
                            prevIsWord);
                    }

                    if (currentLink != null && !this.Links.ContainsKey(lastTextChunk))
                    {
                        this.Links.Add(lastTextChunk, currentLink);
                    }
                    if (!currLine.AddChunk(lastTextChunk, prevIsWord))
                    {
                        prevIsWord = true;
                        //currLine.IsFull = true;
                        string lastText = lastTextChunk.Text;
                        lastTextChunk.Dispose();
                        lastTextChunk = null;
                        bool decoStop = lastTextChunk != null && lastTextChunk.Deco != deco;

                        // find prefix ascii string.
                        //string prefixAsciiText = null;
                        int pos = 0;
                        //for (pos = 0; pos < lastText.Length; ++pos) {
                        //  char ch = lastText[pos];
                        //  if (ch > 255 || ch == ' ') {
                        //    prefixAsciiText = lastText.Substring(0, pos);
                        //    break;
                        //  }
                        //}
                        //if (prefixAsciiText != null) {
                        //  DeviceChunkDrawText prefixAsciiTextChunk;
                        //  if (effect == DrawTextEffect.None) {
                        //    prefixAsciiTextChunk = AcquireDeviceChunkDrawText(
                        //      id,
                        //      prefixAsciiText,
                        //      font,
                        //      color,
                        //      deco,
                        //      decoStop,
                        //      prevIsWord);
                        //  } else {
                        //    prefixAsciiTextChunk = AcquireDeviceChunkDrawTextEffect(
                        //      id,
                        //      prefixAsciiText,
                        //      font,
                        //      color,
                        //      deco,
                        //      decoStop,
                        //      effect,
                        //      effectAmount,
                        //      effectColor,
                        //      prevIsWord);
                        //  }
                        //  if (currLine.AddChunk(prefixAsciiTextChunk, prevIsWord)) {
                        //    if (currentLink != null && !this.Links.ContainsKey(prefixAsciiTextChunk))
                        //      this.Links.Add(prefixAsciiTextChunk, currentLink);
                        //    lastText = lastText.Substring(pos);
                        //    decoStop = false;
                        //  }
                        //}
                        //// reset the pos.
                        //pos = 0;

                        // add multi-lines.
                        int remainingWidth = viewportWidth;
                        for (; pos < lastText.Length;)
                        {
                            char ch = lastText[pos];
                            remainingWidth -= font.Measure(ch.ToString()).Width;
                            if (remainingWidth < 0)
                            {
                                string tmpText = lastText.Substring(0, pos);
                                DeviceChunkDrawText tmpTextChunk;
                                if (effect == DrawTextEffect.None)
                                {
                                    tmpTextChunk = AcquireDeviceChunkDrawText(
                                        id,
                                        tmpText,
                                        font,
                                        color,
                                        deco,
                                        decoStop,
                                        prevIsWord);
                                }
                                else
                                {
                                    tmpTextChunk = AcquireDeviceChunkDrawTextEffect(
                                        id,
                                        tmpText,
                                        font,
                                        color,
                                        deco,
                                        decoStop,
                                        effect,
                                        effectAmount,
                                        effectColor,
                                        prevIsWord);
                                }

                                currLine = this.NewLine(currLine, viewportWidth, align, valign);
                                currLine.AddChunk(tmpTextChunk, prevIsWord);
                                if (currentLink != null && !this.Links.ContainsKey(tmpTextChunk))
                                {
                                    this.Links.Add(tmpTextChunk, currentLink);
                                }
                                lastText       = lastText.Substring(pos);
                                pos            = 0;
                                remainingWidth = viewportWidth;
                            }
                            else
                            {
                                ++pos;
                            }
                        }

                        // add last line.
                        if (!string.IsNullOrEmpty(lastText))
                        {
                            if (effect == DrawTextEffect.None)
                            {
                                lastTextChunk = AcquireDeviceChunkDrawText(
                                    id,
                                    lastText,
                                    font,
                                    color,
                                    deco,
                                    decoStop,
                                    prevIsWord);
                            }
                            else
                            {
                                lastTextChunk = AcquireDeviceChunkDrawTextEffect(
                                    id,
                                    lastText,
                                    font,
                                    color,
                                    deco,
                                    decoStop,
                                    effect,
                                    effectAmount,
                                    effectColor,
                                    prevIsWord);
                            }

                            currLine = this.NewLine(currLine, viewportWidth, align, valign);
                            currLine.AddChunk(lastTextChunk, prevIsWord);
                            if (currentLink != null && !this.Links.ContainsKey(lastTextChunk))
                            {
                                this.Links.Add(lastTextChunk, currentLink);
                            }
                        }
                    }
                    prevIsWord = true;
                }
                else
                {
                    prevIsWord = false;
                }

                var tag = htmlChunk as HtmlChunkTag;
                if (tag != null)
                {
                    switch (tag.Tag)
                    {
                    case "spin":
                        if (tag.IsSingle)
                        {
                            // do nothing
                        }
                        else if (tag.IsClosing)
                        {
                            id = null;
                            this.FinishLine(currLine, align, valign);
                            return;     // return control to parent
                        }
                        else
                        {
                            id = tag.GetAttr("id");
                            ExctractAligns(tag, ref align, ref valign);
                            var compiled = OP <DeviceChunkDrawCompiled> .Acquire();

                            compiled.Font = font;
                            var scompiledWidth = tag.GetAttr("width") ?? "0";
                            var compiledWidth  = 0;
                            if (!int.TryParse(scompiledWidth, out compiledWidth))
                            {
                                compiledWidth = 0;
                            }
                            if (compiledWidth == 0)
                            {
                                compiledWidth = currLine == null ? viewportWidth : currLine.AvailWidth - font.WhiteSize;
                            }
                            if (compiledWidth > 0)
                            {
                                if (compiledWidth > viewportWidth)
                                {
                                    compiledWidth = viewportWidth;
                                }
                                compiled.Parse(htmlChunks, compiledWidth, id, font, color, align, valign);
                                compiled.MeasureSize();
                                if (currLine == null)
                                {
                                    currLine = this.NewLine(null, viewportWidth, align, valign);
                                }

                                if (!currLine.AddChunk(compiled, prevIsWord))
                                {
                                    currLine.IsFull = true;
                                    currLine        = this.NewLine(currLine, viewportWidth, align, valign);
                                    if (!currLine.AddChunk(compiled, prevIsWord))
                                    {
                                        HtEngine.Log(HtLogLevel.Error, "Could not fit spin into line. Word is too big: {0}", lastTextChunk);
                                        compiled.Dispose();
                                        compiled = null;
                                    }
                                }
                            }
                            else
                            {
                                HtEngine.Log(HtLogLevel.Warning, "spin width is not given");
                            }
                        }
                        break;

                    case "effect":
                        if (tag.IsSingle)
                        {
                            // do nothing
                        }
                        else if (tag.IsClosing)
                        {
                            effect = DrawTextEffect.None;
                        }
                        else
                        {
                            var name = tag.GetAttr("name") ?? "outline";
                            switch (name)
                            {
                            case "shadow":
                                effect       = DrawTextEffect.Shadow;
                                effectAmount = 1;
                                effectColor  = HtColor.RGBA(0, 0, 0, 80);
                                break;

                            case "outline":
                                effect       = DrawTextEffect.Outline;
                                effectAmount = 1;
                                effectColor  = HtColor.RGBA(0xFF, 0xFF, 0xFF, 80);
                                break;
                            }
                            var amount = tag.GetAttr("amount");
                            if (amount != null)
                            {
                                if (!int.TryParse(amount, out effectAmount))
                                {
                                    HtEngine.Log(HtLogLevel.Error, "Invalid numeric value: " + amount);
                                }
                            }
                            var colors = tag.GetAttr("color");
                            if (colors != null)
                            {
                                effectColor = HtColor.Parse(colors);
                            }
                        }
                        break;

                    case "u":
                        if (tag.IsSingle)
                        {
                            // do nothing
                        }
                        else if (tag.IsClosing)
                        {
                            deco &= ~DrawTextDeco.Underline;
                        }
                        else
                        {
                            deco |= DrawTextDeco.Underline;
                        }
                        break;

                    case "s":
                    case "strike":
                        if (tag.IsSingle)
                        {
                            // do nothing
                        }
                        else if (tag.IsClosing)
                        {
                            deco &= ~DrawTextDeco.Strike;
                        }
                        else
                        {
                            deco |= DrawTextDeco.Strike;
                        }
                        break;

                    case "code":
                        if (tag.IsSingle)
                        {
                            // do nothing
                        }
                        else if (tag.IsClosing)
                        {
                            font = this.fontStack.Count > 0 ? this.fontStack.Pop() : defaultFont;
                        }
                        else
                        {
                            this.fontStack.Push(font);

                            const string fontName = "code";
                            int          fontSize = font.Size;
                            bool         fontBold = font.Bold;
                            bool         fontItal = font.Italic;

                            font = HtEngine.Device.LoadFont(fontName, fontSize, fontBold, fontItal);
                        }
                        break;

                    case "b":
                        if (tag.IsSingle)
                        {
                            // do nothing
                        }
                        else if (tag.IsClosing)
                        {
                            font = this.fontStack.Count > 0 ? this.fontStack.Pop() : defaultFont;
                        }
                        else
                        {
                            this.fontStack.Push(font);

                            string     fontName = font.Face;
                            int        fontSize = font.Size;
                            const bool fontBold = true;
                            bool       fontItal = font.Italic;

                            font = HtEngine.Device.LoadFont(fontName, fontSize, fontBold, fontItal);
                        }
                        break;

                    case "i":
                        if (tag.IsSingle)
                        {
                            // do nothing
                        }
                        else if (tag.IsClosing)
                        {
                            font = this.fontStack.Count > 0 ? this.fontStack.Pop() : defaultFont;
                        }
                        else
                        {
                            this.fontStack.Push(font);

                            string     fontName = font.Face;
                            int        fontSize = font.Size;
                            bool       fontBold = font.Bold;
                            const bool fontItal = true;

                            font = HtEngine.Device.LoadFont(fontName, fontSize, fontBold, fontItal);
                        }
                        break;

                    case "a":
                        if (tag.IsSingle)
                        {
                            // do nothing
                        }
                        else if (tag.IsClosing)
                        {
                            id = null;
                            if (this.colorStack.Count > 0)
                            {
                                color = this.colorStack.Pop();
                            }
                            currentLink = null;
                        }
                        else
                        {
                            id          = tag.GetAttr("id");
                            currentLink = tag.GetAttr("href");
                            this.colorStack.Push(color);
                            color = HtEngine.DefaultLinkColor;
                        }
                        break;

                    case "font":
                        if (tag.IsSingle)
                        {
                            // do nothing
                        }
                        else if (tag.IsClosing)
                        {
                            font  = this.fontStack.Count > 0 ? this.fontStack.Pop() : defaultFont;
                            color = this.colorStack.Count > 0 ? this.colorStack.Pop() : HtEngine.DefaultColor;
                        }
                        else
                        {
                            this.fontStack.Push(font);
                            this.colorStack.Push(color);

                            string fontName  = tag.GetAttr("face") ?? font.Face;
                            string fontSizeS = tag.GetAttr("size");
                            int    fontSize;
                            if (fontSizeS == null || !int.TryParse(fontSizeS, out fontSize))
                            {
                                fontSize = font.Size;
                            }
                            bool fontBold = font.Bold;
                            bool fontItal = font.Italic;

                            font = HtEngine.Device.LoadFont(fontName, fontSize, fontBold, fontItal);

                            color = HtColor.Parse(tag.GetAttr("color"), color);
                        }
                        break;

                    case "br":
                        currLine        = this.NewLine(currLine, viewportWidth, align, valign);
                        currLine.Height = font.LineSpacing;
                        break;

                    case "img":
                        if (tag.IsClosing)
                        {
                            // ignore closing tags
                        }
                        else
                        {
                            var src = tag.GetAttr("src");
                            var widthS = tag.GetAttr("width");
                            var heightS = tag.GetAttr("height");
                            var fpsS = tag.GetAttr("fps");
                            var imgId = tag.GetAttr("id");
                            int w, h, fps;
                            if (widthS == null || !int.TryParse(widthS, out w))
                            {
                                w = -1;
                            }
                            if (heightS == null || !int.TryParse(heightS, out h))
                            {
                                h = -1;
                            }
                            if (fpsS == null || !int.TryParse(fpsS, out fps))
                            {
                                fps = -1;
                            }
                            var img = HtEngine.Device.LoadImage(src, fps);
                            if (w < 0)
                            {
                                w = img.Width;
                            }
                            if (h < 0)
                            {
                                h = img.Height;
                            }
                            var dChunk = OP <DeviceChunkDrawImage> .Acquire();

                            if (currLine == null)
                            {
                                currLine = this.NewLine(null, viewportWidth, align, valign);
                            }
                            dChunk.Image       = img;
                            dChunk.Rect.Width  = w;
                            dChunk.Rect.Height = h;
                            dChunk.Font        = font; // for whitespace measure
                            dChunk.Id          = imgId;
                            //HtEngine.Log(HtLogLevel.Debug, "Adding image w={0} h={1}",dChunk.Width,dChunk.Height);
                            if (currentLink != null && !this.Links.ContainsKey(dChunk))
                            {
                                this.Links.Add(dChunk, currentLink);
                            }
                            if (!currLine.AddChunk(dChunk, prevIsWord))
                            {
                                currLine.IsFull = true;
                                currLine        = this.NewLine(currLine, viewportWidth, align, valign);
                                if (!currLine.AddChunk(dChunk, prevIsWord))
                                {
                                    HtEngine.Log(HtLogLevel.Error, "Could not fit image into line. Image is too big: {0}", dChunk);
                                    dChunk.Dispose();
                                }
                            }
                        }
                        break;

                    case "p":
                        if (tag.IsClosing)
                        {
                            id = null;
                        }
                        else
                        {
                            id       = tag.GetAttr("id");
                            currLine = this.NewLine(currLine, viewportWidth, align, valign);

                            ExctractAligns(tag, ref align, ref valign);
                        }

                        break;

                    default:
                        HtEngine.Log(HtLogLevel.Error, "Unsupported html tag {0}", tag);
                        break;
                    }
                }
            }

            // align last line
            this.FinishLine(currLine, align, valign);
        }
Example #14
0
        public int AddOp3(OP op, int p1, int p2, int p3)
        {
            int i = Ops.length;
            Debug.Assert(Magic == VDBE_MAGIC_INIT);
            Debug.Assert((int)op > 0 && (int)op < 0xff);
            if (OpsAlloc <= i)
                if (GrowOps(this) != RC.OK)
                    return 1;
            Ops.length++;
            if (Ops[i] == null) Ops[i] = new VdbeOp();
            VdbeOp opAsObj = Ops[i];
            opAsObj.Opcode = op;
            opAsObj.P5 = 0;
            opAsObj.P1 = p1;
            opAsObj.P2 = p2;
            opAsObj.P3 = p3;
            opAsObj.P4.P = null;
            opAsObj.P4Type = Vdbe.P4T.NOTUSED;
#if DEBUG
            opAsObj.Comment = null;
            if ((Ctx.Flags & BContext.FLAG.VdbeAddopTrace) != 0)
                PrintOp(null, i, Ops[i]);
#endif
#if VDBE_PROFILE
            opAsObj.Cycles = 0;
            opAsObj.Cnt = 0;
#endif
            return i;
        }
Example #15
0
 public void Constructor_FromOpNum_ExceptionTest(OP val)
 {
     Assert.Throws <ArgumentException>(() => new PushDataOp(val));
 }
        private static unsafe int EncryptDecryptHelper(OP op, SSPIInterface SecModule, SafeDeleteContext context, SecurityBuffer[] input, uint sequenceNumber)
        {
            SecurityBufferDescriptor inputOutput = new SecurityBufferDescriptor(input.Length);
            SecurityBufferStruct[] structArray = new SecurityBufferStruct[input.Length];
            fixed (SecurityBufferStruct* structRef = structArray)
            {
                int num6;
                inputOutput.UnmanagedPointer = (void*) structRef;
                GCHandle[] handleArray = new GCHandle[input.Length];
                byte[][] bufferArray = new byte[input.Length][];
                try
                {
                    int num2;
                    for (int i = 0; i < input.Length; i++)
                    {
                        SecurityBuffer buffer = input[i];
                        structArray[i].count = buffer.size;
                        structArray[i].type = buffer.type;
                        if ((buffer.token == null) || (buffer.token.Length == 0))
                        {
                            structArray[i].token = IntPtr.Zero;
                        }
                        else
                        {
                            handleArray[i] = GCHandle.Alloc(buffer.token, GCHandleType.Pinned);
                            structArray[i].token = Marshal.UnsafeAddrOfPinnedArrayElement(buffer.token, buffer.offset);
                            bufferArray[i] = buffer.token;
                        }
                    }
                    switch (op)
                    {
                        case OP.Encrypt:
                            num2 = SecModule.EncryptMessage(context, inputOutput, sequenceNumber);
                            break;

                        case OP.Decrypt:
                            num2 = SecModule.DecryptMessage(context, inputOutput, sequenceNumber);
                            break;

                        case OP.MakeSignature:
                            num2 = SecModule.MakeSignature(context, inputOutput, sequenceNumber);
                            break;

                        case OP.VerifySignature:
                            num2 = SecModule.VerifySignature(context, inputOutput, sequenceNumber);
                            break;

                        default:
                            throw ExceptionHelper.MethodNotImplementedException;
                    }
                    for (int j = 0; j < input.Length; j++)
                    {
                        SecurityBuffer buffer2 = input[j];
                        buffer2.size = structArray[j].count;
                        buffer2.type = structArray[j].type;
                        if (buffer2.size == 0)
                        {
                            buffer2.offset = 0;
                            buffer2.token = null;
                        }
                        else
                        {
                            int index = 0;
                            while (index < input.Length)
                            {
                                if (bufferArray[index] != null)
                                {
                                    byte* numPtr = (byte*) Marshal.UnsafeAddrOfPinnedArrayElement(bufferArray[index], 0);
                                    if ((((void*) structArray[j].token) >= numPtr) && ((((void*) structArray[j].token) + buffer2.size) <= (numPtr + bufferArray[index].Length)))
                                    {
                                        buffer2.offset = (int) ((long) ((((void*) structArray[j].token) - numPtr) / 1));
                                        buffer2.token = bufferArray[index];
                                        break;
                                    }
                                }
                                index++;
                            }
                            if (index >= input.Length)
                            {
                                buffer2.size = 0;
                                buffer2.offset = 0;
                                buffer2.token = null;
                            }
                        }
                    }
                    if ((num2 != 0) && Logging.On)
                    {
                        if (num2 == 0x90321)
                        {
                            Logging.PrintError(Logging.Web, SR.GetString("net_log_operation_returned_something", new object[] { op, "SEC_I_RENEGOTIATE" }));
                        }
                        else
                        {
                            Logging.PrintError(Logging.Web, SR.GetString("net_log_operation_failed_with_error", new object[] { op, string.Format(CultureInfo.CurrentCulture, "0X{0:X}", new object[] { num2 }) }));
                        }
                    }
                    num6 = num2;
                }
                finally
                {
                    for (int k = 0; k < handleArray.Length; k++)
                    {
                        if (handleArray[k].IsAllocated)
                        {
                            handleArray[k].Free();
                        }
                    }
                }
                return num6;
            }
        }
Example #17
0
 public Criteria Add(LOP logicOperation, String name, OP operation, Object value)
 {
     this.AddCriterion(new Criterion(logicOperation, name, operation, value));
     return this;
 }
Example #18
0
 public Criteria(String name, OP operation, Object value)
 {
     CriterionList = new List<Criterion>();
     AddCriterion(new Criterion(name, operation, value));
 }
Example #19
0
 private void dumpOp(OP op)
 {
     switch (op)
     {
         case OP.EQ: Append("=="); break;
         case OP.NE: Append("!="); break;
         case OP.LT: Append("<"); break;
         case OP.LE: Append("<="); break;
         case OP.GT: Append(">"); break;
         case OP.GE: Append(">="); break;
         //default: DUMP("??");
     }
 }
Example #20
0
 public IrCJump(OP o, IrExp l, IrExp r, IrName t)
 {
     op = o; left = l; right = r; target = t;
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (lvDataEntryOP.Items.Count > 0)
            {
                float total = float.Parse(lbTotal.Text);

                if (total > 0 && (!string.IsNullOrEmpty(tbFirstname.Text) && !string.IsNullOrEmpty(tbLastname.Text)))
                {
                    OrderOfPayment             OP                  = null;
                    StudentAccount             SAccount            = new StudentAccount();
                    Dictionary <string, float> amountPerParticular = SAccount.getAmountPerParticular(lvDataEntryOP, 2);
                    string payor = tbFirstname.Text.Replace("'", "''") + " " + tbMiddlename.Text + " " + tbLastname.Text;

                    int orderOfPaymentType = 0;
                    try
                    {
                        orderOfPaymentType = int.Parse((mrbUndergrad.Checked) ? mrbUndergrad.Tag.ToString() : (mrbMasteral.Checked) ? mrbMasteral.Tag.ToString() : (mrbFiduciary.Checked) ? mrbFiduciary.Tag.ToString() : (mrbBtr.Checked) ? mrbBtr.Tag.ToString() : (mrbIGD.Checked) ? mrbIGD.Tag.ToString() : "0");
                        paymentType        = (mtrbCash.Checked) ? mtrbCash.Tag.ToString() : (mtrbCheck.Checked) ? mtrbCheck.Tag.ToString() : "0";
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }

                    // check payment type
                    // check if has student ID
                    int studentID = 0;
                    if (lbStudID.Text != "[ Student ID ]")
                    {
                        studentID = int.Parse(lbStudID.Text);
                    }

                    string purpose = "Other Fees";

                    // Purpose
                    if (isTuitionFee)
                    {
                        purpose = "Tuition Fee/Misc";
                    }

                    // has check details
                    if (Payor.validateCheckDetails(mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), mtbCheckAmount.Text) && mtrbCheck.Checked)
                    {
                        OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), purpose, payor, studentID, tbRemarks.Text, mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), float.Parse(mtbCheckAmount.Text), int.Parse(paymentType));
                    }
                    else if (mtrbCash.Checked)
                    {
                        OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), purpose, payor, studentID, tbRemarks.Text, null, null, null, 0, int.Parse(paymentType));
                    }
                    else
                    {
                        MessageBox.Show("There are some fields missing!");
                    }
                    // final validation
                    if (OP != null)
                    {
                        if (OP.createOP())
                        {
                            OP.addOPItem(int.Parse(tPaymentOrNo.Text), amountPerParticular, orderOfPaymentType);
                            MessageBox.Show("Successful! \n \t Please Proceed to Payment");

                            Dictionary <string, string> OPData = OP.getOPDataWOOR(int.Parse(tPaymentOrNo.Text));
                            ePrinting print = new ePrinting(OPData);
                            print.ePrint("OP");

                            this.Dispose();
                            frmOrPayDataEntry temp = new frmOrPayDataEntry();
                            temp.ShowDialog();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Invalid Input / Missing Field");
                }
            }
            else
            {
                MessageBox.Show("Please add an item");
            }
        }
Example #22
0
    /*
    function SpawnEnemyInMap(e : Character, p : Tile) {

        var deo = Instantiate(dungeonEntity, p.GetWorldPos(), Quaternion.identity);
        var de = deo.AddComponent(DungeonEnemy);
        de.mState = this;
        de.Initialize(e);
        de.MoveTo(p);
        enemiesInPlay.Add(de);

        var ds = de.GetComponentInChildren(EntitySprite);
        ds.Initialize(e.spriteData, gState.charLSManager);

        //canUndo = false;
    }

    function SpawnItemInMap(i : Item, p : Tile) {
        var dio = Instantiate(dungeonEntity, p.GetWorldPos(), Quaternion.identity);
        var di = dio.AddComponent(DungeonItem);
        di.mState = this;
        di.Initialize(i);
        di.MoveTo(p);
        itemsInPlay.Add(di);

        var ds = dio.GetComponentInChildren(EntitySprite);
        ds.Initialize(i.spriteData, gState.itemLSManager);
    }

    function LinkMechInMap(m : Mechanism) {
        m.Initialize(this);
        Debug.Log(m);
        Debug.Log(m.GetTile().GetGridPos());
        m.GetTile().mechs.Add(m);
        mechs.Add(m);
    }

    function SetDAction(a : DAction) {
        action = a;
        op = OP.plan;
    }

    function SetTurn(index : int) {

        for (c in charsInPlay) {
            c.SetTurn(index);
        }

        for (i in itemsInPlay) {
            i.SetTurn(index);
        }

        for (k in enemiesInPlay) {
            k.SetTurn(index);
        }

        for (m in mechs) {
            m.SetTurn(index);
        }

        turnIndex = index;

        op = OP.neutral;
        //if (turnIndex == (turnHist.Count - 1)) {

    }
    */
    public void PlayerTurn()
    {
        foreach (DungeonCharacter c in charsInPlay) {
            c.NewTurn();
        }
        whoseTurn = WHOSETURN.player;
        op = OP.neutral;
    }
 protected virtual void DoOperation(OP oper)
 {
 }
Example #24
0
 public void Reset()
 {
     charsInPlay = new List<DungeonCharacter>();
     enemiesInPlay = new List<AutonomousCharacter>();
     execQueue = new List<Executable>();
     triggers = new List<Triggerable>();
     stateables = new List<Stateable>();
     op = OP.neutral;
     turnIndex = 0;
     maxTurnIndex = 0;
     turnChanged = false;
 }
Example #25
0
 private void button5_Click(object sender, EventArgs e)
 {
     OP.DeleteTabels();
 }
Example #26
0
 public void SetAction(CharAction a)
 {
     if (a != null) {
         action = a;
         op = OP.plan;
     }
 }
 protected override string CreateWhereFieldStringForParameter(string field, string paramName, OP whereOperator)
 {
     return($"{GetAliasForType()}.{field} {SqlBuilderHelper.GetStringForOperator(whereOperator)} {DbConfig.WithParameters(paramName)}");
 }
Example #28
0
 public void StartProc(Executable exe)
 {
     proc = gameObject.AddComponent("GameProc") as GameProc;
     DungeonCharacter[] dchars = charsInPlay.ToArray();
     proc.Initialize(exe, EndProc);
     op = OP.execute;
     proc.BeginProc();
 }
Example #29
0
        private unsafe static int EncryptDecryptHelper(OP op, SSPIInterface secModule, SafeDeleteContext context, SecurityBuffer[] input, uint sequenceNumber)
        {
            Interop.Secur32.SecurityBufferDescriptor sdcInOut = new Interop.Secur32.SecurityBufferDescriptor(input.Length);
            var unmanagedBuffer = new Interop.Secur32.SecurityBufferStruct[input.Length];

            fixed (Interop.Secur32.SecurityBufferStruct* unmanagedBufferPtr = unmanagedBuffer)
            {
                sdcInOut.UnmanagedPointer = unmanagedBufferPtr;
                GCHandle[] pinnedBuffers = new GCHandle[input.Length];
                byte[][] buffers = new byte[input.Length][];
                try
                {
                    for (int i = 0; i < input.Length; i++)
                    {
                        SecurityBuffer iBuffer = input[i];
                        unmanagedBuffer[i].count = iBuffer.size;
                        unmanagedBuffer[i].type = iBuffer.type;
                        if (iBuffer.token == null || iBuffer.token.Length == 0)
                        {
                            unmanagedBuffer[i].token = IntPtr.Zero;
                        }
                        else
                        {
                            pinnedBuffers[i] = GCHandle.Alloc(iBuffer.token, GCHandleType.Pinned);
                            unmanagedBuffer[i].token = Marshal.UnsafeAddrOfPinnedArrayElement(iBuffer.token, iBuffer.offset);
                            buffers[i] = iBuffer.token;
                        }
                    }

                    // The result is written in the input Buffer passed as type=BufferType.Data.
                    int errorCode;
                    switch (op)
                    {
                        case OP.Encrypt:
                            errorCode = secModule.EncryptMessage(context, sdcInOut, sequenceNumber);
                            break;

                        case OP.Decrypt:
                            errorCode = secModule.DecryptMessage(context, sdcInOut, sequenceNumber);
                            break;

                        case OP.MakeSignature:
                            errorCode = secModule.MakeSignature(context, sdcInOut, sequenceNumber);
                            break;

                        case OP.VerifySignature:
                            errorCode = secModule.VerifySignature(context, sdcInOut, sequenceNumber);
                            break;

                        default:
                            GlobalLog.Assert("SSPIWrapper::EncryptDecryptHelper", "Unknown OP: " + op);
                            throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException);
                    }

                    // Marshalling back returned sizes / data.
                    for (int i = 0; i < input.Length; i++)
                    {
                        SecurityBuffer iBuffer = input[i];
                        iBuffer.size = unmanagedBuffer[i].count;
                        iBuffer.type = unmanagedBuffer[i].type;

                        if (iBuffer.size == 0)
                        {
                            iBuffer.offset = 0;
                            iBuffer.token = null;
                        }
                        else
                        {
                            checked
                            {
                                // Find the buffer this is inside of.  Usually they all point inside buffer 0.
                                int j;
                                for (j = 0; j < input.Length; j++)
                                {
                                    if (buffers[j] == null)
                                    {
                                        continue;
                                    }

                                    byte* bufferAddress = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(buffers[j], 0);
                                    if ((byte*)unmanagedBuffer[i].token >= bufferAddress &&
                                        (byte*)unmanagedBuffer[i].token + iBuffer.size <= bufferAddress + buffers[j].Length)
                                    {
                                        iBuffer.offset = (int)((byte*)unmanagedBuffer[i].token - bufferAddress);
                                        iBuffer.token = buffers[j];
                                        break;
                                    }
                                }

                                if (j >= input.Length)
                                {
                                    GlobalLog.Assert("SSPIWrapper::EncryptDecryptHelper", "Output buffer out of range.");
                                    iBuffer.size = 0;
                                    iBuffer.offset = 0;
                                    iBuffer.token = null;
                                }
                            }
                        }
                        
                        // Backup validate the new sizes.
                        GlobalLog.Assert(iBuffer.offset >= 0 && iBuffer.offset <= (iBuffer.token == null ? 0 : iBuffer.token.Length), "SSPIWrapper::EncryptDecryptHelper|'offset' out of range.  [{0}]", iBuffer.offset);
                        GlobalLog.Assert(iBuffer.size >= 0 && iBuffer.size <= (iBuffer.token == null ? 0 : iBuffer.token.Length - iBuffer.offset), "SSPIWrapper::EncryptDecryptHelper|'size' out of range.  [{0}]", iBuffer.size);
                    }

                    if (errorCode != 0 && NetEventSource.Log.IsEnabled())
                    {                         
                        if (errorCode == Interop.Secur32.SEC_I_RENEGOTIATE)
                        {
                            NetEventSource.PrintError(NetEventSource.ComponentType.Security, SR.Format(SR.event_OperationReturnedSomething, op, "SEC_I_RENEGOTIATE"));
                        }
                        else
                        {
                            NetEventSource.PrintError(NetEventSource.ComponentType.Security, SR.Format(SR.net_log_operation_failed_with_error, op, String.Format(CultureInfo.CurrentCulture, "0X{0:X}", errorCode)));
                        }
                    }

                    return errorCode;
                }
                finally
                {
                    for (int i = 0; i < pinnedBuffers.Length; ++i)
                    {
                        if (pinnedBuffers[i].IsAllocated)
                        {
                            pinnedBuffers[i].Free();
                        }
                    }
                }
            }
        }
Example #30
0
    public void Update()
    {
        if (op == OP.neutral && execQueue.Count > 0) {
            StartProc(execQueue[execQueue.Count - 1]);
            execQueue.RemoveAt(execQueue.Count - 1);
        }

        else if (whoseTurn == WHOSETURN.player) {

            if (op == OP.neutral) {
                MoveCursor();
                if (Input.GetButtonDown("Select")) {
                    DungeonCharacter bchar = cursorTile.GetBottomChar();
                    if (bchar != null && bchar.alignment == ALIGNMENT.player && !bchar.IsDone()) {
                        string[] opts = CharSelect.OptionsFor(bchar);
                        if (opts.Length > 0) {
                            StartCoroutine(StartCharSelect(bchar));
                            op = OP.menu;
                            Camera.mainCamera.audio.PlayOneShot(Resources.Load("audio/se/select") as AudioClip);
                        }
                    }
                }

                else if (Input.GetButtonDown("Cancel")) {

                    DungeonCharacter dchar = cursorTile.GetBottomChar();
                    if (dchar) {
                        if (dchar.TryUndo()) {
                            Camera.mainCamera.audio.PlayOneShot(Resources.Load("audio/se/cancel") as AudioClip);
                        }
                    }
                }

                else if (Input.GetButtonDown("Finish")) {
                    EnemyTurn();
                }

                else if (Input.GetButtonDown("Undo")) {
                    if (turnChanged) { SetTurn(turnIndex); }
                    else { SetTurn(Mathf.Max(0, turnIndex - 1)); }
                }

                else if (Input.GetButtonDown("Redo")) {
                    SetTurn(turnIndex + 1);
                }
            }

            else if (op == OP.plan) {
                Executable exe = action.UpdateConfig();
                if (exe != null) {
                    turnChanged = true;
                    StartProc(exe);
                }
            }

        }

        else if (whoseTurn == WHOSETURN.enemy) {

            if (op == OP.neutral) {

                AutonomousCharacter ne = enemiesInPlay.Find(e => !e.planned || e.execQueue.Count > 0);

                if (ne != null) {
                    if (!ne.planned) {
                        ne.DecideActions();
                    }

                    if (ne.execQueue != null && ne.execQueue.Count > 0) {

                        Executable exec = ne.execQueue.Dequeue();
                        StartProc(exec);

                    }
                }

                else {
                    EndTurn();
                    PlayerTurn();
                }
            }
        }
    }
Example #31
0
 public Cgt_Un()
 {
     OP.Add(OpCodes.Cgt_Un);
 }
Example #32
0
 public void Cancel()
 {
     op = OP.neutral;
 }
Example #33
0
 public string opName(OP op)
 {
     switch (op)
     {
         case OP.NEG : return "-";
         case OP.NOT : return "!";
         default:  return "?";
     }
 }
Example #34
0
 public void EndProc(GameProc eproc, Executable[] next)
 {
     Destroy(eproc);
     execQueue.AddRange(next);
     GameState.camCtrl.Focus(transform.parent.Find("cursor"));
     op = OP.neutral;
 }
Example #35
0
 public Cgt()
 {
     OP.Add(OpCodes.Cgt);
 }
Example #36
0
 static void dCROSS(float[] a, OP op, float[] b, float[] c)
 {
     if (op == OP.EQ)
     {
         a[0] = ((b)[1] * (c)[2] - (b)[2] * (c)[1]);
         a[1] = ((b)[2] * (c)[0] - (b)[0] * (c)[2]);
         a[2] = ((b)[0] * (c)[1] - (b)[1] * (c)[0]);
     }
     else if (op == OP.ADD_EQ)
     {
         a[0] += ((b)[1] * (c)[2] - (b)[2] * (c)[1]);
         a[1] += ((b)[2] * (c)[0] - (b)[0] * (c)[2]);
         a[2] += ((b)[0] * (c)[1] - (b)[1] * (c)[0]);
     }
     else if (op == OP.SUB_EQ)
     {
         a[0] -= ((b)[1] * (c)[2] - (b)[2] * (c)[1]);
         a[1] -= ((b)[2] * (c)[0] - (b)[0] * (c)[2]);
         a[2] -= ((b)[0] * (c)[1] - (b)[1] * (c)[0]);
     }
     else
     {
         throw new InvalidOperationException(op.ToString());
     }
 }
Example #37
0
 public IrBinop(OP b, IrExp l, IrExp r)
 {
     op = b; left = l; right = r;
 }
Example #38
0
        private unsafe SecurityStatus EncryptDecryptHelper(OP op, SafeDeleteContext context, SecurityBuffer[] input, uint sequenceNumber)
        {
            Interop.Secur32.SecurityBufferDescriptor sdcInOut = new Interop.Secur32.SecurityBufferDescriptor(input.Length);
            var unmanagedBuffer = new Interop.Secur32.SecurityBufferStruct[input.Length];

            fixed(Interop.Secur32.SecurityBufferStruct *unmanagedBufferPtr = unmanagedBuffer)
            {
                sdcInOut.UnmanagedPointer = unmanagedBufferPtr;
                GCHandle[] pinnedBuffers = new GCHandle[input.Length];
                byte[][]   buffers       = new byte[input.Length][];
                try
                {
                    for (int i = 0; i < input.Length; i++)
                    {
                        SecurityBuffer iBuffer = input[i];
                        unmanagedBuffer[i].count = iBuffer.size;
                        unmanagedBuffer[i].type  = iBuffer.type;
                        if (iBuffer.token == null || iBuffer.token.Length == 0)
                        {
                            unmanagedBuffer[i].token = IntPtr.Zero;
                        }
                        else
                        {
                            pinnedBuffers[i]         = GCHandle.Alloc(iBuffer.token, GCHandleType.Pinned);
                            unmanagedBuffer[i].token = Marshal.UnsafeAddrOfPinnedArrayElement(iBuffer.token, iBuffer.offset);
                            buffers[i] = iBuffer.token;
                        }
                    }

                    // The result is written in the input Buffer passed as type=BufferType.Data.
                    int errorCode;
                    switch (op)
                    {
                    case OP.Encrypt:
                        errorCode = EncryptMessage(context, sdcInOut, sequenceNumber);
                        break;

                    case OP.Decrypt:
                        errorCode = DecryptMessage(context, sdcInOut, sequenceNumber);
                        break;

                    default: throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException);
                    }

                    // Marshalling back returned sizes / data.
                    for (int i = 0; i < input.Length; i++)
                    {
                        SecurityBuffer iBuffer = input[i];
                        iBuffer.size = unmanagedBuffer[i].count;
                        iBuffer.type = unmanagedBuffer[i].type;

                        if (iBuffer.size == 0)
                        {
                            iBuffer.offset = 0;
                            iBuffer.token  = null;
                        }
                        else
                        {
                            checked
                            {
                                // Find the buffer this is inside of.  Usually they all point inside buffer 0.
                                int j;
                                for (j = 0; j < input.Length; j++)
                                {
                                    if (buffers[j] == null)
                                    {
                                        continue;
                                    }

                                    byte *bufferAddress = (byte *)Marshal.UnsafeAddrOfPinnedArrayElement(buffers[j], 0);
                                    if ((byte *)unmanagedBuffer[i].token >= bufferAddress &&
                                        (byte *)unmanagedBuffer[i].token + iBuffer.size <= bufferAddress + buffers[j].Length)
                                    {
                                        iBuffer.offset = (int)((byte *)unmanagedBuffer[i].token - bufferAddress);
                                        iBuffer.token  = buffers[j];
                                        break;
                                    }
                                }

                                if (j >= input.Length)
                                {
                                    GlobalLog.Assert("SSPIWrapper::EncryptDecryptHelper", "Output buffer out of range.");
                                    iBuffer.size   = 0;
                                    iBuffer.offset = 0;
                                    iBuffer.token  = null;
                                }
                            }
                        }

                        // Backup validate the new sizes.
                        GlobalLog.Assert(iBuffer.offset >= 0 && iBuffer.offset <= (iBuffer.token == null ? 0 : iBuffer.token.Length), "SSPIWrapper::EncryptDecryptHelper|'offset' out of range.  [{0}]", iBuffer.offset);
                        GlobalLog.Assert(iBuffer.size >= 0 && iBuffer.size <= (iBuffer.token == null ? 0 : iBuffer.token.Length - iBuffer.offset), "SSPIWrapper::EncryptDecryptHelper|'size' out of range.  [{0}]", iBuffer.size);
                    }

                    if (errorCode != 0 && Logging.On)
                    {
                        if (errorCode == 0x90321)
                        {
                            Logging.PrintError(Logging.Web, SR.Format(SR.net_log_operation_returned_something, op, "SEC_I_RENEGOTIATE"));
                        }
                        else
                        {
                            Logging.PrintError(Logging.Web, SR.Format(SR.net_log_operation_failed_with_error, op, String.Format(CultureInfo.CurrentCulture, "0X{0:X}", errorCode)));
                        }
                    }
                    return(MapToSecurityStatus((Interop.SecurityStatus)errorCode));
                }
                finally
                {
                    for (int i = 0; i < pinnedBuffers.Length; ++i)
                    {
                        if (pinnedBuffers[i].IsAllocated)
                        {
                            pinnedBuffers[i].Free();
                        }
                    }
                }
            }
        }
Example #39
0
        public void Constructor_FromOpNumTest(OP val)
        {
            PushDataOp op = new PushDataOp(val);

            Assert.Equal(val, op.OpValue);
        }
Example #40
0
 void DoAttackSwing(OP code, PlayerConnection c)
 {
 }
Example #41
0
        public void Constructor_FromInt_HasOpNum_Test(int i, OP expected)
        {
            PushDataOp op = new PushDataOp(i);

            Assert.Equal(expected, op.OpValue);
        }
Example #42
0
 void DoAttackStop(OP code, PlayerConnection c)
 {
 }
Example #43
0
 public Stind_I1()
 {
     OP.Add(OpCodes.Stind_I1);
 }
Example #44
0
 public Call()
 {
     OP.Add(OpCodes.Call);
 }
Example #45
0
 public Brtrue_S()
 {
     OP.Add(OpCodes.Brtrue_S);
     OP.Add(OpCodes.Brtrue);
 }
		/// <summary>
		/// 得到指定角色下,某些部门内的所有授权人员
		/// </summary>
		/// <param name="roles">角色集合。</param>
		/// <param name="depts">组织机构集合。</param>
		/// <param name="recursively">是否递归。</param>
		/// <returns></returns>
		public OP.OguObjectCollection<OP.IOguObject> GetRolesObjects(OP.RoleCollection roles, OP.OguObjectCollection<OP.IOrganization> depts, bool recursively)
		{
			var items = PC.Adapters.SCSnapshotAdapter.Instance.QueryRolesContainsUsers(new string[] { "Roles" },(from r in roles select r.ID).ToArray(), Util.GetContextIncludeDeleted(), DateTime.MinValue);

			return new BridgedOrganizationMechanism().GetObjects<IOguObject>(SearchOUIDType.Guid, items.ToIDArray());

			//忽略depts参数
		}
Example #47
0
 public Ret()
 {
     OP.Add(OpCodes.Ret);
 }
Example #48
0
 public Lldind_I4()
 {
     OP.Add(OpCodes.Ldind_I4);
 }
Example #49
0
 public Or()
 {
     OP.Add(OpCodes.Or);
 }
Example #50
0
 public Add()
 {
     OP.Add(OpCodes.Add);
 }
Example #51
0
 public Clt()
 {
     OP.Add(OpCodes.Clt);
 }
 /// <summary>
 /// 私有构造
 /// </summary>
 /// <param name="op"></param>
 /// <param name="propertyName"></param>
 /// <param name="value"></param>
 private Expression(OP op, string propertyName, object value)
 {
     m_PropertyName = propertyName;
     m_value        = value;
     m_OP           = op;
 }
Example #53
0
 public Callvirt()
 {
     OP.Add(OpCodes.Callvirt);
 }
 private Expression(OP op, string propertyName)
 {
     m_PropertyName = propertyName;
     m_OP           = op;
 }
Example #55
0
 public Lldind_U1()
 {
     OP.Add(OpCodes.Ldind_U1);
 }
Example #56
0
        private void btCadastrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (cbPrioridade.SelectedItem == null)
                {
                    MessageBox.Show("Escolha uma Prioridade", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cbPrioridade.Focus();
                }
                else if (cbFabrica.SelectedItem == null)
                {
                    MessageBox.Show("Escolha uma Fábrica", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cbFabrica.Focus();
                }
                else if (Properties.Settings.Default.ImpressoraRoteiro == "" && Properties.Settings.Default.ImpressoraRoteiro == "")
                {
                    MessageBox.Show("Por favor, configure as impressoras", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (!string.IsNullOrEmpty(tbQtde.Text) && Convert.ToInt32(tbQtde.Text) > 0)
                {
                    float LoteFabResto = 0;
                    int   LoteFabDiv   = 0;

                    LoteFabResto = Convert.ToInt32(tbQtde.Text) % LoteIdeal;
                    LoteFabDiv   = Convert.ToInt32(tbQtde.Text) / LoteIdeal;

                    OP op = new OP()
                    {
                        CodProduto   = Convert.ToInt32(tbCodProd.Text),
                        Prioridade   = cbPrioridade.SelectedItem.ToString(),
                        IdFabrica    = Convert.ToInt32(cbFabrica.SelectedItem.ToString()),
                        Qtde         = LoteIdeal,
                        Estampo      = ListProduto[0].Estampo,
                        MateriaPrima = ListProduto[0].MateriaPrima,
                        Obs          = tbOpObs.Text,
                        Usuario      = usuario
                    };

                    if (LoteFabDiv > 0)
                    {
                        for (int i = 0; i < LoteFabDiv; i++)
                        {
                            GravaOP(op);
                            DeletaImagens();
                        }
                    }

                    if (LoteFabResto > 0)
                    {
                        op.Qtde = (int)LoteFabResto;
                        GravaOP(op);
                        DeletaImagens();
                    }

                    MessageBox.Show(Msg, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Msg = "";
                    btCadastrar.Enabled = false;
                    Imprimir            = false;
                    ImprimirAviso       = false;
                }
                else
                {
                    MessageBox.Show("Preencha o campo quantidade", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    tbQtde.Focus();
                }
            }
            catch (Exception ex)
            {
                log.Tipo       = "Erro";
                log.Local      = this.GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Login      = usuario;
                log.Computador = Environment.MachineName.ToString();
                log.Mensagem   = ex.Message;
                ListLog.Add(log);
                log.GravaLog(ListLog);
                MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #57
0
 public string opName(OP op)
 {
     switch (op)
     {
         case AstBinop.OP.ADD: return "+";
         case AstBinop.OP.SUB: return "-";
         case AstBinop.OP.MUL: return "*";
         case AstBinop.OP.DIV: return "/";
         case AstBinop.OP.AND: return "&&";
         case AstBinop.OP.OR: return "||";
         default:  return "?";
     }
 }
Example #58
0
        private void GravaOP(OP op)
        {
            try
            {
                List <string>     ListResultadoRoteiro = new List <string>();
                List <string>     ListResultadoOP      = new List <string>();
                List <RoteiroSQL> ListRoteiro          = new List <RoteiroSQL>();
                RoteiroSQL        roteiroSQL           = new RoteiroSQL();

                ListRoteiroSQL.Clear();
                ListCadastrarOP.Clear();
                ListCadastrarOP.Add(op);
                ListResultadoOP = op.CadastrarOP(ListCadastrarOP);

                #region GravaLog
                log.Tipo       = "Informação";
                log.Local      = this.GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Login      = usuario;
                log.Computador = Environment.MachineName.ToString();
                log.Mensagem   = "Criou OP " + ListResultadoOP[0];
                ListLog.Add(log);
                log.GravaLog(ListLog);
                #endregion

                if (Convert.ToInt32(ListResultadoOP[0]) > 0)
                {
                    GeraEtiquetaOP(Convert.ToInt32(ListResultadoOP[0]));

                    for (var i = 0; i < ListRoteiroFireBird.Count; i++)
                    {
                        RoteiroSQL rot = new RoteiroSQL()
                        {
                            IdOP               = Convert.ToInt32(ListResultadoOP[0]),
                            IdFabrica          = Convert.ToInt32(ListRoteiroFireBird[i].Fabrica),
                            CodSetor           = ListRoteiroFireBird[i].CodSetor,
                            NomeSetor          = ListRoteiroFireBird[i].NomeSetor,
                            CodAtividade       = ListRoteiroFireBird[i].CodAtividade,
                            DescricaoAtividade = ListRoteiroFireBird[i].DescricaoAtividade,
                            Sequencia          = ListRoteiroFireBird[i].Sequencia
                        };
                        ListRoteiroSQL.Add(rot);
                        ListRoteiro.Add(rot);
                        ListResultadoRoteiro = roteiroSQL.CadastrarRoteiro(ListRoteiro, Convert.ToInt32(ListResultadoOP[0]));

                        if (Convert.ToInt32(ListResultadoRoteiro[0]) > 0)
                        {
                            ListRoteiroSQL[i].IdRoteiro = Convert.ToInt32(ListResultadoRoteiro[0]);
                            GeraEtiquetaRoteiro(Convert.ToInt32(ListResultadoRoteiro[0]));
                        }
                        else
                        {
                            MessageBox.Show(ListResultadoOP[0].ToString() + " - " + ListResultadoOP[1].ToString(), "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        ListRoteiro.Clear();
                    }

                    if (Imprimir)
                    {
                        pdOpRoteiro.PrinterSettings.PrinterName = Properties.Settings.Default.ImpressoraRoteiro;
                        pdOpRoteiro.PrintPage += pdOpRoteiro_PrintPage;
                        pdOpRoteiro.Print();

                        pdOpEtiqueta.PrinterSettings.PrinterName = Properties.Settings.Default.ImpressoraEtiqueta;
                        pdOpEtiqueta.PrintPage += pdOpEtiqueta_PrintPage;
                        pdOpEtiqueta.Print();
                    }
                    else
                    {
                        if (!ImprimirAviso)
                        {
                            DialogResult dialogResultOp = MessageBox.Show("Deseja imprimir a OP agora?", "Impressão da OP", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                            if (dialogResultOp == DialogResult.Yes)
                            {
                                pdOpRoteiro.PrinterSettings.PrinterName = Properties.Settings.Default.ImpressoraRoteiro;
                                pdOpRoteiro.PrintPage += pdOpRoteiro_PrintPage;
                                pdOpRoteiro.Print();
                                Imprimir = true;
                            }
                            else
                            {
                                Imprimir      = false;
                                ImprimirAviso = true;
                            }

                            DialogResult dialogResultEtiqueta = MessageBox.Show("Deseja imprimir a Etiqueta agora?", "Impressão da Etiqueta", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                            if (dialogResultEtiqueta == DialogResult.Yes)
                            {
                                pdOpEtiqueta.PrinterSettings.PrinterName = Properties.Settings.Default.ImpressoraEtiqueta;
                                pdOpEtiqueta.PrintPage += pdOpEtiqueta_PrintPage;
                                pdOpEtiqueta.Print();
                                Imprimir = true;
                            }
                            else
                            {
                                Imprimir      = false;
                                ImprimirAviso = true;
                            }
                        }
                    }

                    Msg            = Msg + "OP: " + ListResultadoOP[0].ToString() + " (Qtde: " + op.Qtde + ") - " + ListResultadoOP[1].ToString() + "\n";
                    tbCodProd.Text = "";
                    tbCodProd.Focus();
                    lbDescProd.Text     = "";
                    tbQtde.Text         = "";
                    lbEstampo.Text      = "";
                    lbMateriaPrima.Text = "";
                    tbOpObs.Text        = "";
                    ListResultadoOP.Clear();
                }
                else
                {
                    MessageBox.Show(ListResultadoOP[0].ToString() + " - " + ListResultadoOP[1].ToString(), "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                log.Tipo       = "Erro";
                log.Local      = this.GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Login      = usuario;
                log.Computador = Environment.MachineName.ToString();
                log.Mensagem   = ex.Message;
                ListLog.Add(log);
                log.GravaLog(ListLog);
                MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #59
0
 public AstRelop(OP o, AstExp ae1, AstExp ae2)
 {
     op = o; e1 = ae1; e2 = ae2;
 }
Example #60
0
 public int AddOp4(OP op, int p1, int p2, int p3, VTable p4, Vdbe.P4T p4t) // VTable
 {
     Debug.Assert(p4 != null);
     int addr = AddOp3(op, p1, p2, p3);
     ChangeP4(p, addr, new P4_t { VTable = p4 }, p4t);
     return addr;
 }