internal static void InstanciateAll() { foreach (var(assembly, (modInst, modType)) in mods) { if (modInst != null) { continue; } var ctor = modType.GetConstructor(new Type[] { }); if (ctor == null) { Logger.Warning("Could not instanciate '{0}' because no constructor with empty arguments exists", modType.FullName); } else { var mod = (IPipMod)ctor.Invoke(new object[] { }); Logger.Verbose("Instanced: {0}", mod.Name); mods[assembly].first = mod; DoStep(PipMod.Step.PostInstanciate, mod); } } }
/// <summary> /// Issues not-diposed warning. /// </summary> /// <param name="obj"></param> /// <param name="message"></param> public static void NotDisposedFormatted([NotNull] object obj, [NotEmpty] string message, [NotNull] params object[] data) { Logging.ILogger logger = GetLogger(obj.GetType()); logger.Warning(string.Format("Object '{0}' not disposed: {1}", obj, string.Format(message, data))); }
/// <summary> /// Issues not-diposed warning. /// </summary> /// <param name="obj"></param> /// <param name="message"></param> public static void NotDisposed([NotNull] object obj, [NotEmpty] string message) { Logging.ILogger logger = GetLogger(obj.GetType()); logger.Warning(string.Format("Object '{0}' not disposed: {1}", obj, message)); }
/// <summary> /// Issues a formatted warning. /// </summary> /// <param name="type">The type.</param> /// <param name="message">Message with formats.</param> /// <param name="data">The data into message.</param> public static void WarningFormatted([NotNull] Type type, [NotEmpty] string message, [NotNull] params object[] data) { Logging.ILogger logger = GetLogger(type); logger.Warning(string.Format(message, data)); }
/// <summary> /// Issues a warning. /// </summary> /// <param name="type">The type of class/...</param> /// <param name="message">The message of warning.</param> public static void Warning([NotNull] Type type, [NotEmpty] string message) { Logging.ILogger logger = GetLogger(type); logger.Warning(message); }
/// <summary> /// Called by a deprecated method when it is invoked /// </summary> /// <param name="log">a log to use for logging</param> /// <param name="name">the name of the method</param> /// <param name="assembly">the name of the calling assembly</param> public static void MethodDeprecated([NotNull] Type type, [NotEmpty] string name, [NotEmpty] string assembly) { Logging.ILogger logger = GetLogger(type); logger.Warning(string.Format("Method '{0}.{1}' is depricated but was still called from assembly '{2}'", type.FullName, name, assembly)); }
public void RebuildArragement() { Logger.Info("Rebuilding tech tree (this can take time)..."); ResetArrangement(); // this is a little silly, don't you think? var techTable = new Dictionary <int, Dictionary <int, List <global::Tech> > >(); var techRows = new Dictionary <string, int>(); var techRowTitles = new Dictionary <int, string>(); int techRowNum = 0; // calculate row nums foreach (var tech in Techs.resources) { if (tech.unlockedItems.Count == 0) { Logger.Warning("Tech by ID `{0}` has no unlocked items. This will likely cause an error and the tech will not render on the tree.", tech.Id); } if (tech.requiredTech.Count == 0 && !techRows.ContainsKey(tech.Id)) { techRowTitles.Add(techRowNum, tech.Id); techRows.Add(tech.Id, techRowNum++); } } // push the techs into a 2D dictionary(?) of tech lists foreach (var tech in Techs.resources) { var row = GetRow(tech, techRows); var col = GetCol(tech); Dictionary <int, List <global::Tech> > techRow; if (!techTable.TryGetValue(row, out techRow)) { techRow = new Dictionary <int, List <global::Tech> >(); techTable.Add(row, techRow); } List <global::Tech> techCol; if (!techRow.TryGetValue(col, out techCol)) { techCol = new List <global::Tech>(); techRow.Add(col, techCol); } techCol.Add(tech); } // space the techs out in their 2D table float rowHeight = Y0; List <Tuple <string, ResourceTreeNode> > titles = new List <Tuple <string, ResourceTreeNode> >(techTable.Count); foreach (var techTableEntry in techTable) { var techRowI = techTableEntry.Key; var techRow = techTableEntry.Value; float colMaxHeight = 0; foreach (var techCol in techRow.Values) { colMaxHeight = Mathf.Max(techCol.Count * Y, colMaxHeight); } colMaxHeight += ORIGIN.height; var titleID = "_" + techRowTitles[techRowI]; if (titleAssociations.ContainsKey(titleID)) { titleID = titleAssociations[titleID]; } titles.Insert(techRowI, new Tuple <string, ResourceTreeNode>(titleID, new ResourceTreeNode() { nodeX = -X0, nodeY = -(rowHeight - (ORIGIN.height * 2)), width = ORIGIN.width, height = ORIGIN.height })); foreach (var techRowEntry in techRow) { var techColI = techRowEntry.Key; var techCol = techRowEntry.Value; var colHeight = (techCol.Count + 1) * Y; var colOffset = (colMaxHeight - colHeight) / 2; for (int techI = 0; techI < techCol.Count; techI++) { var tech = techCol[techI]; var node = GetNode(tech); node.nodeX = (techColI * X) + X0; node.nodeY = -(rowHeight + (techI * Y) + colOffset); } } rowHeight += colMaxHeight; } foreach (var titleData in titles) { var titleID = titleData.first; var node = titleData.second; var title = new TechTreeTitle(titleID, TechTreeTitles, Strings.Get(LOCNAME_TITLE + titleID.ToUpper()), node); } Logger.Info("Completed TechTree rebuild: {0} techs, {1} titles", Techs.resources.Count, titles.Count); }