unsafe public int Stat(XPBurn.COM.STATSTG *statstg, uint grfStatFlag) { if (statstg != null) { if (grfStatFlag != CONSTS.STATFLAG_NONAME) { string tempString = Marshal.PtrToStringUni(new IntPtr(fStatstg.pwcsName)); statstg->pwcsName = (char *)Marshal.StringToCoTaskMemUni(tempString); } else { statstg->pwcsName = null; } statstg->type = fStatstg.type; statstg->cbSize = fStatstg.cbSize; statstg->mtime = fStatstg.mtime; statstg->ctime = fStatstg.ctime; statstg->atime = fStatstg.atime; statstg->grfMode = fStatstg.grfMode; statstg->grfLocksSupported = fStatstg.grfLocksSupported; statstg->clsid = fStatstg.clsid; statstg->grfStateBits = fStatstg.grfStateBits; statstg->reserved = fStatstg.reserved; return(CONSTS.S_OK); } else { return(CONSTS.STG_E_INVALIDPOINTER); } }
unsafe public int Stat(XPBurn.COM.STATSTG *statstg, uint grfStatFlag) { if (statstg != null) { if ((grfStatFlag == CONSTS.STATFLAG_DEFAULT) || (grfStatFlag == CONSTS.STATFLAG_NONAME)) { try { for (int index = 0; index < sizeof(XPBurn.COM.STATSTG); index++) { ((byte *)statstg)[index] = 0; } statstg->type = CONSTS.STGTY_STREAM; statstg->cbSize = (ulong)fFileStream.Length; long mtime = File.GetLastWriteTime(fFilename).ToFileTime(); statstg->mtime.dwHighDateTime = (uint)(mtime >> 32); statstg->mtime.dwLowDateTime = (uint)(mtime & ((long)0x00000000FFFFFFFF)); long ctime = File.GetCreationTime(fFilename).ToFileTime(); statstg->ctime.dwHighDateTime = (uint)(ctime >> 32); statstg->ctime.dwLowDateTime = (uint)(ctime & ((long)0x00000000FFFFFFFF)); long atime = File.GetLastAccessTime(fFilename).ToFileTime(); statstg->atime.dwHighDateTime = (uint)(atime >> 32); statstg->atime.dwLowDateTime = (uint)(atime & ((long)0x00000000FFFFFFFF)); if (grfStatFlag != CONSTS.STATFLAG_NONAME) { statstg->pwcsName = (char *)Marshal.StringToCoTaskMemUni(fStreamName); } return(CONSTS.S_OK); } catch (Exception) { return(CONSTS.E_UNEXPECTED); } } else { return(CONSTS.STG_E_INVALIDFLAG); } } else { return(CONSTS.STG_E_INVALIDPOINTER); } }
unsafe public int Next(uint celt, XPBurn.COM.STATSTG *elt, uint *pceltFetched) { int returned; if (celt > 1) { return(CONSTS.S_FALSE); } returned = 0; if (fStreamEnumerator == null) { fStreamEnumerator = fStorage.fStreams.Values.GetEnumerator(); } if (fStorageEnumerator == null) { fStorageEnumerator = fStorage.fSubStorages.Values.GetEnumerator(); } while ((returned < celt) && (fStreamEnumerator.MoveNext())) { ((XPBurnIStream)fStreamEnumerator.Current).Stat(elt, CONSTS.STATFLAG_DEFAULT); returned++; } while ((returned < celt) && (fStorageEnumerator.MoveNext())) { ((XPBurnIStorage)fStorageEnumerator.Current).Stat(elt, CONSTS.STATFLAG_DEFAULT); returned++; } if (pceltFetched != null) { *pceltFetched = (uint)returned; } if (returned == celt) { return(CONSTS.S_OK); } else { return(CONSTS.S_FALSE); } }