Catch errors in updater and fix loading error
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.0.212.393")]
|
[assembly: AssemblyVersion("1.0.213.390")]
|
||||||
[assembly: AssemblyFileVersion("1.0.212.393")]
|
[assembly: AssemblyFileVersion("1.0.213.390")]
|
@@ -34,7 +34,10 @@ namespace Torch.Server.Managers
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Init()
|
public override void Init()
|
||||||
{
|
{
|
||||||
LoadInstance(Torch.Config.InstancePath);
|
MyFileSystem.ExePath = Path.Combine(Torch.GetManager<FilesystemManager>().TorchDirectory, "DedicatedServer64");
|
||||||
|
MyFileSystem.Init("Content", Torch.Config.InstancePath);
|
||||||
|
//Initializes saves path. Why this isn't in Init() we may never know.
|
||||||
|
MyFileSystem.InitUserSpecific(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadInstance(string path, bool validate = true)
|
public void LoadInstance(string path, bool validate = true)
|
||||||
@@ -70,7 +73,7 @@ namespace Torch.Server.Managers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadWorldMods();
|
ImportWorldConfig();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (string.IsNullOrEmpty(DedicatedConfig.LoadWorld))
|
if (string.IsNullOrEmpty(DedicatedConfig.LoadWorld))
|
||||||
@@ -83,11 +86,11 @@ namespace Torch.Server.Managers
|
|||||||
public void SelectWorld(string worldPath, bool modsOnly = true)
|
public void SelectWorld(string worldPath, bool modsOnly = true)
|
||||||
{
|
{
|
||||||
DedicatedConfig.LoadWorld = worldPath;
|
DedicatedConfig.LoadWorld = worldPath;
|
||||||
LoadWorldMods(modsOnly);
|
ImportWorldConfig(modsOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void LoadWorldMods(bool modsOnly = true)
|
private void ImportWorldConfig(bool modsOnly = true)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(DedicatedConfig.LoadWorld))
|
if (string.IsNullOrEmpty(DedicatedConfig.LoadWorld))
|
||||||
return;
|
return;
|
||||||
@@ -112,14 +115,14 @@ namespace Torch.Server.Managers
|
|||||||
|
|
||||||
DedicatedConfig.Mods = sb.ToString();
|
DedicatedConfig.Mods = sb.ToString();
|
||||||
|
|
||||||
Log.Info("Loaded mod list from world");
|
Log.Debug("Loaded mod list from world");
|
||||||
|
|
||||||
if (!modsOnly)
|
if (!modsOnly)
|
||||||
DedicatedConfig.SessionSettings = new SessionSettingsViewModel(checkpoint.Settings);
|
DedicatedConfig.SessionSettings = new SessionSettingsViewModel(checkpoint.Settings);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.Error($"Error loading mod list from world '{DedicatedConfig.LoadWorld}'.");
|
Log.Error($"Error loading mod list from world, verify that your mod list is accurate. '{DedicatedConfig.LoadWorld}'.");
|
||||||
Log.Error(e);
|
Log.Error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.1.212.393")]
|
[assembly: AssemblyVersion("1.1.213.390")]
|
||||||
[assembly: AssemblyFileVersion("1.1.212.393")]
|
[assembly: AssemblyFileVersion("1.1.213.390")]
|
@@ -67,7 +67,6 @@ namespace Torch.Server
|
|||||||
public override void Init()
|
public override void Init()
|
||||||
{
|
{
|
||||||
Log.Info($"Init server '{Config.InstanceName}' at '{Config.InstancePath}'");
|
Log.Info($"Init server '{Config.InstanceName}' at '{Config.InstancePath}'");
|
||||||
MyObjectBuilderSerializer.RegisterFromAssembly(typeof(MyObjectBuilder_CheckpointSerializer).Assembly);
|
|
||||||
base.Init();
|
base.Init();
|
||||||
|
|
||||||
MyPerGameSettings.SendLogToKeen = false;
|
MyPerGameSettings.SendLogToKeen = false;
|
||||||
@@ -80,6 +79,7 @@ namespace Torch.Server
|
|||||||
MyFinalBuildConstants.APP_VERSION = MyPerGameSettings.BasicGameInfo.GameVersion;
|
MyFinalBuildConstants.APP_VERSION = MyPerGameSettings.BasicGameInfo.GameVersion;
|
||||||
InvokeBeforeRun();
|
InvokeBeforeRun();
|
||||||
|
|
||||||
|
MyObjectBuilderSerializer.RegisterFromAssembly(typeof(MyObjectBuilder_CheckpointSerializer).Assembly);
|
||||||
MyPlugins.RegisterGameAssemblyFile(MyPerGameSettings.GameModAssembly);
|
MyPlugins.RegisterGameAssemblyFile(MyPerGameSettings.GameModAssembly);
|
||||||
MyPlugins.RegisterGameObjectBuildersAssemblyFile(MyPerGameSettings.GameModObjBuildersAssembly);
|
MyPlugins.RegisterGameObjectBuildersAssemblyFile(MyPerGameSettings.GameModObjBuildersAssembly);
|
||||||
MyPlugins.RegisterSandboxAssemblyFile(MyPerGameSettings.SandboxAssembly);
|
MyPlugins.RegisterSandboxAssemblyFile(MyPerGameSettings.SandboxAssembly);
|
||||||
@@ -87,6 +87,7 @@ namespace Torch.Server
|
|||||||
MyPlugins.Load();
|
MyPlugins.Load();
|
||||||
MyGlobalTypeMetadata.Static.Init();
|
MyGlobalTypeMetadata.Static.Init();
|
||||||
|
|
||||||
|
GetManager<InstanceManager>().LoadInstance(Config.InstancePath);
|
||||||
Plugins.LoadPlugins();
|
Plugins.LoadPlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TabControl Grid.Row="1" Height="Auto" x:Name="TabControl" Margin="5,0,5,5">
|
<TabControl Grid.Row="1" Height="Auto" x:Name="TabControl" Margin="5,0,5,5">
|
||||||
<TabItem Header="Configuration">
|
<TabItem Header="Configuration">
|
||||||
<Grid>
|
<Grid IsEnabled="{Binding IsRunning, Converter={StaticResource InverseBool}}">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
|
@@ -67,27 +67,35 @@ namespace Torch.Managers
|
|||||||
if (!Torch.Config.GetPluginUpdates)
|
if (!Torch.Config.GetPluginUpdates)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var name = manifest.Repository.Split('/');
|
try
|
||||||
if (name.Length != 2)
|
|
||||||
{
|
{
|
||||||
_log.Error($"'{manifest.Repository}' is not a valid GitHub repository.");
|
var name = manifest.Repository.Split('/');
|
||||||
return;
|
if (name.Length != 2)
|
||||||
}
|
{
|
||||||
|
_log.Error($"'{manifest.Repository}' is not a valid GitHub repository.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var currentVersion = new Version(manifest.Version);
|
var currentVersion = new Version(manifest.Version);
|
||||||
var releaseInfo = await GetLatestRelease(name[0], name[1]).ConfigureAwait(false);
|
var releaseInfo = await GetLatestRelease(name[0], name[1]).ConfigureAwait(false);
|
||||||
if (releaseInfo.Item1 > currentVersion)
|
if (releaseInfo.Item1 > currentVersion)
|
||||||
{
|
{
|
||||||
_log.Warn($"Updating {manifest.Repository} from version {currentVersion} to version {releaseInfo.Item1}");
|
_log.Warn($"Updating {manifest.Repository} from version {currentVersion} to version {releaseInfo.Item1}");
|
||||||
var updateName = Path.Combine(_fsManager.TempDirectory, $"{name[0]}_{name[1]}.zip");
|
var updateName = Path.Combine(_fsManager.TempDirectory, $"{name[0]}_{name[1]}.zip");
|
||||||
var updatePath = Path.Combine(_torchDir, "Plugins");
|
var updatePath = Path.Combine(_torchDir, "Plugins");
|
||||||
await new WebClient().DownloadFileTaskAsync(new Uri(releaseInfo.Item2), updateName).ConfigureAwait(false);
|
await new WebClient().DownloadFileTaskAsync(new Uri(releaseInfo.Item2), updateName).ConfigureAwait(false);
|
||||||
UpdateFromZip(updateName, updatePath);
|
UpdateFromZip(updateName, updatePath);
|
||||||
File.Delete(updateName);
|
File.Delete(updateName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_log.Info($"{manifest.Repository} is up to date. ({currentVersion})");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_log.Info($"{manifest.Repository} is up to date. ({currentVersion})");
|
_log.Error($"An error occured downloading the plugin update for {manifest.Repository}.");
|
||||||
|
_log.Error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,18 +104,26 @@ namespace Torch.Managers
|
|||||||
if (!Torch.Config.GetTorchUpdates)
|
if (!Torch.Config.GetTorchUpdates)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var releaseInfo = await GetLatestRelease("TorchAPI", "Torch").ConfigureAwait(false);
|
try
|
||||||
if (releaseInfo.Item1 > Torch.TorchVersion)
|
|
||||||
{
|
{
|
||||||
_log.Warn($"Updating Torch from version {Torch.TorchVersion} to version {releaseInfo.Item1}");
|
var releaseInfo = await GetLatestRelease("TorchAPI", "Torch").ConfigureAwait(false);
|
||||||
var updateName = Path.Combine(_fsManager.TempDirectory, "torchupdate.zip");
|
if (releaseInfo.Item1 > Torch.TorchVersion)
|
||||||
new WebClient().DownloadFile(new Uri(releaseInfo.Item2), updateName);
|
{
|
||||||
UpdateFromZip(updateName, _torchDir);
|
_log.Warn($"Updating Torch from version {Torch.TorchVersion} to version {releaseInfo.Item1}");
|
||||||
File.Delete(updateName);
|
var updateName = Path.Combine(_fsManager.TempDirectory, "torchupdate.zip");
|
||||||
|
new WebClient().DownloadFile(new Uri(releaseInfo.Item2), updateName);
|
||||||
|
UpdateFromZip(updateName, _torchDir);
|
||||||
|
File.Delete(updateName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_log.Info("Torch is up to date.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_log.Info("Torch is up to date.");
|
_log.Error("An error occured downloading the Torch update.");
|
||||||
|
_log.Error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user