Refactored GsmDB
This commit is contained in:
+33
-8
@@ -3,12 +3,13 @@ using FireLance.Models;
|
||||
using Gsm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace DevConsole
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static GsmDB gsmParser = new GsmDB();
|
||||
public static readonly GsmRO gsmRO = new GsmRO();
|
||||
public static FireLanceCRUD fireLanceCRUD = new FireLanceCRUD();
|
||||
|
||||
static void Main(string[] args)
|
||||
@@ -73,14 +74,14 @@ namespace DevConsole
|
||||
{
|
||||
case ConsoleKey.A:
|
||||
Console.WriteLine("Connect to database");
|
||||
gsmParser.OpenConnection(@"C:\Users\Dunestorm\Projects\FireLance\GSMParser\games.db", 0);
|
||||
gsmRO.OpenConnection(@"C:\Users\Dunestorm\Projects\FireLance\GSMParser\games.db", 0);
|
||||
break;
|
||||
case ConsoleKey.B:
|
||||
gsmParser.CloseCurrentConnection();
|
||||
gsmRO.CloseCurrentConnection();
|
||||
break;
|
||||
}
|
||||
|
||||
Console.WriteLine($"GSMParser Connection State: {gsmParser.IsConnectionOpen()}\n");
|
||||
Console.WriteLine($"GSMParser Connection State: {gsmRO.IsConnectionOpen()}\n");
|
||||
}
|
||||
|
||||
private static void OptionB()
|
||||
@@ -89,7 +90,11 @@ namespace DevConsole
|
||||
string r = Console.ReadLine();
|
||||
Console.Write("\n");
|
||||
|
||||
PrintGameEntries(gsmParser.QueryGameById(r));
|
||||
PrintGameEntries(gsmRO.LoadRecords<GameEntryModel>(GsmStruct.GameEntries.GameName,
|
||||
GsmStruct.Tables.GameEntry,
|
||||
GsmStruct.GameEntries.GameID,
|
||||
r,
|
||||
true));
|
||||
}
|
||||
|
||||
private static void OptionC()
|
||||
@@ -98,7 +103,11 @@ namespace DevConsole
|
||||
string r = Console.ReadLine();
|
||||
Console.Write("\n");
|
||||
|
||||
PrintDirectories(gsmParser.QueryDirectoryById(r));
|
||||
PrintDirectories(gsmRO.LoadRecords<DirectoriesModel>("*",
|
||||
GsmStruct.Tables.Directories,
|
||||
GsmStruct.DirectoryColumns.GameID,
|
||||
r,
|
||||
true));
|
||||
}
|
||||
|
||||
private static void OptionD()
|
||||
@@ -107,7 +116,11 @@ namespace DevConsole
|
||||
string r = Console.ReadLine();
|
||||
Console.Write("\n");
|
||||
|
||||
PrintGameEntries(gsmParser.QueryGameByName(r));
|
||||
PrintGameEntries(gsmRO.LoadRecords<GameEntryModel>(GsmStruct.GameEntries.GameName,
|
||||
GsmStruct.Tables.GameEntry,
|
||||
GsmStruct.GameEntries.GameName,
|
||||
r,
|
||||
false));
|
||||
}
|
||||
|
||||
private static void OptionE()
|
||||
@@ -136,7 +149,11 @@ namespace DevConsole
|
||||
private static void OptionF()
|
||||
{
|
||||
//Guid guid = Guid.NewGuid();
|
||||
List<DirectoriesModel> dm = gsmParser.QueryDirectoryById("600");
|
||||
List<DirectoriesModel> dm = gsmRO.LoadRecords<DirectoriesModel>("*",
|
||||
GsmStruct.Tables.Directories,
|
||||
GsmStruct.DirectoryColumns.GameID,
|
||||
"600",
|
||||
true);
|
||||
foreach (var entry in dm)
|
||||
{
|
||||
//entry.Path = guid.ToString();
|
||||
@@ -156,6 +173,14 @@ namespace DevConsole
|
||||
}
|
||||
}
|
||||
|
||||
private static void PrintGameEntry(GameEntryModel gameEntry)
|
||||
{
|
||||
Console.WriteLine($"GameName: {gameEntry.GameName}");
|
||||
Console.WriteLine($"BackupWarning: {gameEntry.BackupWarning}");
|
||||
Console.WriteLine($"RestoreWarning: {gameEntry.RestoreWarning}");
|
||||
Console.WriteLine($"LastModified: {gameEntry.LastModified}\n");
|
||||
}
|
||||
|
||||
private static void PrintDirectories(List<DirectoriesModel> directoryEntries)
|
||||
{
|
||||
foreach (var directory in directoryEntries)
|
||||
|
||||
Reference in New Issue
Block a user