/// <summary> /// Allocates the file attachments /// </summary> /// <param name="fileCount"></param> /// <returns></returns> private IntPtr _AllocAttachments(out int fileCount) { fileCount = 0; if (_files == null) { return(IntPtr.Zero); } if ((_files.Count <= 0) || (_files.Count > 100)) { return(IntPtr.Zero); } Type atype = typeof(MapiFileDescriptor); int asize = Marshal.SizeOf(atype); IntPtr ptra = Marshal.AllocHGlobal(_files.Count * asize); var mfd = new MapiFileDescriptor(); mfd.position = -1; var runptr = ptra; for (int i = 0; i < _files.Count; i++) { var path = _files[i] as string; mfd.name = Path.GetFileName(path); mfd.path = path; Marshal.StructureToPtr(mfd, runptr, false); runptr += asize; } fileCount = _files.Count; return(ptra); }
/// <summary> /// Allocates the file attachments /// </summary> /// <param name="fileCount"></param> /// <returns></returns> private IntPtr allocAttachments(out int fileCount) { fileCount = 0; if (_Files == null) { return(IntPtr.Zero); } if ((_Files.Count <= 0) || (_Files.Count > 100)) { return(IntPtr.Zero); } var atype = typeof(MapiFileDescriptor); var asize = Marshal.SizeOf(atype); var ptra = Marshal.AllocHGlobal(_Files.Count * asize); var mfd = new MapiFileDescriptor { position = -1 }; var runptr = (int)ptra; foreach (var path in _Files) { mfd.name = Path.GetFileName(path); mfd.path = path; Marshal.StructureToPtr(mfd, (IntPtr)runptr, false); runptr += asize; } fileCount = _Files.Count; return(ptra); }
/// <summary> /// Allocates the file attachments /// </summary> /// <param name="fileCount"></param> /// <returns></returns> private IntPtr _AllocAttachments(out int fileCount) { fileCount = 0; if (_files == null) { return(IntPtr.Zero); } if ((_files.Count <= 0) || (_files.Count > 5)) { return(IntPtr.Zero); } Type atype = typeof(MapiFileDescriptor); int asize = Marshal.SizeOf(atype); IntPtr ptra = Marshal.AllocHGlobal(_files.Count * asize); MapiFileDescriptor mfd = new MapiFileDescriptor(); int runptr = (int)ptra; foreach (object t in _files) { string path = t as string; Path.GetFileName(path); Marshal.StructureToPtr(mfd, (IntPtr)runptr, false); runptr += asize; } fileCount = _files.Count; return(ptra); }
/// <summary> /// Allocates the file attachments /// </summary> /// <param name="fileCount"></param> /// <returns></returns> private IntPtr _AllocAttachments(out int fileCount) { fileCount = 0; if (_files == null) { return IntPtr.Zero; } if ((_files.Count <= 0) || (_files.Count > 100)) { return IntPtr.Zero; } Type atype = typeof(MapiFileDescriptor); int asize = Marshal.SizeOf(atype); IntPtr ptra = Marshal.AllocHGlobal(_files.Count * asize); MapiFileDescriptor mfd = new MapiFileDescriptor(); mfd.position = -1; int runptr = (int)ptra; for (int i = 0; i < _files.Count; i++) { string path = _files[i] as string; mfd.name = Path.GetFileName(path); mfd.path = path; Marshal.StructureToPtr(mfd, (IntPtr)runptr, false); runptr += asize; } fileCount = _files.Count; return ptra; }
private IntPtr _AllocAttachments(out int fileCount) { fileCount = 0; if (this._files == null) { return IntPtr.Zero; } if ((this._files.Count <= 0) || (this._files.Count > 100)) { return IntPtr.Zero; } Type t = typeof(MapiFileDescriptor); int num = Marshal.SizeOf(t); IntPtr ptr = Marshal.AllocHGlobal((int) (this._files.Count * num)); MapiFileDescriptor structure = new MapiFileDescriptor { position = -1 }; int num2 = (int) ptr; for (int i = 0; i < this._files.Count; i++) { string path = this._files[i] as string; structure.name = Path.GetFileName(path); structure.path = path; Marshal.StructureToPtr(structure, (IntPtr) num2, false); num2 += num; } fileCount = this._files.Count; return ptr; }
/// <summary> /// Allocates the file attachments /// </summary> /// <param name="fileCount"></param> /// <returns></returns> private IntPtr _AllocAttachments(out int fileCount) { fileCount = 0; if (_files == null) { return IntPtr.Zero; } if ((_files.Count <= 0) || (_files.Count > 5)) { return IntPtr.Zero; } Type atype = typeof(MapiFileDescriptor); int asize = Marshal.SizeOf(atype); IntPtr ptra = Marshal.AllocHGlobal(_files.Count * asize); MapiFileDescriptor mfd = new MapiFileDescriptor(); int runptr = (int)ptra; foreach (object t in _files) { string path = t as string; Path.GetFileName(path); Marshal.StructureToPtr(mfd, (IntPtr)runptr, false); runptr += asize; } fileCount = _files.Count; return ptra; }