public void Start()
{
try
{
if (m_JournalScanner_Thread == null)
{
m_SavedgamesPath = Program.DBCon.getIniValue<String>(IBESettingsView.DB_GROUPNAME, "JournalPath", "");
if(String.IsNullOrWhiteSpace(m_SavedgamesPath) || (!Directory.Exists(m_SavedgamesPath)))
{
if (SHGetKnownFolderPath(SAVED_GAMES, 0, IntPtr.Zero, out m_SavedgamesPath) != 0)
m_SavedgamesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Saved Games");
if(Directory.Exists(m_SavedgamesPath))
m_SavedgamesPath = Path.Combine(m_SavedgamesPath, @"Frontier Developments\Elite Dangerous");
if(!Directory.Exists(m_SavedgamesPath))
{
m_SavedgamesPath = null;
throw new Exception("ED-IBE can't find the \"Saved Games\" path to access the E:D journal file");
}
else
{
Program.DBCon.setIniValue(IBESettingsView.DB_GROUPNAME, "JournalPath", m_SavedgamesPath);
}
}
m_Stop = false;
m_JournalScanner_Thread = new Thread(new ThreadStart(JournalScannerWorker));
m_JournalScanner_Thread.Name = "JournalScanner_Thread";
m_JournalScanner_Thread.IsBackground = false;
m_JournalScanner_Thread.Start();
m_FileWatcher = new FileSystemWatcher(m_SavedgamesPath, "*.log");
m_FileWatcher.EnableRaisingEvents = true;
m_FileWatcher.Created += FileWatcher_Created;
}
}
catch (Exception ex)
{
throw new Exception("Error while starting the journal scanner", ex);
}
}