LibHac/tests/LibHac.Tests/Fs/FileSystemClientTests/FileSystemServerFactory.cs

42 lines
1.3 KiB
C#
Raw Normal View History

using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsService;
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-04-03 06:57:08 +02:00
rootFs = new InMemoryFileSystem();
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);
return fsServer.CreateFileSystemClient();
}
}
}