diff --git a/src/ModuleCore/Database/DatabaseManager.cs b/src/ModuleCore/Database/DatabaseManager.cs
new file mode 100644
index 0000000..4aabadd
--- /dev/null
+++ b/src/ModuleCore/Database/DatabaseManager.cs
@@ -0,0 +1,33 @@
+namespace ModuleCore.Database;
+
+public class DatabaseManager
+{
+ private readonly FileInfo _databaseLocation;
+
+ ///
+ /// Creates a new manager for the given database file by name
+ ///
+ ///
+ /// Filename for the database with no extension. Slashes are accepted and will create directories as needed.
+ ///
+ public DatabaseManager(string databaseName)
+ {
+ // Even though the xmldoc says "with no extension", we strip off any extension regardless
+ _databaseLocation = new FileInfo(Path.Combine(".", "data", $"{SanitiseFilename(databaseName)}.db"));
+
+ Directory.CreateDirectory(_databaseLocation.DirectoryName!);
+ var file = File.Create(_databaseLocation.FullName);
+ file.Close();
+ }
+
+ ///
+ /// Removes double dots from the filename and removes the file extension
+ ///
+ ///
+ ///
+ private string SanitiseFilename(string filename)
+ {
+ // Honestly not really needed seeing as its just me and this isn't coming from user supplied code, but eh.
+ return Path.GetFileNameWithoutExtension(filename.Replace("..", string.Empty));
+ }
+}
\ No newline at end of file
diff --git a/src/ModuleCore/Git/GitManager.cs b/src/ModuleCore/Git/GitManager.cs
index 895bbb4..576afd5 100644
--- a/src/ModuleCore/Git/GitManager.cs
+++ b/src/ModuleCore/Git/GitManager.cs
@@ -1,5 +1,6 @@
using System.Collections.Concurrent;
using System.Diagnostics;
+using ModuleCore.Database;
using ModuleCore.Git.Models;
namespace ModuleCore.Git;
@@ -9,12 +10,14 @@ public class GitManager
{
private static readonly Lazy GitManagerInstance = new(() => new GitManager());
private readonly ConcurrentDictionary _registrations;
+ private readonly DatabaseManager _db;
private GitManager()
{
Debug.WriteLine($"{nameof(GitManager)} init");
_registrations = new ConcurrentDictionary();
+ _db = new DatabaseManager("git.db");
}
public static GitManager Instance => GitManagerInstance.Value;