Add some docs for EmulatedBisFileSystemCreator

This commit is contained in:
Alex Barney 2020-08-29 21:53:45 -07:00
parent 30f306f637
commit d138a52d06
2 changed files with 43 additions and 0 deletions

View file

@ -4,16 +4,49 @@ using LibHac.Fs.Fsa;
namespace LibHac.FsSrv.Creators
{
/// <summary>
/// Provides <see cref="IFileSystem"/> objects for the built-in storage (BIS) partitions.
/// </summary>
/// <remarks>
/// An <see cref="EmulatedBisFileSystemCreator"/> provides <see cref="IFileSystem"/>s of the
/// four BIS partitions: <c>CalibrationFile</c>, <c>SafeMode</c>, <c>User</c> and <c>System</c>.
/// The source of each partition is determined by the (optionally) provided
/// <see cref="EmulatedBisFileSystemCreatorConfig"/>.<br/>
/// There are multiple ways the source of a partition can be specified in the configuration. In order of precedence:
/// <list type="number">
/// <item><description>Set an <see cref="IFileSystem"/> object with <see cref="EmulatedBisFileSystemCreatorConfig.SetFileSystem"/>.<br/>
/// The IFileSystem will directly be used for the specified partition.</description></item>
/// <item><description>Set a path with <see cref="EmulatedBisFileSystemCreatorConfig.SetPath"/>.<br/>
/// The source for the partition will be the provided path in the root file system. e.g. at <c>/my/path</c> in the root FS.
/// The root file system must be set in the configuration when using this option.</description></item>
/// <item><description>Only set the root file system in the configuration.<br/>
/// The source of the partition will be at its default path in the root file system.</description></item></list>
/// Default paths for each partition:<br/>
/// <see cref="BisPartitionId.CalibrationFile"/>: <c>/bis/cal</c><br/>
/// <see cref="BisPartitionId.SafeMode"/>: <c>/bis/safe</c><br/>
/// <see cref="BisPartitionId.User"/>: <c>/bis/user</c><br/>
/// <see cref="BisPartitionId.System"/>: <c>/bis/system</c><br/>
/// </remarks>
public class EmulatedBisFileSystemCreator : IBuiltInStorageFileSystemCreator
{
private EmulatedBisFileSystemCreatorConfig Config { get; }
/// <summary>
/// Initializes an <see cref="EmulatedBisFileSystemCreator"/> with the default
/// <see cref="EmulatedBisFileSystemCreatorConfig"/> using the provided <see cref="IFileSystem"/>.
/// Each partition will be located at their default paths in this IFileSystem.
/// </summary>
/// <param name="rootFileSystem">The <see cref="IFileSystem"/> to use as the root file system.</param>
public EmulatedBisFileSystemCreator(IFileSystem rootFileSystem)
{
Config = new EmulatedBisFileSystemCreatorConfig();
Config.RootFileSystem = rootFileSystem;
}
/// <summary>
/// Initializes an <see cref="EmulatedBisFileSystemCreator"/> with the provided configuration.
/// </summary>
/// <param name="config">The configuration to use.</param>
public EmulatedBisFileSystemCreator(EmulatedBisFileSystemCreatorConfig config)
{
Config = config;
@ -78,6 +111,12 @@ namespace LibHac.FsSrv.Creators
return GetDefaultPartitionPath(id);
}
/// <summary>
/// Gets the default path for the specified partition.
/// </summary>
/// <param name="id">The partition ID of the path to get.</param>
/// <returns>The default path for the specified partition.</returns>
/// <remarks>These paths are the same paths that Nintendo uses on Windows.</remarks>
private string GetDefaultPartitionPath(BisPartitionId id)
{
Debug.Assert(IsValidPartitionId(id));

View file

@ -4,6 +4,10 @@ using LibHac.Fs.Fsa;
namespace LibHac.FsSrv.Creators
{
/// <summary>
/// Configuration for <see cref="EmulatedBisFileSystemCreator"/> that specifies how each
/// BIS partition is opened.
/// </summary>
public class EmulatedBisFileSystemCreatorConfig
{
private const int ValidPartitionCount = 4;