public MemFSDir(string name, MemFSDir parent) { m_name = name; m_dirs = new List <MemFSDir>(); m_files = new List <MemFSFile>(); m_parent = parent; }
public MemFSDir(string path, MemFSDir parent) { _path = path; _parent = parent; _directories = new List <Dir422>(); _files = new List <File422>(); }
public MemFSDir(string newName, MemFSDir newParent) { name = newName; dirs = new List <MemFSDir>(); files = new List <MemFSFile>(); parent = newParent; }
static void Main(string[] args) { MemoryFileSystem mfs = new MemoryFileSystem(); MemFSDir root = (MemFSDir)mfs.GetRoot(); MemFSFile testing = (MemFSFile)root.CreateFile("test.txt"); MemoryStream stream = (MemoryStream)testing.OpenReadWrite(); string test = "This is a test string!"; byte[] buf = Encoding.ASCII.GetBytes(test); stream.Write(buf, 0, buf.Length); stream.Close(); MemoryStream stream2 = (MemoryStream)testing.OpenReadOnly(); int numBytes = stream2.Read(buf, 0, buf.Length); string test2 = Encoding.ASCII.GetString(buf); MemFSDir test1 = (MemFSDir)root.CreateDir("test1"); MemFSDir subTest1 = (MemFSDir)test1.CreateDir("subTest1"); MemFSFile file = (MemFSFile)subTest1.CreateFile("test.txt"); test1.CreateDir("subTest2"); root.CreateDir("test2"); root.CreateDir("test3"); }
public override Dir422 CreateDir(string name) { MemFSDir dir = new MemFSDir(name, this); dirs.Add(dir); return(dir); }
public MemFSDir(string name, MemFSDir parentD) //this is the constructor for this class { this.name = name; dirParent = parentD; directoryChildren = new List <Dir422>(); fileChildren = new List <File422>(); }
public MemFSFile(string newName, MemFSDir newParent) { name = newName; parent = newParent; stream = new MemoryStream(); reads = new List <MemoryStream>(); write = false; }
public MemFSFile(string name, MemFSDir parent) { this.fileName = name; parentDir = parent; readers = new List <trackingMemStream>(); writer = new List <trackingMemStream>(); data = new MemoryStream(); }
public MemFSDir(string name, MemFSDir parent) { _parent = parent; _name = name; Directories = new List <MemFSDir>(); Files = new List <MemFSFile>(); }
public MemFSFile(string name, MemFSDir parent) { m_name = name; m_parent = parent; m_stream = new MemoryStream(); openReads = new List <MemoryStream>(); write = false; }
// Regular ctor private MemFSDir(string name, MemFSDir _parent) { Name = name; Parent = _parent; directories = new List <MemFSDir> (); files = new List <MemFSFile> (); }
public override Dir422 CreateDir(string name) { Dir422 dir = GetDir(name); if (dir == null) { dir = new MemFSDir(name, this); _dirs.Add(dir); } return(dir); }
public override Dir422 CreateDir(string name) { MemFSDir newDir = new MemFSDir(name, this); if (_directoryList == null) { _directoryList = new List <Dir422>(); } _directoryList.Add(newDir); return(newDir); }
public override Dir422 CreateDir(string name) { if (!ValidateName(name)) { return(null); } Dir422 newDir = new MemFSDir(this, name); dirs.Add(newDir); return(newDir); }
public override Dir422 CreateDir(string dirName) { if (dirName.Contains("\\") || dirName.Contains("/") || dirName == string.Empty || dirName == null) { return(null); } MemFSDir dir = new MemFSDir(dirName, this); m_dirs.Add(dir); return(dir); }
public override Dir422 CreateDir(string dirName) { if (string.IsNullOrEmpty(dirName) || !Utilities.isValidFileName(dirName)) { return(null); } var toAdd = new MemFSDir(dirName, this); m_directories.Add(toAdd); return(toAdd); }
public override Dir422 CreateDir(string fileName) { Dir422 memDir = null; if (!StdFSHelper.ContainsPathCharacters(fileName) || string.IsNullOrEmpty(fileName)) { //check if already exists if ((memDir = GetDir(fileName)) == null) { memDir = new MemFSDir(fileName, this); _childDirs.Add(memDir); } } return(memDir); }
public override Dir422 CreateDir(string dirName) { if (dirName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) { return(null); } foreach (var d in _directories) { if (d.Name == dirName) { return(d); } } MemFSDir temp = new MemFSDir(Path.Combine(_path, dirName), this); _directories.Add(temp); return(temp); }
public override Dir422 CreateDir(string name) { bool contains = false; foreach (MemFSDir d in Directories) { if (d.Name == name) { contains = true; } } if (contains) { return(null); } MemFSDir newDir = new MemFSDir(name, this); Directories.Add(newDir); return(newDir); }
// Create new directory in this directory public override Dir422 CreateDir(string dirName) { if (Utility.PathCharPresent(dirName)) { return(null); } IList <Dir422> dirs = this.GetDirs(); foreach (var dir in dirs) { if (dir.Name == dirName) { return(dir); } } Dir422 new_dir = new MemFSDir(dirName, this); this.directories.Add((MemFSDir)new_dir); return(new_dir); }
public MemFSFile(string path, MemFSDir parent) { _path = path; _parent = parent; _content = new MemoryStream(); }
public MemoryFileSystem() { //Create new and empty file system _root = new MemFSDir("root", null); }
public MemFSFile(string name, MemFSDir parent) { _name = name; _parent = parent; }
public MemFSFile(string name, MemFSDir parent) { _name = name; _parent = parent; _data = new byte[256]; }
public MemoryFileSystem() { _root = new MemFSDir("/", null); }
//StdFSFile ctor public MemFSFile(string name, MemFSDir _parent) { Name = name; Parent = _parent; }