コード例 #1
0
ファイル: MQXid.cs プロジェクト: halfsilvered/TestCodes
 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
ファイル: MQXid.cs プロジェクト: halfsilvered/TestCodes
        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
ファイル: MQXid.cs プロジェクト: halfsilvered/TestCodes
        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);
        }