diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index 1271d09fb..bd3c55bd5 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -1,7 +1,6 @@ using System.Numerics; using ImGuiNET; -using Serilog; namespace Dalamud.Interface.Windowing { @@ -12,7 +11,6 @@ namespace Dalamud.Interface.Windowing { private bool internalLastIsOpen = false; private bool internalIsOpen = false; - private bool mainIsOpen = false; /// /// Initializes a new instance of the class. @@ -30,6 +28,9 @@ namespace Dalamud.Interface.Windowing this.ForceMainWindow = forceMainWindow; } + /// + /// Gets or sets the namespace of the window. + /// public string Namespace { get; set; } /// @@ -115,28 +116,35 @@ namespace Dalamud.Interface.Windowing } /// + /// Code to be executed every time the window renders. + /// + /// /// In this method, implement your drawing code. /// You do NOT need to ImGui.Begin your window. - /// + /// public abstract void Draw(); /// /// Code to be executed when the window is opened. /// - public virtual void OnOpen() { } + public virtual void OnOpen() + { + } /// /// Code to be executed when the window is closed. /// - public virtual void OnClose() { } + public virtual void OnClose() + { + } /// /// Draw the window via ImGui. /// internal void DrawInternal() { - //if (WindowName.Contains("Credits")) - // Log.Information($"Draw: {IsOpen} {this.internalIsOpen} {this.internalLastIsOpen}"); + // if (WindowName.Contains("Credits")) + // Log.Information($"Draw: {IsOpen} {this.internalIsOpen} {this.internalLastIsOpen}"); if (!this.IsOpen) { diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs index a42b51a18..f13797a17 100644 --- a/Dalamud/Interface/Windowing/WindowSystem.cs +++ b/Dalamud/Interface/Windowing/WindowSystem.cs @@ -12,7 +12,7 @@ namespace Dalamud.Interface.Windowing /// public class WindowSystem { - private readonly List windows = new List(); + private readonly List windows = new(); /// /// Initializes a new instance of the class. @@ -70,7 +70,7 @@ namespace Dalamud.Interface.Windowing foreach (var window in this.windows) { #if DEBUG - //Log.Verbose($"[WS{(hasNamespace ? "/" + this.Namespace : string.Empty)}] Drawing {window.WindowName}"); + // Log.Verbose($"[WS{(hasNamespace ? "/" + this.Namespace : string.Empty)}] Drawing {window.WindowName}"); #endif window.DrawInternal(); diff --git a/Dalamud/Localization.cs b/Dalamud/Localization.cs index 4fefa1fe3..3469dcb64 100644 --- a/Dalamud/Localization.cs +++ b/Dalamud/Localization.cs @@ -41,7 +41,7 @@ namespace Dalamud } /// - /// Delegate for the event that occurs when the language is changed. + /// Delegate for the event that occurs when the language is changed. /// /// The language code of the new language. public delegate void LocalizationChangedDelegate(string langCode); @@ -51,6 +51,19 @@ namespace Dalamud /// public event LocalizationChangedDelegate OnLocalizationChanged; + /// + /// Search the set-up localization data for the provided assembly for the given string key and return it. + /// If the key is not present, the fallback is shown. + /// The fallback is also required to create the string files to be localized. + /// + /// The string key to be returned. + /// The fallback string, usually your source language. + /// The localized string, fallback or string key if not found. + public static string Localize(string key, string fallBack) + { + return Loc.Localize(key, fallBack, Assembly.GetCallingAssembly()); + } + /// /// Set up the UI language with the users' local UI culture. /// @@ -118,19 +131,6 @@ namespace Dalamud Loc.ExportLocalizableForAssembly(this.assembly); } - /// - /// Search the set-up localization data for the provided assembly for the given string key and return it. - /// If the key is not present, the fallback is shown. - /// The fallback is also required to create the string files to be localized. - /// - /// The string key to be returned. - /// The fallback string, usually your source language. - /// The localized string, fallback or string key if not found. - public static string Localize(string key, string fallBack) - { - return Loc.Localize(key, fallBack, Assembly.GetCallingAssembly()); - } - private string ReadLocData(string langCode) { if (this.useEmbedded) diff --git a/Dalamud/Plugin/DalamudPluginInterface.cs b/Dalamud/Plugin/DalamudPluginInterface.cs index 544ef9209..a9ed0dc4a 100644 --- a/Dalamud/Plugin/DalamudPluginInterface.cs +++ b/Dalamud/Plugin/DalamudPluginInterface.cs @@ -94,7 +94,7 @@ namespace Dalamud.Plugin /// /// Gets the directory your plugin configurations are stored in. /// - public DirectoryInfo ConfigDirectory => new DirectoryInfo(this.GetPluginConfigDirectory()); + public DirectoryInfo ConfigDirectory => new(this.GetPluginConfigDirectory()); /// /// Gets the config file of your plugin. diff --git a/Dalamud/Plugin/IDalamudPlugin.cs b/Dalamud/Plugin/IDalamudPlugin.cs index c5585a0ae..aff863eac 100644 --- a/Dalamud/Plugin/IDalamudPlugin.cs +++ b/Dalamud/Plugin/IDalamudPlugin.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Dalamud.Plugin { diff --git a/Dalamud/Plugin/PluginLoadReason.cs b/Dalamud/Plugin/PluginLoadReason.cs index fa60e33a6..789d4d094 100644 --- a/Dalamud/Plugin/PluginLoadReason.cs +++ b/Dalamud/Plugin/PluginLoadReason.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Dalamud.Plugin { /// diff --git a/Dalamud/Plugin/PluginLog.cs b/Dalamud/Plugin/PluginLog.cs index ef1d3c78e..3bfa0d904 100644 --- a/Dalamud/Plugin/PluginLog.cs +++ b/Dalamud/Plugin/PluginLog.cs @@ -1,10 +1,6 @@ using System; -using System.Diagnostics; using System.Reflection; -using Serilog; -using Serilog.Events; - namespace Dalamud.Plugin { /// diff --git a/Dalamud/SafeMemory.cs b/Dalamud/SafeMemory.cs index 44aca3543..458cc6824 100644 --- a/Dalamud/SafeMemory.cs +++ b/Dalamud/SafeMemory.cs @@ -12,7 +12,7 @@ namespace Dalamud /// /// /// Attention! The performance of these methods is severely worse than regular calls. - /// Please consider using these instead in performance-critical code. + /// Please consider using those instead in performance-critical code. /// public static class SafeMemory { @@ -50,7 +50,7 @@ namespace Dalamud } /// - /// Read an object of the specified struct from the current process. + /// Read an object of the specified struct from the current process. /// /// The type of the struct. /// The address to read from. diff --git a/Dalamud/Troubleshooting.cs b/Dalamud/Troubleshooting.cs index 8cabc4ede..d8137165a 100644 --- a/Dalamud/Troubleshooting.cs +++ b/Dalamud/Troubleshooting.cs @@ -37,9 +37,8 @@ namespace Dalamud ThirdRepo = dalamud.Configuration.ThirdRepoList, }; - Log.Information("TROUBLESHOOTING:" + - System.Convert.ToBase64String( - Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload)))); + var encodedPayload = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload))); + Log.Information($"TROUBLESHOOTING:{encodedPayload}"); } catch (Exception ex) { diff --git a/Dalamud/stylecop.json b/Dalamud/stylecop.json index aaefb4f82..6881efc6d 100644 --- a/Dalamud/stylecop.json +++ b/Dalamud/stylecop.json @@ -1,16 +1,13 @@ { "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", "settings": { - "documentationRules": { - - }, "orderingRules": { "systemUsingDirectivesFirst": true, "usingDirectivesPlacement": "outsideNamespace", "blankLinesBetweenUsingGroups": "require" }, "maintainabilityRules": { - "topLevelTypes": ["class", "interface", "struct", "enum"] + "topLevelTypes": [ "class", "interface", "struct", "enum" ] } } }