-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathFileInfoFactory.cs
More file actions
41 lines (35 loc) · 1007 Bytes
/
FileInfoFactory.cs
File metadata and controls
41 lines (35 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
namespace System.IO.Abstractions
{
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
internal class FileInfoFactory : IFileInfoFactory
{
private readonly IFileSystem fileSystem;
/// <summary>
/// Base factory class for creating a <see cref="IFileInfo"/>
/// </summary>
public FileInfoFactory(IFileSystem fileSystem)
{
this.fileSystem = fileSystem;
}
/// <inheritdoc />
public IFileSystem FileSystem
=> fileSystem;
/// <inheritdoc />
public IFileInfo New(string fileName)
{
var realFileInfo = new FileInfo(fileName);
return new FileInfoWrapper(fileSystem, realFileInfo);
}
/// <inheritdoc />
public IFileInfo Wrap(FileInfo fileInfo)
{
if (fileInfo == null)
{
return null;
}
return new FileInfoWrapper(fileSystem, fileInfo);
}
}
}