/// <summary> /// Returns a <see cref="System.String" /> that represents this instance. /// </summary> /// <returns> /// A <see cref="System.String" /> that represents this instance. /// </returns> public override string ToString() { Log.InfoList info = new Log.InfoList("StuckVehicleInfo: "); info.Add("VehicleId", this.VehicleId); info.Add("CheckFlags", this.checkFlags); info.Add("DispatcherType", this.dispatcherType); info.Add("DispatchersResponsibility", this.DispatchersResponsibility); return(info.ToString()); }
public void DebugListLog() { Log.InfoList info = new Log.InfoList(); info.Add("ServiceBuildingId", this.ServiceBuilding); info.Add("TargetBuildingId", this.TargetBuilding); info.Add("Problem", this.ServiceProblem); info.Add("Weight", this.ProblemWeight); info.Add("ServiceBuildingName", BuildingHelper.GetBuildingName(this.ServiceBuilding)); info.Add("TargetBuildingName", BuildingHelper.GetBuildingName(this.TargetBuilding)); Log.DevDebug(this, "DebugListLog", info.ToString()); }
/// <summary> /// Logs building info for debug use. /// </summary> /// <param name="buildings">The buildings.</param> /// <param name="vehicles">The vehicles.</param> /// <param name="districtManager">The district manager.</param> /// <param name="citizenManager">The citizen manager.</param> /// <param name="buildingId">The building identifier.</param> /// <param name="serviceBuilding">The service building.</param> /// <param name="targetBuilding">The target building.</param> /// <param name="buildingStamp">The building stamp.</param> private static void DebugListLog( Building[] buildings, Vehicle[] vehicles, DistrictManager districtManager, CitizenManager citizenManager, ushort buildingId, ServiceBuildingInfo serviceBuilding, TargetBuildingInfo targetBuilding, BuildingStamp buildingStamp) { if (buildings[buildingId].Info != null && (buildings[buildingId].m_flags & Building.Flags.Created) == Building.Flags.Created) { Log.InfoList info = DebugInfoMsg(buildings, vehicles, districtManager, citizenManager, buildingId, serviceBuilding, targetBuilding, buildingStamp); Log.DevDebug(typeof(BuildingHelper), "DebugListLog", info.ToString()); } }
/// <summary> /// Logs a list of vehicle info for debug use. /// </summary> public void DebugListLogVehicles() { try { if (this.StuckVehicles != null) { foreach (StuckVehicleInfo vehicle in this.StuckVehicles.Values) { Log.InfoList info = new Log.InfoList(); vehicle.AddDebugInfoData(info); Log.DevDebug(this, "DebugListLog", "StuckVehicle", info.ToString()); } } } catch (Exception ex) { Log.Error(this, "DebugListLogVehicles", ex); } }
/// <summary> /// Logs a list of service problem info for debug use. /// </summary> public void DebugListLogServiceProblems() { try { foreach (KeyValuePair <uint, uint> size in this.ProblemSizes) { ushort serviceBuildingId = GetServiceBuildingFromBuildingKey(size.Key); ushort targetBuildingId = GetTargetBuildingFromBuildingKey(size.Key); Log.InfoList info = new Log.InfoList("ProblemSize"); info.Add("ServiceBuildingId", serviceBuildingId); info.Add("TargetBuildingId", targetBuildingId); info.Add("ProblemSize", size.Value); info.Add("ServiceBuildingName", BuildingHelper.GetBuildingName(serviceBuildingId)); info.Add("TargetBuildingName", BuildingHelper.GetBuildingName(targetBuildingId)); Log.DevDebug(this, "DebugListLog", info.ToString()); } foreach (KeyValuePair <ushort, BuildingProblem> problem in TargetBuildingProblems) { Log.InfoList info = new Log.InfoList("TargetBuildingProblem"); info.Add("TargetBuildingId", problem.Key); info.Add("ProblemCount", problem.Value.Count); info.Add("ProblemSize", problem.Value.Size); info.Add("TargetBuildingName", BuildingHelper.GetBuildingName(problem.Key)); Log.DevDebug(this, "DebugListLog", info.ToString()); } } catch (Exception ex) { Log.Error(this, "AddServiceProblemNote", ex); } }
/// <summary> /// Returns a <see cref="System.String" /> that represents this instance. /// </summary> /// <returns> /// A <see cref="System.String" /> that represents this instance. /// </returns> public override string ToString() { Log.InfoList info = new Log.InfoList("BuldingCheckParams: "); info.Add("OnlyProblematic", this.OnlyProblematic); info.Add("IncludeUneedy", this.IncludeUneedy); info.Add("IgnoreRange", this.IgnoreRange); info.Add("MinProblemValue", this.MinProblemValue); info.Add("AllowCreateSpares", this.AllowCreateSpares); return info.ToString(); }
/// <summary> /// Returns a <see cref="System.String" /> that represents this instance. /// </summary> /// <param name="vehicle">The vehicle.</param> /// <param name="vehicles">The vehicles.</param> /// <param name="buildings">The buildings.</param> /// <param name="getHead">if set to <c>true</c> get header instead of data.</param> /// <returns> /// A <see cref="System.String" /> that represents this instance. /// </returns> private static string InfoString(StuckVehicleInfo vehicle, Vehicle[] vehicles, Building[] buildings, bool getHead) { Log.InfoList info = new Log.InfoList(); List <string> status = null; List <string> dispatch = null; string ai = null; if (!getHead) { if (vehicles == null) { vehicles = Singleton <VehicleManager> .instance.m_vehicles.m_buffer; } if (buildings == null) { buildings = Singleton <BuildingManager> .instance.m_buildings.m_buffer; } status = new List <string>(1); if (vehicle.isStuck) { status.Add("Stuck"); } if (vehicle.isBroken) { status.Add("Broken"); } if (vehicle.isLost) { status.Add("Lost"); } if (vehicle.isConfused) { status.Add("Confused"); } if (vehicle.isFlagged) { status.Add("Flagged"); } if (status.Count == 0) { status.Add("Checking"); } dispatch = new List <string>(2); if (IsDispatchersResponsibility(vehicle.dispatcherType)) { dispatch.Add("IsResponsible"); } if (vehicle.dispatcherType != Dispatcher.DispatcherTypes.None) { dispatch.Add(vehicle.dispatcherType.ToString()); } try { if (vehicles[vehicle.VehicleId].Info != null) { if (vehicles[vehicle.VehicleId].Info.m_vehicleAI != null) { ai = vehicles[vehicle.VehicleId].Info.m_vehicleAI.GetType().ToString(); } } } catch { } } if (getHead) { info.Add("<Status>", "<Status>"); info.Add("<Vehicle>", "<VehicleId>", "[VehicleName]", "[VehicleAI]", "[ExtraInfo]"); } else { info.Add("Status", status); info.Add("Vehicle", vehicle.VehicleId, vehicle.VehicleName, ai, vehicle.ExtraInfo); } if (getHead) { info.Add("[Dispatch]", "[Responsibility]", "[DispatcherType]"); } else if (dispatch.Count > 0) { info.Add("Dispatch", dispatch); } if (getHead) { info.Add("[Confused]", "<ConfusedForSeconds>", "<ConfusedForFrames>"); } else if (vehicle.confusedSinceFrame > 0 || vehicle.confusedSinceTime > 0.0) { info.Add("Confused", vehicle.ConfusedForSeconds, vehicle.ConfusedForFrames); } if (getHead) { info.Add("[Flagged]", "<FlaggedForSeconds>", "<FlaggedForFrames>", "[Flags]", "[Position]"); } else if (vehicle.checkFlagSinceFrame > 0 || vehicle.checkFlagSinceTime > 0.0) { info.Add("Flagged", vehicle.CheckFlaggedForSeconds, vehicle.CheckFlaggedForFrames, vehicle.checkFlags, vehicle.checkFlagPosition); } if (getHead) { info.Add("[Lost]", "<LostForSeconds>", "<LostForFrames>", "[LostReason]"); } else if (vehicle.lostSinceFrame > 0 || vehicle.lostSinceTime > 0.0) { info.Add("Lost", vehicle.LostForSeconds, vehicle.LostForFrames, vehicle.lostReason); } if (getHead) { info.Add("[District]", "<districtId>", "[DistrictName]"); } else if (vehicle.checkFlagSinceFrame > 0 || vehicle.checkFlagSinceTime > 0.0) { try { byte districtId = DistrictHelper.GetDistrict(vehicle.checkFlagPosition); if (districtId != 0) { info.Add("District", districtId, DistrictHelper.GetDistrictName(districtId)); } } catch { } } if (getHead) { InfoStringInfoForBuilding(null, null, null, true, 0, "SourceBuilding", info); InfoStringInfoForBuilding(null, null, null, true, 0, "TargetBuilding", info); } else { try { InfoStringInfoForBuilding(vehicle, vehicles, buildings, false, vehicles[vehicle.VehicleId].m_sourceBuilding, "SourceBuilding", info); InfoStringInfoForBuilding(vehicle, vehicles, buildings, false, vehicles[vehicle.VehicleId].m_targetBuilding, "TargetBuilding", info); } catch { } } if (getHead) { info.Add("[Handling]", "<HandledForFrames>", "<HandlingErrors>"); } else if (vehicle.handlingErrors > 0 || vehicle.lastHandledStamp > 0) { info.Add("Handling", (vehicle.lastHandledStamp > 0 && vehicle.lastHandledStamp < Global.CurrentFrame) ? Global.CurrentFrame - vehicle.lastHandledStamp : 0, vehicle.handlingErrors); } return(info.ToString()); }