Merge pull request #362 from daemitus/StyleCop-mini-4

This commit is contained in:
goaaats 2021-05-30 13:01:08 +02:00 committed by GitHub
commit 66a0b83184
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 37 additions and 47 deletions

View file

@ -1,7 +1,6 @@
using System.Numerics; using System.Numerics;
using ImGuiNET; using ImGuiNET;
using Serilog;
namespace Dalamud.Interface.Windowing namespace Dalamud.Interface.Windowing
{ {
@ -12,7 +11,6 @@ namespace Dalamud.Interface.Windowing
{ {
private bool internalLastIsOpen = false; private bool internalLastIsOpen = false;
private bool internalIsOpen = false; private bool internalIsOpen = false;
private bool mainIsOpen = false;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Window"/> class. /// Initializes a new instance of the <see cref="Window"/> class.
@ -30,6 +28,9 @@ namespace Dalamud.Interface.Windowing
this.ForceMainWindow = forceMainWindow; this.ForceMainWindow = forceMainWindow;
} }
/// <summary>
/// Gets or sets the namespace of the window.
/// </summary>
public string Namespace { get; set; } public string Namespace { get; set; }
/// <summary> /// <summary>
@ -115,20 +116,27 @@ namespace Dalamud.Interface.Windowing
} }
/// <summary> /// <summary>
/// Code to be executed every time the window renders.
/// </summary>
/// <remarks>
/// In this method, implement your drawing code. /// In this method, implement your drawing code.
/// You do NOT need to ImGui.Begin your window. /// You do NOT need to ImGui.Begin your window.
/// </summary> /// </remarks>
public abstract void Draw(); public abstract void Draw();
/// <summary> /// <summary>
/// Code to be executed when the window is opened. /// Code to be executed when the window is opened.
/// </summary> /// </summary>
public virtual void OnOpen() { } public virtual void OnOpen()
{
}
/// <summary> /// <summary>
/// Code to be executed when the window is closed. /// Code to be executed when the window is closed.
/// </summary> /// </summary>
public virtual void OnClose() { } public virtual void OnClose()
{
}
/// <summary> /// <summary>
/// Draw the window via ImGui. /// Draw the window via ImGui.

View file

@ -12,7 +12,7 @@ namespace Dalamud.Interface.Windowing
/// </summary> /// </summary>
public class WindowSystem public class WindowSystem
{ {
private readonly List<Window> windows = new List<Window>(); private readonly List<Window> windows = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="WindowSystem"/> class. /// Initializes a new instance of the <see cref="WindowSystem"/> class.

View file

@ -41,7 +41,7 @@ namespace Dalamud
} }
/// <summary> /// <summary>
/// Delegate for the <see cref="Localization.OnLocalizationChanged"/> event that occurs when the language is changed. /// Delegate for the <see cref="OnLocalizationChanged"/> event that occurs when the language is changed.
/// </summary> /// </summary>
/// <param name="langCode">The language code of the new language.</param> /// <param name="langCode">The language code of the new language.</param>
public delegate void LocalizationChangedDelegate(string langCode); public delegate void LocalizationChangedDelegate(string langCode);
@ -51,6 +51,19 @@ namespace Dalamud
/// </summary> /// </summary>
public event LocalizationChangedDelegate OnLocalizationChanged; public event LocalizationChangedDelegate OnLocalizationChanged;
/// <summary>
/// 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.
/// </summary>
/// <param name="key">The string key to be returned.</param>
/// <param name="fallBack">The fallback string, usually your source language.</param>
/// <returns>The localized string, fallback or string key if not found.</returns>
public static string Localize(string key, string fallBack)
{
return Loc.Localize(key, fallBack, Assembly.GetCallingAssembly());
}
/// <summary> /// <summary>
/// Set up the UI language with the users' local UI culture. /// Set up the UI language with the users' local UI culture.
/// </summary> /// </summary>
@ -118,19 +131,6 @@ namespace Dalamud
Loc.ExportLocalizableForAssembly(this.assembly); Loc.ExportLocalizableForAssembly(this.assembly);
} }
/// <summary>
/// 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.
/// </summary>
/// <param name="key">The string key to be returned.</param>
/// <param name="fallBack">The fallback string, usually your source language.</param>
/// <returns>The localized string, fallback or string key if not found.</returns>
public static string Localize(string key, string fallBack)
{
return Loc.Localize(key, fallBack, Assembly.GetCallingAssembly());
}
private string ReadLocData(string langCode) private string ReadLocData(string langCode)
{ {
if (this.useEmbedded) if (this.useEmbedded)

View file

@ -94,7 +94,7 @@ namespace Dalamud.Plugin
/// <summary> /// <summary>
/// Gets the directory your plugin configurations are stored in. /// Gets the directory your plugin configurations are stored in.
/// </summary> /// </summary>
public DirectoryInfo ConfigDirectory => new DirectoryInfo(this.GetPluginConfigDirectory()); public DirectoryInfo ConfigDirectory => new(this.GetPluginConfigDirectory());
/// <summary> /// <summary>
/// Gets the config file of your plugin. /// Gets the config file of your plugin.

View file

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dalamud.Plugin namespace Dalamud.Plugin
{ {

View file

@ -1,9 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dalamud.Plugin namespace Dalamud.Plugin
{ {
/// <summary> /// <summary>

View file

@ -1,10 +1,6 @@
using System; using System;
using System.Diagnostics;
using System.Reflection; using System.Reflection;
using Serilog;
using Serilog.Events;
namespace Dalamud.Plugin namespace Dalamud.Plugin
{ {
/// <summary> /// <summary>

View file

@ -12,7 +12,7 @@ namespace Dalamud
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Attention! The performance of these methods is severely worse than regular <see cref="Marshal"/> calls. /// Attention! The performance of these methods is severely worse than regular <see cref="Marshal"/> calls.
/// Please consider using these instead in performance-critical code. /// Please consider using those instead in performance-critical code.
/// </remarks> /// </remarks>
public static class SafeMemory public static class SafeMemory
{ {

View file

@ -37,9 +37,8 @@ namespace Dalamud
ThirdRepo = dalamud.Configuration.ThirdRepoList, ThirdRepo = dalamud.Configuration.ThirdRepoList,
}; };
Log.Information("TROUBLESHOOTING:" + var encodedPayload = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload)));
System.Convert.ToBase64String( Log.Information($"TROUBLESHOOTING:{encodedPayload}");
Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload))));
} }
catch (Exception ex) catch (Exception ex)
{ {

View file

@ -1,9 +1,6 @@
{ {
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": { "settings": {
"documentationRules": {
},
"orderingRules": { "orderingRules": {
"systemUsingDirectivesFirst": true, "systemUsingDirectivesFirst": true,
"usingDirectivesPlacement": "outsideNamespace", "usingDirectivesPlacement": "outsideNamespace",