Breakdown chart of SNO dictionaries, AnsiTarget.cs update, changed MPQPatchChain.cs logger name, prevent multiple ansi outputs

This commit is contained in:
Lucca Faria Ferri 2023-01-27 08:58:19 -08:00
parent 4027254dd0
commit 3b518c1eb8
5 changed files with 48 additions and 11 deletions

View File

@ -63,7 +63,8 @@ public class AnsiTarget : LogTarget
return text
.Replace("Blizzless", "[dodgerblue1]Blizz[/][deepskyblue2]less[/]")
.Replace("Diablo III", "[red3_1]Diablo[/] [red]III[/]")
.Replace("MPQ", "[underline yellow4]MPQ[/]");
.Replace("MPQ", "[underline yellow4]MPQ[/]")
.Replace("Discord", "[blue]Discord[/]");
}

View File

@ -12,11 +12,11 @@ namespace DiIiS_NA.Core.Logging
public LogTargetConfig[] Targets = new[]
{
new LogTargetConfig("ConsoleLog"),
new LogTargetConfig("AnsiLog")
new LogTargetConfig("AnsiLog"),
//new LogTargetConfig("ServerLog"),
//new LogTargetConfig("ChatLog"),
//new LogTargetConfig("RenameAccountLog"),
//new LogTargetConfig("PacketLog")
new LogTargetConfig("PacketLog")
};
private LogConfig() :

View File

@ -24,6 +24,7 @@ using System.Reflection;
using System.Text;
//Blizzless Project 2022
using System.Threading.Tasks;
using Spectre.Console;
namespace DiIiS_NA.Core.MPQ
{
@ -198,6 +199,43 @@ using (StreamWriter sw = new StreamWriter(writePath, false, System.Text.Encoding
this.LoadSNODict(DictSNOWeathers, SNOGroup.Weather);
this.LoadSNODict(DictSNOWorlds, SNOGroup.Worlds);
#if DEBUG
Console.WriteLine();
AnsiConsole.Write(new BreakdownChart()
.FullSize()
.AddItem("Accolade", DictSNOAccolade.Count, Color.Gold1)
.AddItem("Act", DictSNOAct.Count, Color.Green)
.AddItem("Actor", DictSNOActor.Count, Color.Blue)
.AddItem("Adventure", DictSNOAdventure.Count, Color.Orange4_1)
.AddItem("Ambient Sound", DictSNOAmbientSound.Count, Color.OrangeRed1)
.AddItem("Animations", DictSNOAnim.Count, Color.Orchid)
.AddItem("Animation 2D", DictSNOAnimation2D.Count, Color.BlueViolet)
.AddItem("Animation Set", DictSNOAnimSet.Count, Color.Blue3)
.AddItem("Boss Encounter", DictSNOBossEncounter.Count, Color.Aquamarine1)
.AddItem("Conversation", DictSNOConversation.Count, Color.Aquamarine1_1)
.AddItem("Effect Group", DictSNOEffectGroup.Count, Color.Yellow)
.AddItem("Encounter", DictSNOEncounter.Count, Color.Green3_1)
.AddItem("Game Balance", DictSNOGameBalance.Count, Color.GreenYellow)
.AddItem("Level Area", DictSNOLevelArea.Count, Color.Grey62)
.AddItem("Lore", DictSNOLore.Count, Color.Plum4)
.AddItem("Marker Set", DictSNOMarkerSet.Count, Color.Salmon1)
.AddItem("Monster", DictSNOMonster.Count, Color.Red)
.AddItem("Music", DictSNOMusic.Count, Color.Olive)
.AddItem("Observer", DictSNOObserver.Count, Color.Violet)
.AddItem("Phys Mesh", DictSNOPhysMesh.Count, Color.CornflowerBlue)
.AddItem("Power", DictSNOPower.Count, Color.LightPink1)
.AddItem("Quest", DictSNOQuest.Count, Color.LightGreen)
.AddItem("Quest Range", DictSNOQuestRange.Count, Color.LightGreen_1)
.AddItem("Recipe", DictSNORecipe.Count, Color.Yellow2)
.AddItem("Ropes", DictSNORopes.Count, Color.Yellow1)
.AddItem("Scene", DictSNOScene.Count, Color.DarkOrange3)
.AddItem("Skill Kit", DictSNOSkillKit.Count, Color.DeepPink4_1)
.AddItem("Tutorial", DictSNOTutorial.Count, Color.NavajoWhite3)
.AddItem("Weather", DictSNOWeathers.Count, Color.Navy)
.AddItem("Worlds", DictSNOWorlds.Count, Color.SlateBlue3_1)
);
Console.WriteLine();
#endif
this.LoadDBCatalog();
}

View File

@ -19,7 +19,7 @@ namespace DiIiS_NA.Core.MPQ
{
public class MPQPatchChain
{
protected static readonly Logger Logger = LogManager.CreateLogger("FS");
protected static readonly Logger Logger = LogManager.CreateLogger("MPQPatchChain");
public bool Loaded { get; private set; }
public List<string> BaseMPQFiles = new List<string>();

View File

@ -162,10 +162,8 @@ namespace DiIiS_NA
}
}
});
AchievementManager.Initialize();
Core.Storage.AccountDataBase.SessionProvider.RebuildSchema();
string GeneratePassword(int size) => new string(Enumerable.Repeat("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", size)
.Select(s => s[new Random().Next(s.Length)]).ToArray());
void LogAccountCreated(string username, string password)
@ -333,15 +331,15 @@ namespace DiIiS_NA
Logger.ErrorException(ex, "A root error of the server was detected but was handled.");
}
static bool IsTargetEnabled(string target) => LogConfig.Instance.Targets.Any(t => t.Target.ToLower() == target && t.Enabled);
static int TargetsEnabled(string target) => LogConfig.Instance.Targets.Count(t => t.Target.ToLower() == target && t.Enabled);
static bool IsTargetEnabled(string target) => TargetsEnabled(target) > 0;
private static void InitLoggers()
{
LogManager.Enabled = true;
if (IsTargetEnabled("ansi") && IsTargetEnabled("console"))
if (TargetsEnabled("ansi") > 1 || (IsTargetEnabled("console") && IsTargetEnabled("ansi")))
{
AnsiConsole.MarkupLine("[underline red on white]Fatal:[/] [red]You can't use both ansi and console targets at the same time.[/]");
AnsiConsole.MarkupLine("[underline red on white]Fatal:[/] [red]You can't use both ansi and console targets at the same time, nor have more than one ansi target.[/]");
AnsiConsole.Progress().Start(ctx =>
{
var sd = ctx.AddTask("[red3_1]Shutting down[/]");