Added some documentation to some stuff
This commit is contained in:
parent
8ecabb7f2e
commit
1fb554a804
2 changed files with 32 additions and 1 deletions
|
|
@ -233,6 +233,11 @@ namespace TShockAPI
|
|||
[Description("Prevent players from interacting with the world if dead")] public bool PreventDeadModification =
|
||||
false;
|
||||
|
||||
/// <summary>
|
||||
/// Reads a configuration file from a given path
|
||||
/// </summary>
|
||||
/// <param name="path">string path</param>
|
||||
/// <returns>ConfigFile object</returns>
|
||||
public static ConfigFile Read(string path)
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
|
|
@ -243,6 +248,11 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the configuration file from a stream
|
||||
/// </summary>
|
||||
/// <param name="stream">stream</param>
|
||||
/// <returns>ConfigFile object</returns>
|
||||
public static ConfigFile Read(Stream stream)
|
||||
{
|
||||
using (var sr = new StreamReader(stream))
|
||||
|
|
@ -254,6 +264,10 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the configuration to a given path
|
||||
/// </summary>
|
||||
/// <param name="path">string path - Location to put the config file</param>
|
||||
public void Write(string path)
|
||||
{
|
||||
using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Write))
|
||||
|
|
@ -262,6 +276,10 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the configuration to a stream
|
||||
/// </summary>
|
||||
/// <param name="stream">stream</param>
|
||||
public void Write(Stream stream)
|
||||
{
|
||||
var str = JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
|
|
@ -271,9 +289,14 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On config read hook
|
||||
/// </summary>
|
||||
public static Action<ConfigFile> ConfigRead;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Dumps all configuration options to a text file in Markdown format
|
||||
/// </summary>
|
||||
public static void DumpDescriptions()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue