Firelance 0.1.0.0
- Corrected instancing error by including FQ class name from previous commit - Implemented helper class: - SpecialPath directory converter - Registry value parser
This commit is contained in:
+46
-25
@@ -1,6 +1,5 @@
|
|||||||
using Firelance;
|
using Firelance.Models;
|
||||||
using Firelance.Models;
|
using FirelanceMgr;
|
||||||
using Gsm;
|
|
||||||
using MongoDB.Bson;
|
using MongoDB.Bson;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -11,8 +10,8 @@ namespace DevConsole
|
|||||||
{
|
{
|
||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
public static GsmMgr gsmMgr = new GsmMgr();
|
public static Gsm.GsmMgr gsmMgr = new Gsm.GsmMgr();
|
||||||
public static FirelanceMgr flcMgr = new FirelanceMgr();
|
public static Firelance.FirelanceMgr flcMgr = new Firelance.FirelanceMgr();
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
@@ -28,6 +27,7 @@ namespace DevConsole
|
|||||||
Console.WriteLine("A. Manage DB Connections --->");
|
Console.WriteLine("A. Manage DB Connections --->");
|
||||||
Console.WriteLine("B. GSM Actions --->");
|
Console.WriteLine("B. GSM Actions --->");
|
||||||
Console.WriteLine("C. FLC Actions --->");
|
Console.WriteLine("C. FLC Actions --->");
|
||||||
|
Console.WriteLine("D. Helper Actions --->");
|
||||||
Console.WriteLine("X. Exit application\n");
|
Console.WriteLine("X. Exit application\n");
|
||||||
Console.Write(":");
|
Console.Write(":");
|
||||||
|
|
||||||
@@ -45,6 +45,9 @@ namespace DevConsole
|
|||||||
case "C":
|
case "C":
|
||||||
CmdFlcActions();
|
CmdFlcActions();
|
||||||
break;
|
break;
|
||||||
|
case "D":
|
||||||
|
CmdHelperActions();
|
||||||
|
break;
|
||||||
case "X":
|
case "X":
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
break;
|
break;
|
||||||
@@ -117,10 +120,10 @@ namespace DevConsole
|
|||||||
Console.WriteLine("Enter a game ID:");
|
Console.WriteLine("Enter a game ID:");
|
||||||
|
|
||||||
var queryId = gsmMgr.RO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
var queryId = gsmMgr.RO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
||||||
Gsm.Collections.Tables.GameEntry,
|
Gsm.Collections.Tables.GameEntry,
|
||||||
Gsm.Collections.Columns.ID,
|
Gsm.Collections.Columns.ID,
|
||||||
Console.ReadLine(),
|
Console.ReadLine(),
|
||||||
true);
|
true);
|
||||||
foreach (var record in queryId) PrintAllValues(record);
|
foreach (var record in queryId) PrintAllValues(record);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -128,20 +131,20 @@ namespace DevConsole
|
|||||||
Console.WriteLine("Enter a game ID:");
|
Console.WriteLine("Enter a game ID:");
|
||||||
|
|
||||||
var queryDirectoryId = gsmMgr.RO.LoadRecords<DirectoriesModel>( Gsm.Collections.Options.All,
|
var queryDirectoryId = gsmMgr.RO.LoadRecords<DirectoriesModel>( Gsm.Collections.Options.All,
|
||||||
Gsm.Collections.Tables.Directories,
|
Gsm.Collections.Tables.Directories,
|
||||||
Gsm.Collections.Columns.GameID,
|
Gsm.Collections.Columns.GameID,
|
||||||
Console.ReadLine(),
|
Console.ReadLine(),
|
||||||
true);
|
true);
|
||||||
foreach (var record in queryDirectoryId) PrintAllValues(record);
|
foreach (var record in queryDirectoryId) PrintAllValues(record);
|
||||||
break;
|
break;
|
||||||
case "C":
|
case "C":
|
||||||
Console.WriteLine("Enter game title to search:");
|
Console.WriteLine("Enter game title to search:");
|
||||||
|
|
||||||
var queryGameByName = gsmMgr.RO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
var queryGameByName = gsmMgr.RO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
||||||
Gsm.Collections.Tables.GameEntry,
|
Gsm.Collections.Tables.GameEntry,
|
||||||
Gsm.Collections.Columns.GameName,
|
Gsm.Collections.Columns.GameName,
|
||||||
Console.ReadLine(),
|
Console.ReadLine(),
|
||||||
false);
|
false);
|
||||||
foreach (var record in queryGameByName) PrintAllValues(record);
|
foreach (var record in queryGameByName) PrintAllValues(record);
|
||||||
break;
|
break;
|
||||||
case "X":
|
case "X":
|
||||||
@@ -188,22 +191,40 @@ namespace DevConsole
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void CmdHelperActions()
|
||||||
|
{
|
||||||
|
Console.WriteLine("A. Convert SpecialPath to AbsolutePath");
|
||||||
|
Console.WriteLine("X. <--- Go back\n");
|
||||||
|
Console.Write(":");
|
||||||
|
|
||||||
|
var userInput = Console.ReadLine();
|
||||||
|
Console.Write("\n\n");
|
||||||
|
|
||||||
|
switch (userInput.ToUpper())
|
||||||
|
{
|
||||||
|
case "A":
|
||||||
|
Console.WriteLine(Helpers.Converters.GetSpecialToAbsolutePath(Console.ReadLine().ToUpper()));
|
||||||
|
break;
|
||||||
|
case "X":
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region FlcActions
|
#region FlcActions
|
||||||
private static void FlcWriteMasterGameRecordAction()
|
private static void FlcWriteMasterGameRecordAction()
|
||||||
{
|
{
|
||||||
var masterGameRecord = new MasterGameRecordModel();
|
var masterGameRecord = new MasterGameRecordModel();
|
||||||
List<DirectoriesModel> directories = gsmMgr.RO.LoadRecords<DirectoriesModel>( Gsm.Collections.Options.All,
|
List<DirectoriesModel> directories = gsmMgr.RO.LoadRecords<DirectoriesModel>( Gsm.Collections.Options.All,
|
||||||
Gsm.Collections.Tables.Directories,
|
Gsm.Collections.Tables.Directories,
|
||||||
Gsm.Collections.Columns.GameID,
|
Gsm.Collections.Columns.GameID,
|
||||||
"600",
|
"600",
|
||||||
true);
|
true);
|
||||||
|
|
||||||
GameEntryModel gameEntry = gsmMgr.RO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
GameEntryModel gameEntry = gsmMgr.RO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
||||||
Gsm.Collections.Tables.GameEntry,
|
Gsm.Collections.Tables.GameEntry,
|
||||||
Gsm.Collections.Columns.ID,
|
Gsm.Collections.Columns.ID,
|
||||||
"600",
|
"600",
|
||||||
true).First();
|
true).First();
|
||||||
|
|
||||||
List<SaveGameEntriesModel> saveGameEntries = new List<SaveGameEntriesModel>();
|
List<SaveGameEntriesModel> saveGameEntries = new List<SaveGameEntriesModel>();
|
||||||
saveGameEntries.Add(new SaveGameEntriesModel());
|
saveGameEntries.Add(new SaveGameEntriesModel());
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
|
||||||
<PackageReference Include="MongoDB.Driver" Version="2.10.4" />
|
<PackageReference Include="MongoDB.Driver" Version="2.10.4" />
|
||||||
<PackageReference Include="MongoDB.Driver.GridFS" Version="2.10.4" />
|
<PackageReference Include="MongoDB.Driver.GridFS" Version="2.10.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace FirelanceMgr
|
||||||
|
{
|
||||||
|
public static class Helpers
|
||||||
|
{
|
||||||
|
public static class Converters
|
||||||
|
{
|
||||||
|
public static string GetSpecialToAbsolutePath(string specialPath)
|
||||||
|
{
|
||||||
|
var d = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ "%APPDATA%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) },
|
||||||
|
{ "%APPDATA_LOCAL%", Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) },
|
||||||
|
{ "%APPDATA_LOCALLOW%", @$"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\AppData\LocalLow" },
|
||||||
|
{ "%APPDATA_COMMON%", Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) },
|
||||||
|
{ "%DOCUMENTS%", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) },
|
||||||
|
{ "%SAVED_GAMES%", @$"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\Saved Games" },
|
||||||
|
{ "%STEAM%", Parsers.GetValueFromRegistry(@"SOFTWARE\WOW6432Node\Valve\Steam", "InstallPath") },
|
||||||
|
{ "%STEAM_CLOUD%", $@"{Parsers.GetValueFromRegistry(@"SOFTWARE\WOW6432Node\Valve\Steam", "InstallPath")}\userdata" },
|
||||||
|
{ "%SHARED_DOCUMENTS%", Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments) },
|
||||||
|
{ "%USER_PROFILE%", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) },
|
||||||
|
{ "%UPLAY%", "NOT_YET_IMPLEMENTED" },
|
||||||
|
};
|
||||||
|
|
||||||
|
return d.Where(x => x.Key.Contains(specialPath)).Select(x => x.Value).Single();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Parsers
|
||||||
|
{
|
||||||
|
public static string GetValueFromRegistry(string subKey, string value)
|
||||||
|
{
|
||||||
|
string result = string.Empty;
|
||||||
|
|
||||||
|
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(subKey))
|
||||||
|
{
|
||||||
|
if (key != null)
|
||||||
|
{
|
||||||
|
result = key.GetValue(value).ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user