Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
VirtualFileProviderBase.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.IO;
5 using System.Reflection;
6 using System.Runtime.CompilerServices;
7 
8 namespace SiliconStudio.Core.IO
9 {
10  /// <summary>
11  /// Abstract base class for <see cref="IVirtualFileProvider"/>.
12  /// </summary>
14  {
15  protected VirtualFileProviderBase(string rootPath)
16  {
17  RootPath = rootPath;
18 
19  // Ensure RootPath ends with /
20  if (RootPath != null)
21  {
22  if (RootPath == string.Empty)
23  throw new ArgumentException("rootPath");
24 
25  if (RootPath[RootPath.Length - 1] != VirtualFileSystem.DirectorySeparatorChar)
26  RootPath += VirtualFileSystem.DirectorySeparatorChar;
27  }
28  VirtualFileSystem.RegisterProvider(this);
29  }
30 
31  /// <inheritdoc/>
32  public string RootPath { get; private set; }
33 
34  /// <inheritdoc/>
35  public virtual string GetAbsolutePath(string path)
36  {
37  throw new NotImplementedException();
38  }
39 
40  /// <inheritdoc/>
41  public abstract Stream OpenStream(string url, VirtualFileMode mode, VirtualFileAccess access, VirtualFileShare share = VirtualFileShare.Read, StreamFlags streamFlags = StreamFlags.None);
42 
43  /// <summary>
44  /// Resolves the path (can map virtual to absolute path).
45  /// </summary>
46  /// <param name="path">The path.</param>
47  /// <returns>The resolved path.</returns>
48  protected virtual string ResolvePath(string path)
49  {
50  return path;
51  }
52 
53  public virtual bool DirectoryExists(string url)
54  {
55  throw new NotImplementedException();
56  }
57 
58  /// <inheritdoc/>
59  public virtual string[] ListFiles(string url, string searchPattern, VirtualSearchOption searchOption)
60  {
61  throw new NotImplementedException();
62  }
63 
64  /// <inheritdoc/>
65  public virtual bool FileExists(string url)
66  {
67  throw new NotImplementedException();
68  }
69 
70  /// <inheritdoc/>
71  public virtual void FileDelete(string url)
72  {
73  throw new NotImplementedException();
74  }
75 
76  /// <inheritdoc/>
77  public virtual void FileMove(string sourceUrl, string destinationUrl)
78  {
79  throw new NotImplementedException();
80  }
81 
82  /// <inheritdoc/>
83  public virtual void FileMove(string sourceUrl, IVirtualFileProvider destinationProvider, string destinationUrl)
84  {
85  throw new NotImplementedException();
86  }
87 
88  /// <inheritdoc/>
89  public virtual long FileSize(string url)
90  {
91  throw new NotImplementedException();
92  }
93 
94  /// <inheritdoc/>
95  public virtual DateTime GetLastWriteTime(string url)
96  {
97  throw new NotImplementedException();
98  }
99 
100  /// <inheritdoc/>
101  public virtual void CreateDirectory(string url)
102  {
103  throw new NotImplementedException();
104  }
105  }
106 }
A virtual file provider, that can returns a Stream for a given path.
Virtual abstraction over a file system. It handles access to files, http, packages, path rewrite, etc...
virtual long FileSize(string url)
Returns the size of the specified file in bytes The file or directory for which to obtain sizeA long ...
Abstract base class for IVirtualFileProvider.
virtual string GetAbsolutePath(string path)
Gets the absolute path for the specified local path from this provider. The path local to this instan...
virtual bool FileExists(string url)
Determines whether the specified path points to an existing file. The path.
VirtualFileShare
File share capabilities, equivalent of System.IO.FileShare.
virtual string ResolvePath(string path)
Resolves the path (can map virtual to absolute path).
virtual bool DirectoryExists(string url)
Determines whether the specified path points to an existing directory.
VirtualFileAccess
File access equivalent of System.IO.FileAccess.
VirtualFileMode
File mode equivalent of System.IO.FileMode.
virtual void FileMove(string sourceUrl, IVirtualFileProvider destinationProvider, string destinationUrl)
Move the specified file specified from its sourceUrl to the location pointed by destinationUrl in the...
virtual string[] ListFiles(string url, string searchPattern, VirtualSearchOption searchOption)
Returns the list of files from the specified path. The path.The search pattern.The search option...
virtual DateTime GetLastWriteTime(string url)
Returns the date and time the specified file or directory was last written to. The file or directory ...
virtual void CreateDirectory(string url)
Creates all directories so that url exists. The URL.
StreamFlags
Describes the different type of streams.
Definition: StreamFlags.cs:11
virtual void FileMove(string sourceUrl, string destinationUrl)
Move the specified file specified from its sourceUrl to the location pointed by destinationUrl. Do not overwrite, throw IOException if the file can't be moved. The source URL of the fileThe destination URL of the file
virtual void FileDelete(string url)
Deletes the specified file. The URL.