internal MQMarshalMessageForPut(MQMessage mqMsg)
 {
     base.TrConstructor("%Z% %W%  %I% %E% %U%", new object[] { mqMsg });
     this.mqMessage      = mqMsg;
     this.body           = this.mqMessage.GetBuffer();
     this.msgDataforSend = new byte[this.body.Length];
     if (this.mqMessage.properties.Count > 0)
     {
         this.properties = this.mqMessage.properties;
     }
     this.rfhFolders = new RFH2Folder();
 }
예제 #2
0
        internal void AddFolder(RFH2Folder folder)
        {
            uint method = 0x2ef;

            this.TrEntry(method, new object[] { folder });
            try
            {
                int length = folder.Render().Length;
                this.folders.Add(folder);
            }
            finally
            {
                base.TrExit(method);
            }
        }
예제 #3
0
        internal void AddFolder(RFH2Folder child)
        {
            uint method = 0x2f5;

            this.TrEntry(method, new object[] { child });
            try
            {
                if (this.children == null)
                {
                    this.children = new ArrayList();
                }
                this.children.Add(child);
            }
            finally
            {
                base.TrExit(method);
            }
        }
예제 #4
0
        internal RFH2Folder GetFolder(string folderName)
        {
            uint method = 0x2f3;

            this.TrEntry(method, new object[] { folderName });
            RFH2Folder result = null;

            if (this.children != null)
            {
                foreach (RFH2Folder folder2 in this.children)
                {
                    if (folder2.name == folderName)
                    {
                        result = folder2;
                    }
                }
            }
            base.TrExit(method, result);
            return(result);
        }
예제 #5
0
        internal RFH2Folder GetFolder(string foldername)
        {
            uint method = 0x2f0;

            this.TrEntry(method, new object[] { foldername });
            RFH2Folder folder = null;

            try
            {
                foreach (RFH2Folder folder2 in this.folders)
                {
                    if (folder2.name == foldername)
                    {
                        return(folder2);
                    }
                }
                return(folder);
            }
            finally
            {
                base.TrExit(method);
            }
            return(folder);
        }
        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);
            }
        }
        private void SetPropertyDescriptor(RFH2Folder element, MQPropertyDescriptor pd)
        {
            uint method = 0x107;

            this.TrEntry(method, new object[] { element, pd });
            int cc = 0;
            int rc = 0;

            try
            {
                if (element != null)
                {
                    if (element.name.ToLower().Equals("mq"))
                    {
                        byte[] bytes = BitConverter.GetBytes(pd.Support);
                        Array.Reverse(bytes);
                        StringBuilder builder = new StringBuilder(bytes.Length);
                        for (int i = 0; i < bytes.Length; i++)
                        {
                            builder.Append(bytes[i].ToString("X2"));
                        }
                        element.support = builder.ToString();
                    }
                    if (pd.Context == 0)
                    {
                        element.context = "none";
                    }
                    else if (pd.Context == 1)
                    {
                        element.context = "user";
                    }
                    else
                    {
                        cc = 2;
                        rc = 0x9b2;
                        base.throwNewMQException(cc, rc);
                    }
                    int    copyOptions = pd.CopyOptions;
                    string str         = null;
                    if ((copyOptions & 0x16) != 0x16)
                    {
                        if (copyOptions == 0)
                        {
                            str = "none";
                        }
                        else if ((copyOptions & 1) != 0)
                        {
                            str = "All";
                        }
                        else
                        {
                            if ((copyOptions & 2) != 0)
                            {
                                if (str == null)
                                {
                                    str = "forward";
                                }
                                else
                                {
                                    str = str + ',' + "forward";
                                }
                            }
                            if ((copyOptions & 4) != 0)
                            {
                                if (str == null)
                                {
                                    str = "publish";
                                }
                                else
                                {
                                    str = str + ',' + "publish";
                                }
                            }
                            if ((copyOptions & 0x10) != 0)
                            {
                                if (str == null)
                                {
                                    str = "report";
                                }
                                else
                                {
                                    str = str + ',' + "report";
                                }
                            }
                            if ((copyOptions & 8) != 0)
                            {
                                if (str == null)
                                {
                                    str = "reply";
                                }
                                else
                                {
                                    str = str + ',' + "reply";
                                }
                            }
                        }
                    }
                    element.copyOption = str;
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
        private void SetContent(RFH2Folder element, object value)
        {
            uint method = 260;

            this.TrEntry(method, new object[] { element, value });
            try
            {
                StringBuilder output = new StringBuilder(10);
                if (value is string)
                {
                    element.SetContent(this.EscapeXMLChars(output, (string)value), 0);
                }
                else if (value is int)
                {
                    element.SetContent(value.ToString(), 5);
                }
                else if (value is short)
                {
                    element.SetContent(value.ToString(), 4);
                }
                else if (value is sbyte)
                {
                    element.SetContent(value.ToString(), 3);
                }
                else if (value is byte)
                {
                    element.SetContent(((sbyte)((byte)value)).ToString(), 3);
                }
                else if (value is long)
                {
                    element.SetContent(value.ToString(), 6);
                }
                else if (value is float)
                {
                    element.SetContent(value.ToString(), 8);
                }
                else if (value is double)
                {
                    element.SetContent(value.ToString(), 9);
                }
                else
                {
                    if (value is byte[])
                    {
                        try
                        {
                            StringBuilder hex = new StringBuilder();
                            MQMessage.BinToHex((byte[])value, 0, ((byte[])value).Length, hex);
                            element.SetContent(hex.ToString(), 2);
                            return;
                        }
                        catch (Exception exception)
                        {
                            base.TrException(method, exception, 1);
                            throw exception;
                        }
                    }
                    if (value is bool)
                    {
                        element.SetContent(value.ToString(), 1);
                    }
                    else if (value == null)
                    {
                        element.SetContent(null);
                    }
                    else
                    {
                        element.SetContent(this.EscapeXMLChars(output, value.ToString()), 0);
                    }
                }
            }
            catch (Exception)
            {
                MQException ex = new MQException(2, 0x9a2);
                base.TrException(method, ex);
                throw ex;
            }
            finally
            {
                base.TrExit(method);
            }
        }