protected virtual void Dispose(bool disposing, CloseExState closeState) {
if (Interlocked.Increment(ref _Disposed) == 1) {
ICloseEx icloseEx = m_ParentStream as ICloseEx;
if (icloseEx != null) {
icloseEx.CloseEx(closeState);
}
else {
m_ParentStream.Close();
}
if (m_CacheDestroy)
{
if (m_IsStrictCacheErrors)
{
m_Cache.Remove(m_Key);
}
else
{
m_Cache.TryRemove(m_Key);
}
}
else
{
if (m_IsStrictCacheErrors)
{
m_Cache.Update(m_Key, m_Expires, m_LastModified, m_LastSynchronized, m_MaxStale, m_EntryMetadata, m_SystemMetadata);
}
else
{
m_Cache.TryUpdate(m_Key, m_Expires, m_LastModified, m_LastSynchronized, m_MaxStale, m_EntryMetadata, m_SystemMetadata);
}
}
if (!disposing) {
m_Cache = null;
m_Key = null;
m_EntryMetadata = null;
m_SystemMetadata = null;
}
}
base.Dispose(disposing);
}
}