Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using SpaceTech.Content;
- using Reus.Settings.Model;
- using SpaceTech;
- using Microsoft.Xna.Framework.Content;
- using System.Reflection;
- using Reus.Settings.Model.Giants;
- using Game.Settings.Grammar;
- using Reus.Model.Flora;
- using Reus.Model.Animals;
- using Reus.Model.Mines;
- using Reus.Model.Aspects;
- using Reus.Model.Civilizations.Challenges;
- using Reus.Settings.Model.Ambassadors;
- using Reus.Model.Civilizations.Conversations;
- using System.Collections;
- namespace ConsoleApplication1
- {
- class Program
- {
- private static ContentManager mgr;
- static void Main(string[] args)
- {
- ServiceProvider sp = new ServiceProvider();
- String dir = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Reus\\";
- mgr = new ContentManager(sp, dir);
- Dump("Fo ", mgr.Load<GiantSettings>("Settings/Model/Giants/Forest"));
- Dump("Oc", mgr.Load<GiantSettings>("Settings/Model/Giants/Ocean"));
- Dump("Ro", mgr.Load<GiantSettings>("Settings/Model/Giants/Rock"));
- Dump("Sw", mgr.Load<GiantSettings>("Settings/Model/Giants/Swamp"));
- Display<Ruleset>("Settings/Controller/NameGenerator/Motivationals");
- Display<Ruleset>("Settings/Controller/NameGenerator/Wars");
- Display<Parameters>("Settings/Model/Parameters");
- Display<FloraAssetDefinitionDatabase>("Settings/Model/Flora");
- Display<AnimalDefinitionDatabase>("Settings/Model/Animals");
- Display<MineDefinitionDatabase>("Settings/Model/Mines");
- Display<AspectDefinitionDatabase>("Settings/Model/Aspects");
- Display<CivChallengeDefinitionDatabase>("Settings/Model/CivChallenges", DumpCivChallengeDefinitionDatabase);
- Display<AmbassadorDefinitionDatabase>("Settings/Model/Ambassadors");
- Display<Ruleset>("Settings/Controller/NameGenerator/CityNames");
- Display<TopicList>("Settings/Model/Topics");
- Display<CivilizationParameters>("Settings/Model/Civilizations");
- Display<Parameters>("Settings/Model/Parameters");
- Console.WriteLine("Press any key");
- Console.ReadLine();
- }
- private static void Display<T>(string asset, Action<T> dumpAction = null) {
- Console.WriteLine("Asset: " + asset + " of type " + typeof(T));
- T value = mgr.Load<T>(asset);
- if (dumpAction == null)
- {
- Dump("", value);
- }
- else
- {
- dumpAction(value);
- }
- Console.WriteLine();
- }
- private static void DumpCivChallengeDefinitionDatabase(CivChallengeDefinitionDatabase ccdb)
- {
- foreach (CivChallengeDescription cc in ccdb)
- {
- Dump(cc.Name + " ", cc);
- foreach (ICivChallengeRequirement req in cc.MissionRequirements)
- {
- Dump("req ", req);
- }
- break;
- }
- }
- private static void Dump<T>(string prefix , T dinges, Boolean toplevel = true)
- {
- if (!toplevel) Console.WriteLine(prefix+dinges);
- PropertyInfo[] pis = dinges.GetType().GetProperties();
- foreach (var pi in pis)
- {
- if (pi.GetIndexParameters().Length == 0)
- {
- object val = pi.GetValue(dinges, null);
- Console.WriteLine(prefix + "(property)" + pi.Name + " = " + val + " of type " + pi.PropertyType);
- }
- else
- {
- Console.Write(prefix + "(property)" + pi.Name + " is indexed by ");
- foreach (ParameterInfo ip in pi.GetIndexParameters())
- {
- Console.Write(ip.ParameterType + " ");
- }
- Console.WriteLine();
- }
- }
- FieldInfo[] fis = dinges.GetType().GetFields();
- foreach (var fi in fis)
- {
- object val = fi.GetValue(dinges);
- Console.WriteLine(prefix + fi.Name + " = " + val + " of type " + val.GetType());
- if (val.GetType().IsClass) {
- Dump(prefix + " ", val, false);
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment