mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 20:33:40 +01:00
refactor: new code style in DalamudConfiguration.cs
This commit is contained in:
parent
30280c520c
commit
7a93659dd2
3 changed files with 86 additions and 9 deletions
|
|
@ -1,46 +1,119 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Dalamud.Configuration;
|
|
||||||
using Dalamud.Game.Chat;
|
using Dalamud.Game.Chat;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
namespace Dalamud
|
namespace Dalamud.Configuration
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class containing Dalamud settings.
|
||||||
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
internal class DalamudConfiguration
|
internal class DalamudConfiguration
|
||||||
{
|
{
|
||||||
|
[JsonIgnore]
|
||||||
|
private string configPath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a list of muted works.
|
||||||
|
/// </summary>
|
||||||
public List<string> BadWords { get; set; }
|
public List<string> BadWords { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not the taskbar should flash once a duty is found.
|
||||||
|
/// </summary>
|
||||||
public bool DutyFinderTaskbarFlash { get; set; } = true;
|
public bool DutyFinderTaskbarFlash { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not a message should be sent in chat once a duty is found.
|
||||||
|
/// </summary>
|
||||||
public bool DutyFinderChatMessage { get; set; } = true;
|
public bool DutyFinderChatMessage { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the language code to load Dalamud localization with.
|
||||||
|
/// </summary>
|
||||||
public string LanguageOverride { get; set; }
|
public string LanguageOverride { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the last loaded Dalamud version.
|
||||||
|
/// </summary>
|
||||||
public string LastVersion { get; set; }
|
public string LastVersion { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the chat type used by default for plugin messages.
|
||||||
|
/// </summary>
|
||||||
public XivChatType GeneralChatType { get; set; } = XivChatType.Debug;
|
public XivChatType GeneralChatType { get; set; } = XivChatType.Debug;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not plugin testing builds should be shown.
|
||||||
|
/// </summary>
|
||||||
public bool DoPluginTest { get; set; } = false;
|
public bool DoPluginTest { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not Dalamud testing builds should be used.
|
||||||
|
/// </summary>
|
||||||
public bool DoDalamudTest { get; set; } = false;
|
public bool DoDalamudTest { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a list of custom repos.
|
||||||
|
/// </summary>
|
||||||
public List<ThirdRepoSetting> ThirdRepoList { get; set; } = new List<ThirdRepoSetting>();
|
public List<ThirdRepoSetting> ThirdRepoList { get; set; } = new List<ThirdRepoSetting>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a list of hidden plugins.
|
||||||
|
/// </summary>
|
||||||
public List<string> HiddenPluginInternalName { get; set; } = new List<string>();
|
public List<string> HiddenPluginInternalName { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the global UI scale.
|
||||||
|
/// </summary>
|
||||||
public float GlobalUiScale { get; set; } = 1.0f;
|
public float GlobalUiScale { get; set; } = 1.0f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not plugin UI should be hidden.
|
||||||
|
/// </summary>
|
||||||
public bool ToggleUiHide { get; set; } = true;
|
public bool ToggleUiHide { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not plugin UI should be hidden during cutscenes.
|
||||||
|
/// </summary>
|
||||||
public bool ToggleUiHideDuringCutscenes { get; set; } = true;
|
public bool ToggleUiHideDuringCutscenes { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not plugin UI should be hidden during GPose.
|
||||||
|
/// </summary>
|
||||||
public bool ToggleUiHideDuringGpose { get; set; } = true;
|
public bool ToggleUiHideDuringGpose { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not a message containing detailed plugin information should be sent at login.
|
||||||
|
/// </summary>
|
||||||
public bool PrintPluginsWelcomeMsg { get; set; } = true;
|
public bool PrintPluginsWelcomeMsg { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not plugins should be auto-updated.
|
||||||
|
/// </summary>
|
||||||
public bool AutoUpdatePlugins { get; set; } = false;
|
public bool AutoUpdatePlugins { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not the debug log should scroll automatically.
|
||||||
|
/// </summary>
|
||||||
public bool LogAutoScroll { get; set; } = true;
|
public bool LogAutoScroll { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not the debug log should open at startup.
|
||||||
|
/// </summary>
|
||||||
public bool LogOpenAtStartup { get; set; }
|
public bool LogOpenAtStartup { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
/// <summary>
|
||||||
public string ConfigPath;
|
/// Load a configuration from the provided path.
|
||||||
|
/// </summary>
|
||||||
public static DalamudConfiguration Load(string path) {
|
/// <param name="path">The path to load the configuration file from.</param>
|
||||||
|
/// <returns>The deserialized configuration file.</returns>
|
||||||
|
public static DalamudConfiguration Load(string path)
|
||||||
|
{
|
||||||
DalamudConfiguration deserialized;
|
DalamudConfiguration deserialized;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -52,7 +125,7 @@ namespace Dalamud
|
||||||
deserialized = new DalamudConfiguration();
|
deserialized = new DalamudConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialized.ConfigPath = path;
|
deserialized.configPath = path;
|
||||||
|
|
||||||
return deserialized;
|
return deserialized;
|
||||||
}
|
}
|
||||||
|
|
@ -60,8 +133,9 @@ namespace Dalamud
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save the configuration at the path it was loaded from.
|
/// Save the configuration at the path it was loaded from.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Save() {
|
public void Save()
|
||||||
File.WriteAllText(this.ConfigPath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
{
|
||||||
|
File.WriteAllText(this.configPath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
using Dalamud.Configuration;
|
||||||
using Dalamud.Data;
|
using Dalamud.Data;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
using Dalamud.Game.Chat.SeStringHandling;
|
using Dalamud.Game.Chat.SeStringHandling;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Dalamud.Configuration;
|
||||||
using Dalamud.Game.Command;
|
using Dalamud.Game.Command;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue