示例#1
0
        public LocalFileSystem(Path basePath)
        {
            m_basePath = basePath;

            if (!System.IO.Directory.Exists(m_basePath.ToString()))
                System.IO.Directory.CreateDirectory(m_basePath.ToString());
        }
示例#2
0
        public override bool Exists(Path path)
        {
            if (System.IO.Directory.Exists(ToLocalPath(path)))
                return true;

            return System.IO.File.Exists(ToLocalPath(path));
        }
示例#3
0
 public override void Delete(Path path)
 {
     System.IO.File.Delete(ToLocalPath(path));
 }
示例#4
0
 public override FileSystemStream CreateFile(Path path)
 {
     return new LocalFileSystemStream(System.IO.File.Create(ToLocalPath(path)));
 }
示例#5
0
 public override Directory CreateDirectory(Path path)
 {
     var localPath = ToLocalPath(path);
     System.IO.Directory.CreateDirectory(localPath);
     return new Directory(this, path);
 }
示例#6
0
 private string ToLocalPath(Path path)
 {
     return (Path.Combine(m_basePath, path)).ToString();
 }
示例#7
0
 public abstract FileInfo GetFileInfo(Path path);
示例#8
0
 public override bool Exists(Path path)
 {
     return System.IO.File.Exists(ToLocalPath(path));
 }
示例#9
0
 public abstract void Delete(Path path);
示例#10
0
 public abstract bool Exists(Path path);
示例#11
0
 public abstract FileSystemStream CreateFile(Path path);
示例#12
0
 public abstract Directory CreateDirectory(Path path);
示例#13
0
 public static Path Combine(Path path1, Path path2)
 {
     return new Path(System.IO.Path.Combine(path1.ToString(), path2.ToString()));
 }
示例#14
0
 public override FileInfo GetFileInfo(Path path)
 {
     var fileInfo = new System.IO.FileInfo(ToLocalPath(path));
     return new FileInfo(path, fileInfo.Length);
 }
示例#15
0
 public abstract FileSystemStream OpenFile(Path path, FileMode mode);
示例#16
0
 public override FileSystemStream OpenFile(Path path, FileMode mode)
 {
     return new LocalFileSystemStream(System.IO.File.Open(ToLocalPath(path), ToLocalFileMode(mode)));
 }
示例#17
0
 private string ToLocalPath(Path path)
 {
     return (new Uri(m_basePath, path.Uri)).LocalPath;
 }