Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
IVirtualFileProvider.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 
6 namespace SiliconStudio.Core.IO
7 {
8  /// <summary>
9  /// A virtual file provider, that can returns a Stream for a given path.
10  /// </summary>
11  public interface IVirtualFileProvider
12  {
13  /// <summary>
14  /// Gets or sets the root path of this provider. See remarks.
15  /// </summary>
16  /// <value>
17  /// The root path.
18  /// </value>
19  /// <remarks>
20  /// All path are relative to the root path.
21  /// </remarks>
22  string RootPath { get; }
23 
24  /// <summary>
25  /// Gets the absolute path for the specified local path from this provider.
26  /// </summary>
27  /// <param name="path">The path local to this instance.</param>
28  /// <returns>An absolute path.</returns>
29  string GetAbsolutePath(string path);
30 
31  /// <summary>
32  /// Opens a Stream from the specified path.
33  /// </summary>
34  /// <param name="path">The path.</param>
35  /// <param name="mode">The mode.</param>
36  /// <param name="access">The access.</param>
37  /// <param name="share">The process sharing mode.</param>
38  /// <param name="streamFlags">The type of stream needed</param>
39  /// <returns>The opened stream.</returns>
40  Stream OpenStream(string path, VirtualFileMode mode, VirtualFileAccess access, VirtualFileShare share = VirtualFileShare.Read, StreamFlags streamFlags = StreamFlags.None);
41 
42  /// <summary>
43  /// Returns the list of files from the specified path.
44  /// </summary>
45  /// <param name="path">The path.</param>
46  /// <param name="searchPattern">The search pattern.</param>
47  /// <param name="searchOption">The search option.</param>
48  /// <returns>A list of files from the specified path</returns>
49  string[] ListFiles(string path, string searchPattern, VirtualSearchOption searchOption);
50 
51  /// <summary>
52  /// Creates all directories so that url exists.
53  /// </summary>
54  /// <param name="url">The URL.</param>
55  void CreateDirectory(string url);
56 
57  /// <summary>
58  /// Determines whether the specified path points to an existing directory.
59  /// </summary>
60  /// <param name="url">The path.</param>
61  /// <returns></returns>
62  bool DirectoryExists(string url);
63 
64  /// <summary>
65  /// Determines whether the specified path points to an existing file.
66  /// </summary>
67  /// <param name="url">The path.</param>
68  /// <returns></returns>
69  bool FileExists(string url);
70 
71  /// <summary>
72  /// Deletes the specified file.
73  /// </summary>
74  /// <param name="url">The URL.</param>
75  void FileDelete(string url);
76 
77  /// <summary>
78  /// 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.
79  /// </summary>
80  /// <param name="sourceUrl">The source URL of the file</param>
81  /// <param name="destinationUrl">The destination URL of the file</param>
82  void FileMove(string sourceUrl, string destinationUrl);
83 
84  /// <summary>
85  /// Move the specified file specified from its sourceUrl to the location pointed by destinationUrl in the destination provider. Do not overwrite, throw IOException if the file can't be moved.
86  /// </summary>
87  /// <param name="sourceUrl">The source URL.</param>
88  /// <param name="destinationProvider">The destination provider.</param>
89  /// <param name="destinationUrl">The destination URL, relative to the destination provider.</param>
90  void FileMove(string sourceUrl, IVirtualFileProvider destinationProvider, string destinationUrl);
91 
92  /// <summary>
93  /// Returns the size of the specified file in bytes
94  /// </summary>
95  /// <param name="url">The file or directory for which to obtain size</param>
96  /// <returns>A long value representing the file size in bytes</returns>
97  long FileSize(string url);
98 
99  /// <summary>
100  /// Returns the date and time the specified file or directory was last written to.
101  /// </summary>
102  /// <param name="url">The file or directory for which to obtain write date and time information.</param>
103  /// <returns>A DateTime structure set to the date and time that the specified file or directory was last written to.</returns>
104  DateTime GetLastWriteTime(string url);
105  }
106 }
A virtual file provider, that can returns a Stream for a given path.
VirtualFileShare
File share capabilities, equivalent of System.IO.FileShare.
VirtualFileAccess
File access equivalent of System.IO.FileAccess.
VirtualFileMode
File mode equivalent of System.IO.FileMode.
StreamFlags
Describes the different type of streams.
Definition: StreamFlags.cs:11