static void SimulationStep(NetAI _this, ushort segmentID, ref NetSegment data) { try { _this.SimulationStep(segmentID, ref data); } catch (Exception e) { string info = $"An exception occured during NetAI simulation step.\nAsset: {_this.m_info.name}" + $"\nSegmentID: {segmentID}\nType: {_this.GetType().Name}\nSeverity: High"; HealkitException e2 = new HealkitException(info, e); e2.m_uniqueData = _this.m_info.name; e2.m_supperessMsg = "Suppress similar exceptions caused by this asset"; UIView.ForwardException(e2); } }
static void SimulationStep(VehicleAI _this, ushort vehicleID, ref Vehicle data, Vector3 physicsLodRefPos) { try { _this.SimulationStep(vehicleID, ref data, physicsLodRefPos); } catch (Exception e) { string info = $"An exception occured during VehicleAI simulation step.\nAsset: {_this.m_info.name}" + $"\nVehicleID: {vehicleID}\nType: {_this.GetType().Name}\nSeverity: High"; HealkitException e2 = new HealkitException(info, e); e2.m_uniqueData = _this.m_info.name; e2.m_supperessMsg = "Suppress similar exceptions caused by this asset"; UIView.ForwardException(e2); } }
static void SimulationStep(ref TransportLine _this, ushort lineID) { try { _this.SimulationStep(lineID); } catch (Exception e) { string info = $"An exception occured during TransportLine simulation step.\n" + $"Line: {Enum.GetName(typeof(TransportInfo.TransportType), _this.Info.m_transportType)} {_this.m_lineNumber}\n" + $"LineID: {lineID}\nSeverity: High"; HealkitException e2 = new HealkitException(info, e); e2.m_supperessMsg = "Suppress this exception"; UIView.ForwardException(e2); } }
public static void Handle(Exception e, IThreadingExtension ext, string method) { Assembly assembly = ext.GetType().Assembly; Type modInfoType = null; foreach (Type type in assembly.GetTypes()) { if (type.GetInterface("IUserMod") != null) { modInfoType = type; break; } } string modName = null; IUserMod modInfo = null; foreach (PluginManager.PluginInfo pluginInfo in Singleton <PluginManager> .instance.GetPluginsInfo()) { try { EntryData entryData = new EntryData(pluginInfo); if (!entryData.pluginInfo.isBuiltin) { IUserMod[] instances = entryData.pluginInfo.GetInstances <IUserMod>(); if (instances.Length == 1) { modInfo = instances[0]; } if (modInfo.GetType() == modInfoType) { modName = modInfo.Name + " - " + modInfo.Description; break; } } } catch { } } string info = $"An error has occured in mod's {method} method.\nMod name: {modName ?? "<Unknown>"}\nAssembly: {assembly.FullName}\nSeverity: Medium"; HealkitException e2 = new HealkitException(info, e); e2.m_uniqueData = modName; e2.m_supperessMsg = "Suppress similar exceptions caused by this mod"; UIView.ForwardException(e2); }
static bool CheckUnlocking(BuildingAI _this) { try { return(_this.CheckUnlocking()); } catch (Exception e) { string info = $"An exception occured during BuildingAI CheckUnlocking() method.\nAsset: {_this.m_info.name}" + $"\nBuildingID: ??\nType: {_this.GetType().Name}\nSeverity: High"; HealkitException e2 = new HealkitException(info, e); e2.m_uniqueData = _this.m_info.name; e2.m_supperessMsg = "Suppress similar exceptions caused by this asset"; UIView.ForwardException(e2); } return(false); }
static bool Prefix(ref string message, ref Exception exception, Queue <Exception> ___sLastException) { UIComponent uicomponent = UIView.library.Get("ExceptionPanel"); if (uicomponent != null && UIView.GetModalComponent() != uicomponent) { if (exception == null) { return(ModInfo.sb_SuppressAllExceptions.value ? false : true); } var template = ExceptionTemplate.RegisterException(exception); template.RaisedCount++; if (!template.Suppressed && !ModInfo.sb_SuppressAllExceptions.value) { ExceptionPanelExt.instance.m_chbSuppressThis.isChecked = false; message = message ?? ""; HealkitException hke = exception as HealkitException; if (hke != null) { message += exception.Message + "\n\n" + exception.InnerException.ToString().Replace('&', '+'); if (hke.m_supperessMsg != null) { ExceptionPanelExt.instance.m_chbSuppressThis.isVisible = true; ExceptionPanelExt.instance.m_chbSuppressThis.tooltip = hke.m_supperessMsg; } } else { ExceptionPanelExt.instance.m_chbSuppressThis.isVisible = false; message += exception.ToString().Replace('&', '+'); } exception = null; return(true); } else { if (___sLastException.Count > 0) { ___sLastException.Dequeue(); } } } return(false); }