/// <summary> /// Determines whether the specified <see cref="System.Object" />, is equal to this instance. /// </summary> /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param> /// <returns> /// <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>. /// </returns> public override bool Equals(object obj) { CachedFile meta = obj as CachedFile; if (meta == null) { return(false); } return(meta.ContentHash.Equals(ContentHash) && meta.FullName.Equals(FullName)); }
/// <summary> /// Loads the specified file. /// </summary> /// <param name="file">The file.</param> public virtual void Load(FileInfo file) { string fullName = file.FullName; CachedFile cachedFile = new CachedFile(file); if (_cachedFiles.TryAdd(fullName, cachedFile)) { _hashes[fullName] = cachedFile.ContentHash; } }
public virtual void Load(FileInfo file) { string fullName = file.FullName; CachedFile cachedFile = new CachedFile(file); if (_cachedFiles.TryAdd(fullName, cachedFile)) { lock (_lock) { string text = _cachedFiles[fullName].GetText(); byte[] bytes = _cachedFiles[fullName].GetBytes(); byte[] zippedBytes = _cachedFiles[fullName].GetZippedBytes(); byte[] zippedText = _cachedFiles[fullName].GetZippedText(); _textCache.TryAdd(fullName, text); _byteCache.TryAdd(fullName, bytes); _zippedByteCache.TryAdd(fullName, zippedBytes); _zippedTextCache.TryAdd(fullName, zippedText); } } }