mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Merge pull request #362 from daemitus/StyleCop-mini-4
This commit is contained in:
commit
66a0b83184
10 changed files with 37 additions and 47 deletions
|
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Window"/> class.
|
||||
|
|
@ -30,6 +28,9 @@ namespace Dalamud.Interface.Windowing
|
|||
this.ForceMainWindow = forceMainWindow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the namespace of the window.
|
||||
/// </summary>
|
||||
public string Namespace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -115,28 +116,35 @@ namespace Dalamud.Interface.Windowing
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Code to be executed every time the window renders.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// In this method, implement your drawing code.
|
||||
/// You do NOT need to ImGui.Begin your window.
|
||||
/// </summary>
|
||||
/// </remarks>
|
||||
public abstract void Draw();
|
||||
|
||||
/// <summary>
|
||||
/// Code to be executed when the window is opened.
|
||||
/// </summary>
|
||||
public virtual void OnOpen() { }
|
||||
public virtual void OnOpen()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Code to be executed when the window is closed.
|
||||
/// </summary>
|
||||
public virtual void OnClose() { }
|
||||
public virtual void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the window via ImGui.
|
||||
/// </summary>
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Dalamud.Interface.Windowing
|
|||
/// </summary>
|
||||
public class WindowSystem
|
||||
{
|
||||
private readonly List<Window> windows = new List<Window>();
|
||||
private readonly List<Window> windows = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WindowSystem"/> 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();
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace Dalamud
|
|||
}
|
||||
|
||||
/// <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>
|
||||
/// <param name="langCode">The language code of the new language.</param>
|
||||
public delegate void LocalizationChangedDelegate(string langCode);
|
||||
|
|
@ -51,6 +51,19 @@ namespace Dalamud
|
|||
/// </summary>
|
||||
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>
|
||||
/// Set up the UI language with the users' local UI culture.
|
||||
/// </summary>
|
||||
|
|
@ -118,19 +131,6 @@ namespace Dalamud
|
|||
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)
|
||||
{
|
||||
if (this.useEmbedded)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ namespace Dalamud.Plugin
|
|||
/// <summary>
|
||||
/// Gets the directory your plugin configurations are stored in.
|
||||
/// </summary>
|
||||
public DirectoryInfo ConfigDirectory => new DirectoryInfo(this.GetPluginConfigDirectory());
|
||||
public DirectoryInfo ConfigDirectory => new(this.GetPluginConfigDirectory());
|
||||
|
||||
/// <summary>
|
||||
/// Gets the config file of your plugin.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dalamud.Plugin
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,3 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dalamud.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace Dalamud.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Dalamud
|
|||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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>
|
||||
public static class SafeMemory
|
||||
{
|
||||
|
|
@ -50,7 +50,7 @@ namespace Dalamud
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read an object of the specified struct from the current process.
|
||||
/// Read an object of the specified struct from the current process.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the struct.</typeparam>
|
||||
/// <param name="address">The address to read from.</param>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue