unsafe protected string GetMapiStringValue(mapi.EntryTypes MapiAttribute, int index) { string res = null; IntPtr ErrorMessage = new IntPtr(); UIntPtr StringSize = new UIntPtr(); int r = libpff.GetStringEntrySize(_ItemHandler, index, (UInt32)MapiAttribute, out StringSize, 0, out ErrorMessage); if (r == -1) { throw new PFFRecipientsDataError("Error reading MAPI string size: " + libpff.GetErrorsFromIntPtr(ErrorMessage)[0]); } int size = (int)StringSize.ToUInt32(); if (size > 0) { byte[] buffer = new byte[size]; fixed(byte *p = buffer) { IntPtr StringValue = (IntPtr)p; r = libpff.GetStringEntry(_ItemHandler, index, (UInt32)MapiAttribute, StringValue, StringSize, 0, out ErrorMessage); if (r == -1) { throw new PFFItemDataError("Error reading MAPI string value: " + libpff.GetErrorsFromIntPtr(ErrorMessage)[0]); } res = Encoding.ASCII.GetString(buffer); } res = res.TrimEnd(new char[] { '\0' }); } return(res); }
protected double GetMapiFloatingPointValue(mapi.EntryTypes MapiAttribute, int index) { IntPtr ErrorMessage = new IntPtr(); double value = 0; int r = libpff.GetFloatingPointEntry(_ItemHandler, index, (UInt32)MapiAttribute, out value, 0, out ErrorMessage); if (r == -1) { throw new PFFItemDataError("Error reading MAPI floating point value: " + libpff.GetErrorsFromIntPtr(ErrorMessage)[0]); } return(value); }
protected UInt32 GetMapiIntegerValue(mapi.EntryTypes MapiAttribute, int index) { IntPtr ErrorMessage = new IntPtr(); UInt32 value = 0; int r = libpff.GetIntegerEntry(_ItemHandler, index, (UInt32)MapiAttribute, out value, 0, out ErrorMessage); if (r == -1) { throw new PFFItemDataError("Error reading MAPI integer value: " + libpff.GetErrorsFromIntPtr(ErrorMessage)[0]); } return(value); }
protected bool GetMapiBooleanValue(mapi.EntryTypes MapiAttribute, int index) { IntPtr ErrorMessage = new IntPtr(); uint value = 0; int r = libpff.GetBooleanEntry(_ItemHandler, index, (UInt32)MapiAttribute, out value, 0, out ErrorMessage); if (r == -1) { throw new PFFItemDataError("Error reading MAPI boolean value: " + libpff.GetErrorsFromIntPtr(ErrorMessage)[0]); } return(value == 1); }