private void Write63_WdxFieldInfo(string n, string ns, WdxFieldInfo o, bool isNullable, bool needType) { if (o == null) { if (isNullable) { base.WriteNullTagLiteral(n, ns); } } else { if (!needType && (o.GetType() != typeof(WdxFieldInfo))) { throw base.CreateUnknownTypeException(o); } base.WriteStartElement(n, ns, o, false, null); if (needType) { base.WriteXsiType("WdxFieldInfo", ""); } base.WriteElementString("FieldName", "", o.FieldName); base.WriteElementStringRaw("FieldType", "", XmlConvert.ToString(o.FieldType)); string[] units = o.Units; if (units != null) { base.WriteStartElement("Units", "", null, false); for (int i = 0; i < units.Length; i++) { base.WriteNullableStringLiteral("string", "", units[i]); } base.WriteEndElement(); } base.WriteElementString("Flags", "", this.Write59_ContentFlag(o.Flags)); base.WriteEndElement(o); } }
protected WdxContent(Microsoft.Win32.SafeHandles.SafeLibraryHandle libHandle) { this.LibHandle = libHandle; IntPtr procAddress = Windows.GetProcAddress(this.LibHandle, "ContentGetDetectString"); if (procAddress != IntPtr.Zero) { this.ContentGetDetectString = (ContentGetDetectStringHandler) Marshal.GetDelegateForFunctionPointer(procAddress, typeof(ContentGetDetectStringHandler)); } this.ContentGetSupportedField = (ContentGetSupportedFieldHandler) Marshal.GetDelegateForFunctionPointer(Windows.GetProcAddress(this.LibHandle, "ContentGetSupportedField"), typeof(ContentGetSupportedFieldHandler)); procAddress = Windows.GetProcAddress(this.LibHandle, "ContentGetValueW"); if (procAddress != IntPtr.Zero) { this.ContentGetValueW = (ContentGetValueWHandler) Marshal.GetDelegateForFunctionPointer(procAddress, typeof(ContentGetValueWHandler)); } else { procAddress = Windows.GetProcAddress(this.LibHandle, "ContentGetValue"); if (procAddress == IntPtr.Zero) { throw new ArgumentException(); } this.ContentGetValue = (ContentGetValueHandler) Marshal.GetDelegateForFunctionPointer(procAddress, typeof(ContentGetValueHandler)); } procAddress = Windows.GetProcAddress(this.LibHandle, "ContentGetSupportedFieldFlags"); if (procAddress != IntPtr.Zero) { this.ContentGetSupportedFieldFlags = (ContentGetSupportedFieldFlagsHandler) Marshal.GetDelegateForFunctionPointer(procAddress, typeof(ContentGetSupportedFieldFlagsHandler)); } procAddress = Windows.GetProcAddress(this.LibHandle, "ContentSetValueW"); if (procAddress != IntPtr.Zero) { this.ContentSetValueW = (ContentSetValueWHandler) Marshal.GetDelegateForFunctionPointer(procAddress, typeof(ContentSetValueWHandler)); } else { procAddress = Windows.GetProcAddress(this.LibHandle, "ContentSetValue"); if (procAddress != IntPtr.Zero) { this.ContentSetValue = (ContentSetValueHandler) Marshal.GetDelegateForFunctionPointer(procAddress, typeof(ContentSetValueHandler)); } } procAddress = Windows.GetProcAddress(libHandle, "ContentStopGetValue"); if (procAddress != IntPtr.Zero) { this.ContentStopGetValue = (ContentStopGetValueHandler) Marshal.GetDelegateForFunctionPointer(procAddress, typeof(ContentStopGetValueHandler)); } List<WdxFieldInfo> list = new List<WdxFieldInfo>(); StringBuilder fieldName = new StringBuilder(0x400); StringBuilder units = new StringBuilder(fieldName.Capacity); int fieldIndex = 0; for (int i = this.ContentGetSupportedField(fieldIndex, fieldName, units, fieldName.Capacity); i != 0; i = this.ContentGetSupportedField(++fieldIndex, fieldName, units, fieldName.Capacity)) { WdxFieldInfo item = new WdxFieldInfo { FieldName = fieldName.ToString(), FieldType = i }; if (units.Length > 0) { item.Units = units.ToString().Split(new char[] { '|' }); } if (this.ContentGetSupportedFieldFlags != null) { item.Flags = this.ContentGetSupportedFieldFlags(fieldIndex); } list.Add(item); } this.FieldsCollection = new ReadOnlyCollection<WdxFieldInfo>(list); }
private WdxFieldInfo Read63_WdxFieldInfo(bool isNullable, bool checkType) { XmlQualifiedName type = checkType ? base.GetXsiType() : null; bool flag = false; if (isNullable) { flag = base.ReadNull(); } if ((checkType && (type != null)) && ((type.Name != this.id53_WdxFieldInfo) || (type.Namespace != this.id2_Item))) { throw base.CreateUnknownTypeException(type); } if (flag) { return null; } WdxFieldInfo o = new WdxFieldInfo(); bool[] flagArray = new bool[4]; while (base.Reader.MoveToNextAttribute()) { if (!base.IsXmlnsAttribute(base.Reader.Name)) { base.UnknownNode(o); } } base.Reader.MoveToElement(); if (base.Reader.IsEmptyElement) { base.Reader.Skip(); return o; } base.Reader.ReadStartElement(); base.Reader.MoveToContent(); int whileIterations = 0; int readerCount = base.ReaderCount; while ((base.Reader.NodeType != XmlNodeType.EndElement) && (base.Reader.NodeType != XmlNodeType.None)) { if (base.Reader.NodeType == XmlNodeType.Element) { if ((!flagArray[0] && (base.Reader.LocalName == this.id323_FieldName)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.FieldName = base.Reader.ReadElementString(); flagArray[0] = true; } else if ((!flagArray[1] && (base.Reader.LocalName == this.id324_FieldType)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.FieldType = XmlConvert.ToInt32(base.Reader.ReadElementString()); flagArray[1] = true; } else if ((base.Reader.LocalName == this.id325_Units) && (base.Reader.NamespaceURI == this.id2_Item)) { if (!base.ReadNull()) { string[] a = null; int index = 0; if (base.Reader.IsEmptyElement) { base.Reader.Skip(); } else { base.Reader.ReadStartElement(); base.Reader.MoveToContent(); int num4 = 0; int num5 = base.ReaderCount; while ((base.Reader.NodeType != XmlNodeType.EndElement) && (base.Reader.NodeType != XmlNodeType.None)) { if (base.Reader.NodeType == XmlNodeType.Element) { if ((base.Reader.LocalName == this.id211_string) && (base.Reader.NamespaceURI == this.id2_Item)) { if (base.ReadNull()) { a = (string[]) base.EnsureArrayIndex(a, index, typeof(string)); a[index++] = null; } else { a = (string[]) base.EnsureArrayIndex(a, index, typeof(string)); a[index++] = base.Reader.ReadElementString(); } } else { base.UnknownNode(null, ":string"); } } else { base.UnknownNode(null, ":string"); } base.Reader.MoveToContent(); base.CheckReaderCount(ref num4, ref num5); } base.ReadEndElement(); } o.Units = (string[]) base.ShrinkArray(a, index, typeof(string), false); } } else if ((!flagArray[3] && (base.Reader.LocalName == this.id301_Flags)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.Flags = this.Read59_ContentFlag(base.Reader.ReadElementString()); flagArray[3] = true; } else { base.UnknownNode(o, ":FieldName, :FieldType, :Units, :Flags"); } } else { base.UnknownNode(o, ":FieldName, :FieldType, :Units, :Flags"); } base.Reader.MoveToContent(); base.CheckReaderCount(ref whileIterations, ref readerCount); } base.ReadEndElement(); return o; }