Clean up some spaces in FileTools, and make the motd format a const.
This commit is contained in:
parent
8a7aae9143
commit
5488be0857
1 changed files with 25 additions and 23 deletions
|
|
@ -25,33 +25,35 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
public class FileTools
|
public class FileTools
|
||||||
{
|
{
|
||||||
/// <summary>
|
private const string MotdFormat =
|
||||||
/// Path to the file containing the rules.
|
"This server is running TShock for Terraria.\n Type /help for a list of commands.\n%255,000,000%Current map: %map%\nCurrent players: %players%";
|
||||||
/// </summary>
|
/// <summary>
|
||||||
|
/// Path to the file containing the rules.
|
||||||
|
/// </summary>
|
||||||
internal static string RulesPath
|
internal static string RulesPath
|
||||||
{
|
{
|
||||||
get { return Path.Combine(TShock.SavePath, "rules.txt"); }
|
get { return Path.Combine(TShock.SavePath, "rules.txt"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Path to the file containing the message of the day.
|
/// Path to the file containing the message of the day.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string MotdPath
|
internal static string MotdPath
|
||||||
{
|
{
|
||||||
get { return Path.Combine(TShock.SavePath, "motd.txt"); }
|
get { return Path.Combine(TShock.SavePath, "motd.txt"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Path to the file containing the whitelist.
|
/// Path to the file containing the whitelist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string WhitelistPath
|
internal static string WhitelistPath
|
||||||
{
|
{
|
||||||
get { return Path.Combine(TShock.SavePath, "whitelist.txt"); }
|
get { return Path.Combine(TShock.SavePath, "whitelist.txt"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Path to the file containing the config.
|
/// Path to the file containing the config.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string ConfigPath
|
internal static string ConfigPath
|
||||||
{
|
{
|
||||||
get { return Path.Combine(TShock.SavePath, "config.json"); }
|
get { return Path.Combine(TShock.SavePath, "config.json"); }
|
||||||
|
|
@ -65,20 +67,20 @@ namespace TShockAPI
|
||||||
get { return Path.Combine(TShock.SavePath, "sscconfig.json"); }
|
get { return Path.Combine(TShock.SavePath, "sscconfig.json"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an empty file at the given path.
|
/// Creates an empty file at the given path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="file">The path to the file.</param>
|
/// <param name="file">The path to the file.</param>
|
||||||
public static void CreateFile(string file)
|
public static void CreateFile(string file)
|
||||||
{
|
{
|
||||||
File.Create(file).Close();
|
File.Create(file).Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a file if the files doesn't already exist.
|
/// Creates a file if the files doesn't already exist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="file">The path to the files</param>
|
/// <param name="file">The path to the files</param>
|
||||||
/// <param name="data">The data to write to the file.</param>
|
/// <param name="data">The data to write to the file.</param>
|
||||||
public static void CreateIfNot(string file, string data = "")
|
public static void CreateIfNot(string file, string data = "")
|
||||||
{
|
{
|
||||||
if (!File.Exists(file))
|
if (!File.Exists(file))
|
||||||
|
|
@ -98,8 +100,8 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateIfNot(RulesPath, "Respect the admins!\nDon't use TNT!");
|
CreateIfNot(RulesPath, "Respect the admins!\nDon't use TNT!");
|
||||||
CreateIfNot(MotdPath,
|
CreateIfNot(MotdPath, MotdFormat);
|
||||||
"This server is running TShock for Terraria.\n Type /help for a list of commands.\n%255,000,000%Current map: %map%\nCurrent players: %players%");
|
|
||||||
CreateIfNot(WhitelistPath);
|
CreateIfNot(WhitelistPath);
|
||||||
if (File.Exists(ConfigPath))
|
if (File.Exists(ConfigPath))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue