Browse Source

Fixed a lot of inline documentation

Added proper DocFX integration
pull/46/head
Anairkoen Schno 5 years ago
parent
commit
e5a238400e
27 changed files with 126 additions and 61 deletions
  1. +1
    -1
      IPA.Loader/.gitignore
  2. +1
    -1
      IPA.Loader/Config/Config.cs
  3. +5
    -0
      IPA.Loader/Config/IConfigProvider.cs
  4. +0
    -5
      IPA.Loader/IPA.Loader.csproj
  5. +6
    -4
      IPA.Loader/Loader/Features/Feature.cs
  6. +12
    -1
      IPA.Loader/Loader/PluginLoader.cs
  7. +3
    -0
      IPA.Loader/Loader/PluginManager.cs
  8. +1
    -0
      IPA.Loader/Logging/LogPrinter.cs
  9. +26
    -25
      IPA.Loader/Logging/Logger.cs
  10. +2
    -0
      IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs
  11. +1
    -0
      IPA.Loader/Logging/Printers/ColorlessConsolePrinter.cs
  12. +3
    -2
      IPA.Loader/Logging/Printers/GZFilePrinter.cs
  13. +2
    -1
      IPA.Loader/Logging/Printers/GlobalLogFilePrinter.cs
  14. +2
    -1
      IPA.Loader/Logging/Printers/PluginLogFilePrinter.cs
  15. +2
    -1
      IPA.Loader/Logging/Printers/PluginSubLogPrinter.cs
  16. +3
    -1
      IPA.Loader/Logging/StandardLogger.cs
  17. +9
    -2
      IPA.Loader/Utilities/BeatSaber.cs
  18. +14
    -7
      IPA.Loader/Utilities/Ref.cs
  19. +6
    -6
      IPA.Loader/Utilities/ReflectionUtil.cs
  20. +5
    -0
      IPA.Loader/doc/.gitignore
  21. +5
    -0
      IPA.Loader/doc/api/.gitignore
  22. +2
    -0
      IPA.Loader/doc/api/index.md
  23. +1
    -0
      IPA.Loader/doc/articles/intro.md
  24. +2
    -0
      IPA.Loader/doc/articles/toc.yml
  25. +3
    -3
      IPA.Loader/doc/docfx.json
  26. +4
    -0
      IPA.Loader/doc/index.md
  27. +5
    -0
      IPA.Loader/doc/toc.yml

+ 1
- 1
IPA.Loader/.gitignore View File

@ -6,4 +6,4 @@
/**/packages/ /**/packages/
/**/bin/ /**/bin/
/**/obj/ /**/obj/
_site
log.txt

+ 1
- 1
IPA.Loader/Config/Config.cs View File

@ -118,7 +118,7 @@ namespace IPA.Config
private static List<Tuple<Ref<DateTime>, IConfigProvider>> configProviders = new List<Tuple<Ref<DateTime>, IConfigProvider>>(); private static List<Tuple<Ref<DateTime>, IConfigProvider>> configProviders = new List<Tuple<Ref<DateTime>, IConfigProvider>>();
/// <summary> /// <summary>
/// Gets an <see cref="IConfigProvider"/> using the specified list pf preferred config types.
/// Gets an <see cref="IConfigProvider"/> using the specified list of preferred config types.
/// </summary> /// </summary>
/// <param name="configName">the name of the mod for this config</param> /// <param name="configName">the name of the mod for this config</param>
/// <param name="extensions">the preferred config types to try to get</param> /// <param name="extensions">the preferred config types to try to get</param>


+ 5
- 0
IPA.Loader/Config/IConfigProvider.cs View File

@ -24,24 +24,29 @@ namespace IPA.Config
/// <summary> /// <summary>
/// Gets a dynamic object providing access to the configuration. /// Gets a dynamic object providing access to the configuration.
/// </summary> /// </summary>
/// <value>a dynamically bound object to use to access config values directly</value>
dynamic Dynamic { get; } dynamic Dynamic { get; }
#region State getters #region State getters
/// <summary> /// <summary>
/// Returns <see langword="true"/> if object has changed since the last save /// Returns <see langword="true"/> if object has changed since the last save
/// </summary> /// </summary>
/// <value><see langword="true"/> if object has changed since the last save, else <see langword="false"/></value>
bool HasChanged { get; } bool HasChanged { get; }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the data in memory has been changed - notably including loads. /// Returns <see langword="true"/> if the data in memory has been changed - notably including loads.
/// </summary> /// </summary>
/// <value><see langword="true"/> if the data in memory has been changed, else <see langword="false"/></value>
bool InMemoryChanged { get; set; } bool InMemoryChanged { get; set; }
/// <summary> /// <summary>
/// Will be set with the filename (no extension) to save to. When saving, the implementation should add the appropriate extension. Should error if set multiple times. /// Will be set with the filename (no extension) to save to. When saving, the implementation should add the appropriate extension. Should error if set multiple times.
/// </summary> /// </summary>
/// <value>the extensionless filename to save to</value>
string Filename { set; } string Filename { set; }
/// <summary> /// <summary>
/// Gets the last time the config was modified. /// Gets the last time the config was modified.
/// </summary> /// </summary>
/// <value>the last time the config file was modified</value>
DateTime LastModified { get; } DateTime LastModified { get; }
/// <summary> /// <summary>
/// Saves configuration to file. Should error if not a root object. /// Saves configuration to file. Should error if not a root object.


+ 0
- 5
IPA.Loader/IPA.Loader.csproj View File

@ -113,11 +113,6 @@
<Compile Include="Utilities\Utils.cs" /> <Compile Include="Utilities\Utils.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="docfx.console">
<Version>2.42.4</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Ionic.Zip"> <PackageReference Include="Ionic.Zip">
<Version>1.9.1.8</Version> <Version>1.9.1.8</Version>
</PackageReference> </PackageReference>


+ 6
- 4
IPA.Loader/Loader/Features/Feature.cs View File

@ -18,7 +18,7 @@ namespace IPA.Loader.Features
/// Note: When no parenthesis are provided, <paramref name="parameters"/> is an empty array. /// Note: When no parenthesis are provided, <paramref name="parameters"/> is an empty array.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// This gets called BEFORE your Init method.
/// This gets called BEFORE *your* `Init` method.
/// ///
/// Returning <see langword="false" /> does *not* prevent the plugin from being loaded. It simply prevents the feature from being used. /// Returning <see langword="false" /> does *not* prevent the plugin from being loaded. It simply prevents the feature from being used.
/// </remarks> /// </remarks>
@ -39,6 +39,7 @@ namespace IPA.Loader.Features
/// The message to be logged when the feature is not valid for a plugin. /// The message to be logged when the feature is not valid for a plugin.
/// This should also be set whenever either <see cref="BeforeLoad"/> or <see cref="BeforeInit"/> returns false. /// This should also be set whenever either <see cref="BeforeLoad"/> or <see cref="BeforeInit"/> returns false.
/// </summary> /// </summary>
/// <value>the message to show when the feature is marked invalid</value>
public virtual string InvalidMessage { get; protected set; } public virtual string InvalidMessage { get; protected set; }
/// <summary> /// <summary>
@ -53,21 +54,21 @@ namespace IPA.Loader.Features
public virtual bool BeforeLoad(PluginLoader.PluginMetadata plugin) => true; public virtual bool BeforeLoad(PluginLoader.PluginMetadata plugin) => true;
/// <summary> /// <summary>
/// Called before a plugin's Init method is called. This will not be called if there is no Init method. This should never throw an exception. An exception will abort the loading of the plugin with an error.
/// Called before a plugin's `Init` method is called. This will not be called if there is no `Init` method. This should never throw an exception. An exception will abort the loading of the plugin with an error.
/// </summary> /// </summary>
/// <param name="plugin">the plugin to be initialized</param> /// <param name="plugin">the plugin to be initialized</param>
/// <returns>whether or not to call the Init method</returns> /// <returns>whether or not to call the Init method</returns>
public virtual bool BeforeInit(PluginLoader.PluginInfo plugin) => true; public virtual bool BeforeInit(PluginLoader.PluginInfo plugin) => true;
/// <summary> /// <summary>
/// Called after a plugin has been fully initialized, whether or not there is an Init method. This should never throw an exception.
/// Called after a plugin has been fully initialized, whether or not there is an `Init` method. This should never throw an exception.
/// </summary> /// </summary>
/// <param name="plugin">the plugin that was just initialized</param> /// <param name="plugin">the plugin that was just initialized</param>
/// <param name="pluginInstance">the instance of the plugin being initialized</param> /// <param name="pluginInstance">the instance of the plugin being initialized</param>
public virtual void AfterInit(PluginLoader.PluginInfo plugin, IBeatSaberPlugin pluginInstance) => AfterInit(plugin); public virtual void AfterInit(PluginLoader.PluginInfo plugin, IBeatSaberPlugin pluginInstance) => AfterInit(plugin);
/// <summary> /// <summary>
/// Called after a plugin has been fully initialized, whether or not there is an Init method. This should never throw an exception.
/// Called after a plugin has been fully initialized, whether or not there is an `Init` method. This should never throw an exception.
/// </summary> /// </summary>
/// <param name="plugin">the plugin that was just initialized</param> /// <param name="plugin">the plugin that was just initialized</param>
public virtual void AfterInit(PluginLoader.PluginInfo plugin) { } public virtual void AfterInit(PluginLoader.PluginInfo plugin) { }
@ -81,6 +82,7 @@ namespace IPA.Loader.Features
/// <summary> /// <summary>
/// Defines whether or not this feature will be accessible from the plugin metadata once loaded. /// Defines whether or not this feature will be accessible from the plugin metadata once loaded.
/// </summary> /// </summary>
/// <value><see langword="true"/> if this <see cref="Feature"/> will be stored on the plugin metadata, <see langword="false"/> otherwise</value>
protected internal virtual bool StoreOnPlugin => true; protected internal virtual bool StoreOnPlugin => true;
static Feature() static Feature()


+ 12
- 1
IPA.Loader/Loader/PluginLoader.cs View File

@ -35,37 +35,44 @@ namespace IPA.Loader
/// <summary> /// <summary>
/// The assembly the plugin was loaded from. /// The assembly the plugin was loaded from.
/// </summary> /// </summary>
/// <value>the loaded Assembly that contains the plugin main type</value>
public Assembly Assembly { get; internal set; } public Assembly Assembly { get; internal set; }
/// <summary> /// <summary>
/// The TypeDefinition for the main type of the plugin. /// The TypeDefinition for the main type of the plugin.
/// </summary> /// </summary>
/// <value>the Cecil definition for the plugin main type</value>
public TypeDefinition PluginType { get; internal set; } public TypeDefinition PluginType { get; internal set; }
/// <summary> /// <summary>
/// The human readable name of the plugin. /// The human readable name of the plugin.
/// </summary> /// </summary>
/// <value>the name of the plugin</value>
public string Name { get; internal set; } public string Name { get; internal set; }
/// <summary> /// <summary>
/// The BeatMods ID of the plugin, or null if it doesn't have one. /// The BeatMods ID of the plugin, or null if it doesn't have one.
/// </summary> /// </summary>
/// <value>the updater ID of the plugin</value>
public string Id { get; internal set; } public string Id { get; internal set; }
/// <summary> /// <summary>
/// The version of the plugin. /// The version of the plugin.
/// </summary> /// </summary>
/// <value>the version of the plugin</value>
public Version Version { get; internal set; } public Version Version { get; internal set; }
/// <summary> /// <summary>
/// The file the plugin was loaded from. /// The file the plugin was loaded from.
/// </summary> /// </summary>
/// <value>the file the plugin was loaded from</value>
public FileInfo File { get; internal set; } public FileInfo File { get; internal set; }
// ReSharper disable once UnusedAutoPropertyAccessor.Global // ReSharper disable once UnusedAutoPropertyAccessor.Global
/// <summary> /// <summary>
/// The features this plugin requests. /// The features this plugin requests.
/// </summary> /// </summary>
/// <value>the list of features requested by the plugin</value>
public IReadOnlyList<Feature> Features => InternalFeatures; public IReadOnlyList<Feature> Features => InternalFeatures;
internal readonly List<Feature> InternalFeatures = new List<Feature>(); internal readonly List<Feature> InternalFeatures = new List<Feature>();
@ -90,7 +97,10 @@ namespace IPA.Loader
} }
} }
/// <inheritdoc />
/// <summary>
/// Gets all of the metadata as a readable string.
/// </summary>
/// <returns>the readable printable metadata string</returns>
public override string ToString() => $"{Name}({Id}@{Version})({PluginType?.FullName}) from '{Utils.GetRelativePath(File?.FullName, BeatSaber.InstallPath)}'"; public override string ToString() => $"{Name}({Id}@{Version})({PluginType?.FullName}) from '{Utils.GetRelativePath(File?.FullName, BeatSaber.InstallPath)}'";
} }
@ -104,6 +114,7 @@ namespace IPA.Loader
/// <summary> /// <summary>
/// Metadata for the plugin. /// Metadata for the plugin.
/// </summary> /// </summary>
/// <value>the metadata for this plugin</value>
public PluginMetadata Metadata { get; internal set; } = new PluginMetadata(); public PluginMetadata Metadata { get; internal set; } = new PluginMetadata();
} }


+ 3
- 0
IPA.Loader/Loader/PluginManager.cs View File

@ -236,6 +236,7 @@ namespace IPA.Loader
/// <summary> /// <summary>
/// Gets a list of disabled BSIPA plugins. /// Gets a list of disabled BSIPA plugins.
/// </summary> /// </summary>
/// <value>a collection of all disabled plugins as <see cref="PluginMetadata"/></value>
public static IEnumerable<PluginMetadata> DisabledPlugins => PluginLoader.DisabledPlugins.Concat(runtimeDisabled.Select(p => p.Metadata)); public static IEnumerable<PluginMetadata> DisabledPlugins => PluginLoader.DisabledPlugins.Concat(runtimeDisabled.Select(p => p.Metadata));
/// <summary> /// <summary>
@ -263,6 +264,7 @@ namespace IPA.Loader
/// <summary> /// <summary>
/// Gets a list of all BSIPA plugins. /// Gets a list of all BSIPA plugins.
/// </summary> /// </summary>
/// <value>a collection of all enabled plugins as <see cref="PluginInfo"/>s</value>
public static IEnumerable<PluginInfo> AllPlugins => BSMetas; public static IEnumerable<PluginInfo> AllPlugins => BSMetas;
/// <summary> /// <summary>
@ -281,6 +283,7 @@ namespace IPA.Loader
/// <summary> /// <summary>
/// An <see cref="IEnumerable"/> of old IPA plugins. /// An <see cref="IEnumerable"/> of old IPA plugins.
/// </summary> /// </summary>
/// <value>all legacy plugin instances</value>
[Obsolete("I mean, IPlugin shouldn't be used, so why should this? Not renaming to extend support for old plugins.")] [Obsolete("I mean, IPlugin shouldn't be used, so why should this? Not renaming to extend support for old plugins.")]
public static IEnumerable<IPlugin> Plugins => _ipaPlugins; public static IEnumerable<IPlugin> Plugins => _ipaPlugins;
private static List<IPlugin> _ipaPlugins; private static List<IPlugin> _ipaPlugins;


+ 1
- 0
IPA.Loader/Logging/LogPrinter.cs View File

@ -10,6 +10,7 @@ namespace IPA.Logging
/// <summary> /// <summary>
/// Provides a filter for which log levels to allow through. /// Provides a filter for which log levels to allow through.
/// </summary> /// </summary>
/// <value>the level to filter to</value>
public abstract Logger.LogLevel Filter { get; set; } public abstract Logger.LogLevel Filter { get; set; }
/// <summary> /// <summary>


+ 26
- 25
IPA.Loader/Logging/Logger.cs View File

@ -43,6 +43,7 @@ namespace IPA.Logging
/// <summary> /// <summary>
/// The standard format for log messages. /// The standard format for log messages.
/// </summary> /// </summary>
/// <value>the format for the standard loggers to print in</value>
public static string LogFormat { get; protected internal set; } = "[{3} @ {2:HH:mm:ss} | {1}] {0}"; public static string LogFormat { get; protected internal set; } = "[{3} @ {2:HH:mm:ss} | {1}] {0}";
/// <summary> /// <summary>
@ -174,97 +175,97 @@ namespace IPA.Logging
/// <summary> /// <summary>
/// Sends a debug message. /// Sends a debug message.
/// Equivalent to Log(Level.Debug, message);
/// <see cref="Log(Level, string)"/>
/// Equivalent to `Log(Level.Debug, message);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, string)"/>
/// <param name="message">the message to log</param> /// <param name="message">the message to log</param>
public virtual void Debug(string message) => Log(Level.Debug, message); public virtual void Debug(string message) => Log(Level.Debug, message);
/// <summary> /// <summary>
/// Sends an exception as a debug message. /// Sends an exception as a debug message.
/// Equivalent to Log(Level.Debug, e);
/// <see cref="Log(Level, Exception)"/>
/// Equivalent to `Log(Level.Debug, e);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, Exception)"/>
/// <param name="e">the exception to log</param> /// <param name="e">the exception to log</param>
public virtual void Debug(Exception e) => Log(Level.Debug, e); public virtual void Debug(Exception e) => Log(Level.Debug, e);
/// <summary> /// <summary>
/// Sends an info message. /// Sends an info message.
/// Equivalent to Log(Level.Info, message).
/// <see cref="Log(Level, string)"/>
/// Equivalent to `Log(Level.Info, message);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, string)"/>
/// <param name="message">the message to log</param> /// <param name="message">the message to log</param>
public virtual void Info(string message) => Log(Level.Info, message); public virtual void Info(string message) => Log(Level.Info, message);
/// <summary> /// <summary>
/// Sends an exception as an info message. /// Sends an exception as an info message.
/// Equivalent to Log(Level.Info, e);
/// <see cref="Log(Level, Exception)"/>
/// Equivalent to `Log(Level.Info, e);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, Exception)"/>
/// <param name="e">the exception to log</param> /// <param name="e">the exception to log</param>
public virtual void Info(Exception e) => Log(Level.Info, e); public virtual void Info(Exception e) => Log(Level.Info, e);
/// <summary> /// <summary>
/// Sends a notice message. /// Sends a notice message.
/// Equivalent to Log(Level.Notice, message).
/// <see cref="Log(Level, string)"/>
/// Equivalent to `Log(Level.Notice, message);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, string)"/>
/// <param name="message">the message to log</param> /// <param name="message">the message to log</param>
public virtual void Notice(string message) => Log(Level.Notice, message); public virtual void Notice(string message) => Log(Level.Notice, message);
/// <summary> /// <summary>
/// Sends an exception as a notice message. /// Sends an exception as a notice message.
/// Equivalent to Log(Level.Notice, e);
/// <see cref="Log(Level, Exception)"/>
/// Equivalent to `Log(Level.Notice, e);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, Exception)"/>
/// <param name="e">the exception to log</param> /// <param name="e">the exception to log</param>
public virtual void Notice(Exception e) => Log(Level.Notice, e); public virtual void Notice(Exception e) => Log(Level.Notice, e);
/// <summary> /// <summary>
/// Sends a warning message. /// Sends a warning message.
/// Equivalent to Log(Level.Warning, message).
/// <see cref="Log(Level, string)"/>
/// Equivalent to `Log(Level.Warning, message);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, string)"/>
/// <param name="message">the message to log</param> /// <param name="message">the message to log</param>
public virtual void Warn(string message) => Log(Level.Warning, message); public virtual void Warn(string message) => Log(Level.Warning, message);
/// <summary> /// <summary>
/// Sends an exception as a warning message. /// Sends an exception as a warning message.
/// Equivalent to Log(Level.Warning, e);
/// <see cref="Log(Level, Exception)"/>
/// Equivalent to `Log(Level.Warning, e);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, Exception)"/>
/// <param name="e">the exception to log</param> /// <param name="e">the exception to log</param>
public virtual void Warn(Exception e) => Log(Level.Warning, e); public virtual void Warn(Exception e) => Log(Level.Warning, e);
/// <summary> /// <summary>
/// Sends an error message. /// Sends an error message.
/// Equivalent to Log(Level.Error, message).
/// <see cref="Log(Level, string)"/>
/// Equivalent to `Log(Level.Error, message);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, string)"/>
/// <param name="message">the message to log</param> /// <param name="message">the message to log</param>
public virtual void Error(string message) => Log(Level.Error, message); public virtual void Error(string message) => Log(Level.Error, message);
/// <summary> /// <summary>
/// Sends an exception as an error message. /// Sends an exception as an error message.
/// Equivalent to Log(Level.Error, e);
/// <see cref="Log(Level, Exception)"/>
/// Equivalent to `Log(Level.Error, e);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, Exception)"/>
/// <param name="e">the exception to log</param> /// <param name="e">the exception to log</param>
public virtual void Error(Exception e) => Log(Level.Error, e); public virtual void Error(Exception e) => Log(Level.Error, e);
/// <summary> /// <summary>
/// Sends a critical message. /// Sends a critical message.
/// Equivalent to Log(Level.Critical, message).
/// <see cref="Log(Level, string)"/>
/// Equivalent to `Log(Level.Critical, message);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, string)"/>
/// <param name="message">the message to log</param> /// <param name="message">the message to log</param>
public virtual void Critical(string message) => Log(Level.Critical, message); public virtual void Critical(string message) => Log(Level.Critical, message);
/// <summary> /// <summary>
/// Sends an exception as a critical message. /// Sends an exception as a critical message.
/// Equivalent to Log(Level.Critical, e);
/// <see cref="Log(Level, Exception)"/>
/// Equivalent to `Log(Level.Critical, e);`
/// </summary> /// </summary>
/// <seealso cref="Log(Level, Exception)"/>
/// <param name="e">the exception to log</param> /// <param name="e">the exception to log</param>
public virtual void Critical(Exception e) => Log(Level.Critical, e); public virtual void Critical(Exception e) => Log(Level.Critical, e);
} }

+ 2
- 0
IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs View File

@ -13,10 +13,12 @@ namespace IPA.Logging.Printers
/// <summary> /// <summary>
/// A filter for this specific printer. /// A filter for this specific printer.
/// </summary> /// </summary>
/// <value>the filter to apply to this printer</value>
public override Logger.LogLevel Filter { get => filter; set => filter = value; } public override Logger.LogLevel Filter { get => filter; set => filter = value; }
/// <summary> /// <summary>
/// The color to print messages as. /// The color to print messages as.
/// </summary> /// </summary>
/// <value>the color to print this message as</value>
public ConsoleColor Color { get; set; } = Console.ForegroundColor; public ConsoleColor Color { get; set; } = Console.ForegroundColor;
/// <summary> /// <summary>


+ 1
- 0
IPA.Loader/Logging/Printers/ColorlessConsolePrinter.cs View File

@ -10,6 +10,7 @@ namespace IPA.Logging.Printers
/// <summary> /// <summary>
/// A filter for this specific printer. /// A filter for this specific printer.
/// </summary> /// </summary>
/// <value>the filter level for this printer</value>
public override Logger.LogLevel Filter { get; set; } public override Logger.LogLevel Filter { get; set; }
/// <summary> /// <summary>


+ 3
- 2
IPA.Loader/Logging/Printers/GZFilePrinter.cs View File

@ -26,14 +26,15 @@ namespace IPA.Logging.Printers
/// <summary> /// <summary>
/// The <see cref="StreamWriter"/> that writes to the GZip file. /// The <see cref="StreamWriter"/> that writes to the GZip file.
/// </summary> /// </summary>
/// <value>the writer to the underlying filestream</value>
protected StreamWriter FileWriter; protected StreamWriter FileWriter;
private FileStream fstream; private FileStream fstream;
/// <summary> /// <summary>
/// Gets the <see cref="FileInfo"/> for the file to write to without the .gz extension.
/// Gets the <see cref="FileInfo"/> for the file to write to.
/// </summary> /// </summary>
/// <returns></returns>
/// <returns>the file to write to</returns>
protected abstract FileInfo GetFileInfo(); protected abstract FileInfo GetFileInfo();
private const string latestFormat = "_latest{0}"; private const string latestFormat = "_latest{0}";


+ 2
- 1
IPA.Loader/Logging/Printers/GlobalLogFilePrinter.cs View File

@ -11,6 +11,7 @@ namespace IPA.Logging.Printers
/// <summary> /// <summary>
/// Provides a filter for this specific printer. /// Provides a filter for this specific printer.
/// </summary> /// </summary>
/// <value>the filter level for this printer</value>
public override Logger.LogLevel Filter { get; set; } = Logger.LogLevel.All; public override Logger.LogLevel Filter { get; set; } = Logger.LogLevel.All;
/// <summary> /// <summary>
@ -29,7 +30,7 @@ namespace IPA.Logging.Printers
/// <summary> /// <summary>
/// Gets the <see cref="FileInfo"/> for the target file. /// Gets the <see cref="FileInfo"/> for the target file.
/// </summary> /// </summary>
/// <returns></returns>
/// <returns>the target file to write to</returns>
protected override FileInfo GetFileInfo() protected override FileInfo GetFileInfo()
{ {
var logsDir = new DirectoryInfo("Logs"); var logsDir = new DirectoryInfo("Logs");


+ 2
- 1
IPA.Loader/Logging/Printers/PluginLogFilePrinter.cs View File

@ -11,6 +11,7 @@ namespace IPA.Logging.Printers
/// <summary> /// <summary>
/// Provides a filter for this specific printer. /// Provides a filter for this specific printer.
/// </summary> /// </summary>
/// <value>the filter level for this printer</value>
public override Logger.LogLevel Filter { get; set; } = Logger.LogLevel.All; public override Logger.LogLevel Filter { get; set; } = Logger.LogLevel.All;
private string name; private string name;
@ -18,7 +19,7 @@ namespace IPA.Logging.Printers
/// <summary> /// <summary>
/// Gets the <see cref="FileInfo"/> for the target file. /// Gets the <see cref="FileInfo"/> for the target file.
/// </summary> /// </summary>
/// <returns></returns>
/// <returns>the file to write to</returns>
protected override FileInfo GetFileInfo() protected override FileInfo GetFileInfo()
{ {
var logsDir = new DirectoryInfo(Path.Combine("Logs", name)); var logsDir = new DirectoryInfo(Path.Combine("Logs", name));


+ 2
- 1
IPA.Loader/Logging/Printers/PluginSubLogPrinter.cs View File

@ -11,6 +11,7 @@ namespace IPA.Logging.Printers
/// <summary> /// <summary>
/// Provides a filter for this specific printer. /// Provides a filter for this specific printer.
/// </summary> /// </summary>
/// <value>the filter for this printer</value>
public override Logger.LogLevel Filter { get; set; } = Logger.LogLevel.All; public override Logger.LogLevel Filter { get; set; } = Logger.LogLevel.All;
private string name; private string name;
@ -19,7 +20,7 @@ namespace IPA.Logging.Printers
/// <summary> /// <summary>
/// Gets the <see cref="FileInfo"/> for the target file. /// Gets the <see cref="FileInfo"/> for the target file.
/// </summary> /// </summary>
/// <returns></returns>
/// <returns>the file to write to</returns>
protected override FileInfo GetFileInfo() protected override FileInfo GetFileInfo()
{ {
var logsDir = new DirectoryInfo(Path.Combine("Logs", mainName, name)); var logsDir = new DirectoryInfo(Path.Combine("Logs", mainName, name));


+ 3
- 1
IPA.Loader/Logging/StandardLogger.cs View File

@ -79,12 +79,13 @@ namespace IPA.Logging
/// <summary> /// <summary>
/// The <see cref="TextWriter"/> for writing directly to the console window, or stdout if no window open. /// The <see cref="TextWriter"/> for writing directly to the console window, or stdout if no window open.
/// </summary> /// </summary>
/// <value>a <see cref="TextWriter"/> for the current primary text output</value>
public static TextWriter ConsoleWriter { get; internal set; } = Console.Out; public static TextWriter ConsoleWriter { get; internal set; } = Console.Out;
/// <summary> /// <summary>
/// Adds to the default printer pool that all printers inherit from. Printers added this way will be passed every message from every logger. /// Adds to the default printer pool that all printers inherit from. Printers added this way will be passed every message from every logger.
/// </summary> /// </summary>
/// <param name="printer"></param>
/// <param name="printer">the printer to add</param>
internal static void AddDefaultPrinter(LogPrinter printer) internal static void AddDefaultPrinter(LogPrinter printer)
{ {
defaultPrinters.Add(printer); defaultPrinters.Add(printer);
@ -96,6 +97,7 @@ namespace IPA.Logging
/// <summary> /// <summary>
/// All levels defined by this filter will be sent to loggers. All others will be ignored. /// All levels defined by this filter will be sent to loggers. All others will be ignored.
/// </summary> /// </summary>
/// <value>the global filter level</value>
public static LogLevel PrintFilter { get; set; } = LogLevel.All; public static LogLevel PrintFilter { get; set; } = LogLevel.All;
private readonly List<LogPrinter> printers = new List<LogPrinter>(); private readonly List<LogPrinter> printers = new List<LogPrinter>();


+ 9
- 2
IPA.Loader/Utilities/BeatSaber.cs View File

@ -13,8 +13,9 @@ namespace IPA.Utilities
{ {
private static Version _gameVersion; private static Version _gameVersion;
/// <summary> /// <summary>
/// Provides the current game version
/// Provides the current game version.
/// </summary> /// </summary>
/// <value>the SemVer version of the game</value>
public static Version GameVersion => _gameVersion ?? (_gameVersion = new Version(Application.version, true)); public static Version GameVersion => _gameVersion ?? (_gameVersion = new Version(Application.version, true));
/// <summary> /// <summary>
@ -35,12 +36,14 @@ namespace IPA.Utilities
/// <summary> /// <summary>
/// Gets the <see cref="Release"/> type of this installation of Beat Saber /// Gets the <see cref="Release"/> type of this installation of Beat Saber
/// </summary> /// </summary>
/// <value>the type of release this is</value>
public static Release ReleaseType => (_releaseCache ?? (_releaseCache = FindSteamVRAsset() ? Release.Steam : Release.Oculus)).Value; public static Release ReleaseType => (_releaseCache ?? (_releaseCache = FindSteamVRAsset() ? Release.Steam : Release.Oculus)).Value;
private static string _installRoot; private static string _installRoot;
/// <summary> /// <summary>
/// The path to the Beat Saber install dir
/// Gets the path to the Beat Saber install directory.
/// </summary> /// </summary>
/// <value>the path of the game install directory</value>
public static string InstallPath public static string InstallPath
{ {
get get
@ -54,18 +57,22 @@ namespace IPA.Utilities
/// <summary> /// <summary>
/// The path to the `Libs` folder. Use only if necessary. /// The path to the `Libs` folder. Use only if necessary.
/// </summary> /// </summary>
/// <value>the path to the library directory</value>
public static string LibraryPath => Path.Combine(InstallPath, "Libs"); public static string LibraryPath => Path.Combine(InstallPath, "Libs");
/// <summary> /// <summary>
/// The path to the `Libs\Native` folder. Use only if necessary. /// The path to the `Libs\Native` folder. Use only if necessary.
/// </summary> /// </summary>
/// <value>the path to the native library directory</value>
public static string NativeLibraryPath => Path.Combine(LibraryPath, "Native"); public static string NativeLibraryPath => Path.Combine(LibraryPath, "Native");
/// <summary> /// <summary>
/// The directory to load plugins from. /// The directory to load plugins from.
/// </summary> /// </summary>
/// <value>the path to the plugin directory</value>
public static string PluginsPath => Path.Combine(InstallPath, "Plugins"); public static string PluginsPath => Path.Combine(InstallPath, "Plugins");
/// <summary> /// <summary>
/// The path to the `UserData` folder. /// The path to the `UserData` folder.
/// </summary> /// </summary>
/// <value>the path to the user data directory</value>
public static string UserDataPath => Path.Combine(InstallPath, "UserData"); public static string UserDataPath => Path.Combine(InstallPath, "UserData");
private static bool FindSteamVRAsset() private static bool FindSteamVRAsset()


+ 14
- 7
IPA.Loader/Utilities/Ref.cs View File

@ -31,6 +31,7 @@ namespace IPA.Utilities
/// <summary> /// <summary>
/// The value of the reference /// The value of the reference
/// </summary> /// </summary>
/// <value>the value wrapped by this <see cref="Ref{T}"/></value>
public T Value public T Value
{ {
get get
@ -45,6 +46,7 @@ namespace IPA.Utilities
/// <summary> /// <summary>
/// An exception that was generated while creating the value. /// An exception that was generated while creating the value.
/// </summary> /// </summary>
/// <value>the error held in this <see cref="Ref{T}"/></value>
public Exception Error public Exception Error
{ {
get get
@ -93,8 +95,12 @@ namespace IPA.Utilities
{ {
if (Error != null) throw Error; if (Error != null) throw Error;
} }
/// <inheritdoc />
/// <summary>
/// Compares the wrapped object to the other object.
/// </summary>
/// <param name="other">the object to compare to</param>
/// <returns>the value of the comparison</returns>
public int CompareTo(T other) public int CompareTo(T other)
{ {
if (Value is IComparable<T> compare) if (Value is IComparable<T> compare)
@ -102,11 +108,12 @@ namespace IPA.Utilities
return Equals(Value, other) ? 0 : -1; return Equals(Value, other) ? 0 : -1;
} }
/// <inheritdoc />
public int CompareTo(Ref<T> other)
{
return CompareTo(other.Value);
}
/// <summary>
/// Compares the wrapped object to the other wrapped object.
/// </summary>
/// <param name="other">the wrapped object to compare to</param>
/// <returns>the value of the comparison</returns>
public int CompareTo(Ref<T> other) => CompareTo(other.Value);
} }
internal static class ExceptionUtilities internal static class ExceptionUtilities


+ 6
- 6
IPA.Loader/Utilities/ReflectionUtil.cs View File

@ -75,7 +75,7 @@ namespace IPA.Utilities
} }
/// <summary> /// <summary>
/// Copies a component of type originalType to a component of overridingType on the destination GameObject.
/// Copies a component <paramref name="original"/> to a component of <paramref name="overridingType"/> on the destination <see cref="GameObject"/>.
/// </summary> /// </summary>
/// <param name="original">the original component</param> /// <param name="original">the original component</param>
/// <param name="overridingType">the new component's type</param> /// <param name="overridingType">the new component's type</param>
@ -98,9 +98,9 @@ namespace IPA.Utilities
} }
/// <summary> /// <summary>
/// A generic version of CopyComponent.
/// <see cref="CopyComponent(Component, Type, GameObject, Type)"/>
/// A generic version of <see cref="CopyComponent(Component, Type, GameObject, Type)"/>.
/// </summary> /// </summary>
/// <seealso cref="CopyComponent(Component, Type, GameObject, Type)"/>
/// <typeparam name="T">the overriding type</typeparam> /// <typeparam name="T">the overriding type</typeparam>
/// <param name="original">the original component</param> /// <param name="original">the original component</param>
/// <param name="destination">the destination game object</param> /// <param name="destination">the destination game object</param>
@ -133,9 +133,9 @@ namespace IPA.Utilities
} }
/// <summary> /// <summary>
/// Calls an instance method on a type specified by functionClass and dependency.
/// <seealso cref="CallNonStaticMethod(Type, string, Type[], object[])"/>
/// Calls an instance method on a type specified by <paramref name="functionClass"/> and <paramref name="dependency"/>.
/// </summary> /// </summary>
/// <seealso cref="CallNonStaticMethod(Type, string, Type[], object[])"/>
/// <param name="functionClass">the type name</param> /// <param name="functionClass">the type name</param>
/// <param name="dependency">the assembly the type is in</param> /// <param name="dependency">the assembly the type is in</param>
/// <param name="function">the name of the method to call</param> /// <param name="function">the name of the method to call</param>
@ -178,8 +178,8 @@ namespace IPA.Utilities
/// <summary> /// <summary>
/// Calls an instance method on a new object. /// Calls an instance method on a new object.
/// <seealso cref="CallNonStaticMethod(Type, string, Type[], object[])"/>
/// </summary> /// </summary>
/// <seealso cref="CallNonStaticMethod(Type, string, Type[], object[])"/>
/// <typeparam name="T">the return type</typeparam> /// <typeparam name="T">the return type</typeparam>
/// <param name="type">the object type</param> /// <param name="type">the object type</param>
/// <param name="function">the name of the method to call</param> /// <param name="function">the name of the method to call</param>


+ 5
- 0
IPA.Loader/doc/.gitignore View File

@ -0,0 +1,5 @@
/_site
/**/DROP/
/**/TEMP/
/**/packages/
/**/bin/

+ 5
- 0
IPA.Loader/doc/api/.gitignore View File

@ -0,0 +1,5 @@
###############
# temp file #
###############
*.yml
.manifest

+ 2
- 0
IPA.Loader/doc/api/index.md View File

@ -0,0 +1,2 @@
# PLACEHOLDER
TODO: Add .NET projects to the *src* folder and run `docfx` to generate **REAL** *API Documentation*!

+ 1
- 0
IPA.Loader/doc/articles/intro.md View File

@ -0,0 +1 @@
# Add your introductions here!

+ 2
- 0
IPA.Loader/doc/articles/toc.yml View File

@ -0,0 +1,2 @@
- name: Introduction
href: intro.md

IPA.Loader/docfx.json → IPA.Loader/doc/docfx.json View File

@ -3,10 +3,10 @@
{ {
"src": [ "src": [
{ {
"src": "..",
"files": [ "files": [
"**.csproj" "**.csproj"
],
"src": "Z:\\Users\\aaron\\Source\\Repos\\IPA-Reloaded-BeatSaber\\IPA.Loader"
]
} }
], ],
"dest": "api", "dest": "api",
@ -41,7 +41,7 @@
"overwrite": [ "overwrite": [
{ {
"files": [ "files": [
"apidoc/**.md"
"override/**.md"
], ],
"exclude": [ "exclude": [
"obj/**", "obj/**",

+ 4
- 0
IPA.Loader/doc/index.md View File

@ -0,0 +1,4 @@
# This is the **HOMEPAGE**.
Refer to [Markdown](http://daringfireball.net/projects/markdown/) for how to write markdown files.
## Quick Start Notes:
1. Add images to the *images* folder if the file is referencing an image.

+ 5
- 0
IPA.Loader/doc/toc.yml View File

@ -0,0 +1,5 @@
- name: Articles
href: articles/
- name: Api Documentation
href: api/
homepage: api/index.md

Loading…
Cancel
Save