Removed magic strings from FirelanceMgr
- Renamed CSProj for both Gsm and Firelance. - Made namespace names consistent.
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\GSMParser\GSMParser.csproj" />
|
<ProjectReference Include="..\GSMParser\GsmMgr.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
+32
-24
@@ -1,5 +1,5 @@
|
|||||||
using FireLance;
|
using Firelance;
|
||||||
using FireLance.Models;
|
using Firelance.Models;
|
||||||
using Gsm;
|
using Gsm;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -119,9 +119,9 @@ namespace DevConsole
|
|||||||
case "A":
|
case "A":
|
||||||
Console.WriteLine("Enter a game ID:");
|
Console.WriteLine("Enter a game ID:");
|
||||||
|
|
||||||
var queryId = gsmRO.LoadRecords<GameEntryModel>( GsmRO.Columns.GameName,
|
var queryId = gsmRO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
||||||
GsmRO.Tables.GameEntry,
|
Gsm.Collections.Tables.GameEntry,
|
||||||
GsmRO.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);
|
||||||
@@ -131,8 +131,8 @@ namespace DevConsole
|
|||||||
Console.WriteLine("Enter a game ID:");
|
Console.WriteLine("Enter a game ID:");
|
||||||
|
|
||||||
var queryDirectoryId = gsmRO.LoadRecords<DirectoriesModel>( "*",
|
var queryDirectoryId = gsmRO.LoadRecords<DirectoriesModel>( "*",
|
||||||
GsmRO.Tables.Directories,
|
Gsm.Collections.Tables.Directories,
|
||||||
GsmRO.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);
|
||||||
@@ -140,9 +140,9 @@ namespace DevConsole
|
|||||||
case "C":
|
case "C":
|
||||||
Console.WriteLine("Enter game title to search:");
|
Console.WriteLine("Enter game title to search:");
|
||||||
|
|
||||||
var queryGameByName = gsmRO.LoadRecords<GameEntryModel>( GsmRO.Columns.GameName,
|
var queryGameByName = gsmRO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
||||||
GsmRO.Tables.GameEntry,
|
Gsm.Collections.Tables.GameEntry,
|
||||||
GsmRO.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);
|
||||||
@@ -196,15 +196,15 @@ namespace DevConsole
|
|||||||
private static void FlcWriteMasterGameRecordAction()
|
private static void FlcWriteMasterGameRecordAction()
|
||||||
{
|
{
|
||||||
var masterGameRecord = new MasterGameRecordModel();
|
var masterGameRecord = new MasterGameRecordModel();
|
||||||
List<DirectoriesModel> directories = gsmRO.LoadRecords<DirectoriesModel>("*",
|
List<DirectoriesModel> directories = gsmRO.LoadRecords<DirectoriesModel>( Gsm.Collections.Options.All,
|
||||||
GsmRO.Tables.Directories,
|
Gsm.Collections.Tables.Directories,
|
||||||
GsmRO.Columns.GameID,
|
Gsm.Collections.Columns.GameID,
|
||||||
"600",
|
"600",
|
||||||
true);
|
true);
|
||||||
|
|
||||||
GameEntryModel gameEntry = gsmRO.LoadRecords<GameEntryModel>(GsmRO.Columns.GameName,
|
GameEntryModel gameEntry = gsmRO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
||||||
GsmRO.Tables.GameEntry,
|
Gsm.Collections.Tables.GameEntry,
|
||||||
GsmRO.Columns.ID,
|
Gsm.Collections.Columns.ID,
|
||||||
"600",
|
"600",
|
||||||
true).First();
|
true).First();
|
||||||
|
|
||||||
@@ -215,12 +215,12 @@ namespace DevConsole
|
|||||||
masterGameRecord.GameEntry = gameEntry;
|
masterGameRecord.GameEntry = gameEntry;
|
||||||
masterGameRecord.SaveGameEntries = saveGameEntries;
|
masterGameRecord.SaveGameEntries = saveGameEntries;
|
||||||
|
|
||||||
flcCRUD.InsertRecord("GameRecords", masterGameRecord);
|
flcCRUD.InsertRecord(Firelance.Collections.GameRecords, masterGameRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FlcReadMasterGameRecordAction()
|
static void FlcReadMasterGameRecordAction()
|
||||||
{
|
{
|
||||||
var masterGameRecords = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>("GameRecords");
|
var masterGameRecords = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>(Firelance.Collections.GameRecords);
|
||||||
foreach (var record in masterGameRecords)
|
foreach (var record in masterGameRecords)
|
||||||
{
|
{
|
||||||
Console.WriteLine(record.Id);
|
Console.WriteLine(record.Id);
|
||||||
@@ -244,21 +244,29 @@ namespace DevConsole
|
|||||||
|
|
||||||
private static void FlcRemoveSaveEntryAction()
|
private static void FlcRemoveSaveEntryAction()
|
||||||
{
|
{
|
||||||
Guid firstMasterGameRecordGuid = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>("GameRecords").First().Id;
|
Guid firstMasterGameRecordGuid = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>(
|
||||||
var masterGameRecordToRemove = flcCRUD.LoadRecordById<MasterGameRecordModel>("GameRecords", firstMasterGameRecordGuid);
|
Firelance.Collections.GameRecords).First().Id;
|
||||||
|
var masterGameRecordToRemove = flcCRUD.LoadRecordById<MasterGameRecordModel>(
|
||||||
|
Firelance.Collections.GameRecords, firstMasterGameRecordGuid);
|
||||||
Guid firstSaveGameEntryGuid = masterGameRecordToRemove.SaveGameEntries.Select(x => x.Id).First();
|
Guid firstSaveGameEntryGuid = masterGameRecordToRemove.SaveGameEntries.Select(x => x.Id).First();
|
||||||
masterGameRecordToRemove.SaveGameEntries.RemoveAll(x => x.Id == firstSaveGameEntryGuid);
|
masterGameRecordToRemove.SaveGameEntries.RemoveAll(x => x.Id == firstSaveGameEntryGuid);
|
||||||
|
|
||||||
flcCRUD.UpsertRecordById("GameRecords", firstMasterGameRecordGuid, masterGameRecordToRemove);
|
flcCRUD.UpsertRecordById(Firelance.Collections.GameRecords,
|
||||||
|
firstMasterGameRecordGuid,
|
||||||
|
masterGameRecordToRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void FlcInsertSaveEntryAction()
|
private static void FlcInsertSaveEntryAction()
|
||||||
{
|
{
|
||||||
Guid firstMasterGameRecordGuid = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>("GameRecords").First().Id;
|
Guid firstMasterGameRecordGuid = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>(
|
||||||
var masterGameRecordToInsert = flcCRUD.LoadRecordById<MasterGameRecordModel>("GameRecords", firstMasterGameRecordGuid);
|
Firelance.Collections.GameRecords).First().Id;
|
||||||
|
var masterGameRecordToInsert = flcCRUD.LoadRecordById<MasterGameRecordModel>(
|
||||||
|
Firelance.Collections.GameRecords, firstMasterGameRecordGuid);
|
||||||
masterGameRecordToInsert.SaveGameEntries.Add(new SaveGameEntriesModel());
|
masterGameRecordToInsert.SaveGameEntries.Add(new SaveGameEntriesModel());
|
||||||
|
|
||||||
flcCRUD.UpsertRecordById("GameRecords", firstMasterGameRecordGuid, masterGameRecordToInsert);
|
flcCRUD.UpsertRecordById(Firelance.Collections.GameRecords,
|
||||||
|
firstMasterGameRecordGuid,
|
||||||
|
masterGameRecordToInsert);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void FlcUploadToGridFsAction()
|
private static void FlcUploadToGridFsAction()
|
||||||
|
|||||||
+2
-2
@@ -3,11 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.30204.135
|
VisualStudioVersion = 16.0.30204.135
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GSMParser", "GSMParser\GSMParser.csproj", "{7344FC11-3894-4393-A558-82E7D671372D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GsmMgr", "GSMParser\GsmMgr.csproj", "{7344FC11-3894-4393-A558-82E7D671372D}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevConsole", "DevConsole\DevConsole.csproj", "{6B7A9B29-420B-4F58-975E-3D72A3D95314}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevConsole", "DevConsole\DevConsole.csproj", "{6B7A9B29-420B-4F58-975E-3D72A3D95314}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Firelance", "FireLance\Firelance.csproj", "{6ACF5E6F-42EE-4FD6-8657-51E6380D422C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FirelanceMgr", "FireLance\FirelanceMgr.csproj", "{6ACF5E6F-42EE-4FD6-8657-51E6380D422C}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Firelance
|
||||||
|
{
|
||||||
|
public static class Collections
|
||||||
|
{
|
||||||
|
public const string GameRecords = "GameRecords";
|
||||||
|
public const string SaveGamesBucket = "SaveGames";
|
||||||
|
public const string SaveGamesChunks = "SaveGames.chunks";
|
||||||
|
public const string SaveGamesFiles = "SaveGames.files";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ using MongoDB.Driver;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace FireLance
|
namespace Firelance
|
||||||
{
|
{
|
||||||
public class FirelanceCRUD : IFlcMongoDBConnecton
|
public class FirelanceCRUD : IFlcMongoDBConnecton
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using MongoDB.Driver.GridFS;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FireLance
|
namespace Firelance
|
||||||
{
|
{
|
||||||
public class FirelanceGFS
|
public class FirelanceGFS
|
||||||
{
|
{
|
||||||
@@ -14,7 +14,7 @@ namespace FireLance
|
|||||||
{
|
{
|
||||||
gridFSBucket = new GridFSBucket(db, new GridFSBucketOptions
|
gridFSBucket = new GridFSBucket(db, new GridFSBucketOptions
|
||||||
{
|
{
|
||||||
BucketName = "SaveGames"
|
BucketName = Collections.SaveGamesBucket
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using FireLance.Interfaces;
|
using Firelance.Interfaces;
|
||||||
using MongoDB.Bson;
|
using MongoDB.Bson;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace FireLance
|
namespace Firelance
|
||||||
{
|
{
|
||||||
public class FirelanceMgr : IFlcBaseDBConnection, IFlcMongoDBConnecton
|
public class FirelanceMgr : IFlcBaseDBConnection, IFlcMongoDBConnecton
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace FireLance.Interfaces
|
namespace Firelance.Interfaces
|
||||||
{
|
{
|
||||||
public interface IFlcBaseDBConnection
|
public interface IFlcBaseDBConnection
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
|
|
||||||
namespace FireLance
|
namespace Firelance
|
||||||
{
|
{
|
||||||
public interface IFlcMongoDBConnecton
|
public interface IFlcMongoDBConnecton
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace FireLance.Models
|
namespace Firelance.Models
|
||||||
{
|
{
|
||||||
public class DirectoriesModel
|
public class DirectoriesModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace FireLance.Models
|
namespace Firelance.Models
|
||||||
{
|
{
|
||||||
public class GameEntryModel
|
public class GameEntryModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace FireLance.Models
|
namespace Firelance.Models
|
||||||
{
|
{
|
||||||
public class MasterGameRecordModel
|
public class MasterGameRecordModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace FireLance.Models
|
namespace Firelance.Models
|
||||||
{
|
{
|
||||||
public class SaveGameEntriesModel
|
public class SaveGameEntriesModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Gsm
|
||||||
|
{
|
||||||
|
public static class Collections
|
||||||
|
{
|
||||||
|
public static class Tables
|
||||||
|
{
|
||||||
|
public const string Directories = "Directories";
|
||||||
|
public const string GameEntry = "GameEntry";
|
||||||
|
public const string RegistryList = "RegistryList";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Columns
|
||||||
|
{
|
||||||
|
public const string ID = "id";
|
||||||
|
public const string GameID = "GameID";
|
||||||
|
public const string GameName = "GameName";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Options
|
||||||
|
{
|
||||||
|
public static string All = "*";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
using Microsoft.Data.Sqlite;
|
using Microsoft.Data.Sqlite;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using FireLance.Interfaces;
|
using Firelance.Interfaces;
|
||||||
using GSMParser.Inferfaces;
|
using GSMParser.Inferfaces;
|
||||||
|
|
||||||
namespace Gsm
|
namespace Gsm
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\FireLance\Firelance.csproj" />
|
<ProjectReference Include="..\FireLance\FirelanceMgr.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -7,20 +7,6 @@ namespace Gsm
|
|||||||
{
|
{
|
||||||
public class GsmRO : IGsmSqliteDBConnection
|
public class GsmRO : IGsmSqliteDBConnection
|
||||||
{
|
{
|
||||||
public static class Tables
|
|
||||||
{
|
|
||||||
public static string Directories { get { return "Directories"; } }
|
|
||||||
public static string GameEntry { get { return "GameEntry"; } }
|
|
||||||
public static string RegistryList { get { return "RegistryList"; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Columns
|
|
||||||
{
|
|
||||||
public static string ID { get { return "id"; } }
|
|
||||||
public static string GameID { get { return "GameID"; } }
|
|
||||||
public static string GameName { get { return "GameName"; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
public SqliteConnection Database { get; private set; }
|
public SqliteConnection Database { get; private set; }
|
||||||
public GsmRO(SqliteConnection db)
|
public GsmRO(SqliteConnection db)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user