コード例 #1
0
        private void WriteRFH2Properties()
        {
            uint method = 0xff;

            this.TrEntry(method);
            try
            {
                int        num5;
                int        length     = 0;
                int        num3       = 0;
                string     foldername = null;
                bool       flag       = false;
                RFH2Folder folder     = null;
                if (this.properties != null)
                {
                    IEnumerator enumerator = this.properties.Keys.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        string current          = (string)enumerator.Current;
                        Queue  queue            = (Queue)((Queue)this.properties[current]).Clone();
                        Queue  queue2           = (Queue)this.mqMessage.propertiesPDTable[current];
                        MQPropertyDescriptor pd = new MQPropertyDescriptor();
                        length = current.IndexOf('.');
                        if (length > 0)
                        {
                            foldername = current.Substring(0, length);
                            if (!this.rfh.Contains(foldername))
                            {
                                RFH2Folder child = new RFH2Folder(foldername);
                                this.rfhFolders.AddFolder(child);
                                this.rfh.AddFolder(child);
                            }
                            flag    = true;
                            current = current.Substring(length + 1);
                        }
                        else
                        {
                            if (!this.rfh.Contains("usr"))
                            {
                                RFH2Folder folder3 = new RFH2Folder("usr");
                                this.rfhFolders.AddFolder(folder3);
                                this.rfh.AddFolder(folder3);
                            }
                            RFH2Folder folder4 = this.rfh.GetFolder("usr");
                            if (queue != null)
                            {
                                while (queue.Count > 0)
                                {
                                    RFH2Folder element = new RFH2Folder(current);
                                    if ((queue2 != null) && (queue2.Count > 0))
                                    {
                                        pd = (MQPropertyDescriptor)queue2.Dequeue();
                                        if (pd != null)
                                        {
                                            this.SetPropertyDescriptor(element, pd);
                                        }
                                    }
                                    this.SetContent(element, queue.Dequeue());
                                    folder4.AddFolder(element);
                                }
                                folder4 = null;
                            }
                            else
                            {
                                RFH2Folder folder6 = new RFH2Folder(current);
                                if ((queue2 != null) && (queue2.Count > 0))
                                {
                                    pd = (MQPropertyDescriptor)queue2.Dequeue();
                                    if (pd != null)
                                    {
                                        this.SetPropertyDescriptor(folder6, pd);
                                    }
                                }
                                this.SetContent(folder6, null);
                                folder4.AddFolder(folder6);
                                folder4 = null;
                            }
                        }
                        while (flag)
                        {
                            length = current.IndexOf('.');
                            if (folder == null)
                            {
                                folder = this.rfh.GetFolder(foldername);
                            }
                            if (length == -1)
                            {
                                foldername = current;
                                if (queue != null)
                                {
                                    while (queue.Count > 0)
                                    {
                                        RFH2Folder folder7 = new RFH2Folder(foldername);
                                        if ((queue2 != null) && (queue2.Count > 0))
                                        {
                                            pd = (MQPropertyDescriptor)queue2.Dequeue();
                                            if (pd != null)
                                            {
                                                this.SetPropertyDescriptor(folder7, pd);
                                            }
                                        }
                                        this.SetContent(folder7, queue.Dequeue());
                                        folder.AddFolder(folder7);
                                    }
                                    folder = null;
                                }
                                else
                                {
                                    RFH2Folder folder8 = new RFH2Folder(foldername);
                                    if ((queue2 != null) && (queue2.Count > 0))
                                    {
                                        pd = (MQPropertyDescriptor)queue2.Dequeue();
                                        if (pd != null)
                                        {
                                            this.SetPropertyDescriptor(folder8, pd);
                                        }
                                    }
                                    this.SetContent(folder8, null);
                                    folder.AddFolder(folder8);
                                    folder = null;
                                }
                                continue;
                            }
                            foldername = current.Substring(0, length);
                            current    = current.Substring(length + 1);
                            if (!folder.Contains(foldername) && (folder.name != foldername))
                            {
                                RFH2Folder folder9 = new RFH2Folder(foldername);
                                folder.AddFolder(folder9);
                                folder = folder9;
                            }
                            else if (folder.name != foldername)
                            {
                                folder = folder.GetFolder(foldername);
                            }
                        }
                    }
                }
                ArrayList list           = new ArrayList(10);
                byte[]    buf            = null;
                int       num6           = 4;
                Encoding  dotnetEncoding = MQCcsidTable.GetDotnetEncoding(0x4b8);
                foreach (RFH2Folder folder11 in this.rfh.folders)
                {
                    string s = folder11.Render();
                    buf = dotnetEncoding.GetBytes(s);
                    int num4 = buf.Length;
                    num5  = 3 - ((buf.Length - 1) % num6);
                    num4 += num5;
                    num3 += num4 + num6;
                    base.TrData(method, 2, "RFH2 XML(variable part) Content", buf);
                    list.Add(buf);
                }
                int    i            = num3 + 0x24;
                int    encoding     = this.mqMessage.Encoding;
                int    characterSet = this.mqMessage.CharacterSet;
                string format       = this.mqMessage.Format;
                int    off          = 0;
                byte[] dst          = new byte[0x24];
                RFH2.InsertStrIntoByteArray("RFH ", 4, dst, 0, 0x4b8, encoding);
                off += "RFH ".Length;
                RFH2.InsertIntIntoByteArray(2, dst, off, encoding);
                off += 4;
                RFH2.InsertIntIntoByteArray(i, dst, off, encoding);
                off += 4;
                RFH2.InsertIntIntoByteArray(encoding, dst, off, encoding);
                off += 4;
                RFH2.InsertIntIntoByteArray(characterSet, dst, off, encoding);
                off += 4;
                RFH2.InsertStrIntoByteArray(format, 8, dst, off, 0x4b8, encoding);
                off += 8;
                RFH2.InsertIntIntoByteArray(0, dst, off, encoding);
                off += 4;
                RFH2.InsertIntIntoByteArray(0x4b8, dst, off, encoding);
                this.mqMessage.Format = "MQHRF2  ";
                this.ExpandMessageData((num3 + this.body.Length) + 0x24);
                this.AppendByteArray(dst);
                foreach (object obj2 in list)
                {
                    buf  = (byte[])obj2;
                    num5 = 3 - ((buf.Length - 1) % num6);
                    this.AppendInt(buf.Length, this.mqMessage.Encoding);
                    this.AppendByteArray(buf);
                    this.AppendByteArray(this.SPACES, 0, num5);
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
コード例 #2
0
        internal byte[] ProcessMessageForRFH()
        {
            byte[] buffer;
            uint   method = 0xf4;

            this.TrEntry(method);
            if (this.rfhBytes == null)
            {
                base.TrExit(method, this.rfhBytes, 1);
                return(this.rfhBytes);
            }
            if ((this.rfhBytes != null) && (this.rfhBytes.Length < 0x24))
            {
                base.TrExit(method, this.rfhBytes, 2);
                return(this.rfhBytes);
            }
            int    count  = 0;
            string format = null;

            try
            {
                int   encoding     = this.mqMessage.Encoding;
                int   characterSet = this.mqMessage.CharacterSet;
                ulong formatAsLong = this.GetFormatAsLong(MQCcsidTable.GetDotnetEncoding(characterSet));
                format = this.mqMessage.Format;
                while (((formatAsLong & 18446742974197923840L) == 0x4d51480000000000L) || ((formatAsLong & 18446742974197923840L) == 15337228433335779328L))
                {
                    int num8       = 0;
                    int readCursor = this.readCursor;
                    this.readCursor += 8;
                    num8            += 8;
                    count            = this.ReadInt(encoding);
                    this.readCursor += 4;
                    num8            += 4;
                    int num3 = this.ReadInt(encoding);
                    this.readCursor += 4;
                    num8            += 4;
                    int num4 = this.ReadInt(encoding);
                    this.readCursor += 4;
                    num8            += 4;
                    RFHHeader header = new RFHHeader();
                    header.hdrCcsid          = characterSet;
                    header.hdrEncoding       = encoding;
                    header.hdrFormatAsLong   = formatAsLong;
                    header.hdrFormatAsString = format;
                    header.hdrLength         = count;
                    header.hdrData           = new byte[count];
                    System.Buffer.BlockCopy(this.rfhBytes, readCursor, header.hdrData, 0, count);
                    this.rfhHeaderList.Add(header);
                    format = this.GetFormatAsString(MQCcsidTable.GetDotnetEncoding(characterSet));
                    base.TrText(method, "Format of Next Header " + format);
                    this.mqMessage.Format = format;
                    num8            += 8;
                    this.readCursor += 8;
                    formatAsLong     = this.GetFormatAsLong(MQCcsidTable.GetDotnetEncoding(characterSet));
                    int num10 = count - num8;
                    this.readCursor            += num10;
                    encoding                    = num3;
                    this.mqMessage.Encoding     = encoding;
                    characterSet                = num4;
                    this.mqMessage.CharacterSet = num4;
                }
                int    i     = this.mqMessage.Encoding;
                int    num12 = this.mqMessage.CharacterSet;
                string src   = this.mqMessage.Format;
                if (this.rfhHeaderList.Count > 0)
                {
                    this.ConvertBytesContentToString();
                }
                if (this.rfhStrings.Count > 0)
                {
                    this.ProcessAllAvailableRFHs();
                    this.mqMessage.properties = this._receivedProps;
                    this._receivedProps       = null;
                }
                int num13 = this.dataLength - this.readCursor;
                if (num13 < 0)
                {
                    num13 = 0;
                }
                int num14 = 0;
                for (int j = 0; j < this.rfhHeaderList.Count; j++)
                {
                    RFHHeader header2 = (RFHHeader)this.rfhHeaderList[j];
                    if (header2.includeInMsg)
                    {
                        num14 += header2.hdrLength;
                    }
                }
                num14 += num13;
                buffer = new byte[num14];
                int  dstOffset = 0;
                bool flag      = true;
                for (int k = 0; k < this.rfhHeaderList.Count; k++)
                {
                    RFHHeader header3 = (RFHHeader)this.rfhHeaderList[k];
                    if (header3.includeInMsg)
                    {
                        base.TrText(method, "Including rfh header in message which is at position : " + k);
                        base.TrText(method, "Header Length : " + header3.hdrLength);
                        if (flag)
                        {
                            this.mqMessage.Encoding     = header3.hdrEncoding;
                            this.mqMessage.CharacterSet = header3.hdrCcsid;
                            this.mqMessage.Format       = header3.hdrFormatAsString;
                            flag = false;
                        }
                        System.Buffer.BlockCopy(header3.hdrData, 0, buffer, dstOffset, header3.hdrLength);
                        base.TrText(method, string.Concat(new object[] { "Header ", k, " of length ", header3.hdrLength, ", included in message starting position : ", dstOffset }));
                        int num18 = k + 1;
                        while (num18 < this.rfhHeaderList.Count)
                        {
                            RFHHeader header4 = (RFHHeader)this.rfhHeaderList[num18];
                            if (header4.includeInMsg)
                            {
                                base.TrText(method, "Updating next header encoding, ccsid and format to this header");
                                RFH2.InsertIntIntoByteArray(header4.hdrEncoding, buffer, dstOffset + 12, header3.hdrEncoding);
                                RFH2.InsertIntIntoByteArray(header4.hdrCcsid, buffer, dstOffset + 0x10, header3.hdrEncoding);
                                RFH2.InsertStrIntoByteArray(header4.hdrFormatAsString, 8, buffer, dstOffset + 20, header3.hdrCcsid, header3.hdrEncoding);
                                break;
                            }
                            num18++;
                        }
                        if (num18 == this.rfhHeaderList.Count)
                        {
                            base.TrText(method, "No more header present. Updating encoding, ccsid and format of data to this header");
                            RFH2.InsertIntIntoByteArray(i, buffer, dstOffset + 12, header3.hdrEncoding);
                            RFH2.InsertIntIntoByteArray(num12, buffer, dstOffset + 0x10, header3.hdrEncoding);
                            RFH2.InsertStrIntoByteArray(src, 8, buffer, dstOffset + 20, header3.hdrCcsid, header3.hdrEncoding);
                        }
                        dstOffset += header3.hdrLength;
                        continue;
                    }
                    base.TrText(method, "The header processed. Not Including rfh header in message which is at position : " + k);
                    base.TrText(method, "Header Length which is not included : " + header3.hdrLength);
                }
                System.Buffer.BlockCopy(this.rfhBytes, this.readCursor, buffer, dstOffset, this.dataLength - this.readCursor);
                base.TrText(method, string.Concat(new object[] { "Message data copied from position: ", this.readCursor, ", to position : ", dstOffset, ", length : ", this.dataLength - this.readCursor }));
            }
            finally
            {
                base.TrExit(method, 2);
            }
            return(buffer);
        }