Fixed a bug when starting the server manager and it tries to download steamcmd, but fails as steamcmd is unavailable for download.

This commit is contained in:
Brett Hewitson 2021-12-15 14:55:32 +10:00
parent 8ed965307a
commit dbeaa7699d
11 changed files with 94 additions and 27 deletions

View file

@ -127,6 +127,7 @@
<sys:String x:Key="AutoUpdater_Status_DownloadNewServerComplete">Server download complete</sys:String>
<sys:String x:Key="AutoUpdater_Status_Complete">Complete</sys:String>
<sys:String x:Key="AutoUpdater_Status_Cancelled">Cancelled</sys:String>
<sys:String x:Key="AutoUpdater_Status_Failed">Failed</sys:String>
<sys:String x:Key="AutoUpdater_CancelButtonLabel">Cancel</sys:String>
<!--#endregion-->

View file

@ -9,8 +9,8 @@
<entry>
<id>urn:uuid:18276A38-2C71-4BB8-9A83-96D5EBFE9C87</id>
<title>1.1.412 (1.1.412.3)</title>
<summary>1.1.412.3</summary>
<title>1.1.412 (1.1.412.4)</title>
<summary>1.1.412.4</summary>
<link href="" />
<updated>2021-12-15T00:00:00Z</updated>
<content type="xhtml">
@ -22,6 +22,7 @@
<li>Fixed a bug with the Server Shutdown when the CheckForOnlinePlayers option not selected.</li>
<li>Fixed a bug when the backup path was a root directory that caused a 'Invalid URI: A Dos path must be rooted' crash.</li>
<li>Added additional validation when setting directories in the global setting, to ensure they are rooted correctly.</li>
<li>Fixed a bug when starting the server manager and it tries to download steamcmd, but fails as steamcmd is unavailable for download.</li>
</ul>
<u style="font-size: .9em;">CHANGE</u>
<br/>

View file

@ -7,6 +7,29 @@
<link href="http://arkservermanager.freeforums.net/" />
<updated>2021-12-15T00:00:00Z</updated>
<entry>
<id>urn:uuid:202642C9-3B71-4B90-8A43-EFA1C5272C81</id>
<title>1.1.412 (1.1.412.4)</title>
<summary>1.1.412.4</summary>
<link href="" />
<updated>2021-12-15T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>Fixed a bug when starting the server manager and it tries to download steamcmd, but fails as steamcmd is unavailable for download.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:B7DE873D-4FC3-4A7B-A531-3146B4D8639A</id>
<title>1.1.412 (1.1.412.3)</title>

View file

@ -17,6 +17,7 @@
<ProgressBar x:Name="CompletionProgress" Height="10"/>
<Label x:Name="StatusLabel" Content="{DynamicResource AutoUpdater_Status}" HorizontalContentAlignment="Center"/>
<Button Content="{DynamicResource AutoUpdater_CancelButtonLabel}" Width="75" HorizontalAlignment="Center" IsCancel="True" Click="Button_Click"/>
<TextBlock x:Name="ErrorLabel" Text="Error Text" Margin="0,2,0,0" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
</StackPanel>
</Grid>
</Window>

View file

@ -2,6 +2,7 @@
using ServerManagerTool.Common.Utils;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using WPFSharp.Globalizer;
@ -12,15 +13,16 @@ namespace ServerManagerTool
/// </summary>
public partial class AutoUpdateWindow : Window
{
private GlobalizedApplication _globalizer = GlobalizedApplication.Instance;
private SteamCmdUpdater updater = new SteamCmdUpdater();
private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance;
private readonly SteamCmdUpdater updater = new SteamCmdUpdater();
private CancellationTokenSource cancelSource;
public AutoUpdateWindow()
{
InitializeComponent();
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
this.ErrorLabel.Visibility = Visibility.Collapsed;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
@ -32,10 +34,13 @@ namespace ServerManagerTool
this.StatusLabel.Content = message;
this.CompletionProgress.Value = u.CompletionPercent;
if(u.FailureText != null)
if (u.FailureText != null)
{
// TODO: Report error through UI
throw new Exception(u.FailureText);
this.ErrorLabel.Text = u.FailureText;
this.ErrorLabel.Visibility = Visibility.Visible;
await Task.Delay(10000);
Environment.Exit(1);
}
if (u.CompletionPercent >= 100 || u.Cancelled)

View file

@ -120,6 +120,7 @@
<sys:String x:Key="AutoUpdater_Status_DownloadNewServerComplete">Server download complete</sys:String>
<sys:String x:Key="AutoUpdater_Status_Complete">Complete</sys:String>
<sys:String x:Key="AutoUpdater_Status_Cancelled">Cancelled</sys:String>
<sys:String x:Key="AutoUpdater_Status_Failed">Failed</sys:String>
<sys:String x:Key="AutoUpdater_CancelButtonLabel">Cancel</sys:String>
<!--#endregion-->

View file

@ -9,8 +9,8 @@
<entry>
<id>urn:uuid:6383E79A-C31F-462B-9730-B26B28DC5EFF</id>
<title>1.1.57 (1.1.57.2)</title>
<summary>1.1.57.2</summary>
<title>1.1.57 (1.1.57.3)</title>
<summary>1.1.57.3</summary>
<link href="" />
<updated>2021-12-15T00:00:00Z</updated>
<content type="xhtml">
@ -22,6 +22,7 @@
<li>Fixed a bug with the Server Shutdown when the CheckForOnlinePlayers option not selected.</li>
<li>Fixed a bug when the backup path was a root directory that caused a 'Invalid URI: A Dos path must be rooted' crash.</li>
<li>Added additional validation when setting directories in the global setting, to ensure they are rooted correctly.</li>
<li>Fixed a bug when starting the server manager and it tries to download steamcmd, but fails as steamcmd is unavailable for download.</li>
</ul>
</p>
</div>

View file

@ -7,6 +7,29 @@
<link href="http://servermanagers.freeforums.net/" />
<updated>2021-12-15T00:00:00Z</updated>
<entry>
<id>urn:uuid:28487F4A-4D0F-4344-A19E-EBD71D230180</id>
<title>1.1.57 (1.1.57.3)</title>
<summary>1.1.57.3</summary>
<link href="" />
<updated>2021-12-15T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>Fixed a bug when starting the server manager and it tries to download steamcmd, but fails as steamcmd is unavailable for download.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:6383E79A-C31F-462B-9730-B26B28DC5EFF</id>
<title>1.1.57 (1.1.57.2)</title>

View file

@ -18,6 +18,7 @@
<ProgressBar x:Name="CompletionProgress" Height="10"/>
<Label x:Name="StatusLabel" Content="{DynamicResource AutoUpdater_Status}" HorizontalContentAlignment="Center"/>
<Button Content="{DynamicResource AutoUpdater_CancelButtonLabel}" Width="75" HorizontalAlignment="Center" IsCancel="True" Click="Button_Click"/>
<TextBlock x:Name="ErrorLabel" Text="Error Text" Margin="0,2,0,0" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
</StackPanel>
</Grid>
</Window>

View file

@ -2,6 +2,7 @@
using ServerManagerTool.Common.Utils;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using WPFSharp.Globalizer;
@ -12,15 +13,16 @@ namespace ServerManagerTool
/// </summary>
public partial class AutoUpdateWindow : Window
{
private GlobalizedApplication _globalizer = GlobalizedApplication.Instance;
private SteamCmdUpdater updater = new SteamCmdUpdater();
private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance;
private readonly SteamCmdUpdater updater = new SteamCmdUpdater();
private CancellationTokenSource cancelSource;
public AutoUpdateWindow()
{
InitializeComponent();
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
this.ErrorLabel.Visibility = Visibility.Collapsed;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
@ -32,10 +34,13 @@ namespace ServerManagerTool
this.StatusLabel.Content = message;
this.CompletionProgress.Value = u.CompletionPercent;
if(u.FailureText != null)
if (u.FailureText != null)
{
// TODO: Report error through UI
throw new Exception(u.FailureText);
this.ErrorLabel.Text = u.FailureText;
this.ErrorLabel.Visibility = Visibility.Visible;
await Task.Delay(10000);
Environment.Exit(1);
}
if (u.CompletionPercent >= 100 || u.Cancelled)

View file

@ -23,15 +23,10 @@ namespace ServerManagerTool.Common.Lib
this.StatusKey = statusKey;
this.CompletionPercent = completionPercent;
this.Cancelled = false;
this.Failure = null;
this.FailureText = null;
}
public Update SetFailed(string failureText)
{
this.FailureText = failureText;
return this;
}
public static Update AsCompleted(string statusKey)
{
return new Update { StatusKey = statusKey, CompletionPercent = 100, Cancelled = false };
@ -42,9 +37,17 @@ namespace ServerManagerTool.Common.Lib
return new Update { StatusKey = statusKey, CompletionPercent = 100, Cancelled = true };
}
public Update SetFailed(Exception ex)
{
this.Failure = ex;
this.FailureText = ex.Message;
return this;
}
public string StatusKey;
public float CompletionPercent;
public bool Cancelled;
public Exception Failure;
public string FailureText;
}
@ -56,10 +59,11 @@ namespace ServerManagerTool.Common.Lib
RunningSteamCmd,
InstallSteamCmdComplete,
Complete,
Cancelled
Cancelled,
Failed,
}
Dictionary<Status, Update> statuses = new Dictionary<Status, Update>()
readonly Dictionary<Status, Update> statuses = new Dictionary<Status, Update>()
{
{ Status.CleaningSteamCmd, new Update("AutoUpdater_Status_CleaningSteamCmd", 0) },
{ Status.DownloadingSteamCmd, new Update("AutoUpdater_Status_DownloadingSteamCmd", 10) },
@ -67,7 +71,8 @@ namespace ServerManagerTool.Common.Lib
{ Status.RunningSteamCmd, new Update("AutoUpdater_Status_RunningSteamCmd", 50) },
{ Status.InstallSteamCmdComplete, new Update("AutoUpdater_Status_InstallSteamCmdComplete", 80) },
{ Status.Complete, Update.AsCompleted("AutoUpdater_Status_Complete") },
{ Status.Cancelled, Update.AsCancelled("AutoUpdater_Status_Cancelled") }
{ Status.Cancelled, Update.AsCancelled("AutoUpdater_Status_Cancelled") },
{ Status.Failed, Update.AsCancelled("AutoUpdater_Status_Failed") },
};
public static string GetSteamCmdFile(string dataPath) => IOUtils.NormalizePath(Path.Combine(dataPath, CommonConfig.Default.SteamCmdRelativePath, CommonConfig.Default.SteamCmdExeFile));
@ -99,7 +104,7 @@ namespace ServerManagerTool.Common.Lib
}
catch (Exception ex)
{
reporter?.Report(statuses[Status.Complete].SetFailed(ex.ToString()));
reporter?.Report(statuses[Status.Failed].SetFailed(ex));
}
}
@ -189,7 +194,7 @@ namespace ServerManagerTool.Common.Lib
}
catch(Exception ex)
{
reporter?.Report(statuses[Status.Complete].SetFailed(ex.ToString()));
reporter?.Report(statuses[Status.Failed].SetFailed(ex));
}
}
}