diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs index fd57c1c..7e248b3 100755 --- a/ChatTwo/Resources/Language.Designer.cs +++ b/ChatTwo/Resources/Language.Designer.cs @@ -1832,6 +1832,15 @@ namespace ChatTwo.Resources { } } + /// + /// Looks up a localized string similar to Open migration window. + /// + internal static string Options_Database_Old_Migration { + get { + return ResourceManager.GetString("Options_Database_Old_Migration", resourceCulture); + } + } + /// /// Looks up a localized string similar to Database. /// diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx index 05bf77d..c9f249f 100644 --- a/ChatTwo/Resources/Language.resx +++ b/ChatTwo/Resources/Language.resx @@ -1009,4 +1009,7 @@ The old database was successfully removed. + + Open migration window + diff --git a/ChatTwo/Ui/LegacyMessageImporterWindow.cs b/ChatTwo/Ui/LegacyMessageImporterWindow.cs index 45d7923..94e57ee 100644 --- a/ChatTwo/Ui/LegacyMessageImporterWindow.cs +++ b/ChatTwo/Ui/LegacyMessageImporterWindow.cs @@ -97,8 +97,8 @@ internal class LegacyMessageImporterWindow : Window private void DrawEligible() { ImGui.TextWrapped("Import database messages from legacy LiteDB database to SQLite database?"); - ImGui.Text($"Message count: {Eligibility.MessageCount:N0}"); - ImGui.Text($"Database size: {StringUtil.BytesToString(Eligibility.DatabaseSizeBytes)}"); + ImGui.TextWrapped($"Message count: {Eligibility.MessageCount:N0}"); + ImGui.TextWrapped($"Database size: {StringUtil.BytesToString(Eligibility.DatabaseSizeBytes)}"); ImGui.Spacing(); @@ -126,20 +126,20 @@ internal class LegacyMessageImporterWindow : Window private void DrawIneligible() { - ImGui.Text("Your legacy LiteDB database is not eligible for import:"); + ImGui.TextWrapped("Your legacy LiteDB database is not eligible for import:"); switch (Eligibility.Status) { case LegacyMessageImporterEligibilityStatus.IneligibleOriginalDbNotExists: - ImGui.Text("The old database could not be found."); + ImGui.TextWrapped("The old database could not be found."); break; case LegacyMessageImporterEligibilityStatus.IneligibleMigrationDbExists: - ImGui.Text("The migration process was already started."); + ImGui.TextWrapped("The migration process was already started."); break; case LegacyMessageImporterEligibilityStatus.IneligibleLiteDbFailed: - ImGui.Text("The old database could not be opened."); + ImGui.TextWrapped("The old database could not be opened."); break; case LegacyMessageImporterEligibilityStatus.IneligibleNoMessages: - ImGui.Text("The old database contains no messages."); + ImGui.TextWrapped("The old database contains no messages."); break; case LegacyMessageImporterEligibilityStatus.Eligible: default: @@ -147,7 +147,7 @@ internal class LegacyMessageImporterWindow : Window } if (!string.IsNullOrWhiteSpace(Eligibility.AdditionalIneligibilityInfo)) - ImGui.Text(Eligibility.AdditionalIneligibilityInfo); + ImGui.TextWrapped(Eligibility.AdditionalIneligibilityInfo); // LiteDB failures notify the user, so give them a chance to rename the // database to avoid prompting again. diff --git a/ChatTwo/Ui/SettingsTabs/Database.cs b/ChatTwo/Ui/SettingsTabs/Database.cs index 67c4e63..dc3b88c 100755 --- a/ChatTwo/Ui/SettingsTabs/Database.cs +++ b/ChatTwo/Ui/SettingsTabs/Database.cs @@ -53,16 +53,29 @@ internal sealed class Database : ISettingsTab ImGui.Spacing(); var old = new FileInfo(Path.Join(Plugin.Interface.ConfigDirectory.FullName, "chat.db")); + var migratedOld = new FileInfo(Path.Join(Plugin.Interface.ConfigDirectory.FullName, "chat-litedb.db")); if (old.Exists) { ImGui.TextUnformatted(Language.Options_Database_Old_Heading); ImGui.Spacing(); + if (ImGui.Button(Language.Options_Database_Old_Migration)) + Plugin.LegacyMessageImporterWindow.IsOpen = true; + + ImGui.Spacing(); + ImGui.Separator(); + ImGui.Spacing(); + } + else if (migratedOld.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(); + migratedOld.Delete(); WrapperUtil.AddNotification(Language.Options_Database_Old_Delete_Success, NotificationType.Success); } catch (Exception e)