fix crash on logout, change several logger.debug to verbose, adjustments to player cache generation, fixes to file scan manager, better handling disconnects, some refactoring, adjustments to intro UI, correct display of server state
This commit is contained in:
@@ -10,8 +10,26 @@ namespace MareSynchronos.FileCacheDB
|
||||
{
|
||||
public partial class FileCacheContext : DbContext
|
||||
{
|
||||
public FileCacheContext()
|
||||
private string DbPath { get; set; }
|
||||
public FileCacheContext()
|
||||
{
|
||||
DbPath = Path.Combine(Plugin.PluginInterface.ConfigDirectory.FullName, "FileCache.db");
|
||||
string oldDbPath = Path.Combine(Plugin.PluginInterface.ConfigDirectory.FullName, "FileCacheDebug.db");
|
||||
if (!Directory.Exists(Plugin.PluginInterface.ConfigDirectory.FullName))
|
||||
{
|
||||
Directory.CreateDirectory(Plugin.PluginInterface.ConfigDirectory.FullName);
|
||||
}
|
||||
var veryOldDbPath = Path.Combine(Plugin.PluginInterface.ConfigDirectory.FullName, "..", "FileCacheDebug.db");
|
||||
if (File.Exists(veryOldDbPath))
|
||||
{
|
||||
Logger.Debug("Migrated old path to new path");
|
||||
File.Move(veryOldDbPath, oldDbPath, true);
|
||||
}
|
||||
if (File.Exists(oldDbPath))
|
||||
{
|
||||
File.Move(oldDbPath, DbPath, true);
|
||||
}
|
||||
|
||||
Database.EnsureCreated();
|
||||
}
|
||||
|
||||
@@ -26,19 +44,7 @@ namespace MareSynchronos.FileCacheDB
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
string dbPath = Path.Combine(Plugin.PluginInterface.ConfigDirectory.FullName, "FileCacheDebug.db");
|
||||
if(!Directory.Exists(Plugin.PluginInterface.ConfigDirectory.FullName))
|
||||
{
|
||||
Directory.CreateDirectory(Plugin.PluginInterface.ConfigDirectory.FullName);
|
||||
}
|
||||
var oldDbPath = Path.Combine(Plugin.PluginInterface.ConfigDirectory.FullName, "..", "FileCacheDebug.db");
|
||||
if (File.Exists(oldDbPath))
|
||||
{
|
||||
Logger.Debug("Migrated old path to new path");
|
||||
File.Move(oldDbPath, dbPath, true);
|
||||
}
|
||||
//PluginLog.Debug("Using Database " + dbPath);
|
||||
optionsBuilder.UseSqlite("Data Source=" + dbPath);
|
||||
optionsBuilder.UseSqlite("Data Source=" + DbPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user