public IFile GetFile(string name, ActionIfMissing actionIfMissing) { var file = this.files.GetValueOrDefault(name); if (actionIfMissing != ActionIfMissing.ReturnNull) file = file ?? new MemoryFile(this, name, false); return file; }
public ILocation GetLocation(string path, ActionIfMissing actionIfMissing = ActionIfMissing.ThrowException) { if (!Directory.Exists(path) && actionIfMissing != ActionIfMissing.ReturnAsIs) { if (actionIfMissing == ActionIfMissing.CreateNew) { Directory.CreateDirectory(path); } else if (actionIfMissing == ActionIfMissing.ReturnNull) { return null; } else if (actionIfMissing == ActionIfMissing.ThrowException) { throw new FileNotFoundException("Location was not found.", path); } } return new Location(path); }
public IFile GetFile(string name, ActionIfMissing actionIfMissing = ActionIfMissing.ReturnNull) { var path = System.IO.Path.Combine(this.Path, name); if (!System.IO.File.Exists(path) && actionIfMissing != ActionIfMissing.ReturnAsIs) { if (actionIfMissing == ActionIfMissing.CreateNew) { System.IO.File.Create(path).Close(); } else if (actionIfMissing == ActionIfMissing.ReturnNull) { return null; } else if (actionIfMissing == ActionIfMissing.ThrowException) { throw new FileNotFoundException("File was not found.", path); } } return new File(path, this); }
public ILocation GetLocation(string path, ActionIfMissing actionIfMissing) { return new MemoryLocation { Path = path }; }
public IFile GetFile(string path, ActionIfMissing actionIfMissing) { throw new NotImplementedException(); }
public IFile GetFile(string path, ActionIfMissing actionIfMissing = ActionIfMissing.ReturnNull) { return this.GetLocation(Path.GetDirectoryName(path)) .GetFile(Path.GetFileName(path), actionIfMissing); }
public ILocation GetLocation(string name, ActionIfMissing actionIfMissing = ActionIfMissing.ReturnNull) { var path = System.IO.Path.Combine(this.Path, name); return new FileSystem().GetLocation(path, actionIfMissing); }
public ILocation GetLocation(string path, ActionIfMissing actionIfMissing = ActionIfMissing.ReturnNull) { return new MemoryLocation { Path = this.Path + "/" + path }; }