internal RequestCacheEntry(_WinInetCache.Entry entry, bool isPrivateEntry) { this.m_IsPrivateEntry = isPrivateEntry; this.m_StreamSize = (entry.Info.SizeHigh << 0x20) | entry.Info.SizeLow; this.m_ExpiresUtc = entry.Info.ExpireTime.IsNull ? DateTime.MinValue : DateTime.FromFileTimeUtc(entry.Info.ExpireTime.ToLong()); this.m_HitCount = entry.Info.HitRate; this.m_LastAccessedUtc = entry.Info.LastAccessTime.IsNull ? DateTime.MinValue : DateTime.FromFileTimeUtc(entry.Info.LastAccessTime.ToLong()); this.m_LastModifiedUtc = entry.Info.LastModifiedTime.IsNull ? DateTime.MinValue : DateTime.FromFileTimeUtc(entry.Info.LastModifiedTime.ToLong()); this.m_LastSynchronizedUtc = entry.Info.LastSyncTime.IsNull ? DateTime.MinValue : DateTime.FromFileTimeUtc(entry.Info.LastSyncTime.ToLong()); this.m_MaxStale = TimeSpan.FromSeconds((double) entry.Info.U.ExemptDelta); if (this.m_MaxStale == WinInetCache.s_MaxTimeSpanForInt32) { this.m_MaxStale = TimeSpan.MaxValue; } this.m_UsageCount = entry.Info.UseCount; this.m_IsPartialEntry = (entry.Info.EntryType & _WinInetCache.EntryType.Sparse) != 0; }
// This ctor is for IERequestCache class only that relies on WinInet cache API. internal RequestCacheEntry(_WinInetCache.Entry entry, bool isPrivateEntry) { m_IsPrivateEntry = isPrivateEntry; m_StreamSize = ((long)entry.Info.SizeHigh<<32) | (long)((ulong)entry.Info.SizeLow); m_ExpiresUtc = (entry.Info.ExpireTime.IsNull? DateTime.MinValue: DateTime.FromFileTimeUtc(entry.Info.ExpireTime.ToLong())); m_HitCount = entry.Info.HitRate; m_LastAccessedUtc= (entry.Info.LastAccessTime.IsNull? DateTime.MinValue: DateTime.FromFileTimeUtc(entry.Info.LastAccessTime.ToLong())); m_LastModifiedUtc= (entry.Info.LastModifiedTime.IsNull? DateTime.MinValue: DateTime.FromFileTimeUtc(entry.Info.LastModifiedTime.ToLong())); m_LastSynchronizedUtc= (entry.Info.LastSyncTime.IsNull? DateTime.MinValue: DateTime.FromFileTimeUtc(entry.Info.LastSyncTime.ToLong())); m_MaxStale = TimeSpan.FromSeconds(entry.Info.U.ExemptDelta); if (m_MaxStale == Microsoft.Win32.WinInetCache.s_MaxTimeSpanForInt32) { m_MaxStale = TimeSpan.MaxValue; } m_UsageCount = entry.Info.UseCount; m_IsPartialEntry = (entry.Info.EntryType & _WinInetCache.EntryType.Sparse) != 0; }
internal WriteStream(_WinInetCache.Entry entry, bool isThrow, long streamSize, bool async) : base(entry.Filename, FileMode.Create, FileAccess.ReadWrite, FileShare.None, 0x1000, async) { this.m_Entry = entry; this.m_IsThrow = isThrow; this.m_StreamSize = streamSize; this.m_OneWriteSucceeded = streamSize == 0L; this.m_ReadTimeout = this.m_WriteTimeout = -1; }
internal ReadStream(_WinInetCache.Entry entry, SafeUnlockUrlCacheEntryFile handle, bool async) : base(entry.Filename, FileMode.Open, FileAccess.Read, ComNetOS.IsWinNt ? (FileShare.Delete | FileShare.Read) : FileShare.Read, 0x1000, async) { this.m_Key = entry.Key; this.m_Handle = handle; this.m_ReadTimeout = this.m_WriteTimeout = -1; }
internal WriteStream(_WinInetCache.Entry entry, bool isThrow, long streamSize, bool async): base(entry.Filename, FileMode.Create, FileAccess.ReadWrite, FileShare.None, 4096, async) { m_Entry = entry; m_IsThrow = isThrow; m_StreamSize = streamSize; m_OneWriteSucceeded = streamSize == 0; //if 0 is expected or the lenght is unknonw we will commit even an emtpy stream. m_ReadTimeout = m_WriteTimeout = System.Threading.Timeout.Infinite; }
internal ReadStream(_WinInetCache.Entry entry, SafeUnlockUrlCacheEntryFile handle, bool async) : base(entry.Filename, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete, 4096, async) { m_Key = entry.Key; m_Handle = handle; m_ReadTimeout = m_WriteTimeout = System.Threading.Timeout.Infinite; }