using System.Diagnostics;
using TitanSTUDIO.Helpers.Parsers;
using TitanSTUDIO.Models;
using TitanSTUDIO.Repositories;
namespace TitanSTUDIO.Presentation
{
public partial class FTUEView : Form
{
static StringDatabaseModel? _sdbModel;
public FTUEView()
{
InitializeComponent();
}
private static async Task ImportSDBFile()
{
try
{
using (var ofd = new OpenFileDialog())
{
ofd.Filter = "String Database File (*.sdb)|*.sdb";
ofd.RestoreDirectory = true;
if (ofd.ShowDialog() == DialogResult.OK)
{
Debug.WriteLine("Reading SDB File...");
_sdbModel = await StringDatabase.ReadStringAsync(ofd.FileName);
// Import model data into the sqlite table.
await StringFileRepository.ImportData("StringsEnglishTable", StringFileRepository._sdbModel);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private async void NextStepBtn_Click(object sender, EventArgs e)
{
await ImportSDBFile();
}
private async void ImportSDB_Click(object sender, EventArgs e)
{
await ImportSDBFile();
}
}
}