public IFileObject ResolveFile(string name) { if (name.Length > 0) { if (name.Contains("..")) { var fakeRootPath = "f:\\"; var fakeAbsolutePath = Path.GetFullPath(Path.Combine(fakeRootPath, name)); name = fakeAbsolutePath.Substring(Path.GetPathRoot(fakeAbsolutePath).Length); } // use only one symbol as directory separator name = name.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); // normalize file name name = Path.Combine(Path.GetDirectoryName(name), Path.GetFileName(name)); } if (!MemoryFilesMap.ContainsKey(name)) { var newFile = new MemoryFile(name, name.Length > 0 ? FileType.Imaginary : FileType.Folder, this); } return(MemoryFilesMap[name]); }
public MemoryFileContent(MemoryFile file) { MemoryFile = file; }
internal void AddFile(MemoryFile f) { MemoryFilesMap[f.Name] = f; }