public static void DefLabels() { List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (Type type in from def in GenDefDatabase.AllDefTypesWithDatabases() orderby def.Name select def) { DebugMenuOption item = new DebugMenuOption(type.Name, DebugMenuOptionMode.Action, delegate { IEnumerable source = (IEnumerable)GenGeneric.GetStaticPropertyOnGenericType(typeof(DefDatabase <>), type, "AllDefs"); int num = 0; StringBuilder stringBuilder = new StringBuilder(); foreach (Def item2 in source.Cast <Def>()) { stringBuilder.AppendLine(item2.label); num++; if (num >= 500) { Log.Message(stringBuilder.ToString()); stringBuilder = new StringBuilder(); num = 0; } } Log.Message(stringBuilder.ToString()); }); list.Add(item); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); }
public static void DefNamesAll() { StringBuilder stringBuilder = new StringBuilder(); int num = 0; foreach (Type item in from def in GenDefDatabase.AllDefTypesWithDatabases() orderby def.Name select def) { IEnumerable source = (IEnumerable)GenGeneric.GetStaticPropertyOnGenericType(typeof(DefDatabase <>), item, "AllDefs"); stringBuilder.AppendLine("-- " + item.ToString()); foreach (Def item2 in from Def def in source orderby def.defName select def) { stringBuilder.AppendLine(item2.defName); num++; if (num >= 500) { Log.Message(stringBuilder.ToString()); stringBuilder = new StringBuilder(); num = 0; } } stringBuilder.AppendLine(); stringBuilder.AppendLine(); } Log.Message(stringBuilder.ToString()); }
public static IEnumerable <Def> GetAllDefsInDatabaseForDef(Type defType) { return(((IEnumerable)GenGeneric.GetStaticPropertyOnGenericType(typeof(DefDatabase <>), defType, "AllDefs")).Cast <Def>()); }