52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using skyscraper5.Skyscraper;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Voile.Patchouli.Reflection;
|
|
using Voile.Storage.Sqlite;
|
|
|
|
namespace Voile.Tasks
|
|
{
|
|
internal class StartupInitializeDatabase : VoileRunnable
|
|
{
|
|
public Form1 Form1 { get; internal set; }
|
|
private Ini ini;
|
|
public void Run()
|
|
{
|
|
VoilePluginManager voilePluginManager = VoilePluginManager.GetInstance();
|
|
voilePluginManager.ScanAssembly(this.GetType().Assembly);
|
|
voilePluginManager.ScanAssembly(typeof(SqliteDataStorageFactory).Assembly);
|
|
|
|
if (IsFirstRun())
|
|
{
|
|
FirstRunWizard frw = new FirstRunWizard();
|
|
DialogResult dr = frw.ShowDialog(Form1);
|
|
}
|
|
}
|
|
|
|
private bool IsFirstRun()
|
|
{
|
|
VoileContext voileContext = VoileContext.GetContext();
|
|
FileInfo fileInfo = voileContext.GetVoileIniFile();
|
|
if (!fileInfo.Exists)
|
|
{
|
|
voileContext.Ini = new Ini();
|
|
ini = voileContext.Ini;
|
|
return true;
|
|
}
|
|
|
|
voileContext.Ini = new Ini(fileInfo.FullName);
|
|
|
|
|
|
|
|
bool firstRunComplete = ini.ReadValue("voile", "firstRunComplete", false);
|
|
if (!firstRunComplete)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|