Use file-scoped namespaces

This commit is contained in:
Liza 2023-03-30 22:01:43 +02:00
parent 0b07e8b8f6
commit 8042aee951
76 changed files with 4771 additions and 4841 deletions

View File

@ -21,7 +21,7 @@ resharper_indent_text = ZeroIndent
csharp_style_expression_bodied_methods = true csharp_style_expression_bodied_methods = true
# namespaces # namespaces
csharp_style_namespace_declarations = block_scoped csharp_style_namespace_declarations = file_scoped
# braces # braces
csharp_prefer_braces = when_multiline csharp_prefer_braces = when_multiline

View File

@ -1,10 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Pal.Client.Commands namespace Pal.Client.Commands;
{
public interface ISubCommand public interface ISubCommand
{ {
IReadOnlyDictionary<string, Action<string>> GetHandlers(); IReadOnlyDictionary<string, Action<string>> GetHandlers();
} }
}

View File

@ -3,8 +3,8 @@ using System.Collections.Generic;
using Pal.Client.Configuration; using Pal.Client.Configuration;
using Pal.Client.Windows; using Pal.Client.Windows;
namespace Pal.Client.Commands namespace Pal.Client.Commands;
{
internal class PalConfigCommand : ISubCommand internal class PalConfigCommand : ISubCommand
{ {
private readonly IPalacePalConfiguration _configuration; private readonly IPalacePalConfiguration _configuration;
@ -37,4 +37,3 @@ namespace Pal.Client.Commands
_configWindow.Toggle(); _configWindow.Toggle();
} }
} }
}

View File

@ -7,8 +7,8 @@ using Pal.Client.Extensions;
using Pal.Client.Floors; using Pal.Client.Floors;
using Pal.Client.Rendering; using Pal.Client.Rendering;
namespace Pal.Client.Commands namespace Pal.Client.Commands;
{
internal sealed class PalNearCommand : ISubCommand internal sealed class PalNearCommand : ISubCommand
{ {
private readonly Chat _chat; private readonly Chat _chat;
@ -60,4 +60,3 @@ namespace Pal.Client.Commands
$"{nearbyMarker.distance:F2} - {nearbyMarker.m.Type} {nearbyMarker.m.NetworkId?.ToPartialId(length: 8)} - {nearbyMarker.m.Position}"); $"{nearbyMarker.distance:F2} - {nearbyMarker.m.Type} {nearbyMarker.m.NetworkId?.ToPartialId(length: 8)} - {nearbyMarker.m.Position}");
} }
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using Pal.Client.DependencyInjection; using Pal.Client.DependencyInjection;
namespace Pal.Client.Commands namespace Pal.Client.Commands;
{
internal sealed class PalStatsCommand : ISubCommand internal sealed class PalStatsCommand : ISubCommand
{ {
private readonly StatisticsService _statisticsService; private readonly StatisticsService _statisticsService;
@ -22,4 +22,3 @@ namespace Pal.Client.Commands
private void Execute() private void Execute()
=> _statisticsService.ShowGlobalStatistics(); => _statisticsService.ShowGlobalStatistics();
} }
}

View File

@ -3,8 +3,8 @@ using System.Collections.Generic;
using ECommons.Schedulers; using ECommons.Schedulers;
using Pal.Client.Windows; using Pal.Client.Windows;
namespace Pal.Client.Commands namespace Pal.Client.Commands;
{
internal sealed class PalTestConnectionCommand : ISubCommand internal sealed class PalTestConnectionCommand : ISubCommand
{ {
private readonly ConfigWindow _configWindow; private readonly ConfigWindow _configWindow;
@ -27,4 +27,3 @@ namespace Pal.Client.Commands
var _ = new TickScheduler(() => _configWindow.TestConnection()); var _ = new TickScheduler(() => _configWindow.TestConnection());
} }
} }
}

View File

@ -4,8 +4,8 @@ using System.Security.Cryptography;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Pal.Client.Configuration namespace Pal.Client.Configuration;
{
public sealed class AccountConfigurationV7 : IAccountConfiguration public sealed class AccountConfigurationV7 : IAccountConfiguration
{ {
private const int DefaultEntropyLength = 16; private const int DefaultEntropyLength = 16;
@ -146,4 +146,3 @@ namespace Pal.Client.Configuration
ProtectedDataUnsupported = 3, ProtectedDataUnsupported = 3,
} }
} }
}

View File

@ -3,8 +3,8 @@ using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Pal.Client.Configuration namespace Pal.Client.Configuration;
{
internal static class ConfigurationData internal static class ConfigurationData
{ {
private static readonly ILogger _logger = private static readonly ILogger _logger =
@ -41,4 +41,3 @@ namespace Pal.Client.Configuration
} }
} }
} }
}

View File

@ -13,8 +13,8 @@ using Pal.Client.Configuration.Legacy;
using Pal.Client.Database; using Pal.Client.Database;
using NJson = Newtonsoft.Json; using NJson = Newtonsoft.Json;
namespace Pal.Client.Configuration namespace Pal.Client.Configuration;
{
internal sealed class ConfigurationManager internal sealed class ConfigurationManager
{ {
private readonly ILogger<ConfigurationManager> _logger; private readonly ILogger<ConfigurationManager> _logger;
@ -153,4 +153,3 @@ namespace Pal.Client.Configuration
#pragma warning restore CS0618 #pragma warning restore CS0618
#pragma warning restore CS0612 #pragma warning restore CS0612
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace Pal.Client.Configuration namespace Pal.Client.Configuration;
{
public sealed class ConfigurationV7 : IPalacePalConfiguration, IConfigurationInConfigDirectory public sealed class ConfigurationV7 : IPalacePalConfiguration, IConfigurationInConfigDirectory
{ {
public int Version { get; set; } = 7; public int Version { get; set; } = 7;
@ -51,4 +51,3 @@ namespace Pal.Client.Configuration
return account == null || account.CachedRoles.Contains(role); return account == null || account.CachedRoles.Contains(role);
} }
} }
}

View File

@ -1,5 +1,5 @@
namespace Pal.Client.Configuration namespace Pal.Client.Configuration;
{
public enum EMode public enum EMode
{ {
/// <summary> /// <summary>
@ -12,4 +12,3 @@
/// </summary> /// </summary>
Offline = 2, Offline = 2,
} }
}

View File

@ -1,5 +1,5 @@
namespace Pal.Client.Configuration namespace Pal.Client.Configuration;
{
public enum ERenderer public enum ERenderer
{ {
/// <see cref="Rendering.SimpleRenderer"/> /// <see cref="Rendering.SimpleRenderer"/>
@ -8,4 +8,3 @@
/// <see cref="Rendering.SplatoonRenderer"/> /// <see cref="Rendering.SplatoonRenderer"/>
Splatoon = 1, Splatoon = 1,
} }
}

View File

@ -4,8 +4,8 @@ using System.Numerics;
using ImGuiNET; using ImGuiNET;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Pal.Client.Configuration namespace Pal.Client.Configuration;
{
public interface IVersioned public interface IVersioned
{ {
int Version { get; set; } int Version { get; set; }
@ -108,4 +108,3 @@ namespace Pal.Client.Configuration
public int MinimumBackupsToKeep { get; set; } = 3; public int MinimumBackupsToKeep { get; set; } = 3;
public int DaysToDeleteAfter { get; set; } = 21; public int DaysToDeleteAfter { get; set; } = 21;
} }
}

View File

@ -8,8 +8,8 @@ using Dalamud.Plugin;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Pal.Client.Configuration.Legacy namespace Pal.Client.Configuration.Legacy;
{
[Obsolete] [Obsolete]
public sealed class ConfigurationV1 public sealed class ConfigurationV1
{ {
@ -164,4 +164,3 @@ namespace Pal.Client.Configuration.Legacy
public DateTime ImportedAt { get; set; } public DateTime ImportedAt { get; set; }
} }
} }
}

View File

@ -7,8 +7,8 @@ using System.Text.Json;
using Pal.Client.Extensions; using Pal.Client.Extensions;
using Pal.Common; using Pal.Common;
namespace Pal.Client.Configuration.Legacy namespace Pal.Client.Configuration.Legacy;
{
/// <summary> /// <summary>
/// Legacy JSON file for marker locations. /// Legacy JSON file for marker locations.
/// </summary> /// </summary>
@ -159,4 +159,3 @@ namespace Pal.Client.Configuration.Legacy
public HashSet<JsonMarker> Markers { get; set; } = new(); public HashSet<JsonMarker> Markers { get; set; } = new();
} }
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Numerics; using System.Numerics;
namespace Pal.Client.Configuration.Legacy namespace Pal.Client.Configuration.Legacy;
{
[Obsolete] [Obsolete]
public class JsonMarker public class JsonMarker
{ {
@ -23,4 +23,3 @@ namespace Pal.Client.Configuration.Legacy
Debug = 3, Debug = 3,
} }
} }
}

View File

@ -12,8 +12,8 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Database; using Pal.Client.Database;
using Pal.Common; using Pal.Common;
namespace Pal.Client.Configuration.Legacy namespace Pal.Client.Configuration.Legacy;
{
/// <summary> /// <summary>
/// Imports legacy territoryType.json files into the database if it exists, and no markers for that territory exist. /// Imports legacy territoryType.json files into the database if it exists, and no markers for that territory exist.
/// </summary> /// </summary>
@ -144,4 +144,3 @@ namespace Pal.Client.Configuration.Legacy
} }
#pragma warning restore CS0612 #pragma warning restore CS0612
} }
}

View File

@ -6,8 +6,8 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Configuration; using Pal.Client.Configuration;
using Pal.Common; using Pal.Common;
namespace Pal.Client.Database namespace Pal.Client.Database;
{
internal sealed class Cleanup internal sealed class Cleanup
{ {
private readonly ILogger<Cleanup> _logger; private readonly ILogger<Cleanup> _logger;
@ -64,4 +64,3 @@ namespace Pal.Client.Database
return o => o.Source != ClientLocation.ESource.Download; return o => o.Source != ClientLocation.ESource.Download;
} }
} }
}

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace Pal.Client.Database namespace Pal.Client.Database;
{
internal sealed class ClientLocation internal sealed class ClientLocation
{ {
[Key] public int LocalId { get; set; } [Key] public int LocalId { get; set; }
@ -56,4 +56,3 @@ namespace Pal.Client.Database
Download = 4, Download = 4,
} }
} }
}

View File

@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Pal.Client.Database namespace Pal.Client.Database;
{
internal sealed class ImportHistory internal sealed class ImportHistory
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
@ -12,4 +12,3 @@ namespace Pal.Client.Database
public List<ClientLocation> ImportedLocations { get; set; } = new(); public List<ClientLocation> ImportedLocations { get; set; } = new();
} }
}

View File

@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Pal.Client.Database namespace Pal.Client.Database;
{
internal class PalClientContext : DbContext internal class PalClientContext : DbContext
{ {
public DbSet<ClientLocation> Locations { get; set; } = null!; public DbSet<ClientLocation> Locations { get; set; } = null!;
@ -21,4 +21,3 @@ namespace Pal.Client.Database
.UsingEntity(o => o.ToTable("LocationImports")); .UsingEntity(o => o.ToTable("LocationImports"));
} }
} }
}

View File

@ -2,8 +2,8 @@
using Pal.Client.Extensions; using Pal.Client.Extensions;
using Pal.Client.Net; using Pal.Client.Net;
namespace Pal.Client.Database namespace Pal.Client.Database;
{
/// <summary> /// <summary>
/// To avoid sending too many requests to the server, we cache which locations have been seen /// To avoid sending too many requests to the server, we cache which locations have been seen
/// locally. These never expire, and locations which have been seen with a specific account /// locally. These never expire, and locations which have been seen with a specific account
@ -38,4 +38,3 @@ namespace Pal.Client.Database
AccountId = accountId.ToPartialId(); AccountId = accountId.ToPartialId();
} }
} }
}

View File

@ -19,8 +19,8 @@ using Pal.Client.DependencyInjection;
using Pal.Client.Floors; using Pal.Client.Floors;
using Pal.Client.Windows; using Pal.Client.Windows;
namespace Pal.Client namespace Pal.Client;
{
/// <summary> /// <summary>
/// Takes care of async plugin init - this is mostly everything that requires either the config or the database to /// Takes care of async plugin init - this is mostly everything that requires either the config or the database to
/// be available. /// be available.
@ -193,4 +193,3 @@ namespace Pal.Client
await dbContext.SaveChangesAsync(); await dbContext.SaveChangesAsync();
} }
} }
}

View File

@ -3,8 +3,8 @@ using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Pal.Client.Properties; using Pal.Client.Properties;
namespace Pal.Client.DependencyInjection namespace Pal.Client.DependencyInjection;
{
internal sealed class Chat internal sealed class Chat
{ {
private readonly ChatGui _chatGui; private readonly ChatGui _chatGui;
@ -35,4 +35,3 @@ namespace Pal.Client.DependencyInjection
public void UnformattedMessage(string message) public void UnformattedMessage(string message)
=> _chatGui.Print(message); => _chatGui.Print(message);
} }
}

View File

@ -8,8 +8,8 @@ using Lumina.Excel.GeneratedSheets;
using Pal.Client.Configuration; using Pal.Client.Configuration;
using Pal.Client.Floors; using Pal.Client.Floors;
namespace Pal.Client.DependencyInjection namespace Pal.Client.DependencyInjection;
{
internal sealed class ChatService : IDisposable internal sealed class ChatService : IDisposable
{ {
private readonly ChatGui _chatGui; private readonly ChatGui _chatGui;
@ -107,4 +107,3 @@ namespace Pal.Client.DependencyInjection
new(@"This isn't a game message, but will be replaced"); // new Regex(@"^Floor (\d+)$"); new(@"This isn't a game message, but will be replaced"); // new Regex(@"^Floor (\d+)$");
} }
} }
}

View File

@ -1,7 +1,7 @@
using System; using System;
namespace Pal.Client.DependencyInjection namespace Pal.Client.DependencyInjection;
{
internal sealed class DebugState internal sealed class DebugState
{ {
public string? DebugMessage { get; set; } public string? DebugMessage { get; set; }
@ -12,4 +12,3 @@ namespace Pal.Client.DependencyInjection
public void Reset() public void Reset()
=> DebugMessage = null; => DebugMessage = null;
} }
}

View File

@ -8,8 +8,8 @@ using Dalamud.Utility.Signatures;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Pal.Client.Floors; using Pal.Client.Floors;
namespace Pal.Client.DependencyInjection namespace Pal.Client.DependencyInjection;
{
internal sealed unsafe class GameHooks : IDisposable internal sealed unsafe class GameHooks : IDisposable
{ {
private readonly ILogger<GameHooks> _logger; private readonly ILogger<GameHooks> _logger;
@ -103,4 +103,3 @@ namespace Pal.Client.DependencyInjection
ActorVfxCreateHook.Dispose(); ActorVfxCreateHook.Dispose();
} }
} }
}

View File

@ -12,8 +12,8 @@ using Pal.Client.Floors;
using Pal.Client.Floors.Tasks; using Pal.Client.Floors.Tasks;
using Pal.Common; using Pal.Common;
namespace Pal.Client.DependencyInjection namespace Pal.Client.DependencyInjection;
{
internal sealed class ImportService internal sealed class ImportService
{ {
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
@ -163,4 +163,3 @@ namespace Pal.Client.DependencyInjection
} }
} }
} }
}

View File

@ -6,8 +6,8 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Extensions; using Pal.Client.Extensions;
using Pal.Client.Properties; using Pal.Client.Properties;
namespace Pal.Client.DependencyInjection namespace Pal.Client.DependencyInjection;
{
internal sealed class RepoVerification internal sealed class RepoVerification
{ {
public RepoVerification(ILogger<RepoVerification> logger, DalamudPluginInterface pluginInterface, Chat chat) public RepoVerification(ILogger<RepoVerification> logger, DalamudPluginInterface pluginInterface, Chat chat)
@ -27,4 +27,3 @@ namespace Pal.Client.DependencyInjection
{ {
} }
} }
}

View File

@ -9,8 +9,8 @@ using Pal.Client.Net;
using Pal.Client.Properties; using Pal.Client.Properties;
using Pal.Client.Windows; using Pal.Client.Windows;
namespace Pal.Client.DependencyInjection namespace Pal.Client.DependencyInjection;
{
internal sealed class StatisticsService internal sealed class StatisticsService
{ {
private readonly IPalacePalConfiguration _configuration; private readonly IPalacePalConfiguration _configuration;
@ -72,4 +72,3 @@ namespace Pal.Client.DependencyInjection
} }
} }
} }
}

View File

@ -25,8 +25,8 @@ using Pal.Client.Rendering;
using Pal.Client.Scheduled; using Pal.Client.Scheduled;
using Pal.Client.Windows; using Pal.Client.Windows;
namespace Pal.Client namespace Pal.Client;
{
/// <summary> /// <summary>
/// DI-aware Plugin. /// DI-aware Plugin.
/// </summary> /// </summary>
@ -187,4 +187,3 @@ namespace Pal.Client
SqliteConnection.ClearPool(sqliteConnection); SqliteConnection.ClearPool(sqliteConnection);
} }
} }
}

View File

@ -1,7 +1,7 @@
using System; using System;
namespace Pal.Client.Extensions namespace Pal.Client.Extensions;
{
public static class GuidExtensions public static class GuidExtensions
{ {
public static string ToPartialId(this Guid g, int length = 13) public static string ToPartialId(this Guid g, int length = 13)
@ -10,4 +10,3 @@ namespace Pal.Client.Extensions
public static string ToPartialId(this string s, int length = 13) public static string ToPartialId(this string s, int length = 13)
=> s.PadRight(length + 1).Substring(0, length); => s.PadRight(length + 1).Substring(0, length);
} }
}

View File

@ -3,8 +3,8 @@ using System.Runtime.InteropServices;
using System.Text; using System.Text;
using ImGuiNET; using ImGuiNET;
namespace Pal.Client.Extensions namespace Pal.Client.Extensions;
{
internal static class PalImGui internal static class PalImGui
{ {
/// <summary> /// <summary>
@ -33,4 +33,3 @@ namespace Pal.Client.Extensions
choice = value; choice = value;
} }
} }
}

View File

@ -1,7 +1,7 @@
using System; using System;
namespace Pal.Client.Floors namespace Pal.Client.Floors;
{
/// <summary> /// <summary>
/// This is a currently-visible marker. /// This is a currently-visible marker.
/// </summary> /// </summary>
@ -26,4 +26,3 @@ namespace Pal.Client.Floors
return $"EphemeralLocation(Position={Position}, Type={Type})"; return $"EphemeralLocation(Position={Position}, Type={Type})";
} }
} }
}

View File

@ -10,8 +10,8 @@ using Pal.Client.Floors.Tasks;
using Pal.Client.Net; using Pal.Client.Net;
using Pal.Common; using Pal.Common;
namespace Pal.Client.Floors namespace Pal.Client.Floors;
{
internal sealed class FloorService internal sealed class FloorService
{ {
private readonly IPalacePalConfiguration _configuration; private readonly IPalacePalConfiguration _configuration;
@ -160,4 +160,3 @@ namespace Pal.Client.Floors
} }
} }
} }
}

View File

@ -18,8 +18,8 @@ using Pal.Client.Rendering;
using Pal.Client.Scheduled; using Pal.Client.Scheduled;
using Pal.Common; using Pal.Common;
namespace Pal.Client.Floors namespace Pal.Client.Floors;
{
internal sealed class FrameworkService : IDisposable internal sealed class FrameworkService : IDisposable
{ {
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
@ -465,4 +465,3 @@ namespace Pal.Client.Floors
handler.RunIfCompatible(queued, ref recreateLayout); handler.RunIfCompatible(queued, ref recreateLayout);
} }
} }
}

View File

@ -5,8 +5,8 @@ using Pal.Client.Rendering;
using Pal.Common; using Pal.Common;
using Palace; using Palace;
namespace Pal.Client.Floors namespace Pal.Client.Floors;
{
/// <summary> /// <summary>
/// Base class for <see cref="MemoryLocation"/> and <see cref="EphemeralLocation"/>. /// Base class for <see cref="MemoryLocation"/> and <see cref="EphemeralLocation"/>.
/// </summary> /// </summary>
@ -64,4 +64,3 @@ namespace Pal.Client.Floors
}; };
} }
} }
}

View File

@ -5,8 +5,8 @@ using Pal.Client.Configuration;
using Pal.Client.Scheduled; using Pal.Client.Scheduled;
using Pal.Common; using Pal.Common;
namespace Pal.Client.Floors namespace Pal.Client.Floors;
{
/// <summary> /// <summary>
/// A single set of floors loaded entirely in memory, can be e.g. POTD 51-60. /// A single set of floors loaded entirely in memory, can be e.g. POTD 51-60.
/// </summary> /// </summary>
@ -60,4 +60,3 @@ namespace Pal.Client.Floors
Importing, Importing,
} }
} }
}

View File

@ -9,8 +9,8 @@ using Dalamud.Game.Gui;
using Dalamud.Plugin; using Dalamud.Plugin;
using ImGuiNET; using ImGuiNET;
namespace Pal.Client.Floors namespace Pal.Client.Floors;
{
/// <summary> /// <summary>
/// This isn't very useful for running deep dungeons normally, but it is for plugin dev. /// This isn't very useful for running deep dungeons normally, but it is for plugin dev.
/// ///
@ -98,4 +98,3 @@ namespace Pal.Client.Floors
_pluginInterface.UiBuilder.Draw -= Draw; _pluginInterface.UiBuilder.Draw -= Draw;
} }
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using Pal.Client.Database; using Pal.Client.Database;
namespace Pal.Client.Floors namespace Pal.Client.Floors;
{
/// <summary> /// <summary>
/// A <see cref="ClientLocation"/> loaded in memory, with certain extra attributes as needed. /// A <see cref="ClientLocation"/> loaded in memory, with certain extra attributes as needed.
/// </summary> /// </summary>
@ -52,4 +52,3 @@ namespace Pal.Client.Floors
return $"PersistentLocation(Position={Position}, Type={Type})"; return $"PersistentLocation(Position={Position}, Type={Type})";
} }
} }
}

View File

@ -4,8 +4,8 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Pal.Client.Database; using Pal.Client.Database;
namespace Pal.Client.Floors.Tasks namespace Pal.Client.Floors.Tasks;
{
internal abstract class DbTask<T> internal abstract class DbTask<T>
where T : DbTask<T> where T : DbTask<T>
{ {
@ -38,4 +38,3 @@ namespace Pal.Client.Floors.Tasks
protected abstract void Run(PalClientContext dbContext, ILogger<T> logger); protected abstract void Run(PalClientContext dbContext, ILogger<T> logger);
} }
}

View File

@ -7,8 +7,8 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Pal.Client.Database; using Pal.Client.Database;
namespace Pal.Client.Floors.Tasks namespace Pal.Client.Floors.Tasks;
{
internal sealed class LoadTerritory : DbTask<LoadTerritory> internal sealed class LoadTerritory : DbTask<LoadTerritory>
{ {
private readonly Cleanup _cleanup; private readonly Cleanup _cleanup;
@ -76,4 +76,3 @@ namespace Pal.Client.Floors.Tasks
}; };
} }
} }
}

View File

@ -5,8 +5,8 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Pal.Client.Database; using Pal.Client.Database;
namespace Pal.Client.Floors.Tasks namespace Pal.Client.Floors.Tasks;
{
internal sealed class MarkLocalSeen : DbTask<MarkLocalSeen> internal sealed class MarkLocalSeen : DbTask<MarkLocalSeen>
{ {
private readonly MemoryTerritory _territory; private readonly MemoryTerritory _territory;
@ -34,4 +34,3 @@ namespace Pal.Client.Floors.Tasks
} }
} }
} }
}

View File

@ -5,8 +5,8 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Pal.Client.Database; using Pal.Client.Database;
namespace Pal.Client.Floors.Tasks namespace Pal.Client.Floors.Tasks;
{
internal sealed class MarkRemoteSeen : DbTask<MarkRemoteSeen> internal sealed class MarkRemoteSeen : DbTask<MarkRemoteSeen>
{ {
private readonly MemoryTerritory _territory; private readonly MemoryTerritory _territory;
@ -48,4 +48,3 @@ namespace Pal.Client.Floors.Tasks
} }
} }
} }
}

View File

@ -6,8 +6,8 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Database; using Pal.Client.Database;
using Pal.Common; using Pal.Common;
namespace Pal.Client.Floors.Tasks namespace Pal.Client.Floors.Tasks;
{
internal sealed class SaveNewLocations : DbTask<SaveNewLocations> internal sealed class SaveNewLocations : DbTask<SaveNewLocations>
{ {
private readonly MemoryTerritory _territory; private readonly MemoryTerritory _territory;
@ -74,4 +74,3 @@ namespace Pal.Client.Floors.Tasks
}; };
} }
} }
}

View File

@ -2,8 +2,8 @@
using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Conditions;
using Pal.Common; using Pal.Common;
namespace Pal.Client.Floors namespace Pal.Client.Floors;
{
public sealed class TerritoryState public sealed class TerritoryState
{ {
private readonly ClientState _clientState; private readonly ClientState _clientState;
@ -33,4 +33,3 @@ namespace Pal.Client.Floors
FoundOnCurrentFloor, FoundOnCurrentFloor,
PomanderOfSafetyUsed, PomanderOfSafetyUsed,
} }
}

View File

@ -4,10 +4,9 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Pal.Client namespace Pal.Client;
{
internal interface ILanguageChanged internal interface ILanguageChanged
{ {
void LanguageChanged(); void LanguageChanged();
} }
}

View File

@ -1,13 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Pal.Client.Net namespace Pal.Client.Net;
{
internal sealed class JwtClaims internal sealed class JwtClaims
{ {
[JsonPropertyName("nameid")] [JsonPropertyName("nameid")]
@ -77,19 +75,3 @@ namespace Pal.Client.Net
public override void Write(Utf8JsonWriter writer, List<string> value, JsonSerializerOptions options) => throw new NotImplementedException(); public override void Write(Utf8JsonWriter writer, List<string> value, JsonSerializerOptions options) => throw new NotImplementedException();
} }
public sealed class JwtDateConverter : JsonConverter<DateTimeOffset>
{
static readonly DateTimeOffset Zero = new(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);
public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.Number)
throw new JsonException("bad token type");
return Zero.AddSeconds(reader.GetInt64());
}
public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) => throw new NotImplementedException();
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Pal.Client.Net;
public sealed class JwtDateConverter : JsonConverter<DateTimeOffset>
{
static readonly DateTimeOffset Zero = new(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);
public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.Number)
throw new JsonException("bad token type");
return Zero.AddSeconds(reader.GetInt64());
}
public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) => throw new NotImplementedException();
}

View File

@ -12,8 +12,8 @@ using Pal.Client.Configuration;
using Pal.Client.Extensions; using Pal.Client.Extensions;
using Pal.Client.Properties; using Pal.Client.Properties;
namespace Pal.Client.Net namespace Pal.Client.Net;
{
internal partial class RemoteApi internal partial class RemoteApi
{ {
private readonly SemaphoreSlim _connectLock = new(1, 1); private readonly SemaphoreSlim _connectLock = new(1, 1);
@ -229,4 +229,3 @@ namespace Pal.Client.Net
public bool IsValid => IsLoggedIn && !IsExpired; public bool IsValid => IsLoggedIn && !IsExpired;
} }
} }
}

View File

@ -3,8 +3,8 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Export; using Export;
namespace Pal.Client.Net namespace Pal.Client.Net;
{
internal partial class RemoteApi internal partial class RemoteApi
{ {
public async Task<(bool, ExportRoot)> DoExport(CancellationToken cancellationToken = default) public async Task<(bool, ExportRoot)> DoExport(CancellationToken cancellationToken = default)
@ -20,4 +20,3 @@ namespace Pal.Client.Net
return (exportReply.Success, exportReply.Data); return (exportReply.Success, exportReply.Data);
} }
} }
}

View File

@ -8,8 +8,8 @@ using Pal.Client.Database;
using Pal.Client.Floors; using Pal.Client.Floors;
using Palace; using Palace;
namespace Pal.Client.Net namespace Pal.Client.Net;
{
internal partial class RemoteApi internal partial class RemoteApi
{ {
public async Task<(bool, List<PersistentLocation>)> DownloadRemoteMarkers(ushort territoryId, CancellationToken cancellationToken = default) public async Task<(bool, List<PersistentLocation>)> DownloadRemoteMarkers(ushort territoryId, CancellationToken cancellationToken = default)
@ -84,4 +84,3 @@ namespace Pal.Client.Net
return (statisticsReply.Success, statisticsReply.FloorStatistics.ToList()); return (statisticsReply.Success, statisticsReply.FloorStatistics.ToList());
} }
} }
}

View File

@ -5,8 +5,8 @@ using Dalamud.Logging;
using Grpc.Core; using Grpc.Core;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Pal.Client.Net namespace Pal.Client.Net;
{
internal partial class RemoteApi internal partial class RemoteApi
{ {
private Metadata UnauthorizedHeaders() => new() private Metadata UnauthorizedHeaders() => new()
@ -55,4 +55,3 @@ namespace Pal.Client.Net
#endif #endif
} }
} }
}

View File

@ -6,8 +6,8 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Configuration; using Pal.Client.Configuration;
using Pal.Client.DependencyInjection; using Pal.Client.DependencyInjection;
namespace Pal.Client.Net namespace Pal.Client.Net;
{
internal sealed partial class RemoteApi : IDisposable internal sealed partial class RemoteApi : IDisposable
{ {
#if DEBUG #if DEBUG
@ -49,4 +49,3 @@ namespace Pal.Client.Net
_channel = null; _channel = null;
} }
} }
}

View File

@ -21,8 +21,8 @@ using Pal.Client.DependencyInjection;
using Pal.Client.Properties; using Pal.Client.Properties;
using Pal.Client.Rendering; using Pal.Client.Rendering;
namespace Pal.Client namespace Pal.Client;
{
/// <summary> /// <summary>
/// With all DI logic elsewhere, this plugin shell really only takes care of a few things around events that /// With all DI logic elsewhere, this plugin shell really only takes care of a few things around events that
/// need to be sent to different receivers depending on priority or configuration . /// need to be sent to different receivers depending on priority or configuration .
@ -234,4 +234,3 @@ namespace Pal.Client
Error Error
} }
} }
}

View File

@ -1,9 +1,8 @@
namespace Pal.Client.Rendering namespace Pal.Client.Rendering;
{
internal enum ELayer internal enum ELayer
{ {
TrapHoard, TrapHoard,
RegularCoffers, RegularCoffers,
Test, Test,
} }
}

View File

@ -1,9 +1,8 @@
namespace Pal.Client.Rendering namespace Pal.Client.Rendering;
{
public interface IRenderElement public interface IRenderElement
{ {
bool IsValid { get; } bool IsValid { get; }
uint Color { get; set; } uint Color { get; set; }
} }
}

View File

@ -3,8 +3,8 @@ using System.Numerics;
using Pal.Client.Configuration; using Pal.Client.Configuration;
using Pal.Client.Floors; using Pal.Client.Floors;
namespace Pal.Client.Rendering namespace Pal.Client.Rendering;
{
internal interface IRenderer internal interface IRenderer
{ {
ERenderer GetConfigValue(); ERenderer GetConfigValue();
@ -17,4 +17,3 @@ namespace Pal.Client.Rendering
void DrawDebugItems(uint trapColor, uint hoardColor); void DrawDebugItems(uint trapColor, uint hoardColor);
} }
}

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using Pal.Client.Floors; using Pal.Client.Floors;
namespace Pal.Client.Rendering namespace Pal.Client.Rendering;
{
internal sealed class MarkerConfig internal sealed class MarkerConfig
{ {
private static readonly MarkerConfig EmptyConfig = new(); private static readonly MarkerConfig EmptyConfig = new();
@ -21,4 +21,3 @@ namespace Pal.Client.Rendering
public static MarkerConfig ForType(MemoryLocation.EType type) => public static MarkerConfig ForType(MemoryLocation.EType type) =>
MarkerConfigs.GetValueOrDefault(type, EmptyConfig); MarkerConfigs.GetValueOrDefault(type, EmptyConfig);
} }
}

View File

@ -6,8 +6,8 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Configuration; using Pal.Client.Configuration;
using Pal.Client.Floors; using Pal.Client.Floors;
namespace Pal.Client.Rendering namespace Pal.Client.Rendering;
{
internal sealed class RenderAdapter : IRenderer, IDisposable internal sealed class RenderAdapter : IRenderer, IDisposable
{ {
private readonly IServiceScopeFactory _serviceScopeFactory; private readonly IServiceScopeFactory _serviceScopeFactory;
@ -75,4 +75,3 @@ namespace Pal.Client.Rendering
sr.DrawLayers(); sr.DrawLayers();
} }
} }
}

View File

@ -1,8 +1,7 @@
namespace Pal.Client.Rendering namespace Pal.Client.Rendering;
{
internal static class RenderData internal static class RenderData
{ {
public static readonly uint ColorInvisible = 0; public static readonly uint ColorInvisible = 0;
public static readonly long TestLayerTimeout = 10_000; public static readonly long TestLayerTimeout = 10_000;
} }
}

View File

@ -11,8 +11,8 @@ using Pal.Client.Configuration;
using Pal.Client.DependencyInjection; using Pal.Client.DependencyInjection;
using Pal.Client.Floors; using Pal.Client.Floors;
namespace Pal.Client.Rendering namespace Pal.Client.Rendering;
{
/// <summary> /// <summary>
/// Simple renderer that only draws basic stuff. /// Simple renderer that only draws basic stuff.
/// ///
@ -201,4 +201,3 @@ namespace Pal.Client.Rendering
public required bool Fill { get; init; } public required bool Fill { get; init; }
} }
} }
}

View File

@ -15,8 +15,8 @@ using Pal.Client.Configuration;
using Pal.Client.DependencyInjection; using Pal.Client.DependencyInjection;
using Pal.Client.Floors; using Pal.Client.Floors;
namespace Pal.Client.Rendering namespace Pal.Client.Rendering;
{
internal sealed class SplatoonRenderer : IRenderer, IDisposable internal sealed class SplatoonRenderer : IRenderer, IDisposable
{ {
private const long OnTerritoryChange = -2; private const long OnTerritoryChange = -2;
@ -193,4 +193,3 @@ namespace Pal.Client.Rendering
} }
} }
} }
}

View File

@ -2,8 +2,8 @@
using Dalamud.Logging; using Dalamud.Logging;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Pal.Client.Scheduled namespace Pal.Client.Scheduled;
{
internal interface IQueueOnFrameworkThread internal interface IQueueOnFrameworkThread
{ {
internal interface IHandler internal interface IHandler
@ -37,4 +37,3 @@ namespace Pal.Client.Scheduled
} }
} }
} }
}

View File

@ -4,8 +4,8 @@ using Pal.Client.DependencyInjection;
using Pal.Client.Floors; using Pal.Client.Floors;
using Pal.Client.Rendering; using Pal.Client.Rendering;
namespace Pal.Client.Scheduled namespace Pal.Client.Scheduled;
{
internal sealed class QueuedConfigUpdate : IQueueOnFrameworkThread internal sealed class QueuedConfigUpdate : IQueueOnFrameworkThread
{ {
internal sealed class Handler : IQueueOnFrameworkThread.Handler<QueuedConfigUpdate> internal sealed class Handler : IQueueOnFrameworkThread.Handler<QueuedConfigUpdate>
@ -26,4 +26,3 @@ namespace Pal.Client.Scheduled
} }
} }
} }
}

View File

@ -10,8 +10,8 @@ using Pal.Client.Properties;
using Pal.Client.Windows; using Pal.Client.Windows;
using Pal.Common; using Pal.Common;
namespace Pal.Client.Scheduled namespace Pal.Client.Scheduled;
{
internal sealed class QueuedImport : IQueueOnFrameworkThread internal sealed class QueuedImport : IQueueOnFrameworkThread
{ {
private ExportRoot Export { get; } private ExportRoot Export { get; }
@ -120,4 +120,3 @@ namespace Pal.Client.Scheduled
} }
} }
} }
}

View File

@ -11,8 +11,8 @@ using Pal.Client.Floors.Tasks;
using Pal.Client.Net; using Pal.Client.Net;
using Pal.Common; using Pal.Common;
namespace Pal.Client.Scheduled namespace Pal.Client.Scheduled;
{
internal sealed class QueuedSyncResponse : IQueueOnFrameworkThread internal sealed class QueuedSyncResponse : IQueueOnFrameworkThread
{ {
public required SyncType Type { get; init; } public required SyncType Type { get; init; }
@ -158,4 +158,3 @@ namespace Pal.Client.Scheduled
Download, Download,
MarkSeen, MarkSeen,
} }
}

View File

@ -7,8 +7,8 @@ using Pal.Client.Floors;
using Pal.Client.Windows; using Pal.Client.Windows;
using Pal.Common; using Pal.Common;
namespace Pal.Client.Scheduled namespace Pal.Client.Scheduled;
{
internal sealed class QueuedUndoImport : IQueueOnFrameworkThread internal sealed class QueuedUndoImport : IQueueOnFrameworkThread
{ {
public QueuedUndoImport(Guid exportId) public QueuedUndoImport(Guid exportId)
@ -39,4 +39,3 @@ namespace Pal.Client.Scheduled
} }
} }
} }
}

View File

@ -8,8 +8,8 @@ using Pal.Client.Configuration;
using Pal.Client.Extensions; using Pal.Client.Extensions;
using Pal.Client.Properties; using Pal.Client.Properties;
namespace Pal.Client.Windows namespace Pal.Client.Windows;
{
internal sealed class AgreementWindow : Window, IDisposable, ILanguageChanged internal sealed class AgreementWindow : Window, IDisposable, ILanguageChanged
{ {
private const string WindowId = "###PalPalaceAgreement"; private const string WindowId = "###PalPalaceAgreement";
@ -102,4 +102,3 @@ namespace Pal.Client.Windows
GenericHelpers.ShellStart("https://github.com/carvelli/PalPalace"); GenericHelpers.ShellStart("https://github.com/carvelli/PalPalace");
} }
} }
}

View File

@ -23,8 +23,8 @@ using Pal.Client.Properties;
using Pal.Client.Rendering; using Pal.Client.Rendering;
using Pal.Client.Scheduled; using Pal.Client.Scheduled;
namespace Pal.Client.Windows namespace Pal.Client.Windows;
{
internal sealed class ConfigWindow : Window, ILanguageChanged, IDisposable internal sealed class ConfigWindow : Window, ILanguageChanged, IDisposable
{ {
private const string WindowId = "###PalPalaceConfig"; private const string WindowId = "###PalPalaceConfig";
@ -576,4 +576,3 @@ namespace Pal.Client.Windows
} }
} }
} }
}

View File

@ -8,8 +8,8 @@ using Pal.Client.Properties;
using Pal.Common; using Pal.Common;
using Palace; using Palace;
namespace Pal.Client.Windows namespace Pal.Client.Windows;
{
internal sealed class StatisticsWindow : Window, IDisposable, ILanguageChanged internal sealed class StatisticsWindow : Window, IDisposable, ILanguageChanged
{ {
private const string WindowId = "###PalacePalStats"; private const string WindowId = "###PalacePalStats";
@ -123,4 +123,3 @@ namespace Pal.Client.Windows
} }
} }
} }
}

View File

@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
namespace Pal.Common namespace Pal.Common;
{
[SuppressMessage("ReSharper", "UnusedMember.Global")] [SuppressMessage("ReSharper", "UnusedMember.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ETerritoryType : ushort public enum ETerritoryType : ushort
@ -60,4 +60,3 @@ namespace Pal.Common
EurekaOrthos_81_90, EurekaOrthos_81_90,
EurekaOrthos_91_100 EurekaOrthos_91_100
} }
}

View File

@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Reflection; using System.Reflection;
namespace Pal.Common namespace Pal.Common;
{
public static class EnumExtensions public static class EnumExtensions
{ {
public static int? GetOrder(this Enum e) public static int? GetOrder(this Enum e)
@ -13,4 +13,3 @@ namespace Pal.Common
return attribute?.Order; return attribute?.Order;
} }
} }
}

View File

@ -4,10 +4,9 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Pal.Common namespace Pal.Common;
{
public static class ExportConfig public static class ExportConfig
{ {
public static int ExportVersion => 2; public static int ExportVersion => 2;
} }
}

View File

@ -1,7 +1,7 @@
using System.Numerics; using System.Numerics;
namespace Pal.Common namespace Pal.Common;
{
public class PalaceMath public class PalaceMath
{ {
private static readonly Vector3 ScaleFactor = new(5); private static readonly Vector3 ScaleFactor = new(5);
@ -19,4 +19,3 @@ namespace Pal.Common
return HashCode.Combine((int)v.X, (int)v.Y, (int)v.Z); return HashCode.Combine((int)v.X, (int)v.Y, (int)v.Z);
} }
} }
}