public void PutReportMessage(MQMessage message, MQPutMessageOptions putMessageOptions) { uint method = 0x22d; this.TrEntry(method, new object[] { message, putMessageOptions }); int compCode = 0; int reason = 0; try { if (message == null) { base.throwNewMQException(2, 0x7ea); } if (putMessageOptions == null) { base.throwNewMQException(2, 0x87d); } MQMessage newMsg = new MQMessage(); if ((putMessageOptions.Options & 0x800000) != 0) { newMsg = this.CopyMDFromOldMsgIntoReportMsg(message, newMsg, putMessageOptions.Options); putMessageOptions.Options &= -8388609; } IEnumerator propertyNames = message.GetPropertyNames("%"); MQPropertyDescriptor pd = new MQPropertyDescriptor(); while (propertyNames.MoveNext()) { string name = propertyNames.Current.ToString(); object objectProperty = message.GetObjectProperty(name, pd); if (this.ValidToCopy(pd.CopyOptions, 0x10)) { newMsg.SetObjectProperty(name, pd, objectProperty); } } base.Put(newMsg, putMessageOptions); } catch (MQException exception) { compCode = exception.CompCode; reason = exception.Reason; throw exception; } finally { base.unsafe_compCode = compCode; base.unsafe_reason = reason; base.TrExit(method); } }
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 CheckForPropertyDescriptorAttributes(ref MQPropertyDescriptor pd, ref XmlTextReader xmlReader) { uint method = 0xfd; this.TrEntry(method, new object[] { pd, xmlReader }); try { switch (xmlReader.GetAttribute("context")) { case "none": pd.Context = 0; break; case "user": pd.Context = 1; break; } string attribute = xmlReader.GetAttribute("support"); if (attribute != null) { StringBuilder hex = new StringBuilder(attribute); byte[] bin = new byte[attribute.Length / 2]; MQMessage.BinToHex(bin, 0, bin.Length, hex); Array.Reverse(bin); pd.Support = BitConverter.ToInt32(bin, 0); } string str3 = xmlReader.GetAttribute("copy"); if (str3 != null) { foreach (string str4 in str3.Split(new char[] { ',' })) { if (str4 == "none") { pd.CopyOptions = 0; } else if (str4 == "All") { pd.CopyOptions = 1; } else { if (pd.CopyOptions == 0x16) { pd.CopyOptions = 0; } if (str4 == "forward") { pd.CopyOptions += 2; } if (str4 == "reply") { pd.CopyOptions += 8; } if (str4 == "report") { pd.CopyOptions += 0x10; } } } } } finally { base.TrExit(method); } }
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); } }