LibHac/tests/LibHac.Tests/HorizonFactory.cs

36 lines
1.1 KiB
C#
Raw Normal View History

using LibHac.Bcat;
using LibHac.Common.Keys;
2020-10-05 21:25:39 +02:00
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSrv;
2021-11-14 20:08:57 +01:00
namespace LibHac.Tests;
public static class HorizonFactory
{
2021-11-14 20:08:57 +01:00
public static Horizon CreateBasicHorizon()
{
2021-11-14 20:08:57 +01:00
IFileSystem rootFs = new InMemoryFileSystem();
var keySet = new KeySet();
2021-11-14 20:08:57 +01:00
var horizon = new Horizon(new HorizonConfiguration());
2021-11-14 20:08:57 +01:00
HorizonClient fsServerClient = horizon.CreatePrivilegedHorizonClient();
var fsServer = new FileSystemServer(fsServerClient);
2021-11-14 20:08:57 +01:00
var defaultObjects = DefaultFsServerObjects.GetDefaultEmulatedCreators(rootFs, keySet, fsServer);
2021-11-14 20:08:57 +01:00
var config = new FileSystemServerConfig();
config.FsCreators = defaultObjects.FsCreators;
config.DeviceOperator = defaultObjects.DeviceOperator;
config.ExternalKeySet = new ExternalKeySet();
2021-11-14 20:08:57 +01:00
FileSystemServerInitializer.InitializeWithConfig(fsServerClient, fsServer, config);
2021-11-14 20:08:57 +01:00
HorizonClient bcatServerClient = horizon.CreateHorizonClient();
_ = new BcatServer(bcatServerClient);
2021-11-14 20:08:57 +01:00
return horizon;
}
}