2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-01 16:33:43 -04:00

Add Shipyard & Fix ShipLocker

Update File handling
Update Journal handling
Update README.md
This commit is contained in:
2024-05-10 22:26:44 +10:00
parent bc958e7679
commit 235cb2401a
17 changed files with 255 additions and 530 deletions

View File

@ -11,34 +11,9 @@ public class ModulesInfoService(
{
public string FileName => FileHandlerService.ModulesInfoFileName;
public bool ValidateFile(string filePath)
{
if (!File.Exists(filePath))
{
logger.LogWarning("Journal file {JournalFile} does not exist", filePath);
return false;
}
var fileInfo = new FileInfo(filePath);
if (!string.Equals(fileInfo.Name, FileName, StringComparison.InvariantCultureIgnoreCase))
{
logger.LogWarning("Journal file {name} is not valid");
return false;
}
if (fileInfo.Length == 0)
{
logger.LogWarning("Journal file {name} is empty", filePath);
return false;
}
return true;
}
public async Task HandleFile(string filePath)
{
if (!ValidateFile(filePath))
if (!FileHelper.ValidateFile(filePath))
{
return;
}
@ -59,7 +34,7 @@ public class ModulesInfoService(
{
var moduleInfoFile = Path.Combine(options.Value.JournalDirectory, FileName);
if (!ValidateFile(moduleInfoFile))
if (!FileHelper.ValidateFile(moduleInfoFile))
{
return new ModuleInfoFile();
}