Add Shipyard & Fix ShipLocker
Update File handling Update Journal handling Update README.md
This commit is contained in:
parent
bc958e7679
commit
235cb2401a
17 changed files with 253 additions and 528 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue