Initial commit
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FireLance\GSMParser.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>DevConsole</ActiveDebugProfile>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,133 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DevConsole
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static GSMParser parser = new GSMParser();
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Console.WriteLine($"Connection State: {parser.GetConnectionState()}");
|
||||
CommandsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
private static void CommandsMenu()
|
||||
{
|
||||
Console.WriteLine("Please select an option below:\n");
|
||||
Console.WriteLine("A. Database connection");
|
||||
Console.WriteLine("B. Query game by ID");
|
||||
Console.WriteLine("C. Query directory by ID");
|
||||
Console.WriteLine("D. Query game by NAME");
|
||||
Console.WriteLine("X. Exit application\n");
|
||||
Console.Write(":");
|
||||
|
||||
var userInput = Console.ReadKey();
|
||||
Console.Write("\n\n");
|
||||
|
||||
switch (userInput.Key)
|
||||
{
|
||||
case ConsoleKey.A:
|
||||
OptionA();
|
||||
break;
|
||||
case ConsoleKey.B:
|
||||
OptionB();
|
||||
break;
|
||||
case ConsoleKey.C:
|
||||
OptionC();
|
||||
break;
|
||||
case ConsoleKey.D:
|
||||
OptionD();
|
||||
break;
|
||||
case ConsoleKey.X:
|
||||
Environment.Exit(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#region Command Options
|
||||
private static void OptionA()
|
||||
{
|
||||
Console.WriteLine("A. Open DB");
|
||||
Console.WriteLine("B. Close DB");
|
||||
Console.Write(":");
|
||||
|
||||
var userInput = Console.ReadKey();
|
||||
Console.Write("\n\n");
|
||||
|
||||
switch (userInput.Key)
|
||||
{
|
||||
case ConsoleKey.A:
|
||||
Console.WriteLine("Connect to database");
|
||||
parser.OpenConnection(@"C:\Users\Dunestorm\Projects\FireLance\FireLance\games.db");
|
||||
break;
|
||||
case ConsoleKey.B:
|
||||
parser.CloseCurrentConnection();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void OptionB()
|
||||
{
|
||||
Console.WriteLine("Enter a Game ID (1043)");
|
||||
string r = Console.ReadLine();
|
||||
Console.Write("\n");
|
||||
|
||||
PrintGameEntries(parser.QueryGameById(r));
|
||||
}
|
||||
|
||||
private static void OptionC()
|
||||
{
|
||||
Console.WriteLine("Enter a Game ID (1043)");
|
||||
string r = Console.ReadLine();
|
||||
Console.Write("\n");
|
||||
|
||||
PrintDirectories(parser.QueryDirectoryById(r));
|
||||
}
|
||||
|
||||
private static void OptionD()
|
||||
{
|
||||
Console.WriteLine("Enter game to search");
|
||||
string r = Console.ReadLine();
|
||||
Console.Write("\n");
|
||||
|
||||
PrintGameEntries(parser.QueryGameByName(r));
|
||||
}
|
||||
#endregion
|
||||
|
||||
private static void PrintGameEntries(List<GameEntry> gameEntries)
|
||||
{
|
||||
foreach (var game in gameEntries)
|
||||
{
|
||||
Console.WriteLine($"ID: {game.id}");
|
||||
Console.WriteLine($"GameName: {game.GameName}");
|
||||
Console.WriteLine($"BackupWarning: {game.BackupWarning}");
|
||||
Console.WriteLine($"RestoreWarning: {game.RestoreWarning}");
|
||||
Console.WriteLine($"LastModified: {game.LastModified}\n");
|
||||
}
|
||||
}
|
||||
|
||||
private static void PrintDirectories(List<Directories> directoryEntries)
|
||||
{
|
||||
foreach (var directory in directoryEntries)
|
||||
{
|
||||
Console.WriteLine($"ID: {directory.id}");
|
||||
Console.WriteLine($"GameID: {directory.GameID}");
|
||||
Console.WriteLine($"SpecialPath: {directory.SpecialPath}");
|
||||
Console.WriteLine($"Path: {directory.Path}");
|
||||
Console.WriteLine($"RegHive: {directory.RegHive}");
|
||||
Console.WriteLine($"RegPath: {directory.RegPath}");
|
||||
Console.WriteLine($"RegValue: {directory.RegValue}");
|
||||
Console.WriteLine($"DefinedFiles: {directory.DefinedFiles}");
|
||||
Console.WriteLine($"ExcludedFiles: {directory.ExcludedFiles}");
|
||||
Console.WriteLine($"Recurse: {directory.Recurse}\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user