Exemple #1
0
        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]);
        }
Exemple #2
0
 public MemoryFileContent(MemoryFile file)
 {
     MemoryFile = file;
 }
Exemple #3
0
 internal void AddFile(MemoryFile f)
 {
     MemoryFilesMap[f.Name] = f;
 }