示例#1
0
 public MQXid()
 {
     base.TrConstructor("%Z% %W%  %I% %E% %U%");
     this.xid = new Xid();
     this.xid.bqual_length = 0;
     this.xid.gtrid_length = 0;
     this.xid.data         = new byte[0x80];
     this.xid.formatID     = 12;
 }
示例#2
0
        public override bool Equals(object obj)
        {
            uint method = 0x50a;

            this.TrEntry(method, new object[] { obj });
            Xid  xid    = this.xid;
            Xid  xid2   = ((MQXid)obj).xid;
            bool result = true;

            if (xid.formatID != xid2.formatID)
            {
                result = false;
                base.TrExit(method, result, 1);
                return(result);
            }
            if (xid.gtrid_length != xid2.gtrid_length)
            {
                result = false;
                base.TrExit(method, result, 2);
                return(result);
            }
            if (xid.bqual_length != xid2.bqual_length)
            {
                result = false;
                base.TrExit(method, result, 3);
                return(result);
            }
            try
            {
                for (int i = 0; i < (xid.bqual_length + xid.gtrid_length); i++)
                {
                    if (xid.data[i] != xid2.data[i])
                    {
                        return(false);
                    }
                }
                return(result);
            }
            catch (Exception exception)
            {
                base.TrException(method, exception);
            }
            finally
            {
                base.TrExit(method, result, 4);
            }
            return(result);
        }
示例#3
0
        public int ReadBytes(byte[] b, int Offset)
        {
            uint method = 0x504;

            this.TrEntry(method, new object[] { b, Offset });
            IntPtr zero          = IntPtr.Zero;
            int    roundedLength = this.GetRoundedLength();
            int    result        = 0;

            try
            {
                if (zero == IntPtr.Zero)
                {
                    zero = Marshal.AllocCoTaskMem(roundedLength);
                }
                if (roundedLength > (b.Length - Offset))
                {
                    roundedLength = b.Length - Offset;
                }
                Marshal.Copy(b, Offset, zero, roundedLength);
                this.xid = (Xid)Marshal.PtrToStructure(zero, typeof(Xid));
                Marshal.FreeCoTaskMem(zero);
                result = Offset + roundedLength;
                byte[] destinationArray = new byte[this.xid.gtrid_length];
                Array.Copy(this.xid.data, destinationArray, (int)this.xid.gtrid_length);
                this.globalTransId = new Guid(destinationArray);
                destinationArray   = new byte[this.xid.bqual_length];
                Array.Copy(this.xid.data, this.xid.gtrid_length, destinationArray, 0, this.xid.bqual_length);
                this.localTransBranchId = Encoding.ASCII.GetString(destinationArray);
                destinationArray        = null;
            }
            finally
            {
                base.TrExit(method, result);
            }
            return(result);
        }