IEnumFORMATETC IDataObject.EnumFormatEtc(DATADIR direction) { if (direction == DATADIR.DATADIR_GET) { if (0 == _dataObjects.Count) { // Note: SHCreateStdEnumFmtEtc fails for a count of 0; throw helpful exception throw new InvalidOperationException( "VirtualFileDataObject requires at least one data object to enumerate."); } // Create enumerator and return it IEnumFORMATETC enumerator; List <FORMATETC> l = new List <FORMATETC>(); foreach (DataObject o in _dataObjects) { l.Add(o.FORMATETC); } if ( NativeMethods.SUCCEEDED(NativeMethods.SHCreateStdEnumFmtEtc((uint)(_dataObjects.Count), l.ToArray(), out enumerator))) { return(enumerator); } // Returning null here can cause an AV in the caller; throw instead Marshal.ThrowExceptionForHR(NativeMethods.E_FAIL); } throw new NotImplementedException(); }
IEnumFORMATETC IComDataObject.EnumFormatEtc(DATADIR direction) { if (direction == DATADIR.DATADIR_GET) { return(new FormatEnumrator(this)); } throw HRESULT.E_NOTIMPL.GetException(); }
/// <summary> /// Creates an object for enumerating the <see cref="T:System.Runtime.InteropServices.ComTypes.FORMATETC"/> /// structures for a data object. These structures are used in calls to GetData() or SetData().</summary> /// <returns>This method supports the standard return values E_INVALIDARG and E_OUTOFMEMORY, as well as the following: /// S_OK -- The enumerator object was successfully created. /// E_NOTIMPL -- The direction specified by the <paramref name="direction"/> parameter is not supported. /// OLE_S_USEREG -- Requests that OLE enumerate the formats from the registry.</returns> /// <param name="direction">Specifies the direction of the data.</param> public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { if (direction == DATADIR.DATADIR_GET) { var list = m_oleStorage.Select(data => data.Format).ToArray(); return(new FormatEnumerator(list)); } throw new NotImplementedException("OLE_S_USEREG"); }
public EnumFORMATETC(DATADIR dir, IEnumerable cache) { if (cache == null) throw new ArgumentNullException("cache"); this.cache = cache; this.dir = dir; e = cache.GetEnumerator(); }
IEnumFORMATETC IDataObject.EnumFormatEtc(DATADIR direction) { if (direction == DATADIR.DATADIR_GET) { return(new FormatEnumerator(this)); } throw new ExternalException(direction.ToString(), Consts.E_NOTIMPL); }
public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { // We only support GET. if (DATADIR.DATADIR_GET == direction) { return(new EnumFORMATETC(storage)); } throw new NotImplementedException("DataObject: only \"get\" data direction supported in EnumFormatEtc"); }
/// <summary> /// Gets an enumerator for the formats contained in this DataObject. /// </summary> /// <param name="direction">The direction of the data.</param> /// <returns>An instance of the IEnumFORMATETC interface.</returns> public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { // We only support GET if (DATADIR.DATADIR_GET == direction) { return(new EnumFORMATETC(storage)); } throw new NotImplementedException("OLE_S_USEREG"); }
public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { if (DATADIR.DATADIR_GET == direction) { return((IEnumFORMATETC) new Advent.Common.Interop.DataObject.EnumFORMATETC(this.storage)); } else { throw new NotImplementedException("OLE_S_USEREG"); } }
public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { int a = SHCreateStdEnumFmtEtc((uint)supportedFormats.Count, supportedFormats.ToArray(), out IEnumFORMATETC enumer); if (a != 0) { throw new Win32Exception(); } return(enumer); }
public EnumFORMATETC(DATADIR dir, IEnumerable cache) { if (cache == null) { throw new ArgumentNullException("cache"); } this.cache = cache; this.dir = dir; e = cache.GetEnumerator(); }
IEnumFORMATETC IOleDataObject.EnumFormatEtc(DATADIR direction) { if (_wrapped is IOleDataObject ole) { return(ole.EnumFormatEtc(direction)); } if (direction == DATADIR.DATADIR_GET) { return(new FormatEnumerator(_wrapped)); } throw new NotSupportedException(); }
IEnumFORMATETC IComDataObject.EnumFormatEtc(DATADIR dwDirection) { Debug.WriteLineIf(CompModSwitches.DataObject.TraceVerbose, "EnumFormatEtc: " + dwDirection.ToString()); if (innerData is OleConverter innerDataOleConverter) { return(innerDataOleConverter.OleDataObject.EnumFormatEtc(dwDirection)); } if (dwDirection == DATADIR.DATADIR_GET) { return(new FormatEnumerator(this)); } throw new ExternalException(SR.ExternalException, (int)HRESULT.E_NOTIMPL); }
/// <summary> /// Creates and returns a pointer to an object to enumerate the FORMATETC /// supported by the data object /// </summary> /// <param name="dwDirection">Direction of the data through a value from /// the enumeration DATADIR</param> /// <param name="ppEnumFormatEtc">Address of IEnumFORMATETC* pointer variable /// that receives the interface pointer to the new enumerator object</param> public int EnumFormatEtc(DATADIR dwDirection, out IEnumFORMATETC ppEnumFormatEtc) { // don't support enumeration of set formats if (dwDirection == DATADIR.SET) { ppEnumFormatEtc = null; return(HRESULT.E_NOTIMPL); } // return a new enumerator for our data entries IEnumFORMATETC enumerator = new EnumFORMATETC(oleDataEntries); enumerators.Add(enumerator); ppEnumFormatEtc = enumerator; return(HRESULT.S_OK); }
public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { Console.WriteLine("EnumFormatEtc"); FORMATETC fmt = new FORMATETC(); fmt.tymed = TYMED.TYMED_ISTORAGE; fmt.cfFormat = 1; fmt.dwAspect = DVASPECT.DVASPECT_CONTENT; fmt.lindex = -1; FORMATETC[] fmts = new FORMATETC[] { fmt }; IEnumFORMATETC e; int hr = SHCreateStdEnumFmtEtc(1, fmts, out e); if (hr != 0) { Marshal.ThrowExceptionForHR(hr); } return(e); }
public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { ComDebug.ReportInfo("{0}.IDataObject.EnumFormatEtc", GetType().Name); try { // We only support GET if (DATADIR.DATADIR_GET == direction) { return(new EnumFormatEtc(new List <FORMATETC>(Renderings.Select(x => x.format)))); } } catch (Exception e) { ComDebug.ReportError("{0}.IDataObject.EnumFormatEtc exception: {1}", GetType().Name, e); throw; } throw new NotImplementedException("Can not use registry here because a return value is not supported"); }
private static HRESULT EnumFormatEtc(IntPtr thisPtr, DATADIR direction, IntPtr *pEnumFormatC) { var instance = ComInterfaceDispatch.GetInstance <IDataObject>((ComInterfaceDispatch *)thisPtr); try { var formatEtc = instance.EnumFormatEtc(direction); var result = WinFormsComWrappers.Instance.TryGetComPointer(formatEtc, IID.IEnumFORMATETC, out var formatEtcPtr); if (result.Failed()) { return(result); } *pEnumFormatC = formatEtcPtr; return(HRESULT.S_OK); } catch (Exception ex) { Debug.WriteLine(ex); return((HRESULT)ex.HResult); } }
/// <summary> /// Gets an enumerator for the formats contained in this DataObject. /// </summary> /// <param name="direction">The direction of the data.</param> /// <returns>An instance of the IEnumFORMATETC interface.</returns> public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { // We only support GET if (DATADIR.DATADIR_GET == direction) return new EnumFORMATETC(storage); throw new NotImplementedException("OLE_S_USEREG"); }
/// <summary> /// The IntPtr is data allocated that should be removed. It is allocated by the ProcessSelectionData method. /// </summary> public DataCacheEntry(FORMATETC fmt, SafeGlobalAllocHandle data, DATADIR dir) { this.format = fmt; this.data = data; this.dataDir = dir; }
public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { // We only support GET. if (DATADIR.DATADIR_GET == direction) return new EnumFORMATETC(storage); throw new NotImplementedException("DataObject: only \"get\" data direction supported in EnumFormatEtc"); }
IEnumFORMATETC System.Runtime.InteropServices.ComTypes.IDataObject.EnumFormatEtc(DATADIR dwDirection) { throw null; }
/// <summary> /// The IntPtr is data allocated that should be removed. It is allocated by the ProcessSelectionData method. /// </summary> /*internal, but public for FSharp.Project.dll*/ public DataCacheEntry(FORMATETC fmt, IntPtr data, DATADIR dir) { this.format = fmt; this.data = (long)data; this.dataDir = dir; }
public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { return(CreateFormatEnumerator(formatetc.Length, formatetc)); }
IEnumFORMATETC System.Runtime.InteropServices.ComTypes.IDataObject.EnumFormatEtc(DATADIR direction) { if (direction == DATADIR.DATADIR_GET) { if (0 == _dataObjects.Count) { // Note: SHCreateStdEnumFmtEtc fails for a count of 0; throw helpful exception throw new InvalidOperationException("VirtualFileDataObject requires at least one data object to enumerate."); } // Create enumerator and return it IEnumFORMATETC enumerator; if (NativeMethods.SUCCEEDED(NativeMethods.SHCreateStdEnumFmtEtc((uint)(_dataObjects.Count), _dataObjects.Select(d => d.FORMATETC).ToArray(), out enumerator))) { return(enumerator); } // Returning null here can cause an AV in the caller; throw instead Marshal.ThrowExceptionForHR(NativeMethods.E_FAIL); } throw new NotImplementedException(); }
public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { throw new NotImplementedException(); }
public EnumFORMATETC(DATADIR dir, IEnumerable cache) { this.cache = cache; this.dir = dir; e = cache.GetEnumerator(); }
public Class940(DATADIR A_0, Struct33 A_1, Struct34 A_2) { this.struct33_0 = A_1; this.struct34_0 = A_2; this.datadir_0 = A_0; }
public DataCacheEntry(FORMATETC fmt, IntPtr data, DATADIR dir) { this.format = fmt; this.data = data; this.dataDir = dir; }
public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { ComDebug.ReportInfo("{0}.IDataObject.EnumFormatEtc", this.GetType().Name); try { // We only support GET if (DATADIR.DATADIR_GET == direction) return new EnumFormatEtc(new List<FORMATETC>(Renderings.Select(x => x.format))); } catch (Exception e) { ComDebug.ReportError("{0}.IDataObject.EnumFormatEtc exception: {1}", this.GetType().Name, e); throw; } throw new NotImplementedException("Can not use registry here because a return value is not supported"); }
public int EnumFormatEtc(DATADIR direction, out IEnumFORMATETC ppenumFormatEtc) { IEnumFORMATETC origEnum = null; try { log.DebugFormat("IDataObject.EnumFormatEtc called -- direction {0}", direction); switch (direction) { case DATADIR.DATADIR_GET: //Get original enumerator int result = innerData.EnumFormatEtc(direction, out origEnum); if (result != NativeMethods.S_OK) { ppenumFormatEtc = null; return(result); } //Enumerate original formats List <FORMATETC> formats = new List <FORMATETC>(); FORMATETC[] buffer = new FORMATETC[] { new FORMATETC() }; while (origEnum.Next(1, buffer, null) == NativeMethods.S_OK) { //Convert format from short to unsigned short ushort cfFormat = (ushort)buffer[0].cfFormat; //Do not return text formats -- some applications try to get text before files if (cfFormat != NativeMethods.CF_TEXT && cfFormat != NativeMethods.CF_UNICODETEXT && cfFormat != (ushort)DataObjectHelper.GetClipboardFormat("Csv")) { formats.Add(buffer[0]); } } //Add CF_HDROP format FORMATETC format = new FORMATETC(); format.cfFormat = NativeMethods.CF_HDROP; format.dwAspect = DVASPECT.DVASPECT_CONTENT; format.lindex = -1; format.ptd = IntPtr.Zero; format.tymed = TYMED.TYMED_HGLOBAL; formats.Add(format); //Return new enumerator for available formats ppenumFormatEtc = new FormatEtcEnumerator(formats.ToArray()); return(NativeMethods.S_OK); case DATADIR.DATADIR_SET: //Return original enumerator return(innerData.EnumFormatEtc(direction, out ppenumFormatEtc)); default: //Invalid direction ppenumFormatEtc = null; return(NativeMethods.E_INVALIDARG); } } catch (Exception ex) { log.Error("Exception in IDataObject.EnumFormatEtc", ex); ppenumFormatEtc = null; return(NativeMethods.E_UNEXPECTED); } finally { //Release all unmanaged objects if (origEnum != null) { Marshal.ReleaseComObject(origEnum); } } }
IEnumFORMATETC IComDataObject.EnumFormatEtc(DATADIR dwDirection) { Debug.WriteLineIf(CompModSwitches.DataObject.TraceVerbose, "EnumFormatEtc: " + dwDirection.ToString()); if (innerData is OleConverter) { return ((OleConverter)innerData).OleDataObject.EnumFormatEtc(dwDirection); } if (dwDirection == DATADIR.DATADIR_GET) { return new FormatEnumerator(this); } else { throw new ExternalException(SR.GetString(SR.ExternalException), NativeMethods.E_NOTIMPL); } }
public DataCacheEntry(FORMATETC fmt, IntPtr data, DATADIR dir) { this.format = fmt; this.data = (long)data; this.dataDir = dir; }
private IEnumFORMATETC EnumFormatEtcInner(DATADIR dwDirection) { IEnumFORMATETC enumFORMATETC; new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert(); // BlessedAssert try { enumFORMATETC = _innerData.EnumFormatEtc(dwDirection); } finally { SecurityPermission.RevertAssert(); } return enumFORMATETC; }
IEnumFORMATETC System.Runtime.InteropServices.ComTypes.IDataObject.EnumFormatEtc(DATADIR direction) { var innerEnumerator = _innerComDataObject.EnumFormatEtc(direction); if (direction != DATADIR.DATADIR_GET) { return(innerEnumerator); } var formats = new List <FORMATETC>(5 + _fileContents.Count); var tmp = new FORMATETC[5]; var fetched = new int[2]; int result; do { result = innerEnumerator.Next(5, tmp, fetched); for (var i = 0; i < fetched[0]; ++i) { formats.Add(tmp[i]); } } while (result == 0); formats.AddRange(_fileContents.Select(c => c.Format)); return(new FormatEnumerator(formats)); }
IEnumFORMATETC IComDataObject.EnumFormatEtc(DATADIR dwDirection) { if (_innerData is OleConverter) { return ((OleConverter)_innerData).OleDataObject.EnumFormatEtc(dwDirection); } if (dwDirection == DATADIR.DATADIR_GET) { return new FormatEnumerator(this); } else { throw new ExternalException(SR.Get(SRID.DataObject_NotImplementedEnumFormatEtc, dwDirection), NativeMethods.E_NOTIMPL); } }
/// <summary> /// Creates an object for enumerating the <see cref="T:System.Runtime.InteropServices.ComTypes.FORMATETC"/> /// structures for a data object. These structures are used in calls to GetData() or SetData().</summary> /// <returns>This method supports the standard return values E_INVALIDARG and E_OUTOFMEMORY, as well as the following: /// S_OK -- The enumerator object was successfully created. /// E_NOTIMPL -- The direction specified by the <paramref name="direction"/> parameter is not supported. /// OLE_S_USEREG -- Requests that OLE enumerate the formats from the registry.</returns> /// <param name="direction">Specifies the direction of the data.</param> public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { if (direction == DATADIR.DATADIR_GET) { var list = m_oleStorage.Select(data => data.Format).ToArray(); return new FormatEnumerator(list); } throw new NotImplementedException("OLE_S_USEREG"); }
/// <summary> /// The IntPtr is data allocated that should be removed. It is allocated by the ProcessSelectionData method. /// </summary> internal DataCacheEntry(FORMATETC fmt, IntPtr data, DATADIR dir) { this.Format = fmt; this.Data = (long)data; this.DataDir = dir; }
IEnumFORMATETC IDataObject.EnumFormatEtc(DATADIR direction) { if (direction == DATADIR.DATADIR_GET) { if (0 == _dataObjects.Count) { // Note: SHCreateStdEnumFmtEtc fails for a count of 0; throw helpful exception throw new InvalidOperationException("VirtualFileDataObject requires at least one data object to enumerate."); } // Create enumerator and return it IEnumFORMATETC enumerator; if ( NativeMethods.Succeeded(NativeMethods.SHCreateStdEnumFmtEtc((uint)(_dataObjects.Count), _dataObjects.Select(d => d.FORMATETC).ToArray(), out enumerator))) { return enumerator; } // Returning null here can cause an AV in the caller; throw instead Marshal.ThrowExceptionForHR(NativeMethods.E_FAIL); } throw new NotImplementedException(); }
public IEnumFORMATETC EnumFormatEtc(DATADIR direction) { if (DATADIR.DATADIR_GET == direction) return (IEnumFORMATETC)new Advent.Common.Interop.DataObject.EnumFORMATETC(this.storage); else throw new NotImplementedException("OLE_S_USEREG"); }
/// <summary> /// The IntPtr is data allocated that should be removed. It is allocated by the ProcessSelectionData method. /// </summary> internal DataCacheEntry(FORMATETC fmt, IntPtr data, DATADIR dir) { this.format = fmt; this.data = (long)data; this.dataDir = dir; }
/// <summary> /// Creates and returns a pointer to an object to enumerate the FORMATETC /// supported by the data object /// </summary> /// <param name="dwDirection">Direction of the data through a value from /// the enumeration DATADIR</param> /// <param name="ppEnumFormatEtc">Address of IEnumFORMATETC* pointer variable /// that receives the interface pointer to the new enumerator object</param> public int EnumFormatEtc(DATADIR dwDirection, out IEnumFORMATETC ppEnumFormatEtc) { // don't support enumeration of set formats if (dwDirection == DATADIR.SET) { ppEnumFormatEtc = null; return HRESULT.E_NOTIMPL; } // return a new enumerator for our data entries IEnumFORMATETC enumerator = new EnumFORMATETC(oleDataEntries); enumerators.Add(enumerator); ppEnumFormatEtc = enumerator; return HRESULT.S_OK; }