Add old database section
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Version>1.21.4</Version>
|
||||
<Version>1.22.0</Version>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@@ -56,9 +56,7 @@ internal class MessageManager : IDisposable
|
||||
|
||||
internal static string DatabasePath()
|
||||
{
|
||||
var dir = Plugin.Interface.ConfigDirectory;
|
||||
dir.Create();
|
||||
return Path.Join(dir.FullName, "chat-sqlite.db");
|
||||
return Path.Join(Plugin.Interface.ConfigDirectory.FullName, "chat-sqlite.db");
|
||||
}
|
||||
|
||||
private void Logout()
|
||||
|
||||
Generated
+45
@@ -1787,6 +1787,51 @@ namespace ChatTwo.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Delete.
|
||||
/// </summary>
|
||||
internal static string Options_Database_Old_Delete {
|
||||
get {
|
||||
return ResourceManager.GetString("Options_Database_Old_Delete", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unable to remove the old database, more information under /xllog..
|
||||
/// </summary>
|
||||
internal static string Options_Database_Old_Delete_Error {
|
||||
get {
|
||||
return ResourceManager.GetString("Options_Database_Old_Delete_Error", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The old database was successfully removed..
|
||||
/// </summary>
|
||||
internal static string Options_Database_Old_Delete_Success {
|
||||
get {
|
||||
return ResourceManager.GetString("Options_Database_Old_Delete_Success", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Removes the database from your disk. This is not recoverable! Hold Ctrl+Shift to click..
|
||||
/// </summary>
|
||||
internal static string Options_Database_Old_Delete_Tooltip {
|
||||
get {
|
||||
return ResourceManager.GetString("Options_Database_Old_Delete_Tooltip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Old database:.
|
||||
/// </summary>
|
||||
internal static string Options_Database_Old_Heading {
|
||||
get {
|
||||
return ResourceManager.GetString("Options_Database_Old_Heading", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Database.
|
||||
/// </summary>
|
||||
|
||||
@@ -994,4 +994,19 @@
|
||||
<data name="LoadMessages_Error" xml:space="preserve">
|
||||
<value>An error occurred while loading chat history. Please see plugin logs for more information to report this issue.</value>
|
||||
</data>
|
||||
<data name="Options_Database_Old_Heading" xml:space="preserve">
|
||||
<value>Old database:</value>
|
||||
</data>
|
||||
<data name="Options_Database_Old_Delete" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
<data name="Options_Database_Old_Delete_Tooltip" xml:space="preserve">
|
||||
<value>Removes the database from your disk. This is not recoverable! Hold Ctrl+Shift to click.</value>
|
||||
</data>
|
||||
<data name="Options_Database_Old_Delete_Error" xml:space="preserve">
|
||||
<value>Unable to remove the old database, more information under /xllog.</value>
|
||||
</data>
|
||||
<data name="Options_Database_Old_Delete_Success" xml:space="preserve">
|
||||
<value>The old database was successfully removed.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -54,7 +54,32 @@ internal sealed class Database : ISettingsTab
|
||||
ImGui.Separator();
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGui.Text(Language.Options_Database_Metadata_Heading);
|
||||
var old = new FileInfo(Path.Join(Plugin.Interface.ConfigDirectory.FullName, "chat.db"));
|
||||
if (old.Exists)
|
||||
{
|
||||
ImGui.TextUnformatted(Language.Options_Database_Old_Heading);
|
||||
ImGui.Spacing();
|
||||
|
||||
if (ImGuiUtil.CtrlShiftButton(Language.Options_Database_Old_Delete, Language.Options_Database_Old_Delete_Tooltip))
|
||||
{
|
||||
try
|
||||
{
|
||||
old.Delete();
|
||||
WrapperUtil.AddNotification(Language.Options_Database_Old_Delete_Success, NotificationType.Success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Plugin.Log.Error(e, "Unable to delete old database");
|
||||
WrapperUtil.AddNotification(Language.Options_Database_Old_Delete_Error, NotificationType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Separator();
|
||||
ImGui.Spacing();
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted(Language.Options_Database_Metadata_Heading);
|
||||
var style = ImGui.GetStyle();
|
||||
ImGui.Indent(style.IndentSpacing);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user