2020-02-14 01:21:24 +01:00
|
|
|
|
using LibHac.Fs;
|
2020-06-10 07:55:59 +02:00
|
|
|
|
using LibHac.Fs.Fsa;
|
2020-08-07 20:45:11 +02:00
|
|
|
|
using LibHac.FsSrv;
|
2020-02-14 01:21:24 +01:00
|
|
|
|
|
|
|
|
|
namespace LibHac.Tests.Fs.FileSystemClientTests
|
|
|
|
|
{
|
|
|
|
|
public static class FileSystemServerFactory
|
|
|
|
|
{
|
2020-04-03 06:57:08 +02:00
|
|
|
|
public static FileSystemServer CreateServer(bool sdCardInserted, out IFileSystem rootFs)
|
2020-02-14 01:21:24 +01:00
|
|
|
|
{
|
2020-04-03 06:57:08 +02:00
|
|
|
|
rootFs = new InMemoryFileSystem();
|
2020-02-14 01:21:24 +01:00
|
|
|
|
|
|
|
|
|
var defaultObjects = DefaultFsServerObjects.GetDefaultEmulatedCreators(rootFs, new Keyset());
|
|
|
|
|
|
|
|
|
|
defaultObjects.SdCard.SetSdCardInsertionStatus(sdCardInserted);
|
|
|
|
|
|
|
|
|
|
var config = new FileSystemServerConfig();
|
|
|
|
|
config.FsCreators = defaultObjects.FsCreators;
|
|
|
|
|
config.DeviceOperator = defaultObjects.DeviceOperator;
|
|
|
|
|
config.ExternalKeySet = new ExternalKeySet();
|
|
|
|
|
|
|
|
|
|
var fsServer = new FileSystemServer(config);
|
|
|
|
|
|
|
|
|
|
return fsServer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static FileSystemClient CreateClient(bool sdCardInserted)
|
|
|
|
|
{
|
2020-04-03 06:57:08 +02:00
|
|
|
|
FileSystemServer fsServer = CreateServer(sdCardInserted, out _);
|
|
|
|
|
|
|
|
|
|
return fsServer.CreateFileSystemClient();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static FileSystemClient CreateClient(out IFileSystem rootFs)
|
|
|
|
|
{
|
|
|
|
|
FileSystemServer fsServer = CreateServer(false, out rootFs);
|
2020-02-14 01:21:24 +01:00
|
|
|
|
|
|
|
|
|
return fsServer.CreateFileSystemClient();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|