CrabUI
Loading...
Searching...
No Matches
CUIErrors.cs
1using System;
2using System.Reflection;
3using System.Runtime.CompilerServices;
4using System.Collections.Generic;
5using System.Collections.Immutable;
6using System.Linq;
7
8using Barotrauma;
9using HarmonyLib;
10using Microsoft.Xna.Framework;
11using System.IO;
12
13namespace CrabUI
14{
15 public partial class CUI
16 {
17 public static Dictionary<string, int> Errors = new();
18 public static void Error(object msg, int maxPrints = 1, int tolerate = 5, bool silent = false)
19 {
20 string s = $"{msg}";
21 if (!Errors.ContainsKey(s)) Errors[s] = 1;
22 else Errors[s] = Errors[s] + 1;
23 if (silent) return;
24 if (tolerate < Errors[s] && Errors[s] <= maxPrints) Log($"CUI: {s} x{Errors[s]}", Color.Orange);
25 }
26 }
27}
In fact a static class managing static things.
Definition CUIErrors.cs:16
static void Log(object msg, Color? color=null, [CallerFilePath] string source="", [CallerLineNumber] int lineNumber=0)
Prints a message to console.