private void CopyFromFile(InMemoryFile fileToCopy) { _exists = true; _LastModifiedTimeUtc = fileToCopy.GetLastModifiedTimeUtc(); lock (fileToCopy._contentLock) { var newContent = new byte[fileToCopy._content.Length]; Buffer.BlockCopy(fileToCopy._content, 0, newContent, 0, fileToCopy._content.Length); _content = newContent; _contentLength = fileToCopy._contentLength; } }
public File GetFile(string fileName) { InMemoryFile file; lock (ChildFiles) { file = ChildFiles.FirstOrDefault(x => x.Name.Equals(fileName, StringComparison.OrdinalIgnoreCase)); if (file == null) { file = new InMemoryFile(Path.Combine(fileName).FullPath) { Parent = this }; ChildFiles.Add(file); } file.FileSystem = FileSystem; } return(file); }
public InMemFileStream(InMemoryFile file, FileAccess fileAccess) { _file = file; _fileAccess = fileAccess; }