Firelance 0.1.5.2

- Identification of valid save path function added
- Beginning to relocate SaveGameEntries model to be embedded within the relevant DirectoryEntry
This commit is contained in:
2020-07-11 22:18:24 +01:00
parent ca04c7a88f
commit 529c031e31
3 changed files with 28 additions and 7 deletions
-1
View File
@@ -251,7 +251,6 @@ namespace DevConsole
masterGameRecord.Directories = directories;
masterGameRecord.GameEntry = gameEntry;
masterGameRecord.SaveGameEntries = saveGameEntries;
flcMgr.CRUD.InsertRecord(Firelance.Collections.GameRecords, masterGameRecord);
}
+24 -5
View File
@@ -1,8 +1,8 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection.Metadata;
namespace FirelanceMgr
{
@@ -39,14 +39,33 @@ namespace FirelanceMgr
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(subKey))
{
if (key != null)
{
result = key.GetValue(value).ToString();
}
result = (key != null) ? key.GetValue(value).ToString() : string.Empty;
}
return result;
}
public static string IdentifyValidSavePath(IEnumerable<string> fullSpecialPaths, IEnumerable<string> savePaths)
{
List<string> allPaths = new List<string>();
foreach (var spPaths in fullSpecialPaths)
foreach (var svPaths in savePaths)
{
allPaths.Add(Path.Combine(spPaths, svPaths));
}
string validPath = string.Empty;
foreach (var path in allPaths)
{
if (Directory.Exists(path) && validPath.Length == 0)
{
var files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
validPath = (files.Length > 0) ? path : string.Empty;
}
}
return validPath;
}
}
}
}
+4 -1
View File
@@ -1,4 +1,6 @@
namespace Firelance.Models
using System.Collections.Generic;
namespace Firelance.Models
{
public class DirectoriesModel
{
@@ -11,5 +13,6 @@
public string DefinedFiles { get; set; }
public string ExcludedFiles { get; set; }
public bool Recurse { get; set; }
List<SaveGameEntriesModel> SaveGameEntries { get; set; }
}
}