Fix internetconnection test, include NoAutoUpdate config

pull/32/head
Miepee 4 years ago
parent 416c17ecad
commit d2456a1f4e

@ -6,6 +6,12 @@
<ApplicationIcon>icon64.ico</ApplicationIcon> <ApplicationIcon>icon64.ico</ApplicationIcon>
<RollForward>LatestMajor</RollForward> <RollForward>LatestMajor</RollForward>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Configurations>Debug;Release;NoAutoUpdate</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'NoAutoUpdate' ">
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

@ -5,11 +5,17 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifiers>osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>osx-x64</RuntimeIdentifiers>
<RollForward>LatestMajor</RollForward> <RollForward>LatestMajor</RollForward>
<Configurations>Debug;Release;NoAutoUpdate</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'NoAutoUpdate' ">
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\AM2RLauncher\AM2RLauncher.csproj" /> <ProjectReference Include="..\AM2RLauncher\AM2RLauncher.csproj" />
</ItemGroup> </ItemGroup>

@ -18,6 +18,8 @@
<PackageLicenseExpression>GNU General Public License v3.0</PackageLicenseExpression> <PackageLicenseExpression>GNU General Public License v3.0</PackageLicenseExpression>
<Description>A Launcher for AM2R that with mod capabilities.</Description> <Description>A Launcher for AM2R that with mod capabilities.</Description>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Configurations>Debug;Release;NoAutoUpdate</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -28,6 +30,11 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'NoAutoUpdate' ">
<PlatformTarget>x86</PlatformTarget>
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\AM2RLauncher\AM2RLauncher.csproj" /> <ProjectReference Include="..\AM2RLauncher\AM2RLauncher.csproj" />

@ -17,28 +17,39 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
NoAutoUpdate|Any CPU = NoAutoUpdate|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9B67055C-5AEF-4F83-AFE0-38E600183C9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9B67055C-5AEF-4F83-AFE0-38E600183C9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B67055C-5AEF-4F83-AFE0-38E600183C9F}.Debug|Any CPU.Build.0 = Debug|Any CPU {9B67055C-5AEF-4F83-AFE0-38E600183C9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B67055C-5AEF-4F83-AFE0-38E600183C9F}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B67055C-5AEF-4F83-AFE0-38E600183C9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B67055C-5AEF-4F83-AFE0-38E600183C9F}.Release|Any CPU.Build.0 = Release|Any CPU {9B67055C-5AEF-4F83-AFE0-38E600183C9F}.Release|Any CPU.Build.0 = Release|Any CPU
{9B67055C-5AEF-4F83-AFE0-38E600183C9F}.NoAutoUpdate|Any CPU.ActiveCfg = NoAutoUpdate|Any CPU
{9B67055C-5AEF-4F83-AFE0-38E600183C9F}.NoAutoUpdate|Any CPU.Build.0 = NoAutoUpdate|Any CPU
{B3AAD6F3-41B9-4981-8CD4-FE683429AD95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B3AAD6F3-41B9-4981-8CD4-FE683429AD95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B3AAD6F3-41B9-4981-8CD4-FE683429AD95}.Debug|Any CPU.Build.0 = Debug|Any CPU {B3AAD6F3-41B9-4981-8CD4-FE683429AD95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3AAD6F3-41B9-4981-8CD4-FE683429AD95}.Release|Any CPU.ActiveCfg = Release|Any CPU {B3AAD6F3-41B9-4981-8CD4-FE683429AD95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3AAD6F3-41B9-4981-8CD4-FE683429AD95}.Release|Any CPU.Build.0 = Release|Any CPU {B3AAD6F3-41B9-4981-8CD4-FE683429AD95}.Release|Any CPU.Build.0 = Release|Any CPU
{B3AAD6F3-41B9-4981-8CD4-FE683429AD95}.NoAutoUpdate|Any CPU.ActiveCfg = NoAutoUpdate|Any CPU
{B3AAD6F3-41B9-4981-8CD4-FE683429AD95}.NoAutoUpdate|Any CPU.Build.0 = NoAutoUpdate|Any CPU
{0A619FA8-61B4-48C6-9461-21B3FE137D03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0A619FA8-61B4-48C6-9461-21B3FE137D03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A619FA8-61B4-48C6-9461-21B3FE137D03}.Debug|Any CPU.Build.0 = Debug|Any CPU {0A619FA8-61B4-48C6-9461-21B3FE137D03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A619FA8-61B4-48C6-9461-21B3FE137D03}.Release|Any CPU.ActiveCfg = Release|Any CPU {0A619FA8-61B4-48C6-9461-21B3FE137D03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A619FA8-61B4-48C6-9461-21B3FE137D03}.Release|Any CPU.Build.0 = Release|Any CPU {0A619FA8-61B4-48C6-9461-21B3FE137D03}.Release|Any CPU.Build.0 = Release|Any CPU
{0A619FA8-61B4-48C6-9461-21B3FE137D03}.NoAutoUpdate|Any CPU.ActiveCfg = NoAutoUpdate|Any CPU
{0A619FA8-61B4-48C6-9461-21B3FE137D03}.NoAutoUpdate|Any CPU.Build.0 = NoAutoUpdate|Any CPU
{8A162932-BAA3-429A-84C4-B93A1C85DDE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8A162932-BAA3-429A-84C4-B93A1C85DDE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A162932-BAA3-429A-84C4-B93A1C85DDE3}.Debug|Any CPU.Build.0 = Debug|Any CPU {8A162932-BAA3-429A-84C4-B93A1C85DDE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A162932-BAA3-429A-84C4-B93A1C85DDE3}.Release|Any CPU.ActiveCfg = Release|Any CPU {8A162932-BAA3-429A-84C4-B93A1C85DDE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A162932-BAA3-429A-84C4-B93A1C85DDE3}.Release|Any CPU.Build.0 = Release|Any CPU {8A162932-BAA3-429A-84C4-B93A1C85DDE3}.Release|Any CPU.Build.0 = Release|Any CPU
{8A162932-BAA3-429A-84C4-B93A1C85DDE3}.NoAutoUpdate|Any CPU.ActiveCfg = NoAutoUpdate|Any CPU
{8A162932-BAA3-429A-84C4-B93A1C85DDE3}.NoAutoUpdate|Any CPU.Build.0 = NoAutoUpdate|Any CPU
{6F240F19-144E-4704-A16A-8FDAC3867EC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6F240F19-144E-4704-A16A-8FDAC3867EC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F240F19-144E-4704-A16A-8FDAC3867EC9}.Debug|Any CPU.Build.0 = Debug|Any CPU {6F240F19-144E-4704-A16A-8FDAC3867EC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F240F19-144E-4704-A16A-8FDAC3867EC9}.Release|Any CPU.ActiveCfg = Release|Any CPU {6F240F19-144E-4704-A16A-8FDAC3867EC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F240F19-144E-4704-A16A-8FDAC3867EC9}.Release|Any CPU.Build.0 = Release|Any CPU {6F240F19-144E-4704-A16A-8FDAC3867EC9}.Release|Any CPU.Build.0 = Release|Any CPU
{6F240F19-144E-4704-A16A-8FDAC3867EC9}.NoAutoUpdate|Any CPU.ActiveCfg = NoAutoUpdate|Any CPU
{6F240F19-144E-4704-A16A-8FDAC3867EC9}.NoAutoUpdate|Any CPU.Build.0 = NoAutoUpdate|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

@ -8,6 +8,8 @@
<Company>AM2R-Community-Developers</Company> <Company>AM2R-Community-Developers</Company>
<Description>This is a Launcher for AM2R and its Community Updates.</Description> <Description>This is a Launcher for AM2R and its Community Updates.</Description>
<RepositoryUrl>https://github.com/AM2R-Community-Developers/AM2RLauncher/</RepositoryUrl> <RepositoryUrl>https://github.com/AM2R-Community-Developers/AM2RLauncher/</RepositoryUrl>
<Configurations>Debug;Release;NoAutoUpdate</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -22,6 +24,14 @@
<NoWarn>1701;1702;0090</NoWarn> <NoWarn>1701;1702;0090</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'NoAutoUpdate' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<NoWarn>1701;1702;0090</NoWarn>
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Content Include="Resources\LauncherIcon.ico" /> <Content Include="Resources\LauncherIcon.ico" />
</ItemGroup> </ItemGroup>

@ -51,6 +51,11 @@ public static class LauncherUpdater
/// </summary> /// </summary>
public static void Main() public static void Main()
{ {
#if NOAUTOUPDATE
log.Info("On \"No auto update\" configuration, skipping auto update.");
return;
#endif
log.Info("Running update check..."); log.Info("Running update check...");
// Update section // Update section

@ -504,7 +504,7 @@ public partial class MainForm : Form
Text = Text.AutoUpdateAM2R, Text = Text.AutoUpdateAM2R,
TextColor = colorGreen TextColor = colorGreen
}; };
// autoUpdateLauncher checkbox // autoUpdateLauncher checkbox
autoUpdateLauncherCheck = new CheckBox autoUpdateLauncherCheck = new CheckBox
{ {
@ -602,7 +602,28 @@ public partial class MainForm : Form
settingsLayout.BeginHorizontal(); settingsLayout.BeginHorizontal();
settingsLayout.AddSpace(); settingsLayout.AddSpace();
settingsLayout.AddColumn(null, languageLabel, languageDropDown, autoUpdateAM2RCheck, autoUpdateLauncherCheck, hqMusicPCCheck, hqMusicAndroidCheck, profileDebugLogCheck, customEnvVarLabel, (Control)customEnvVarTextBox ?? new Label(), mirrorLabel, mirrorDropDown, customMirrorCheck, customMirrorTextBox, null); List<Control> settingsElements = new List<Control>
{
null,
languageLabel,
languageDropDown,
autoUpdateAM2RCheck,
autoUpdateLauncherCheck,
hqMusicPCCheck,
hqMusicAndroidCheck,
profileDebugLogCheck,
customEnvVarLabel,
(Control)customEnvVarTextBox ?? new Label(),
mirrorLabel,
mirrorDropDown,
customMirrorCheck,
customMirrorTextBox,
null
};
#if NOAUTOUPDATE
settingsElements.Remove(autoUpdateLauncherCheck);
#endif
settingsLayout.AddColumn(settingsElements.ToArray());
settingsLayout.AddSpace(); settingsLayout.AddSpace();
TabPage settingsPage = new TabPage TabPage settingsPage = new TabPage

@ -3,6 +3,12 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>default</LangVersion> <LangVersion>default</LangVersion>
<Configurations>Debug;Release;NoAutoUpdate</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'NoAutoUpdate' ">
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

@ -1,7 +1,6 @@
using log4net; using log4net;
using System; using System;
using System.IO; using System.IO;
using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Security.Cryptography; using System.Security.Cryptography;
@ -148,7 +147,7 @@ public static class HelperMethods
public static bool IsConnectedToInternet() public static bool IsConnectedToInternet()
{ {
log.Info("Checking internet connection..."); log.Info("Checking internet connection...");
PingReply pingReply = new Ping().Send("https://github.com"); PingReply pingReply = new Ping().Send("github.com");
if (pingReply?.Status != IPStatus.Success) if (pingReply?.Status != IPStatus.Success)
{ {
log.Info("Internet connection failed."); log.Info("Internet connection failed.");

Loading…
Cancel
Save