Exemplo n.º 1
0
        internal void SetContent(string setContent, int setType)
        {
            uint method = 0x2f4;

            this.TrEntry(method, new object[] { setContent, setType });
            bool flag = false;

            try
            {
                if (this.children != null)
                {
                    flag = true;
                }
                else if (this.ownRolled && (this.type != -1))
                {
                    flag = true;
                }
                else if (this.content != null)
                {
                    flag = true;
                }
                else
                {
                    this.content = setContent;
                    this.type    = setType;
                }
                if (flag)
                {
                    MQException ex = new MQException(2, 0x975);
                    base.TrException(method, ex);
                    throw ex;
                }
            }
            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);
            }
        }
Exemplo n.º 3
0
        private void ProcessAllAvailableRFHs()
        {
            uint method = 0xf6;

            this.TrEntry(method);
            XmlTextReader        xmlReader = null;
            string               key       = null;
            string               dt        = null;
            string               name      = null;
            string               propValue = null;
            bool                 flag      = true;
            string               attribute = null;
            MQPropertyDescriptor pd        = null;
            Queue                queue     = null;
            Queue                queue2    = null;

            try
            {
                foreach (string str6 in this.rfhStrings)
                {
                    string str7 = str6;
                    str7      = str7.Replace("xsi:nil", "xsi_ns:nil");
                    xmlReader = new XmlTextReader(new StringReader("<xsiwrapper xmlns:xsi_ns=\"xsi_explicitns\">" + str7 + "</xsiwrapper>"));
                    key       = null;
                    dt        = null;
                    name      = null;
                    propValue = null;
                    flag      = true;
                    attribute = null;
                    xmlReader.WhitespaceHandling = WhitespaceHandling.Significant;
                    try
                    {
                        while (xmlReader.Read())
                        {
                            if ((xmlReader.NodeType != XmlNodeType.Element) || (xmlReader.Name != "Root"))
                            {
                                if (xmlReader.NodeType == XmlNodeType.Element)
                                {
                                    if (!flag && (name != null))
                                    {
                                        name = name + '.' + xmlReader.Name;
                                    }
                                    if (flag && (xmlReader.Name != "xsiwrapper"))
                                    {
                                        name = xmlReader.Name;
                                        flag = false;
                                    }
                                }
                                if (xmlReader.HasAttributes)
                                {
                                    dt        = xmlReader.GetAttribute("dt");
                                    attribute = xmlReader.GetAttribute("nil", "xsi_explicitns");
                                    if ((attribute != null) && (attribute.ToLower().Trim() == "true"))
                                    {
                                        key = name;
                                        if (!this._receivedProps.Contains(key))
                                        {
                                            this._receivedProps[key] = null;
                                        }
                                        continue;
                                    }
                                    pd = new MQPropertyDescriptor();
                                    this.CheckForPropertyDescriptorAttributes(ref pd, ref xmlReader);
                                    if (key == null)
                                    {
                                        key = name;
                                    }
                                    if (key != null)
                                    {
                                        if (this.mqMessage.propertiesPDTable.ContainsKey(key))
                                        {
                                            queue = (Queue)this.mqMessage.propertiesPDTable[key];
                                            if (queue != null)
                                            {
                                                queue.Enqueue(pd);
                                            }
                                            this.mqMessage.propertiesPDTable[key] = queue;
                                        }
                                        else
                                        {
                                            queue = new Queue();
                                            queue.Enqueue(pd);
                                            this.mqMessage.propertiesPDTable.Add(key, queue);
                                        }
                                    }
                                    switch (dt)
                                    {
                                    case null:
                                    case "":
                                        dt = "string";
                                        break;
                                    }
                                }
                                if (xmlReader.HasValue)
                                {
                                    key       = name;
                                    propValue = xmlReader.Value;
                                    if (!this._receivedProps.Contains(key))
                                    {
                                        queue2 = new Queue();
                                        queue2.Enqueue(this.GetValueAsObject(dt, propValue));
                                        this._receivedProps.Add(key, queue2);
                                    }
                                    else
                                    {
                                        queue2 = (Queue)this._receivedProps[key];
                                        if (queue2 != null)
                                        {
                                            queue2.Enqueue(this.GetValueAsObject(dt, propValue));
                                        }
                                        this._receivedProps[key] = queue2;
                                    }
                                    key = null;
                                    dt  = null;
                                }
                                if ((xmlReader.NodeType == XmlNodeType.EndElement) && (xmlReader.Name != "xsiwrapper"))
                                {
                                    int num2 = name.LastIndexOf('.');
                                    if (num2 == -1)
                                    {
                                        if (name != xmlReader.Name)
                                        {
                                            MQException exception = new MQException(2, 0x975);
                                            throw exception;
                                        }
                                        flag = true;
                                        name = null;
                                    }
                                    else
                                    {
                                        if (xmlReader.Name != name.Substring(num2 + 1))
                                        {
                                            MQException exception2 = new MQException(2, 0x975);
                                            throw exception2;
                                        }
                                        name = name.Substring(0, name.LastIndexOf('.'));
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception exception3)
                    {
                        base.TrException(method, exception3);
                        base.TrText(method, "We are not sucessful in parsing one of theRFH2Header.Raise the RFH_FORMAT exception and breakfurther processing in loop");
                        base.throwNewMQException(2, 0x975);
                    }
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }