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>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GSMParser\GSMParser.csproj" />
|
||||
<ProjectReference Include="..\GSMParser\GsmMgr.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
+32
-24
@@ -1,5 +1,5 @@
|
||||
using FireLance;
|
||||
using FireLance.Models;
|
||||
using Firelance;
|
||||
using Firelance.Models;
|
||||
using Gsm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -119,9 +119,9 @@ namespace DevConsole
|
||||
case "A":
|
||||
Console.WriteLine("Enter a game ID:");
|
||||
|
||||
var queryId = gsmRO.LoadRecords<GameEntryModel>( GsmRO.Columns.GameName,
|
||||
GsmRO.Tables.GameEntry,
|
||||
GsmRO.Columns.ID,
|
||||
var queryId = gsmRO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
||||
Gsm.Collections.Tables.GameEntry,
|
||||
Gsm.Collections.Columns.ID,
|
||||
Console.ReadLine(),
|
||||
true);
|
||||
foreach (var record in queryId) PrintAllValues(record);
|
||||
@@ -131,8 +131,8 @@ namespace DevConsole
|
||||
Console.WriteLine("Enter a game ID:");
|
||||
|
||||
var queryDirectoryId = gsmRO.LoadRecords<DirectoriesModel>( "*",
|
||||
GsmRO.Tables.Directories,
|
||||
GsmRO.Columns.GameID,
|
||||
Gsm.Collections.Tables.Directories,
|
||||
Gsm.Collections.Columns.GameID,
|
||||
Console.ReadLine(),
|
||||
true);
|
||||
foreach (var record in queryDirectoryId) PrintAllValues(record);
|
||||
@@ -140,9 +140,9 @@ namespace DevConsole
|
||||
case "C":
|
||||
Console.WriteLine("Enter game title to search:");
|
||||
|
||||
var queryGameByName = gsmRO.LoadRecords<GameEntryModel>( GsmRO.Columns.GameName,
|
||||
GsmRO.Tables.GameEntry,
|
||||
GsmRO.Columns.GameName,
|
||||
var queryGameByName = gsmRO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
||||
Gsm.Collections.Tables.GameEntry,
|
||||
Gsm.Collections.Columns.GameName,
|
||||
Console.ReadLine(),
|
||||
false);
|
||||
foreach (var record in queryGameByName) PrintAllValues(record);
|
||||
@@ -196,15 +196,15 @@ namespace DevConsole
|
||||
private static void FlcWriteMasterGameRecordAction()
|
||||
{
|
||||
var masterGameRecord = new MasterGameRecordModel();
|
||||
List<DirectoriesModel> directories = gsmRO.LoadRecords<DirectoriesModel>("*",
|
||||
GsmRO.Tables.Directories,
|
||||
GsmRO.Columns.GameID,
|
||||
List<DirectoriesModel> directories = gsmRO.LoadRecords<DirectoriesModel>( Gsm.Collections.Options.All,
|
||||
Gsm.Collections.Tables.Directories,
|
||||
Gsm.Collections.Columns.GameID,
|
||||
"600",
|
||||
true);
|
||||
|
||||
GameEntryModel gameEntry = gsmRO.LoadRecords<GameEntryModel>(GsmRO.Columns.GameName,
|
||||
GsmRO.Tables.GameEntry,
|
||||
GsmRO.Columns.ID,
|
||||
GameEntryModel gameEntry = gsmRO.LoadRecords<GameEntryModel>( Gsm.Collections.Columns.GameName,
|
||||
Gsm.Collections.Tables.GameEntry,
|
||||
Gsm.Collections.Columns.ID,
|
||||
"600",
|
||||
true).First();
|
||||
|
||||
@@ -215,12 +215,12 @@ namespace DevConsole
|
||||
masterGameRecord.GameEntry = gameEntry;
|
||||
masterGameRecord.SaveGameEntries = saveGameEntries;
|
||||
|
||||
flcCRUD.InsertRecord("GameRecords", masterGameRecord);
|
||||
flcCRUD.InsertRecord(Firelance.Collections.GameRecords, masterGameRecord);
|
||||
}
|
||||
|
||||
static void FlcReadMasterGameRecordAction()
|
||||
{
|
||||
var masterGameRecords = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>("GameRecords");
|
||||
var masterGameRecords = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>(Firelance.Collections.GameRecords);
|
||||
foreach (var record in masterGameRecords)
|
||||
{
|
||||
Console.WriteLine(record.Id);
|
||||
@@ -244,21 +244,29 @@ namespace DevConsole
|
||||
|
||||
private static void FlcRemoveSaveEntryAction()
|
||||
{
|
||||
Guid firstMasterGameRecordGuid = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>("GameRecords").First().Id;
|
||||
var masterGameRecordToRemove = flcCRUD.LoadRecordById<MasterGameRecordModel>("GameRecords", firstMasterGameRecordGuid);
|
||||
Guid firstMasterGameRecordGuid = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>(
|
||||
Firelance.Collections.GameRecords).First().Id;
|
||||
var masterGameRecordToRemove = flcCRUD.LoadRecordById<MasterGameRecordModel>(
|
||||
Firelance.Collections.GameRecords, firstMasterGameRecordGuid);
|
||||
Guid firstSaveGameEntryGuid = masterGameRecordToRemove.SaveGameEntries.Select(x => x.Id).First();
|
||||
masterGameRecordToRemove.SaveGameEntries.RemoveAll(x => x.Id == firstSaveGameEntryGuid);
|
||||
|
||||
flcCRUD.UpsertRecordById("GameRecords", firstMasterGameRecordGuid, masterGameRecordToRemove);
|
||||
flcCRUD.UpsertRecordById(Firelance.Collections.GameRecords,
|
||||
firstMasterGameRecordGuid,
|
||||
masterGameRecordToRemove);
|
||||
}
|
||||
|
||||
private static void FlcInsertSaveEntryAction()
|
||||
{
|
||||
Guid firstMasterGameRecordGuid = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>("GameRecords").First().Id;
|
||||
var masterGameRecordToInsert = flcCRUD.LoadRecordById<MasterGameRecordModel>("GameRecords", firstMasterGameRecordGuid);
|
||||
Guid firstMasterGameRecordGuid = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>(
|
||||
Firelance.Collections.GameRecords).First().Id;
|
||||
var masterGameRecordToInsert = flcCRUD.LoadRecordById<MasterGameRecordModel>(
|
||||
Firelance.Collections.GameRecords, firstMasterGameRecordGuid);
|
||||
masterGameRecordToInsert.SaveGameEntries.Add(new SaveGameEntriesModel());
|
||||
|
||||
flcCRUD.UpsertRecordById("GameRecords", firstMasterGameRecordGuid, masterGameRecordToInsert);
|
||||
flcCRUD.UpsertRecordById(Firelance.Collections.GameRecords,
|
||||
firstMasterGameRecordGuid,
|
||||
masterGameRecordToInsert);
|
||||
}
|
||||
|
||||
private static void FlcUploadToGridFsAction()
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30204.135
|
||||
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
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevConsole", "DevConsole\DevConsole.csproj", "{6B7A9B29-420B-4F58-975E-3D72A3D95314}"
|
||||
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
|
||||
Global
|
||||
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.Collections.Generic;
|
||||
|
||||
namespace FireLance
|
||||
namespace Firelance
|
||||
{
|
||||
public class FirelanceCRUD : IFlcMongoDBConnecton
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using MongoDB.Driver.GridFS;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FireLance
|
||||
namespace Firelance
|
||||
{
|
||||
public class FirelanceGFS
|
||||
{
|
||||
@@ -14,7 +14,7 @@ namespace FireLance
|
||||
{
|
||||
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.Driver;
|
||||
using System;
|
||||
|
||||
namespace FireLance
|
||||
namespace Firelance
|
||||
{
|
||||
public class FirelanceMgr : IFlcBaseDBConnection, IFlcMongoDBConnecton
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace FireLance.Interfaces
|
||||
namespace Firelance.Interfaces
|
||||
{
|
||||
public interface IFlcBaseDBConnection
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace FireLance
|
||||
namespace Firelance
|
||||
{
|
||||
public interface IFlcMongoDBConnecton
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace FireLance.Models
|
||||
namespace Firelance.Models
|
||||
{
|
||||
public class DirectoriesModel
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace FireLance.Models
|
||||
namespace Firelance.Models
|
||||
{
|
||||
public class GameEntryModel
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FireLance.Models
|
||||
namespace Firelance.Models
|
||||
{
|
||||
public class MasterGameRecordModel
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FireLance.Models
|
||||
namespace Firelance.Models
|
||||
{
|
||||
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 System;
|
||||
using System.IO;
|
||||
using FireLance.Interfaces;
|
||||
using Firelance.Interfaces;
|
||||
using GSMParser.Inferfaces;
|
||||
|
||||
namespace Gsm
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FireLance\Firelance.csproj" />
|
||||
<ProjectReference Include="..\FireLance\FirelanceMgr.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -7,20 +7,6 @@ namespace Gsm
|
||||
{
|
||||
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 GsmRO(SqliteConnection db)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user