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);
 }
 public virtual void Dispose()
 {
     if (this.LibHandle != null)
     {
         IntPtr procAddress = Windows.GetProcAddress(this.LibHandle, "ContentPluginUnloading");
         if (procAddress != IntPtr.Zero)
         {
             ContentPluginUnloadingHandler delegateForFunctionPointer = (ContentPluginUnloadingHandler) Marshal.GetDelegateForFunctionPointer(procAddress, typeof(ContentPluginUnloadingHandler));
             delegateForFunctionPointer();
         }
         this.ContentGetDetectString = null;
         this.ContentGetSupportedField = null;
         this.ContentGetValue = null;
         this.ContentGetValueW = null;
         this.ContentGetSupportedFieldFlags = null;
         this.ContentSetValue = null;
         this.ContentSetValueW = null;
         this.ContentStopGetValue = null;
         this.LibHandle.Close();
         this.LibHandle = null;
         this.UpdateMap = null;
     }
 }