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

40 lines
1.2 KiB
C#
Raw Normal View History

using LibHac.Fs;
using LibHac.Fs.Fsa;
2020-08-07 20:45:11 +02:00
using LibHac.FsSrv;
namespace LibHac.Tests.Fs.FileSystemClientTests
{
public static class FileSystemServerFactory
{
private static FileSystemClient CreateClientImpl(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 horizon = new Horizon(new StopWatchTimeSpanGenerator(), config);
HorizonClient horizonClient = horizon.CreatePrivilegedHorizonClient();
return horizonClient.Fs;
}
public static FileSystemClient CreateClient(bool sdCardInserted)
{
return CreateClientImpl(sdCardInserted, out _);
2020-04-03 06:57:08 +02:00
}
public static FileSystemClient CreateClient(out IFileSystem rootFs)
{
return CreateClientImpl(false, out rootFs);
}
}
}