public static List <Def> GetResearchUnlocked(this ResearchProjectDef researchProjectDef) { #if DEBUG CCL_Log.TraceMod( researchProjectDef, Verbosity.Stack, "GetResearchUnlocked()" ); #endif var researchDefs = new List <Def>(); //Log.Message( "Normal" ); researchDefs.AddRangeUnique(DefDatabase <ResearchProjectDef> .AllDefsListForReading.Where(rd => (!rd.prerequisites.NullOrEmpty()) && (rd.prerequisites.Contains(researchProjectDef)) ).ToList().ConvertAll <Def>(def => (Def)def)); //Log.Message( "Advanced" ); // same as prerequisites, but with effectedResearchDefs and researchDefs switched. var advancedResearchDefs = Controller.Data.AdvancedResearchDefs.Where(a => ( (a.IsResearchToggle) && (!a.HideDefs) && (a.researchDefs.Contains(researchProjectDef)) )).ToList(); researchDefs.AddRangeUnique(advancedResearchDefs.SelectMany(ar => ar.effectedResearchDefs).ToList().ConvertAll <Def>(Def => (Def)Def)); return(researchDefs); }
public static bool IsLockedOut(this BuildableDef buildableDef) { bool rVal; var foo = buildableDef.GetHashCode(); if (!isLockedOut.TryGetValue(buildableDef.shortHash, out rVal)) { #if DEBUG CCL_Log.TraceMod( buildableDef, Verbosity.Stack, "IsLockedOut()" ); #endif // Is it a frame or blueprint? if ( (buildableDef.defName.EndsWith("_Frame")) || (buildableDef.defName.EndsWith("_Blueprint")) || (buildableDef.defName.EndsWith("_Blueprint_Install")) ) { isLockedOut.Add(buildableDef.shortHash, true); return(true); } // Logic is faulty ( Thingdefs inherit from buildable defs, checking for existence of blueprint eliminates all non-buildings ) // After correcting logic (Valid: blueprint == null [items], or blueprint != null and designation != null/None [buildings]), // the check no longer makes sense, since only defs with a designation category ever get a blueprint assigned. -- Fluffy. // //// Is the designationCategory locked out? //// only applies if it is buildable (has a blueprint def), but no category. //if( // buildableDef.blueprintDef != null && // ( buildableDef.designationCategory.NullOrEmpty()|| // buildableDef.designationCategory == "None" ) //) //{ // isLockedOut.Add( buildableDef, true ); // return true; //} // If the research locks it's out, check for an ARDef unlock if ( (buildableDef.researchPrerequisites != null) && (buildableDef.researchPrerequisites.Any(def => def.IsLockedOut())) && (!Controller.Data.AdvancedResearchDefs.Any(a => ( (a.IsBuildingToggle) && (!a.HideDefs) && (a.thingDefs.Contains(buildableDef as ThingDef)) )))) { rVal = true; } // Cache the result isLockedOut.Add(buildableDef.shortHash, rVal); } return(rVal); }
public static bool HasResearchRequirement(this BuildableDef buildableDef) { #if DEBUG CCL_Log.TraceMod( buildableDef, Verbosity.Stack, "HasResearchRequirement()" ); #endif // Can't entirely rely on this one check as it's state may change mid-game if ( (buildableDef.researchPrerequisites != null) && (buildableDef.researchPrerequisites.Any(def => def != null)) ) { // Easiest check, do it first return(true); } // Check for an advanced research unlock return (Controller.Data.AdvancedResearchDefs.Any(a => ( (a.IsBuildingToggle) && (!a.HideDefs) && (a.thingDefs.Contains(buildableDef as ThingDef)) ))); }
public bool Inject(ModHelperDef def) { if (def.PostLoadInjectors.NullOrEmpty()) { return(true); } foreach (var injectorType in def.PostLoadInjectors) { try { var injectorObject = (SpecialInjector)Activator.CreateInstance(injectorType); if (injectorObject == null) { CCL_Log.Message(string.Format("Unable to create instance of '{0}'", injectorType.ToString())); return(false); } if (!injectorObject.Inject()) { CCL_Log.Message(string.Format("Error injecting '{0}'", injectorType.ToString())); return(false); } } catch (Exception e) { CCL_Log.Message(e.ToString(), string.Format("Error injecting '{0}'", injectorType.ToString())); return(false); } } dictInjected.Add(def.defName, true); return(true); }
public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot) { var Restrictions = checkingDef.RestrictedPlacement_Properties(); #if DEBUG if (Restrictions == null) { CCL_Log.Error("PlaceWorker_RestrictedCount unable to get properties!", checkingDef.defName); return(AcceptanceReport.WasRejected); } #endif var thingDef = checkingDef as ThingDef; #if DEBUG if (thingDef == null) { CCL_Log.Error("PlaceWorker_RestrictedCount unable to get cast BuildableDef to ThingDef!", checkingDef.defName); return(AcceptanceReport.WasRejected); } #endif // Get the current count of instances and blueprints of int count = Find.ListerThings.ThingsOfDef(thingDef).Count + Find.ListerThings.ThingsOfDef(thingDef.blueprintDef).Count; return(count < Restrictions.MaxCount ? AcceptanceReport.WasAccepted : "MessagePlacementCountRestricted".Translate(Restrictions.MaxCount)); }
private bool DumpAllModsAssemblies() { var stream = CCL_Log.OpenStream("assembly_dump.txt"); if (stream == null) { return(false); } DumpAssembly(stream, Controller.Data.Assembly_CSharp); foreach (var mod in Controller.Data.Mods) { if (!mod.assemblies.loadedAssemblies.NullOrEmpty()) { CCL_Log.Write("Mod: " + mod.Identifier); foreach (var assembly in mod.assemblies.loadedAssemblies) { DumpAssembly(stream, assembly); } } } CCL_Log.CloseStream(stream); return(true); }
// Replace the comp props with a new one with different values // must replace comp props as comps share props for things of the // same class. We need to make a unique copy for the building. public void ChangeColor(ColorInt color) { // Get glower var glower = CompGlower; // New glower properties var newProps = new CompProperties_Glower(); if (newProps == null) { CCL_Log.Error("CompColoredLight unable to create new CompProperties!", parent.def.defName); return; } // Set the new properties values newProps.compClass = typeof(CompGlower); newProps.glowColor = color; newProps.glowRadius = lightRadius; // Initialize comp with new properties glower.Initialize(newProps); // Update glow grid //glower.UpdateLit(); <-- Only works if the light changes state (on<->off) Find.GlowGrid.MarkGlowGridDirty(parent.Position); }
public bool Inject(ModHelperDef def) { if (def.MapComponents.NullOrEmpty()) { return(true); } var existingComponents = Find.Map.components; foreach (var componentType in def.MapComponents) { if (!existingComponents.Exists(c => c.GetType() == componentType)) { var componentObject = (MapComponent)Activator.CreateInstance(componentType); if (componentObject == null) { CCL_Log.Message(string.Format("Unable to create instance of '{0}'", componentType)); return(false); } existingComponents.Add(componentObject); } } return(true); }
public bool Inject(ModHelperDef def) { if (def.TraderKinds.NullOrEmpty()) { return(true); } for (var index = 0; index < def.TraderKinds.Count; index++) { var injectionSet = def.TraderKinds[index]; if ( (!injectionSet.requiredMod.NullOrEmpty()) && (Find_Extensions.ModByName(injectionSet.requiredMod) == null) ) { continue; } var traderKindDef = DefDatabase <TraderKindDef> .GetNamed(injectionSet.targetDef); foreach (var stockGenerator in injectionSet.stockGenerators) { traderKindDef.stockGenerators.Add(stockGenerator); stockGenerator.PostLoad(); stockGenerator.ResolveReferences(traderKindDef); CCL_Log.TraceMod( def, Verbosity.Injections, string.Format("Injecting {0} into {1}", stockGenerator.GetType().Name, traderKindDef.label), "TraderKinds"); } } dictInjected.Add(def, true); return(true); }
public static void SaveHostData(MCMHost host) { var filePath = HostFilePath(host); // Open it for writing try { Scribe.InitWriting(filePath, "ModConfigurationData"); if (Scribe.mode == LoadSaveMode.Saving) { // Write this library version as the one saved with string version = Version.Current.ToString(); Scribe_Values.LookValue <string>(ref version, "ccl_version"); // Call the worker scribe Scribe_Deep.LookDeep <MCMHost>(ref host, host.key); } } catch (Exception e) { CCL_Log.Trace( Verbosity.NonFatalErrors, string.Format("Unexpected error scribing data for mod {0}\n{1}", host.Label, e.ToString()), "Mod Configuration Menu"); } finally { // Finish Scribe.FinalizeWriting(); Scribe.mode = LoadSaveMode.Inactive; Messages.Message("ModConfigurationSaved".Translate(host.Label), MessageSound.Standard); } host.OpenedThisSession = false; }
public static List <Def> GetResearchedLockedBy(this ResearchProjectDef researchProjectDef) { #if DEBUG CCL_Log.TraceMod( researchProjectDef, Verbosity.Stack, "GetResearchLockedBy()" ); #endif // Advanced Research that locks it var researchDefs = new List <Def>(); // Look in advanced research var advancedResearch = Controller.Data.AdvancedResearchDefs.Where(a => ( (a.IsResearchToggle) && (a.HideDefs) && (a.effectedResearchDefs.Contains(researchProjectDef)) )).ToList(); // Aggregate research if (!advancedResearch.NullOrEmpty()) { foreach (var a in advancedResearch) { researchDefs.AddRangeUnique(a.researchDefs.ConvertAll <Def>(def => (Def)def)); } } return(researchDefs); }
// XML data into verb protected virtual void TryGetProps() { if (gotProps) { //Already done, pass return; } var props = verbProps as VerbProperties_Extended; if (props == null) { #if DEBUG CCL_Log.TraceMod( this.caster.def, Verbosity.Warnings, "Missing VerbProperties_Extended" ); #endif pelletCount = 1; expMin = 10; expMid = 50; expMax = 240; } else { pelletCount = props.pelletCount; expMin = props.experienceGain.min; expMid = props.experienceGain.mid; expMax = props.experienceGain.max; } gotProps = true; }
public static List <RecipeDef> GetRecipesUnlocked(this ThingDef thingDef, ref List <Def> researchDefs) { #if DEBUG CCL_Log.TraceMod( thingDef, Verbosity.Stack, "GetRecipesUnlocked()" ); #endif // Recipes that are unlocked on thing with research var recipeDefs = new List <RecipeDef>(); if (researchDefs != null) { researchDefs.Clear(); } // Look at recipes var recipes = DefDatabase <RecipeDef> .AllDefsListForReading.Where(r => ( (r.researchPrerequisite != null) && ( ( (r.recipeUsers != null) && (r.recipeUsers.Contains(thingDef)) ) || ( (thingDef.recipes != null) && (thingDef.recipes.Contains(r)) ) ) && (!r.IsLockedOut()) )).ToList(); // Look in advanced research too var advancedResearch = Controller.Data.AdvancedResearchDefs.Where(a => ( (a.IsRecipeToggle) && (!a.HideDefs) && (a.thingDefs.Contains(thingDef)) )).ToList(); // Aggregate advanced research foreach (var a in advancedResearch) { recipeDefs.AddRangeUnique(a.recipeDefs); if (researchDefs != null) { if (a.researchDefs.Count == 1) { // If it's a single research project, add that researchDefs.AddUnique(a.researchDefs[0]); } else { // Add the advanced project instead researchDefs.AddUnique(a); } } } return(recipeDefs); }
public override void ResolveReferences() { base.ResolveReferences(); if (category == null) { CCL_Log.Error("Category resolved to null", "HelpDef :: " + defName); } }
public static void Log() { #if DEBUG CCL_Log.Message("v" + Current + " (debug)"); #else CCL_Log.Message("v" + Current); #endif }
public override void PostSpawnSetup() { base.PostSpawnSetup(); // Get the default glower CompGlower = parent.TryGetComp <CompGlower>(); #if DEBUG if (CompGlower == null) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Missing CompGlower" ); return; } #endif // Get the color properties ColorProps = this.CompProperties_ColoredLight(); #if DEBUG if (ColorProps == null) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Missing CompProperties_ColoredLight" ); return; } #endif // Set default palette if none is specified if (ColorProps.color == null) { ColorProps.color = Light.Color; } // Set default if ((ColorIndex < 0) || (ColorIndex >= ColorProps.color.Count)) { ColorIndex = ColorProps.Default; } // Get the glow radius lightRadius = CompGlower.Props.glowRadius; // Set the light color if (ColorProps.useColorPicker) { ChangeColor(Color, false); } else { ChangeColor(ColorIndex); } }
public override void PostLoad() { base.PostLoad(); if (ModName.NullOrEmpty()) { CCL_Log.Error("ModName resolved to null", "HelpCategoryDef :: " + defName); } }
public static bool HasResearchRequirement(this RecipeDef recipeDef) { #if DEBUG CCL_Log.TraceMod( recipeDef, Verbosity.Stack, "HasResearchRequirement()" ); #endif // Can't entirely rely on this one check as it's state may change mid-game if (recipeDef.researchPrerequisite != null) { // Easiest check, do it first return(true); } // Check for an advanced research unlock if (Controller.Data.AdvancedResearchDefs.Any(a => ( (a.IsRecipeToggle) && (!a.HideDefs) && (a.recipeDefs.Contains(recipeDef)) ))) { return(true); } // Get list of things referencing var thingsOn = DefDatabase <ThingDef> .AllDefsListForReading.Where(t => ( (t.recipes != null) && (t.recipes.Contains(recipeDef)) && (!t.IsLockedOut()) )).ToList(); if (thingsOn == null) { thingsOn = new List <ThingDef>(); } else { thingsOn.AddRangeUnique(recipeDef.recipeUsers); } var advancedResearchDefs = Controller.Data.AdvancedResearchDefs.Where(a => ( (a.IsRecipeToggle) && (a.recipeDefs.Contains(recipeDef)) && (!a.HideDefs) )).ToList(); if (!advancedResearchDefs.NullOrEmpty()) { foreach (var a in advancedResearchDefs) { thingsOn.AddRangeUnique(a.thingDefs); } } // Now check for an absolute requirement return(thingsOn.All(t => t.HasResearchRequirement())); }
public static List <ThingDef> GetThingsUnlocked(this RecipeDef recipeDef, ref List <Def> researchDefs) { #if DEBUG CCL_Log.TraceMod( recipeDef, Verbosity.Stack, "GetThingsUnlocked()" ); #endif // Things it is unlocked on with research var thingDefs = new List <ThingDef>(); if (researchDefs != null) { researchDefs.Clear(); } if (recipeDef.researchPrerequisite != null) { thingDefs.AddRangeUnique(recipeDef.recipeUsers); if (researchDefs != null) { researchDefs.AddUnique(recipeDef.researchPrerequisite); } } // Look in advanced research too var advancedResearch = Controller.Data.AdvancedResearchDefs.Where(a => ( (a.IsRecipeToggle) && (!a.HideDefs) && (a.recipeDefs.Contains(recipeDef)) )).ToList(); // Aggregate advanced research if (!advancedResearch.NullOrEmpty()) { foreach (var a in advancedResearch) { thingDefs.AddRangeUnique(a.thingDefs); if (researchDefs != null) { if (a.researchDefs.Count == 1) { // If it's a single research project, add that researchDefs.AddUnique(a.researchDefs[0]); } else { // Add the advanced project instead researchDefs.AddUnique(a); } } } } return(thingDefs); }
public void Disable(bool firstTimeRun = false) { // Don't disable if it's not the first run and not yet enabled if ( (researchState == ResearchEnableMode.Incomplete) && (firstTimeRun == false) ) { return; } #if DEBUG CCL_Log.TraceMod( modHelperDef, Verbosity.StateChanges, "Disabling '" + defName + "'", "AdvancedResearchDef" ); #endif if (IsRecipeToggle) { // Recipe toggle ToggleRecipes(true); } if (IsPlantToggle) { // Plant toggle TogglePlants(true); } if (IsBuildingToggle) { // Building toggle ToggleBuildings(true); } if ( (IsResearchToggle) && (researchState != ResearchEnableMode.GodMode) ) { // Research toggle ToggleResearch(true); } if ( (HasCallbacks) && (!firstTimeRun) ) { // Cache callbacks ToggleCallbacks(true); } if (HasHelp) { // Build & toggle help ToggleHelp(true); } // Flag it as disabled researchState = ResearchEnableMode.Incomplete; }
public static bool InitializeHosts(bool preload = false) { if (preload) { Controller.Data.MCMHosts.Clear(); } // Get the mods with config menus foreach (var mhd in Controller.Data.ModHelperDefs) { // Create all the menus for it if (!mhd.ModConfigurationMenus.NullOrEmpty()) { foreach (var mcm in mhd.ModConfigurationMenus) { if ( // Filter out preload during non-preload and non-preload during preload ( (preload) && (mcm.preload) ) || ( (!preload) && (!mcm.preload) ) ) { var host = Controller.Data.MCMHosts.Find(m => m.worker.InjectionSet == mcm); if (host != null) { // MCM already created....? CCL_Log.TraceMod( mhd, Verbosity.Warnings, string.Format("{0} - Tried to create an MCM when an MCM already exists", mcm.mcmClass.ToString()) ); continue; } host = new MCMHost(); host.Label = mcm.label; host.worker = (ModConfigurationMenu)Activator.CreateInstance(mcm.mcmClass); if (host.worker == null) { CCL_Log.Error(string.Format("Unable to create instance of {0}", mcm.mcmClass.ToString())); return(false); } else { // Initialize, add it to the menu list and then load it's data host.worker.InjectionSet = mcm; host.worker.Initialize(); Controller.Data.MCMHosts.Add(host); LoadHostData(host); } } } } } return(true); }
public static List <string> GetSowTagsUnlocked(this ResearchProjectDef researchProjectDef, ref List <ThingDef> thingDefs) { #if DEBUG CCL_Log.TraceMod( researchProjectDef, Verbosity.Stack, "GetSowTagsUnlocked()" ); #endif var sowTags = new List <string>(); if (thingDefs != null) { thingDefs.Clear(); } // Add all plants using this research project var researchPlants = DefDatabase <ThingDef> .AllDefsListForReading.Where(d => ( (d.plant != null) && (!d.plant.sowResearchPrerequisites.NullOrEmpty()) && (d.plant.sowResearchPrerequisites.Contains(researchProjectDef)) )).ToList(); if (!researchPlants.NullOrEmpty()) { foreach (var plant in researchPlants) { sowTags.AddRangeUnique(plant.plant.sowTags); } if (thingDefs != null) { thingDefs.AddRangeUnique(researchPlants); } } // Look in advanced research to add plants and sow tags it unlocks var advancedResearch = Controller.Data.AdvancedResearchDefs.Where(a => ( (a.IsPlantToggle) && (!a.HideDefs) && (a.researchDefs.Count == 1) && (a.researchDefs.Contains(researchProjectDef)) )).ToList(); // Aggregate advanced research if (!advancedResearch.NullOrEmpty()) { foreach (var a in advancedResearch) { sowTags.AddRangeUnique(a.sowTags); if (thingDefs != null) { thingDefs.AddRangeUnique(a.thingDefs); } } } return(sowTags); }
public static List <RecipeDef> GetRecipesCurrent(this ThingDef thingDef) { #if DEBUG CCL_Log.TraceMod( thingDef, Verbosity.Stack, "GetRecipesCurrent()" ); #endif return(thingDef.AllRecipes); }
public void ExposeData() { if (worker == null) { CCL_Log.Trace( Verbosity.FatalErrors, string.Format("worker is null in MCMHost for {0}", Label), "Mod Configuration Menu"); return; } // Call the worker expose data worker.ExposeData(); }
// The list of things are all the growers we want to change void GroupPlantChange(List <Thing> things) { var thisGrower = Building_PlantGrower; #if DEBUG if (thisGrower == null) { CCL_Log.TraceMod( parent.def, Verbosity.NonFatalErrors, "Unable to resolve ThingClass to base Building_PlantGrower" ); return; } #endif // Get plant to grow var plantDef = thisGrower.GetPlantDefToGrow(); if (GenList.NullOrEmpty(plantDef?.plant?.sowTags)) { // "Plant" doesn't contain the required information CCL_Log.TraceMod( parent.def, Verbosity.Warnings, "Unable to resolve plant def to grow" ); return; } // Now set their plant foreach (Thing g in things) { // Should be a Building_PlantGrower var grower = g as Building_PlantGrower; #if DEBUG if (string.IsNullOrEmpty(grower?.def?.building.sowTag)) { CCL_Log.TraceMod( parent.def, Verbosity.Warnings, "Unable to resolve other things ThingClass to base Building_PlantGrower" ); return; } #endif // Only set if the sow tags match if (plantDef.plant.sowTags.Contains(grower.def.building.sowTag)) { grower.SetPlantDefToGrow(plantDef); } } }
public static bool CaptureBegin(StringBuilder target) { if (captureTarget == null) { captureTarget = target; captureVerbosity = Verbosity.Default; return(true); } if (captureTarget == target) { CCL_Log.Error("Already capturing log", "Log Capture"); return(true); } return(false); }
public static Pawn_DrawTracker GetPawnDrawTracker(this Pawn pawn) { if (_GetPawnDrawTracker == null) { _GetPawnDrawTracker = typeof(Pawn).GetField("drawer", BindingFlags.Instance | BindingFlags.NonPublic); if (_GetPawnDrawTracker == null) { CCL_Log.Trace( Verbosity.FatalErrors, "Unable to get 'drawer' in class 'Pawn'", "CommunityCoreLibrary.Detour.JobDriver_SocialRelax"); return(null); } } return((Pawn_DrawTracker)_GetPawnDrawTracker.GetValue(pawn)); }
public static bool IsLockedOut(this RecipeDef recipeDef) { bool rVal = false; if (!isLockedOut.TryGetValue(recipeDef.shortHash, out rVal)) { #if DEBUG CCL_Log.TraceMod( recipeDef, Verbosity.Stack, "IsLockedOut()" ); #endif // Advanced research unlocking it? if (Controller.Data.AdvancedResearchDefs.Any(a => ( (a.IsRecipeToggle) && (!a.HideDefs) && (a.recipeDefs.Contains(recipeDef)) ))) { isLockedOut.Add(recipeDef.shortHash, false); return(false); } // Is the research parent locked out? if ( (recipeDef.researchPrerequisite != null) && (recipeDef.researchPrerequisite.IsLockedOut()) ) { isLockedOut.Add(recipeDef.shortHash, true); return(true); } // Is everything using it locked? if (!DefDatabase <ThingDef> .AllDefsListForReading.Any(t => ( (t.AllRecipes != null) && (t.AllRecipes.Contains(recipeDef)) && (!t.IsLockedOut()) ))) { rVal = true; } isLockedOut.Add(recipeDef.shortHash, rVal); } return(rVal); }
public override void PostLoad() { base.PostLoad(); if (first.NullOrEmpty()) { CCL_Log.Error("Custom name with defName: " + defName + " has no defined first name. It will not be added.", "Backstories"); return; } if (last.NullOrEmpty()) { CCL_Log.Error("Custom name with defName: " + defName + " has no defined last name. It will not be added.", "Backstories"); return; } PawnNameDatabaseSolid.AddPlayerContentName(Name, genderPossibility); }
public static List <RecipeDef> GetRecipesLocked(this ThingDef thingDef, ref List <Def> researchDefs) { #if DEBUG CCL_Log.TraceMod( thingDef, Verbosity.Stack, "GetRecipesLocked()" ); #endif // Things it is locked on with research var recipeDefs = new List <RecipeDef>(); if (researchDefs != null) { researchDefs.Clear(); } // Look in advanced research var advancedResearch = Controller.Data.AdvancedResearchDefs.Where(a => ( (a.IsRecipeToggle) && (a.HideDefs) && (a.thingDefs.Contains(thingDef)) )).ToList(); // Aggregate advanced research foreach (var a in advancedResearch) { recipeDefs.AddRangeUnique(a.recipeDefs); if (researchDefs != null) { if (a.researchDefs.Count == 1) { // If it's a single research project, add that researchDefs.AddUnique(a.researchDefs[0]); } else if (a.ResearchConsolidator != null) { // Add the advanced project instead researchDefs.AddUnique(a.ResearchConsolidator); } } } return(recipeDefs); }
private void DumpAssembly( CCL_Log.LogStream stream, Assembly assembly ) { CCL_Log.IndentStream( stream ); { CCL_Log.Write( "Assembly: " + assembly.GetName(), stream ); CCL_Log.IndentStream( stream ); { foreach( var type in assembly.GetTypes() ) { CCL_Log.Write( "Type: " + type.FullName, stream ); CCL_Log.IndentStream( stream ); { #region Fields var fields = type.GetFields( BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public ); if( !fields.NullOrEmpty() ) { CCL_Log.Write( "Fields:", stream ); CCL_Log.IndentStream( stream ); { foreach( var entity in fields ) { var str = entity.FieldType.Name; str += " " + entity.Name; if( entity.IsStatic ) str += " (Static)"; else str += " (Instance)"; if( entity.IsPrivate ) str += " (NonPublic)"; if( entity.IsPublic ) str += " (Public)"; CCL_Log.Write( str, stream ); } } CCL_Log.IndentStream( stream, -1 ); } #endregion #region Properties var properties = type.GetProperties( BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public ); if( !properties.NullOrEmpty() ) { CCL_Log.Write( "Properties:", stream ); CCL_Log.IndentStream( stream ); { foreach( var entity in properties ) { var str = entity.PropertyType.Name; str += " " + entity.Name; var method = entity.GetGetMethod(); if( method != null ) { str += " (Public Get)"; } else { method = entity.GetGetMethod( true ); if( method != null ) str += " (NonPublic Get)"; } method = entity.GetSetMethod(); if( method != null ) { str += " (Public Set)"; } else { method = entity.GetSetMethod( true ); if( method != null ) str += " (NonPublic Set)"; } CCL_Log.Write( str, stream ); } } CCL_Log.IndentStream( stream, -1 ); } #endregion #region Methods var methods = type.GetMethods( BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public ); if( !methods.NullOrEmpty() ) { CCL_Log.Write( "Methods:", stream ); CCL_Log.IndentStream( stream ); { foreach( var entity in methods ) { var str = entity.ReturnType.Name; str += " " + entity.Name; if( entity.IsStatic ) str += " (Static)"; else str += " (Instance)"; if( entity.IsPrivate ) str += " (NonPublic)"; if( entity.IsPublic ) str += " (Public)"; if( !entity.GetParameters().NullOrEmpty() ) { var parameters = entity.GetParameters(); str += " Parameters: ("; for( int i = 0; i < parameters.Length; ++i ) { var optional = false; var pi = parameters[ i ]; if( pi.IsOut ) str += " (out)"; if( pi.IsRetval ) str += " (ret)"; if( !pi.GetCustomAttributes( true ).NullOrEmpty() ) { foreach( var attribute in pi.GetCustomAttributes( true ) ) { optional |= attribute.GetType().Name == "OptionalAttribute"; str += " " + attribute.GetType().Name; } } if( !pi.GetRequiredCustomModifiers().NullOrEmpty() ) { foreach( var modifier in pi.GetRequiredCustomModifiers() ) { str += " " + modifier.Name; } } if( !pi.GetOptionalCustomModifiers().NullOrEmpty() ) { foreach( var modifier in pi.GetOptionalCustomModifiers() ) { str += " " + modifier.Name; } } str += " " + pi.ParameterType.ToString(); str += " " + pi.Name; if( ( optional )&& ( pi.DefaultValue != null ) ) { str += " = "; if( pi.DefaultValue is string ) { str += "\""; } str += pi.DefaultValue.ToString(); if( pi.DefaultValue is string ) { str += "\""; } } if( i < parameters.Length - 1 ) { str += ","; } } str += " )"; } CCL_Log.Write( str, stream ); } } CCL_Log.IndentStream( stream, -1 ); } #endregion } CCL_Log.IndentStream( stream, -1 ); CCL_Log.Write( "\n", stream ); } } CCL_Log.IndentStream( stream, -1 ); } CCL_Log.IndentStream( stream, -1 ); CCL_Log.Write( "\n", stream ); }