Dont crash if can't access ensl website. Http version not https anymore.

This commit is contained in:
Mael-fixe 2021-02-06 18:43:01 +01:00
parent ad787ef5dc
commit e5e366be27
5 changed files with 30 additions and 20 deletions

View file

@ -23,7 +23,7 @@
<value>http://ensl.gk-servers.de/ns</value>
</setting>
<setting name="GatherURL" serializeAs="String">
<value>https://www.ensl.org/gathers/latest/ns1</value>
<value>http://www.ensl.org/gathers/latest/ns1</value>
</setting>
<setting name="NsXpURL" serializeAs="String">
<value>http://ensl.gk-servers.de/ns_xp</value>

View file

@ -69,7 +69,10 @@
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<Reference Include="CrashReporter.NET, Version=1.5.5.0, Culture=neutral, PublicKeyToken=7828e0fd88cab698, processorArchitecture=MSIL">

View file

@ -12,7 +12,7 @@ namespace NaturalLauncher.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -73,7 +73,7 @@ namespace NaturalLauncher.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("https://www.ensl.org/gathers/latest/ns1")]
[global::System.Configuration.DefaultSettingValueAttribute("http://www.ensl.org/gathers/latest/ns1")]
public string GatherURL {
get {
return ((string)(this["GatherURL"]));

View file

@ -15,7 +15,7 @@
<Value Profile="(Default)">http://ensl.gk-servers.de/ns</Value>
</Setting>
<Setting Name="GatherURL" Type="System.String" Scope="User">
<Value Profile="(Default)">https://www.ensl.org/gathers/latest/ns1</Value>
<Value Profile="(Default)">http://www.ensl.org/gathers/latest/ns1</Value>
</Setting>
<Setting Name="NsXpURL" Type="System.String" Scope="User">
<Value Profile="(Default)">http://ensl.gk-servers.de/ns_xp</Value>

View file

@ -274,12 +274,15 @@ namespace NaturalLauncher
}
public static int ReadGathererCount()
{
int Count = 0;
try
{
var url = Properties.Settings.Default.GatherURL;
var web = new HtmlWeb();
var doc = web.Load(url);
string htmlstring = doc.Text;
int Count = 0;
// need to retrieve this : <ul id="gatherers">
var nodal = doc.DocumentNode.Descendants("ul");
@ -296,7 +299,11 @@ namespace NaturalLauncher
{
Count = 0;
}
}
}
catch
{
Count = 0;
}
return Count;