Change the way we ignore packets from clients while swapping with SSC inv.
Add dump for SSC, and terminate the application (maybe).
This commit is contained in:
parent
7fe761bacb
commit
b031f45cb0
3 changed files with 44 additions and 2 deletions
|
|
@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TShockAPI.ServerSideCharacters
|
||||
|
|
@ -61,5 +63,37 @@ namespace TShockAPI.ServerSideCharacters
|
|||
writer.Write(JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dumps all configuration options to a text file in Markdown format
|
||||
/// </summary>
|
||||
public static void DumpDescriptions()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var defaults = new ServerSideConfig();
|
||||
|
||||
foreach (var field in defaults.GetType().GetFields().OrderBy(f => f.Name))
|
||||
{
|
||||
if (field.IsStatic)
|
||||
continue;
|
||||
|
||||
var name = field.Name;
|
||||
var type = field.FieldType.Name;
|
||||
|
||||
var descattr =
|
||||
field.GetCustomAttributes(false).FirstOrDefault(o => o is DescriptionAttribute) as DescriptionAttribute;
|
||||
var desc = descattr != null && !string.IsNullOrWhiteSpace(descattr.Description) ? descattr.Description : "None";
|
||||
|
||||
var def = field.GetValue(defaults);
|
||||
|
||||
sb.AppendLine("{0} ".SFormat(name));
|
||||
sb.AppendLine("Type: {0} ".SFormat(type));
|
||||
sb.AppendLine("Description: {0} ".SFormat(desc));
|
||||
sb.AppendLine("Default: \"{0}\" ".SFormat(def));
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
File.WriteAllText("ServerSideConfigDescriptions.txt", sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue