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:
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user