fix(core): Fixes errors from missing files (#511)
This commit is contained in:
parent
ea5d09a7d7
commit
8006fa20df
10 changed files with 54 additions and 14 deletions
|
|
@ -176,7 +176,7 @@ namespace Server
|
|||
Utility.PushColor(ConsoleColor.Red);
|
||||
Console.WriteLine("failed");
|
||||
Utility.PopColor();
|
||||
throw new Exception("Core: Server configuration failed to deserialize.");
|
||||
throw new FileNotFoundException($"Failed to deserialize {m_FilePath}.");
|
||||
}
|
||||
|
||||
Console.WriteLine("done");
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ using System.Runtime;
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Server.Json;
|
||||
|
|
@ -445,7 +446,12 @@ namespace Server
|
|||
var assemblyPath = Path.Join(BaseDirectory, AssembliesConfiguration);
|
||||
|
||||
// Load UOContent.dll
|
||||
var assemblyFiles = JsonConfig.Deserialize<List<string>>(assemblyPath).ToArray();
|
||||
var assemblyFiles = JsonConfig.Deserialize<List<string>>(assemblyPath)?.ToArray();
|
||||
if (assemblyFiles == null)
|
||||
{
|
||||
throw new JsonException($"Failed to deserialize {assemblyPath}.");
|
||||
}
|
||||
|
||||
for (var i = 0; i < assemblyFiles.Length; i++)
|
||||
{
|
||||
assemblyFiles[i] = Path.Join(BaseDirectory, "Assemblies", assemblyFiles[i]);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Server.Json;
|
||||
|
||||
|
|
@ -51,6 +52,10 @@ namespace Server
|
|||
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
var maps = JsonConfig.Deserialize<List<MapDefinition>>(path);
|
||||
if (maps == null)
|
||||
{
|
||||
throw new JsonException($"Failed to deserialize {path}.");
|
||||
}
|
||||
|
||||
foreach (var def in maps)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using Server.Json;
|
||||
using Server.Utilities;
|
||||
|
||||
|
|
@ -35,6 +36,10 @@ namespace Server
|
|||
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
var regions = JsonConfig.Deserialize<List<DynamicJson>>(path);
|
||||
if (regions == null)
|
||||
{
|
||||
throw new JsonException($"Failed to deserialize {path}.");
|
||||
}
|
||||
|
||||
foreach (var json in regions)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue