Implemented deleting save game entries.
This commit is contained in:
@@ -157,8 +157,8 @@ namespace DevConsole
|
||||
{
|
||||
Console.WriteLine("A. Write predefined MasterGameRecord");
|
||||
Console.WriteLine("B. Read predefined MasterGameRecord");
|
||||
Console.WriteLine("C. Insert save entry into existing MasterGameRecord");
|
||||
Console.WriteLine("D. Remove save entry from existing MasterGameRecord");
|
||||
Console.WriteLine("C. Insert blank save entry into existing MasterGameRecord");
|
||||
Console.WriteLine("D. Remove first save entry from existing MasterGameRecord");
|
||||
Console.WriteLine("E. Upload save entry using GridFS");
|
||||
Console.WriteLine("F. Download save entry using GridFS");
|
||||
Console.WriteLine("X. <--- Go back\n");
|
||||
@@ -176,10 +176,10 @@ namespace DevConsole
|
||||
FlcReadMasterGameRecordAction();
|
||||
break;
|
||||
case "C":
|
||||
FlcInsertSaveEntryAction();
|
||||
FlcInsertBlankSaveEntryAction();
|
||||
break;
|
||||
case "D":
|
||||
FlcRemoveSaveEntryAction();
|
||||
FlcRemoveFirstSaveEntryAction();
|
||||
break;
|
||||
case "E":
|
||||
FlcUploadToGridFsAction();
|
||||
@@ -243,7 +243,7 @@ namespace DevConsole
|
||||
}
|
||||
}
|
||||
|
||||
private static void FlcRemoveSaveEntryAction()
|
||||
private static void FlcRemoveFirstSaveEntryAction()
|
||||
{
|
||||
Guid firstMasterGameRecordGuid = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>(
|
||||
Firelance.Collections.GameRecords).First().Id;
|
||||
@@ -256,10 +256,10 @@ namespace DevConsole
|
||||
firstMasterGameRecordGuid,
|
||||
masterGameRecordToRemove);
|
||||
|
||||
|
||||
var result = new FirelanceGFS(flcMgr.Database).DeleteFile(firstSaveGameEntryObjId);
|
||||
}
|
||||
|
||||
private static void FlcInsertSaveEntryAction()
|
||||
private static void FlcInsertBlankSaveEntryAction()
|
||||
{
|
||||
Guid firstMasterGameRecordGuid = flcCRUD.LoadRecordsFromTable<MasterGameRecordModel>(
|
||||
Firelance.Collections.GameRecords).First().Id;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.GridFS;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firelance
|
||||
@@ -39,6 +40,8 @@ namespace Firelance
|
||||
return VerifyDownloadedFile(saveLocation);
|
||||
}
|
||||
|
||||
public async Task DeleteFile(ObjectId id) { await gridFSBucket.DeleteAsync(id); }
|
||||
|
||||
private bool VerifyDownloadedFile(string path) { return File.Exists(path); }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user