Exemplo n.º 1
0
        static void DumpDescriptions()
        {
            var sb       = new StringBuilder();
            var defaults = new ExtendedAdminConfig();

            foreach (var field in defaults.GetType().GetFields())
            {
                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("ConfigDescriptions.txt", sb.ToString());
        }
Exemplo n.º 2
0
        public static void InitConfig()
        {
            if (!Directory.Exists(TShock.SavePath))
            {
                Directory.CreateDirectory(TShock.SavePath);
            }

            if (File.Exists(ConfigPath))
            {
                ExtendedAdmin.Config = ExtendedAdminConfig.Read(ConfigPath);
            }

            ExtendedAdmin.Config.Write(ConfigPath);
        }
Exemplo n.º 3
0
 public ExtendedAdmin(Terraria.Main game) :
     base(game)
 {
     Config = new ExtendedAdminConfig();
 }
Exemplo n.º 4
0
 public ExtendedAdmin(Terraria.Main game)
     : base(game)
 {
     Config = new ExtendedAdminConfig();
 }
Exemplo n.º 5
0
        static void DumpDescriptions()
        {
            var sb = new StringBuilder();
            var defaults = new ExtendedAdminConfig();

            foreach (var field in defaults.GetType().GetFields())
            {
                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("ConfigDescriptions.txt", sb.ToString());
        }