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
# namespaces
csharp_style_namespace_declarations = block_scoped
csharp_style_namespace_declarations = file_scoped
# braces
csharp_prefer_braces = when_multiline

View File

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

View File

@ -3,10 +3,10 @@ using System.Collections.Generic;
using Pal.Client.Configuration;
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 AgreementWindow _agreementWindow;
private readonly ConfigWindow _configWindow;
@ -36,5 +36,4 @@ namespace Pal.Client.Commands
else
_configWindow.Toggle();
}
}
}

View File

@ -7,10 +7,10 @@ using Pal.Client.Extensions;
using Pal.Client.Floors;
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 ClientState _clientState;
private readonly TerritoryState _territoryState;
@ -59,5 +59,4 @@ namespace Pal.Client.Commands
_chat.UnformattedMessage(
$"{nearbyMarker.distance:F2} - {nearbyMarker.m.Type} {nearbyMarker.m.NetworkId?.ToPartialId(length: 8)} - {nearbyMarker.m.Position}");
}
}
}

View File

@ -2,10 +2,10 @@
using System.Collections.Generic;
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;
public PalStatsCommand(StatisticsService statisticsService)
@ -21,5 +21,4 @@ namespace Pal.Client.Commands
private void Execute()
=> _statisticsService.ShowGlobalStatistics();
}
}

View File

@ -3,10 +3,10 @@ using System.Collections.Generic;
using ECommons.Schedulers;
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;
public PalTestConnectionCommand(ConfigWindow configWindow)
@ -26,5 +26,4 @@ namespace Pal.Client.Commands
_configWindow.IsOpen = true;
var _ = new TickScheduler(() => _configWindow.TestConnection());
}
}
}

View File

@ -4,10 +4,10 @@ using System.Security.Cryptography;
using System.Text.Json.Serialization;
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 static readonly ILogger _logger =
@ -145,5 +145,4 @@ namespace Pal.Client.Configuration
/// </summary>
ProtectedDataUnsupported = 3,
}
}
}

View File

@ -3,10 +3,10 @@ using System.Linq;
using System.Security.Cryptography;
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 =
DependencyInjectionContext.LoggerProvider.CreateLogger(typeof(ConfigurationData));
@ -40,5 +40,4 @@ namespace Pal.Client.Configuration
return _supportsDpapi.Value;
}
}
}
}

View File

@ -13,10 +13,10 @@ using Pal.Client.Configuration.Legacy;
using Pal.Client.Database;
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 DalamudPluginInterface _pluginInterface;
private readonly IServiceProvider _serviceProvider;
@ -152,5 +152,4 @@ namespace Pal.Client.Configuration
}
#pragma warning restore CS0618
#pragma warning restore CS0612
}
}

View File

@ -2,10 +2,10 @@
using System.Collections.Generic;
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 bool FirstUse { get; set; } = true;
@ -50,5 +50,4 @@ namespace Pal.Client.Configuration
var account = FindAccount(server);
return account == null || account.CachedRoles.Contains(role);
}
}
}

View File

@ -1,7 +1,7 @@
namespace Pal.Client.Configuration
namespace Pal.Client.Configuration;
public enum EMode
{
public enum EMode
{
/// <summary>
/// Fetches trap locations from remote server.
/// </summary>
@ -11,5 +11,4 @@
/// Only shows traps found by yourself using a pomander of sight.
/// </summary>
Offline = 2,
}
}

View File

@ -1,11 +1,10 @@
namespace Pal.Client.Configuration
namespace Pal.Client.Configuration;
public enum ERenderer
{
public enum ERenderer
{
/// <see cref="Rendering.SimpleRenderer"/>
Simple = 0,
/// <see cref="Rendering.SplatoonRenderer"/>
Splatoon = 1,
}
}

View File

@ -4,18 +4,18 @@ using System.Numerics;
using ImGuiNET;
using Newtonsoft.Json;
namespace Pal.Client.Configuration
{
public interface IVersioned
{
int Version { get; set; }
}
public interface IConfigurationInConfigDirectory : IVersioned
{
}
namespace Pal.Client.Configuration;
public interface IPalacePalConfiguration : IConfigurationInConfigDirectory
{
public interface IVersioned
{
int Version { get; set; }
}
public interface IConfigurationInConfigDirectory : IVersioned
{
}
public interface IPalacePalConfiguration : IConfigurationInConfigDirectory
{
bool FirstUse { get; set; }
EMode Mode { get; set; }
string BetaKey { get; }
@ -30,10 +30,10 @@ namespace Pal.Client.Configuration
void RemoveAccount(string server);
bool HasRoleOnCurrentServer(string server, string role);
}
}
public class DeepDungeonConfiguration
{
public class DeepDungeonConfiguration
{
public MarkerConfiguration Traps { get; set; } = new()
{
Show = true,
@ -65,10 +65,10 @@ namespace Pal.Client.Configuration
OnlyVisibleAfterPomander = false,
Fill = true
};
}
}
public class MarkerConfiguration
{
public class MarkerConfiguration
{
[JsonRequired]
public bool Show { get; set; }
@ -77,15 +77,15 @@ namespace Pal.Client.Configuration
public bool OnlyVisibleAfterPomander { get; set; }
public bool Fill { get; set; }
}
}
public class RendererConfiguration
{
public class RendererConfiguration
{
public ERenderer SelectedRenderer { get; set; } = ERenderer.Splatoon;
}
}
public interface IAccountConfiguration
{
public interface IAccountConfiguration
{
bool IsUsable { get; }
string Server { get; }
Guid AccountId { get; }
@ -101,11 +101,10 @@ namespace Pal.Client.Configuration
List<string> CachedRoles { get; set; }
bool EncryptIfNeeded();
}
}
public class BackupConfiguration
{
public class BackupConfiguration
{
public int MinimumBackupsToKeep { get; set; } = 3;
public int DaysToDeleteAfter { get; set; } = 21;
}
}

View File

@ -8,11 +8,11 @@ using Dalamud.Plugin;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace Pal.Client.Configuration.Legacy
namespace Pal.Client.Configuration.Legacy;
[Obsolete]
public sealed class ConfigurationV1
{
[Obsolete]
public sealed class ConfigurationV1
{
public int Version { get; set; } = 6;
#region Saved configuration values
@ -163,5 +163,4 @@ namespace Pal.Client.Configuration.Legacy
/// </summary>
public DateTime ImportedAt { get; set; }
}
}
}

View File

@ -7,14 +7,14 @@ using System.Text.Json;
using Pal.Client.Extensions;
using Pal.Common;
namespace Pal.Client.Configuration.Legacy
namespace Pal.Client.Configuration.Legacy;
/// <summary>
/// Legacy JSON file for marker locations.
/// </summary>
[Obsolete]
public sealed class JsonFloorState
{
/// <summary>
/// Legacy JSON file for marker locations.
/// </summary>
[Obsolete]
public sealed class JsonFloorState
{
private static readonly JsonSerializerOptions JsonSerializerOptions = new() { IncludeFields = true };
private const int CurrentVersion = 4;
@ -158,5 +158,4 @@ namespace Pal.Client.Configuration.Legacy
public int Version { get; set; }
public HashSet<JsonMarker> Markers { get; set; } = new();
}
}
}

View File

@ -2,11 +2,11 @@
using System.Collections.Generic;
using System.Numerics;
namespace Pal.Client.Configuration.Legacy
namespace Pal.Client.Configuration.Legacy;
[Obsolete]
public class JsonMarker
{
[Obsolete]
public class JsonMarker
{
public EType Type { get; set; } = EType.Unknown;
public Vector3 Position { get; set; }
public bool Seen { get; set; }
@ -22,5 +22,4 @@ namespace Pal.Client.Configuration.Legacy
Hoard = 2,
Debug = 3,
}
}
}

View File

@ -12,13 +12,13 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Database;
using Pal.Common;
namespace Pal.Client.Configuration.Legacy
namespace Pal.Client.Configuration.Legacy;
/// <summary>
/// Imports legacy territoryType.json files into the database if it exists, and no markers for that territory exist.
/// </summary>
internal sealed class JsonMigration
{
/// <summary>
/// Imports legacy territoryType.json files into the database if it exists, and no markers for that territory exist.
/// </summary>
internal sealed class JsonMigration
{
private readonly ILogger<JsonMigration> _logger;
private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly DalamudPluginInterface _pluginInterface;
@ -143,5 +143,4 @@ namespace Pal.Client.Configuration.Legacy
};
}
#pragma warning restore CS0612
}
}

View File

@ -6,10 +6,10 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Configuration;
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 IPalacePalConfiguration _configuration;
@ -63,5 +63,4 @@ namespace Pal.Client.Database
// keep downloaded markers
return o => o.Source != ClientLocation.ESource.Download;
}
}
}

View File

@ -1,10 +1,10 @@
using System.Collections.Generic;
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; }
public ushort TerritoryType { get; set; }
public EType Type { get; set; }
@ -55,5 +55,4 @@ namespace Pal.Client.Database
Import = 3,
Download = 4,
}
}
}

View File

@ -1,15 +1,14 @@
using System;
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 string? RemoteUrl { get; set; }
public DateTime ExportedAt { get; set; }
public DateTime ImportedAt { get; set; }
public List<ClientLocation> ImportedLocations { get; set; } = new();
}
}

View File

@ -1,9 +1,9 @@
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<ImportHistory> Imports { get; set; } = null!;
public DbSet<RemoteEncounter> RemoteEncounters { get; set; } = null!;
@ -20,5 +20,4 @@ namespace Pal.Client.Database
.WithMany(o => o.ImportedLocations)
.UsingEntity(o => o.ToTable("LocationImports"));
}
}
}

View File

@ -2,17 +2,17 @@
using Pal.Client.Extensions;
using Pal.Client.Net;
namespace Pal.Client.Database
namespace Pal.Client.Database;
/// <summary>
/// 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
/// are never sent to the server again.
///
/// To be marked as seen, it needs to be essentially processed by <see cref="RemoteApi.MarkAsSeen"/>.
/// </summary>
internal sealed class RemoteEncounter
{
/// <summary>
/// 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
/// are never sent to the server again.
///
/// To be marked as seen, it needs to be essentially processed by <see cref="RemoteApi.MarkAsSeen"/>.
/// </summary>
internal sealed class RemoteEncounter
{
[Key]
public int Id { get; private set; }
@ -37,5 +37,4 @@ namespace Pal.Client.Database
ClientLocation = clientLocation;
AccountId = accountId.ToPartialId();
}
}
}

View File

@ -19,14 +19,14 @@ using Pal.Client.DependencyInjection;
using Pal.Client.Floors;
using Pal.Client.Windows;
namespace Pal.Client
namespace Pal.Client;
/// <summary>
/// Takes care of async plugin init - this is mostly everything that requires either the config or the database to
/// be available.
/// </summary>
internal sealed class DependencyContextInitializer
{
/// <summary>
/// Takes care of async plugin init - this is mostly everything that requires either the config or the database to
/// be available.
/// </summary>
internal sealed class DependencyContextInitializer
{
private readonly ILogger<DependencyContextInitializer> _logger;
private readonly IServiceProvider _serviceProvider;
@ -192,5 +192,4 @@ namespace Pal.Client
await dbContext.SaveChangesAsync();
}
}
}

View File

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

View File

@ -8,10 +8,10 @@ using Lumina.Excel.GeneratedSheets;
using Pal.Client.Configuration;
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 TerritoryState _territoryState;
private readonly IPalacePalConfiguration _configuration;
@ -106,5 +106,4 @@ namespace Pal.Client.DependencyInjection
public Regex FloorChanged { get; init; } =
new(@"This isn't a game message, but will be replaced"); // new Regex(@"^Floor (\d+)$");
}
}
}

View File

@ -1,9 +1,9 @@
using System;
namespace Pal.Client.DependencyInjection
namespace Pal.Client.DependencyInjection;
internal sealed class DebugState
{
internal sealed class DebugState
{
public string? DebugMessage { get; set; }
public void SetFromException(Exception e)
@ -11,5 +11,4 @@ namespace Pal.Client.DependencyInjection
public void Reset()
=> DebugMessage = null;
}
}

View File

@ -8,10 +8,10 @@ using Dalamud.Utility.Signatures;
using Microsoft.Extensions.Logging;
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 ObjectTable _objectTable;
private readonly TerritoryState _territoryState;
@ -102,5 +102,4 @@ namespace Pal.Client.DependencyInjection
_logger.LogDebug("Disposing game hooks");
ActorVfxCreateHook.Dispose();
}
}
}

View File

@ -12,10 +12,10 @@ using Pal.Client.Floors;
using Pal.Client.Floors.Tasks;
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 FloorService _floorService;
private readonly Cleanup _cleanup;
@ -162,5 +162,4 @@ namespace Pal.Client.DependencyInjection
_floorService.ResetAll();
}
}
}
}

View File

@ -6,10 +6,10 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Extensions;
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)
{
logger.LogInformation("Install source: {Repo}", pluginInterface.SourceRepository);
@ -26,5 +26,4 @@ namespace Pal.Client.DependencyInjection
internal sealed class RepoVerificationFailedException : Exception
{
}
}
}

View File

@ -9,10 +9,10 @@ using Pal.Client.Net;
using Pal.Client.Properties;
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 ILogger<StatisticsService> _logger;
private readonly RemoteApi _remoteApi;
@ -71,5 +71,4 @@ namespace Pal.Client.DependencyInjection
$"{e.GetType()} - {e.Message}"));
}
}
}
}

View File

@ -25,13 +25,13 @@ using Pal.Client.Rendering;
using Pal.Client.Scheduled;
using Pal.Client.Windows;
namespace Pal.Client
namespace Pal.Client;
/// <summary>
/// DI-aware Plugin.
/// </summary>
internal sealed class DependencyInjectionContext : IDisposable
{
/// <summary>
/// DI-aware Plugin.
/// </summary>
internal sealed class DependencyInjectionContext : IDisposable
{
public const string DatabaseFileName = "palace-pal.data.sqlite3";
public static DalamudLoggerProvider LoggerProvider { get; } = new(typeof(Plugin).Assembly);
@ -186,5 +186,4 @@ namespace Pal.Client
using (SqliteConnection sqliteConnection = new(_sqliteConnectionString))
SqliteConnection.ClearPool(sqliteConnection);
}
}
}

View File

@ -1,13 +1,12 @@
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)
=> g.ToString().ToPartialId();
public static string ToPartialId(this string s, int length = 13)
=> s.PadRight(length + 1).Substring(0, length);
}
}

View File

@ -3,10 +3,10 @@ using System.Runtime.InteropServices;
using System.Text;
using ImGuiNET;
namespace Pal.Client.Extensions
namespace Pal.Client.Extensions;
internal static class PalImGui
{
internal static class PalImGui
{
/// <summary>
/// None of the default BeginTabItem methods allow using flags without making the tab have a close button for some reason.
/// </summary>
@ -32,5 +32,4 @@ namespace Pal.Client.Extensions
if (ImGui.IsItemClicked())
choice = value;
}
}
}

View File

@ -1,12 +1,12 @@
using System;
namespace Pal.Client.Floors
namespace Pal.Client.Floors;
/// <summary>
/// This is a currently-visible marker.
/// </summary>
internal sealed class EphemeralLocation : MemoryLocation
{
/// <summary>
/// This is a currently-visible marker.
/// </summary>
internal sealed class EphemeralLocation : MemoryLocation
{
public override bool Equals(object? obj) => obj is EphemeralLocation && base.Equals(obj);
public override int GetHashCode() => base.GetHashCode();
@ -25,5 +25,4 @@ namespace Pal.Client.Floors
{
return $"EphemeralLocation(Position={Position}, Type={Type})";
}
}
}

View File

@ -10,10 +10,10 @@ using Pal.Client.Floors.Tasks;
using Pal.Client.Net;
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 Cleanup _cleanup;
private readonly IServiceScopeFactory _serviceScopeFactory;
@ -159,5 +159,4 @@ namespace Pal.Client.Floors
memoryTerritory.ReadyState = MemoryTerritory.EReadyState.Importing;
}
}
}
}

View File

@ -18,10 +18,10 @@ using Pal.Client.Rendering;
using Pal.Client.Scheduled;
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 ILogger<FrameworkService> _logger;
private readonly Framework _framework;
@ -464,5 +464,4 @@ namespace Pal.Client.Floors
handler.RunIfCompatible(queued, ref recreateLayout);
}
}
}

View File

@ -5,13 +5,13 @@ using Pal.Client.Rendering;
using Pal.Common;
using Palace;
namespace Pal.Client.Floors
namespace Pal.Client.Floors;
/// <summary>
/// Base class for <see cref="MemoryLocation"/> and <see cref="EphemeralLocation"/>.
/// </summary>
internal abstract class MemoryLocation
{
/// <summary>
/// Base class for <see cref="MemoryLocation"/> and <see cref="EphemeralLocation"/>.
/// </summary>
internal abstract class MemoryLocation
{
public required EType Type { get; init; }
public required Vector3 Position { get; init; }
public bool Seen { get; set; }
@ -40,10 +40,10 @@ namespace Pal.Client.Floors
{
return HashCode.Combine(Type, PalaceMath.GetHashCode(Position));
}
}
}
internal static class ETypeExtensions
{
internal static class ETypeExtensions
{
public static MemoryLocation.EType ToMemoryType(this ObjectType objectType)
{
return objectType switch
@ -63,5 +63,4 @@ namespace Pal.Client.Floors
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
};
}
}
}

View File

@ -5,13 +5,13 @@ using Pal.Client.Configuration;
using Pal.Client.Scheduled;
using Pal.Common;
namespace Pal.Client.Floors
namespace Pal.Client.Floors;
/// <summary>
/// A single set of floors loaded entirely in memory, can be e.g. POTD 51-60.
/// </summary>
internal sealed class MemoryTerritory
{
/// <summary>
/// A single set of floors loaded entirely in memory, can be e.g. POTD 51-60.
/// </summary>
internal sealed class MemoryTerritory
{
public MemoryTerritory(ETerritoryType territoryType)
{
TerritoryType = territoryType;
@ -59,5 +59,4 @@ namespace Pal.Client.Floors
/// </summary>
Importing,
}
}
}

View File

@ -9,15 +9,15 @@ using Dalamud.Game.Gui;
using Dalamud.Plugin;
using ImGuiNET;
namespace Pal.Client.Floors
namespace Pal.Client.Floors;
/// <summary>
/// This isn't very useful for running deep dungeons normally, but it is for plugin dev.
///
/// Needs the corresponding beta feature to be enabled.
/// </summary>
internal sealed class ObjectTableDebug : IDisposable
{
/// <summary>
/// This isn't very useful for running deep dungeons normally, but it is for plugin dev.
///
/// Needs the corresponding beta feature to be enabled.
/// </summary>
internal sealed class ObjectTableDebug : IDisposable
{
public const string FeatureName = nameof(ObjectTableDebug);
private readonly DalamudPluginInterface _pluginInterface;
@ -97,5 +97,4 @@ namespace Pal.Client.Floors
{
_pluginInterface.UiBuilder.Draw -= Draw;
}
}
}

View File

@ -2,13 +2,13 @@
using System.Collections.Generic;
using Pal.Client.Database;
namespace Pal.Client.Floors
namespace Pal.Client.Floors;
/// <summary>
/// A <see cref="ClientLocation"/> loaded in memory, with certain extra attributes as needed.
/// </summary>
internal sealed class PersistentLocation : MemoryLocation
{
/// <summary>
/// A <see cref="ClientLocation"/> loaded in memory, with certain extra attributes as needed.
/// </summary>
internal sealed class PersistentLocation : MemoryLocation
{
/// <see cref="ClientLocation.LocalId"/>
public int? LocalId { get; set; }
@ -51,5 +51,4 @@ namespace Pal.Client.Floors
{
return $"PersistentLocation(Position={Position}, Type={Type})";
}
}
}

View File

@ -4,11 +4,11 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Pal.Client.Database;
namespace Pal.Client.Floors.Tasks
{
internal abstract class DbTask<T>
namespace Pal.Client.Floors.Tasks;
internal abstract class DbTask<T>
where T : DbTask<T>
{
{
private readonly IServiceScopeFactory _serviceScopeFactory;
protected DbTask(IServiceScopeFactory serviceScopeFactory)
@ -37,5 +37,4 @@ namespace Pal.Client.Floors.Tasks
}
protected abstract void Run(PalClientContext dbContext, ILogger<T> logger);
}
}

View File

@ -7,10 +7,10 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
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 MemoryTerritory _territory;
@ -75,5 +75,4 @@ namespace Pal.Client.Floors.Tasks
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
};
}
}
}

View File

@ -5,10 +5,10 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
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 IReadOnlyList<PersistentLocation> _locations;
@ -33,5 +33,4 @@ namespace Pal.Client.Floors.Tasks
dbContext.SaveChanges();
}
}
}
}

View File

@ -5,10 +5,10 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
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 IReadOnlyList<PersistentLocation> _locations;
private readonly string _accountId;
@ -47,5 +47,4 @@ namespace Pal.Client.Floors.Tasks
dbContext.SaveChanges();
}
}
}
}

View File

@ -6,10 +6,10 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Database;
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 List<PersistentLocation> _newLocations;
@ -73,5 +73,4 @@ namespace Pal.Client.Floors.Tasks
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
};
}
}
}

View File

@ -2,10 +2,10 @@
using Dalamud.Game.ClientState.Conditions;
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 Condition _condition;
@ -24,13 +24,12 @@ namespace Pal.Client.Floors
&& _condition[ConditionFlag.InDeepDungeon]
&& typeof(ETerritoryType).IsEnumDefined(_clientState.TerritoryType);
}
}
public enum PomanderState
{
public enum PomanderState
{
Inactive,
Active,
FoundOnCurrentFloor,
PomanderOfSafetyUsed,
}
}

View File

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

View File

@ -1,15 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
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")]
public Guid NameId { get; set; }
@ -44,10 +42,10 @@ namespace Pal.Client.Net
string content = Encoding.UTF8.GetString(Convert.FromBase64String(payload));
return JsonSerializer.Deserialize<JwtClaims>(content) ?? throw new InvalidOperationException("token deserialization returned null");
}
}
}
internal sealed class JwtRoleConverter : JsonConverter<List<string>>
{
internal sealed class JwtRoleConverter : JsonConverter<List<string>>
{
public override List<string> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.String)
@ -76,20 +74,4 @@ namespace Pal.Client.Net
}
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,10 +12,10 @@ using Pal.Client.Configuration;
using Pal.Client.Extensions;
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 async Task<(bool Success, string Error)> TryConnect(CancellationToken cancellationToken,
@ -228,5 +228,4 @@ namespace Pal.Client.Net
public bool IsValid => IsLoggedIn && !IsExpired;
}
}
}

View File

@ -3,10 +3,10 @@ using System.Threading;
using System.Threading.Tasks;
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)
{
if (!await Connect(cancellationToken))
@ -19,5 +19,4 @@ namespace Pal.Client.Net
}, headers: AuthorizedHeaders(), deadline: DateTime.UtcNow.AddSeconds(120), cancellationToken: cancellationToken);
return (exportReply.Success, exportReply.Data);
}
}
}

View File

@ -8,10 +8,10 @@ using Pal.Client.Database;
using Pal.Client.Floors;
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)
{
if (!await Connect(cancellationToken))
@ -83,5 +83,4 @@ namespace Pal.Client.Net
var statisticsReply = await palaceClient.FetchStatisticsAsync(new StatisticsRequest(), headers: AuthorizedHeaders(), deadline: DateTime.UtcNow.AddSeconds(30), cancellationToken: cancellationToken);
return (statisticsReply.Success, statisticsReply.FloorStatistics.ToList());
}
}
}

View File

@ -5,10 +5,10 @@ using Dalamud.Logging;
using Grpc.Core;
using Microsoft.Extensions.Logging;
namespace Pal.Client.Net
namespace Pal.Client.Net;
internal partial class RemoteApi
{
internal partial class RemoteApi
{
private Metadata UnauthorizedHeaders() => new()
{
{ "User-Agent", _userAgent },
@ -54,5 +54,4 @@ namespace Pal.Client.Net
return null;
#endif
}
}
}

View File

@ -6,10 +6,10 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Configuration;
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
public const string RemoteUrl = "http://localhost:5415";
#else
@ -48,5 +48,4 @@ namespace Pal.Client.Net
_channel?.Dispose();
_channel = null;
}
}
}

View File

@ -29,18 +29,18 @@
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release' And Exists('Certificate.pfx')">
<None Remove="Certificate.pfx"/>
<None Remove="Certificate.pfx" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release' And Exists('Certificate.pfx')">
<EmbeddedResource Include="Certificate.pfx"/>
<EmbeddedResource Include="Certificate.pfx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.11"/>
<PackageReference Include="Dalamud.Extensions.MicrosoftLogging" Version="1.0.0"/>
<PackageReference Include="Google.Protobuf" Version="3.22.1"/>
<PackageReference Include="Grpc.Net.Client" Version="2.52.0"/>
<PackageReference Include="DalamudPackager" Version="2.1.11" />
<PackageReference Include="Dalamud.Extensions.MicrosoftLogging" Version="1.0.0" />
<PackageReference Include="Google.Protobuf" Version="3.22.1" />
<PackageReference Include="Grpc.Net.Client" Version="2.52.0" />
<PackageReference Include="GitInfo" Version="2.3.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
@ -48,24 +48,24 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.4"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0"/>
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="7.0.1"/>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="7.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pal.Common\Pal.Common.csproj"/>
<ProjectReference Include="..\vendor\ECommons\ECommons\ECommons.csproj"/>
<ProjectReference Include="..\Pal.Common\Pal.Common.csproj" />
<ProjectReference Include="..\vendor\ECommons\ECommons\ECommons.csproj" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="..\Pal.Common\Protos\account.proto" Link="Protos\account.proto" GrpcServices="Client" Access="Internal"/>
<Protobuf Include="..\Pal.Common\Protos\palace.proto" Link="Protos\palace.proto" GrpcServices="Client" Access="Internal"/>
<Protobuf Include="..\Pal.Common\Protos\export.proto" Link="Protos\export.proto" GrpcServices="Client" Access="Internal"/>
<Protobuf Include="..\Pal.Common\Protos\account.proto" Link="Protos\account.proto" GrpcServices="Client" Access="Internal" />
<Protobuf Include="..\Pal.Common\Protos\palace.proto" Link="Protos\palace.proto" GrpcServices="Client" Access="Internal" />
<Protobuf Include="..\Pal.Common\Protos\export.proto" Link="Protos\export.proto" GrpcServices="Client" Access="Internal" />
</ItemGroup>
<ItemGroup>
@ -124,10 +124,10 @@
</Target>
<Target Name="RenameLatestZip" AfterTargets="PackagePlugin" Condition="'$(Configuration)' == 'Release'">
<Exec Command="rename &quot;$(OutDir)$(AssemblyName)\latest.zip&quot; &quot;$(AssemblyName)-$(Version).zip&quot;"/>
<Exec Command="rename &quot;$(OutDir)$(AssemblyName)\latest.zip&quot; &quot;$(AssemblyName)-$(Version).zip&quot;" />
</Target>
<Target Name="Clean">
<RemoveDir Directories="dist"/>
<RemoveDir Directories="dist" />
</Target>
</Project>

View File

@ -21,15 +21,15 @@ using Pal.Client.DependencyInjection;
using Pal.Client.Properties;
using Pal.Client.Rendering;
namespace Pal.Client
namespace Pal.Client;
/// <summary>
/// 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 .
/// </summary>
/// <see cref="DependencyInjectionContext"/>
internal sealed class Plugin : IDalamudPlugin
{
/// <summary>
/// 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 .
/// </summary>
/// <see cref="DependencyInjectionContext"/>
internal sealed class Plugin : IDalamudPlugin
{
private readonly CancellationTokenSource _initCts = new();
private readonly DalamudPluginInterface _pluginInterface;
@ -233,5 +233,4 @@ namespace Pal.Client
Loaded,
Error
}
}
}

View File

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

View File

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

View File

@ -3,10 +3,10 @@ using System.Numerics;
using Pal.Client.Configuration;
using Pal.Client.Floors;
namespace Pal.Client.Rendering
namespace Pal.Client.Rendering;
internal interface IRenderer
{
internal interface IRenderer
{
ERenderer GetConfigValue();
void SetLayer(ELayer layer, IReadOnlyList<IRenderElement> elements);
@ -16,5 +16,4 @@ namespace Pal.Client.Rendering
IRenderElement CreateElement(MemoryLocation.EType type, Vector3 pos, uint color, bool fill = false);
void DrawDebugItems(uint trapColor, uint hoardColor);
}
}

View File

@ -1,10 +1,10 @@
using System.Collections.Generic;
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 Dictionary<MemoryLocation.EType, MarkerConfig> MarkerConfigs = new()
@ -20,5 +20,4 @@ namespace Pal.Client.Rendering
public static MarkerConfig ForType(MemoryLocation.EType type) =>
MarkerConfigs.GetValueOrDefault(type, EmptyConfig);
}
}

View File

@ -6,10 +6,10 @@ using Microsoft.Extensions.Logging;
using Pal.Client.Configuration;
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 ILogger<RenderAdapter> _logger;
private readonly IPalacePalConfiguration _configuration;
@ -74,5 +74,4 @@ namespace Pal.Client.Rendering
if (_implementation is SimpleRenderer sr)
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 long TestLayerTimeout = 10_000;
}
}

View File

@ -11,17 +11,17 @@ using Pal.Client.Configuration;
using Pal.Client.DependencyInjection;
using Pal.Client.Floors;
namespace Pal.Client.Rendering
namespace Pal.Client.Rendering;
/// <summary>
/// Simple renderer that only draws basic stuff.
///
/// This is based on what SliceIsRight uses, and what PalacePal used before it was
/// remade into PalacePal (which is the third or fourth iteration on the same idea
/// I made, just with a clear vision).
/// </summary>
internal sealed class SimpleRenderer : IRenderer, IDisposable
{
/// <summary>
/// Simple renderer that only draws basic stuff.
///
/// This is based on what SliceIsRight uses, and what PalacePal used before it was
/// remade into PalacePal (which is the third or fourth iteration on the same idea
/// I made, just with a clear vision).
/// </summary>
internal sealed class SimpleRenderer : IRenderer, IDisposable
{
private const int SegmentCount = 20;
private readonly ClientState _clientState;
@ -200,5 +200,4 @@ namespace Pal.Client.Rendering
public required float Radius { get; init; }
public required bool Fill { get; init; }
}
}
}

View File

@ -15,10 +15,10 @@ using Pal.Client.Configuration;
using Pal.Client.DependencyInjection;
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 readonly ILogger<SplatoonRenderer> _logger;
@ -192,5 +192,4 @@ namespace Pal.Client.Rendering
set => Delegate.color = value;
}
}
}
}

View File

@ -2,10 +2,10 @@
using Dalamud.Logging;
using Microsoft.Extensions.Logging;
namespace Pal.Client.Scheduled
namespace Pal.Client.Scheduled;
internal interface IQueueOnFrameworkThread
{
internal interface IQueueOnFrameworkThread
{
internal interface IHandler
{
void RunIfCompatible(IQueueOnFrameworkThread queued, ref bool recreateLayout);
@ -36,5 +36,4 @@ namespace Pal.Client.Scheduled
}
}
}
}
}

View File

@ -4,10 +4,10 @@ using Pal.Client.DependencyInjection;
using Pal.Client.Floors;
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>
{
private readonly RenderAdapter _renderAdapter;
@ -25,5 +25,4 @@ namespace Pal.Client.Scheduled
_renderAdapter.ConfigUpdated();
}
}
}
}

View File

@ -10,10 +10,10 @@ using Pal.Client.Properties;
using Pal.Client.Windows;
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 Guid ExportId { get; set; }
private int ImportedTraps { get; set; }
@ -119,5 +119,4 @@ namespace Pal.Client.Scheduled
return true;
}
}
}
}

View File

@ -11,10 +11,10 @@ using Pal.Client.Floors.Tasks;
using Pal.Client.Net;
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 ushort TerritoryType { get; init; }
public required bool Success { get; init; }
@ -141,21 +141,20 @@ namespace Pal.Client.Scheduled
}
}
}
}
}
public enum ESyncState
{
public enum ESyncState
{
NotAttempted,
NotNeeded,
Started,
Complete,
Failed,
}
}
public enum SyncType
{
public enum SyncType
{
Upload,
Download,
MarkSeen,
}
}

View File

@ -7,10 +7,10 @@ using Pal.Client.Floors;
using Pal.Client.Windows;
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)
{
ExportId = exportId;
@ -38,5 +38,4 @@ namespace Pal.Client.Scheduled
_configWindow.UpdateLastImport();
}
}
}
}

View File

@ -8,10 +8,10 @@ using Pal.Client.Configuration;
using Pal.Client.Extensions;
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 readonly WindowSystem _windowSystem;
private readonly ConfigurationManager _configurationManager;
@ -101,5 +101,4 @@ namespace Pal.Client.Windows
if (ImGui.Button(Localization.Agreement_ViewPluginAndServerSourceCode))
GenericHelpers.ShellStart("https://github.com/carvelli/PalPalace");
}
}
}

View File

@ -23,10 +23,10 @@ using Pal.Client.Properties;
using Pal.Client.Rendering;
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 readonly ILogger<ConfigWindow> _logger;
@ -575,5 +575,4 @@ namespace Pal.Client.Windows
};
}
}
}
}

View File

@ -8,10 +8,10 @@ using Pal.Client.Properties;
using Pal.Common;
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 readonly WindowSystem _windowSystem;
private readonly SortedDictionary<ETerritoryType, TerritoryStatistics> _territoryStatistics = new();
@ -122,5 +122,4 @@ namespace Pal.Client.Windows
TerritoryName = territoryName;
}
}
}
}

View File

@ -1,12 +1,12 @@
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
namespace Pal.Common
namespace Pal.Common;
[SuppressMessage("ReSharper", "UnusedMember.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ETerritoryType : ushort
{
[SuppressMessage("ReSharper", "UnusedMember.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ETerritoryType : ushort
{
Palace_1_10 = 561,
Palace_11_20,
Palace_21_30,
@ -59,5 +59,4 @@ namespace Pal.Common
EurekaOrthos_71_80,
EurekaOrthos_81_90,
EurekaOrthos_91_100
}
}

View File

@ -1,10 +1,10 @@
using System.ComponentModel.DataAnnotations;
using System.Reflection;
namespace Pal.Common
namespace Pal.Common;
public static class EnumExtensions
{
public static class EnumExtensions
{
public static int? GetOrder(this Enum e)
{
Type type = e.GetType();
@ -12,5 +12,4 @@ namespace Pal.Common
DisplayAttribute? attribute = field.GetCustomAttributes(typeof(DisplayAttribute), false).Cast<DisplayAttribute>().FirstOrDefault();
return attribute?.Order;
}
}
}

View File

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

View File

@ -1,9 +1,9 @@
using System.Numerics;
namespace Pal.Common
namespace Pal.Common;
public class PalaceMath
{
public class PalaceMath
{
private static readonly Vector3 ScaleFactor = new(5);
public static bool IsNearlySamePosition(Vector3 a, Vector3 b)
@ -18,5 +18,4 @@ namespace Pal.Common
v *= ScaleFactor;
return HashCode.Combine((int)v.X, (int)v.Y, (int)v.Z);
}
}
}