mirror of
https://github.com/ENSL/NaturalLauncher.git
synced 2025-04-22 01:01:12 +00:00
Compare commits
No commits in common. "master" and "v1.0.1.5" have entirely different histories.
12 changed files with 126 additions and 253 deletions
|
@ -23,10 +23,10 @@
|
|||
<value>http://ensl.gk-servers.de/ns</value>
|
||||
</setting>
|
||||
<setting name="GatherURL" serializeAs="String">
|
||||
<value>http://www.ensl.org/gathers/latest/ns1</value>
|
||||
<value>https://www.ensl.org/gathers/latest/ns1</value>
|
||||
</setting>
|
||||
<setting name="NsXpURL" serializeAs="String">
|
||||
<value>http://ensl.gk-servers.de/ns_xp</value>
|
||||
<setting name="NineLegendUrl" serializeAs="String">
|
||||
<value>http://www.elseware-experience.com/vignauxmael/NaturalLauncher/NLPack</value>
|
||||
</setting>
|
||||
<setting name="LauncherUrl" serializeAs="String">
|
||||
<value>http://ensl.gk-servers.de/Launcher/</value>
|
||||
|
|
|
@ -40,16 +40,12 @@ namespace NaturalLauncher
|
|||
|
||||
public static string VersionFileName = "app.version";
|
||||
public static string ManifestName = "Manifest.txt";
|
||||
public static string XPManifestName = "XPManifest.txt";
|
||||
public static string NLManifestName = "NLManifest.txt";
|
||||
public static string configName = "Launcher.xml";
|
||||
|
||||
public static bool keepLauncherAlive = true;
|
||||
public static bool restartSteam = false; // used at the end of the verify process
|
||||
public static bool keepCustomFiles = false; // keep files customized by the player when existing (sound, sprites ...)
|
||||
|
||||
public static DateTime LAUNCHTIME = System.DateTime.UtcNow;
|
||||
public static string discordCustomStatus = "Currently In The Launcher";
|
||||
internal static bool isExperimental = false;
|
||||
|
||||
public static void PlayGame()
|
||||
{
|
||||
|
@ -134,17 +130,6 @@ namespace NaturalLauncher
|
|||
Process.Start(Url);
|
||||
}
|
||||
|
||||
public static void RestartSteam()
|
||||
{
|
||||
string strCmdText;
|
||||
strCmdText = "/c taskkill /f /IM \"steam.exe\" ";
|
||||
System.Diagnostics.Process.Start("CMD.exe", strCmdText); // kill steam
|
||||
System.Threading.Thread.Sleep(1000); // wait one sec
|
||||
strCmdText = "/c start steam:";
|
||||
System.Diagnostics.Process.Start("CMD.exe", strCmdText); // start steam
|
||||
|
||||
}
|
||||
|
||||
public static void RefreshInternetPageAsync(string whichPage)
|
||||
{
|
||||
using (var webClient = new WebClient())
|
||||
|
@ -170,16 +155,14 @@ namespace NaturalLauncher
|
|||
if (File.Exists(curDir + Path.DirectorySeparatorChar + configName))
|
||||
{
|
||||
string IndicatedFolder = "";
|
||||
bool isXP = false;
|
||||
XmlBuilder.ReadConfigXml(out IndicatedFolder, out isXP, out string discordStatus, out bool keepAlive, out bool keepcustoms);
|
||||
bool IsNLPack = false;
|
||||
XmlBuilder.ReadConfigXml(out IndicatedFolder, out IsNLPack, out string discordStatus, out bool keepAlive);
|
||||
|
||||
if (IndicatedFolder.Length >0)
|
||||
{
|
||||
HLFolder = IndicatedFolder;
|
||||
isExperimental = isXP;
|
||||
discordCustomStatus = discordStatus;
|
||||
keepLauncherAlive = keepAlive;
|
||||
keepCustomFiles = keepcustoms;
|
||||
}
|
||||
else
|
||||
NeedDirectory = true;
|
||||
|
@ -217,9 +200,6 @@ namespace NaturalLauncher
|
|||
{
|
||||
Environment.Exit(0); //stop the process
|
||||
}
|
||||
|
||||
// Because it's first launch, ask if we want to keep custom files
|
||||
Util.AskForCustomFiles();
|
||||
}
|
||||
|
||||
NSFolder = HLFolder + Path.DirectorySeparatorChar + "ns";
|
||||
|
@ -232,7 +212,7 @@ namespace NaturalLauncher
|
|||
if (File.Exists(curDir + Path.DirectorySeparatorChar + configName))
|
||||
{
|
||||
string IndicatedFolder = "";
|
||||
XmlBuilder.ReadConfigXml(out IndicatedFolder, out Result, out string plop, out bool noob,out bool lolilol);
|
||||
XmlBuilder.ReadConfigXml(out IndicatedFolder, out Result, out string plop, out bool noob);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -280,21 +260,16 @@ namespace NaturalLauncher
|
|||
|
||||
internal static void UpdatePubServ(out int publicPlayers, out int maxPlayers)
|
||||
{
|
||||
|
||||
// TO BE CONTINUED but so far we can retrieve pub serv info...
|
||||
/*
|
||||
string serverIP = "104.156.251.121"; //public us
|
||||
int port = 27015;
|
||||
IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(serverIP), port);
|
||||
string serverIP = "104.156.251.121"; //public us
|
||||
int port = 27015;
|
||||
IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(serverIP), port);
|
||||
|
||||
var ServInfo = new ServerChecker.A2S_INFO(remoteEP);
|
||||
var ServInfo = new ServerChecker.A2S_INFO(remoteEP);
|
||||
|
||||
publicPlayers = ServInfo.Players; //out
|
||||
maxPlayers = ServInfo.MaxPlayers; //out
|
||||
// Check for the launcher to self update
|
||||
*/ //shit get stuck at trying to connect with the ip.
|
||||
publicPlayers = 0;
|
||||
maxPlayers = 0;
|
||||
publicPlayers = ServInfo.Players; //out
|
||||
maxPlayers = ServInfo.MaxPlayers; //out
|
||||
// Check for the launcher to self update
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<ColumnDefinition Width="268*"/>
|
||||
<ColumnDefinition Width="47*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label x:Name="TitleLabel" Content="Natural Selection Launcher" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="24" FontFamily="Britannic Bold" FontWeight="Bold" Height="32" Width="328" Foreground="#FFEEC160" RenderTransformOrigin="0.5,0.5" Grid.Column="1">
|
||||
<Label x:Name="TitleLabel" Content="Natural Selection Launcher" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="24" FontFamily="Britannic Bold" FontWeight="Bold" Height="32" Width="336" Foreground="#FFEEC160" RenderTransformOrigin="0.5,0.5" Grid.Column="1">
|
||||
<Label.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform/>
|
||||
|
@ -47,7 +47,7 @@
|
|||
</Label.RenderTransform>
|
||||
</Label>
|
||||
<Rectangle Fill="#A50D0D0C" Margin="0,0,10,32" Stroke="Black" Grid.ColumnSpan="3" Height="46" VerticalAlignment="Bottom" Grid.Column="1"/>
|
||||
<Label x:Name="VersionLabel" Content="checking" Margin="329,9,0,0" VerticalAlignment="Top" FontStyle="Italic" Background="#00000000" Foreground="#FF5ACAFF" Height="38" Grid.Column="1" FontWeight="Bold" FontSize="14" HorizontalAlignment="Left" Width="74" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
<Label x:Name="VersionLabel" Content="checking" Margin="341,10,0,0" VerticalAlignment="Top" FontStyle="Italic" Background="#00000000" Foreground="#FF5ACAFF" Height="38" Grid.Column="1" FontWeight="Bold" FontSize="14" HorizontalAlignment="Left" Width="74" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
<WebBrowser x:Name="MainWebBrowser" Margin="0,47,10,83" UseLayoutRounding="False" RenderTransformOrigin="0.498,0.492" Grid.ColumnSpan="3" Grid.Column="1"/>
|
||||
<Button x:Name="StartButton" Content="Start" Margin="0,0,10,32" FontWeight="Bold" FontSize="24" Background="#A5151513" Padding="1,1,1,3" Height="46" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="296" Click="Start_Click" Grid.Column="2" BorderBrush="#FF5A71FF" Foreground="#FF2149D3" BorderThickness="2,1" Grid.ColumnSpan="2"/>
|
||||
<Button x:Name="WebsiteButton" Content="Join Gather" HorizontalAlignment="Left" Margin="0,0,0,32" Width="218" FontSize="18" Background="#A5151513" Padding="1,1,1,3" Height="46" VerticalAlignment="Bottom" Click="Website_Click" BorderBrush="#FFCD6E52" Grid.Column="1" Foreground="#FF2EB2F0" FontWeight="Bold"/>
|
||||
|
@ -64,14 +64,13 @@
|
|||
<ImageBrush ImageSource="Ressources/pauseimage.png" Stretch="Uniform"/>
|
||||
</Button.Background>
|
||||
</Button>
|
||||
<Image Grid.Column="2" Margin="9,20,0,0" Source="Ressources/steam_icon.png" Stretch="Fill" Height="22" VerticalAlignment="Top" HorizontalAlignment="Left" Width="31" Visibility="Hidden"/>
|
||||
<Label x:Name="ServInfoLabel" Content="Public Server :" Grid.Column="2" HorizontalAlignment="Left" Margin="44,18,0,0" VerticalAlignment="Top" Foreground="White" FontFamily="Segoe WP Black" Width="224" Visibility="Hidden">
|
||||
<Image Grid.Column="2" Margin="9,24,0,0" Source="Ressources/steam_icon.png" Stretch="Fill" Height="18" VerticalAlignment="Top" HorizontalAlignment="Left" Width="25"/>
|
||||
<Label x:Name="ServInfoLabel" Content="Public Server :" Grid.Column="2" HorizontalAlignment="Left" Margin="34,20,0,0" VerticalAlignment="Top" Foreground="White" FontFamily="Segoe WP Black" Width="224">
|
||||
<Label.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Join the server" Click="JoinPublicServer"/>
|
||||
</ContextMenu>
|
||||
</Label.ContextMenu>
|
||||
</Label>
|
||||
<Label x:Name="Experimental_label" Content="Experimental" Margin="403,9,0,0" VerticalAlignment="Top" FontStyle="Italic" Background="#00000000" Foreground="#FFFF5A5A" Height="38" Grid.Column="1" FontWeight="Bold" FontSize="14" HorizontalAlignment="Left" Width="104" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace NaturalLauncher
|
|||
|
||||
if (SelfUpdater.LaucherRemoteVNumber != SelfUpdater.LaucherLocalVNumber && SelfUpdater.isSelfUpdating)
|
||||
{
|
||||
Hide();
|
||||
this.Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -102,15 +102,7 @@ namespace NaturalLauncher
|
|||
// CHECK THE HL AND NS INSTALL DIR AND WRITE IT IN THE LAUNCHER XML
|
||||
Launcher.CheckInstallDirectory();
|
||||
|
||||
// set the experimental label
|
||||
if (Launcher.isExperimental)
|
||||
{
|
||||
Experimental_label.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
Experimental_label.Visibility = Visibility.Hidden;
|
||||
}
|
||||
//Util.ChangeAValueInCfg("net_graph", "2"); //this is not useful but might be someday, that's why I still let it live
|
||||
|
||||
// WE SET DISCORD PRESENCE
|
||||
string ApplicationID = "474144509048127503";
|
||||
|
@ -221,7 +213,6 @@ namespace NaturalLauncher
|
|||
MessageBoxResult AlertBox = System.Windows.MessageBox.Show("Please verify the installation" + Environment.NewLine
|
||||
+ "This message will show up if this is the first time you launch this software"
|
||||
, "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation); //not true anymore
|
||||
Launcher.restartSteam = true;
|
||||
SettingButton.IsEnabled = false;
|
||||
IsVerification = false;
|
||||
}
|
||||
|
@ -428,25 +419,12 @@ namespace NaturalLauncher
|
|||
else
|
||||
{
|
||||
ProgressLabel.Content = "Up to date !";
|
||||
if (Launcher.restartSteam)
|
||||
{
|
||||
Launcher.RestartSteam();
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + "Restarting Steam");
|
||||
}
|
||||
StartButton.Content = "Play";
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + "Completed the update or verify work");
|
||||
TaskbarItemInfo.ProgressValue = 0;
|
||||
TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Normal;
|
||||
Util.CreateLocalVersionFile(Launcher.curDir, Launcher.VersionFileName, remoteVersionNumber); //update the version with the new one
|
||||
|
||||
if(Launcher.isExperimental)
|
||||
{
|
||||
Experimental_label.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
Experimental_label.Visibility = Visibility.Hidden;
|
||||
}
|
||||
Check_Version(); // we should have a changed app.version file to check
|
||||
}
|
||||
|
||||
|
@ -480,34 +458,21 @@ namespace NaturalLauncher
|
|||
|
||||
string manifest = webClient.DownloadString(ManifestURL);
|
||||
LauncherManifest RemoteManifest = JsonConvert.DeserializeObject<LauncherManifest>(manifest);
|
||||
string UrlToDownloadGame = Properties.Settings.Default.GameUrl;
|
||||
|
||||
if (Launcher.isExperimental)
|
||||
if (Launcher.IsNLPack())
|
||||
{
|
||||
try
|
||||
{
|
||||
string XPManifestURL = Launcher.MainPageURL.AbsoluteUri + Launcher.XPManifestName;
|
||||
string XPmanifest = webClient.DownloadString(XPManifestURL);
|
||||
LauncherManifest XPManifest = JsonConvert.DeserializeObject<LauncherManifest>(XPmanifest);
|
||||
string NLManifestURL = Launcher.MainPageURL.AbsoluteUri + Launcher.NLManifestName;
|
||||
string NLmanifest = webClient.DownloadString(NLManifestURL);
|
||||
LauncherManifest NLManifest = JsonConvert.DeserializeObject<LauncherManifest>(NLmanifest);
|
||||
|
||||
//RemoteManifest = Util.CleanManifestWithOptions(RemoteManifest, XPManifest); //cleaning the manifest hash consequently
|
||||
RemoteManifest = XPManifest;
|
||||
UrlToDownloadGame = Properties.Settings.Default.NsXpURL;
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBoxResult AlertBox = System.Windows.MessageBox.Show("Couldn't find the experimental manifest online, downloading normal version instead"
|
||||
, "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation); //not true anymore
|
||||
RemoteManifest = JsonConvert.DeserializeObject<LauncherManifest>(manifest);
|
||||
UrlToDownloadGame = Properties.Settings.Default.GameUrl;
|
||||
}
|
||||
RemoteManifest = Util.CleanManifestWithOptions(RemoteManifest, NLManifest); //cleaning the manifest hash consequently
|
||||
}
|
||||
|
||||
LauncherManifest IgnoreManifest = Util.GetIgnoreManifest(IsVerification); //attention, might not exist, if so it has to be downloaded, if not let's use it !
|
||||
|
||||
string gameInstallDir = Launcher.NSFolder;
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + "Install Directory located in : " + gameInstallDir);
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + "Is Experimental : " + Launcher.isExperimental.ToString());
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + "NL Pack installed : " + Launcher.IsNLPack().ToString());
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + "Distant Manifest located at : " + ManifestURL);
|
||||
|
||||
var md5 = MD5.Create();
|
||||
|
@ -548,11 +513,6 @@ namespace NaturalLauncher
|
|||
UpdateLog.WriteLine(Util.GetShortTimeString() + gameFilePath + " not existing, needs downloading");
|
||||
ShouldDownload = true;
|
||||
}
|
||||
if (File.Exists(gameFilePath) && Launcher.keepCustomFiles && ( kv.Key.EndsWith(".wav") || kv.Key.EndsWith(".mp3") || kv.Key.EndsWith(".spr") || kv.Key.EndsWith(".tga") ) )
|
||||
{
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + gameFilePath + " Keeping custom files");
|
||||
ShouldDownload = false;
|
||||
}
|
||||
if (File.Exists(gameFilePath) && IgnoreManifest.Files.ContainsKey(kv.Key) && IgnoreValue == "1") // ignore everything
|
||||
{
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + gameFilePath + " Is Ignored for update, not checking");
|
||||
|
@ -567,7 +527,7 @@ namespace NaturalLauncher
|
|||
|
||||
if (ShouldDownload)
|
||||
{
|
||||
DownloadFile(curFile, totalFiles, kv, RemoteManifest, gameFilePath, UrlToDownloadGame, webClient);
|
||||
DownloadFile(curFile, totalFiles, kv, RemoteManifest, gameFilePath, Properties.Settings.Default.GameUrl, webClient);
|
||||
|
||||
var hash = Util.ComputeMD5(gameFilePath);
|
||||
|
||||
|
@ -575,7 +535,7 @@ namespace NaturalLauncher
|
|||
{
|
||||
//MessageBox.Show("Failed Validating " + kv.Key + " : Redownloading"); //problem with double validation, is it too soon in the chain of event ?
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + "failed to verify newly downloaded file, redownloading");
|
||||
DownloadFile(curFile, totalFiles, kv, RemoteManifest, gameFilePath, UrlToDownloadGame, webClient);
|
||||
DownloadFile(curFile, totalFiles, kv, RemoteManifest, gameFilePath, Properties.Settings.Default.GameUrl, webClient);
|
||||
}
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + "Download complete for file: " + kv.Key + " with new hash :" + hash + " for manifest hash : " + kv.Value);
|
||||
}
|
||||
|
@ -587,6 +547,64 @@ namespace NaturalLauncher
|
|||
|
||||
curFile++;
|
||||
}
|
||||
|
||||
// Update the NineLegend pack files if requiered
|
||||
/*if (Launcher.IsNLPack())
|
||||
{
|
||||
string NLManifestURL = Launcher.MainPageURL.AbsoluteUri + Launcher.NLManifestName;
|
||||
string NLmanifest = webClient.DownloadString(NLManifestURL);
|
||||
LauncherManifest NLManifest = JsonConvert.DeserializeObject<LauncherManifest>(NLmanifest);
|
||||
curFile = curFile - NLManifest.Files.Count;
|
||||
|
||||
foreach (KeyValuePair<string, string> kv in NLManifest.Files)
|
||||
{
|
||||
bool ShouldDownload = false;
|
||||
string gameFilePath = gameInstallDir + kv.Key.Replace("/", Path.DirectorySeparatorChar.ToString());
|
||||
if (File.Exists(gameFilePath))
|
||||
{
|
||||
int progress = (int)(((float)curFile / (float)totalFiles) * 100);
|
||||
backgroundWorker.ReportProgress(progress, "(" + (curFile) + " / " + totalFiles + ") Checking " + kv.Key);
|
||||
//Check its md5 hash
|
||||
using (var stream = File.OpenRead(gameFilePath))
|
||||
{
|
||||
var hash = Util.ComputeMD5(gameFilePath);
|
||||
|
||||
if (hash != kv.Value)
|
||||
{
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + gameFilePath + " needs to be updated");
|
||||
ShouldDownload = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + gameFilePath + " not existing, needs downloading");
|
||||
ShouldDownload = true;
|
||||
}
|
||||
|
||||
if (ShouldDownload)
|
||||
{
|
||||
DownloadFile(curFile, totalFiles, kv, NLManifest, gameFilePath, Properties.Settings.Default.NineLegendUrl, webClient);
|
||||
|
||||
var hash = Util.ComputeMD5(gameFilePath);
|
||||
|
||||
if (hash != kv.Value)
|
||||
{
|
||||
//MessageBox.Show("Failed Validating " + kv.Key + " : Redownloading"); //problem with double validation, is it too soon in the chain of event ?
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + "failed to verify newly downloaded file, redownloading");
|
||||
DownloadFile(curFile, totalFiles, kv, NLManifest, gameFilePath, Properties.Settings.Default.NineLegendUrl, webClient);
|
||||
}
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + "Download complete for NineLegend file: " + kv.Key + " with new hash :" + hash + " for manifest hash : " + kv.Value);
|
||||
}
|
||||
if (backgroundWorker.CancellationPending)
|
||||
{
|
||||
UpdateLog.WriteLine(Util.GetShortTimeString() + "Update cancelled");
|
||||
return;
|
||||
}
|
||||
|
||||
curFile++;
|
||||
}
|
||||
}*/
|
||||
|
||||
backgroundWorker.ReportProgress(100, "Writing Local Manifest");
|
||||
|
||||
|
|
|
@ -69,10 +69,7 @@
|
|||
<GenerateManifests>true</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
<SignManifests>true</SignManifests>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CrashReporter.NET, Version=1.5.5.0, Culture=neutral, PublicKeyToken=7828e0fd88cab698, processorArchitecture=MSIL">
|
||||
|
@ -114,7 +111,6 @@
|
|||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="ConsoleManager.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="LauncherManifest.cs" />
|
||||
<Compile Include="ManifestBuilder.cs" />
|
||||
<Compile Include="ProjectSettings.cs" />
|
||||
|
|
|
@ -49,5 +49,5 @@ using System.Windows;
|
|||
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
|
||||
// en utilisant '*', comme indiqué ci-dessous :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.2.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.2.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
12
NaturalLauncher/Properties/Settings.Designer.cs
generated
12
NaturalLauncher/Properties/Settings.Designer.cs
generated
|
@ -12,7 +12,7 @@ namespace NaturalLauncher.Properties {
|
|||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.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("http://www.ensl.org/gathers/latest/ns1")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://www.ensl.org/gathers/latest/ns1")]
|
||||
public string GatherURL {
|
||||
get {
|
||||
return ((string)(this["GatherURL"]));
|
||||
|
@ -85,13 +85,13 @@ namespace NaturalLauncher.Properties {
|
|||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("http://ensl.gk-servers.de/ns_xp")]
|
||||
public string NsXpURL {
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("http://www.elseware-experience.com/vignauxmael/NaturalLauncher/NLPack")]
|
||||
public string NineLegendUrl {
|
||||
get {
|
||||
return ((string)(this["NsXpURL"]));
|
||||
return ((string)(this["NineLegendUrl"]));
|
||||
}
|
||||
set {
|
||||
this["NsXpURL"] = value;
|
||||
this["NineLegendUrl"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
<Value Profile="(Default)">http://ensl.gk-servers.de/ns</Value>
|
||||
</Setting>
|
||||
<Setting Name="GatherURL" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">http://www.ensl.org/gathers/latest/ns1</Value>
|
||||
<Value Profile="(Default)">https://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>
|
||||
<Setting Name="NineLegendUrl" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">http://www.elseware-experience.com/vignauxmael/NaturalLauncher/NLPack</Value>
|
||||
</Setting>
|
||||
<Setting Name="LauncherUrl" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">http://ensl.gk-servers.de/Launcher/</Value>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:NaturalLauncher"
|
||||
mc:Ignorable="d"
|
||||
Title="Settings" Height="375.49" Width="587" Background="#FF0D0D0C" MinWidth="568" MinHeight="280" MaxWidth="587" MaxHeight="375">
|
||||
Title="Settings" Height="350" Width="587" Background="#FF0D0D0C" MinWidth="568" MinHeight="280" MaxWidth="587" MaxHeight="350">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="95*"/>
|
||||
|
@ -34,12 +34,10 @@
|
|||
<RadioButton x:Name="NLRadioButton" Content="Nine Legend" Canvas.Left="417" Canvas.Top="45" Foreground="#FFFFA55A" Checked="NLRadioButton_Checked"/>
|
||||
<Label Content="Add files to ignore list :" Canvas.Left="39" Canvas.Top="172" Height="27" Width="145" Foreground="#FF5ACAFF" FontWeight="Bold" HorizontalContentAlignment="Center"/>
|
||||
<Button x:Name="BrowseHLFolderButton_Copy" Content="Add file(s)" Canvas.Left="252" Canvas.Top="169" Width="221" Height="33" Click="AddToIgnoreButton_Click"/>
|
||||
<CheckBox x:Name="KeepAliveChecker" Content="Keep Launcher alive when playing (and discord status)" Canvas.Left="112" Canvas.Top="294" FontWeight="Bold" Foreground="#FF5ACAFF" Width="343" HorizontalContentAlignment="Center" Click="StopAfterLaunch_Click"/>
|
||||
<CheckBox x:Name="KeepAliveChecker" Content="Keep Launcher alive when playing (and discord status)" Canvas.Left="108" Canvas.Top="266" FontWeight="Bold" Foreground="#FF5ACAFF" Width="343" HorizontalContentAlignment="Center" Click="StopAfterLaunch_Click"/>
|
||||
<Label Content="Custom discord status :" Canvas.Left="38" Canvas.Top="128" Height="27" Width="145" Foreground="#FF5ACAFF" FontWeight="Bold" HorizontalContentAlignment="Center"/>
|
||||
<TextBox x:Name="DiscordTxtbox" Height="27" Canvas.Left="212" TextWrapping="Wrap" Text="status" Canvas.Top="127" Width="261" Foreground="#FF2B2F30" FontWeight="Bold" Background="#BFFFFFFF" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
<Button x:Name="ChangeDiscordButton" Content="Change" Canvas.Left="479" Canvas.Top="127" Width="49" Height="27" Background="#19000000" BorderBrush="#FF5ACAFF" Foreground="#FF5ACAFF" Click="ChangeDiscord_Click"/>
|
||||
<CheckBox x:Name="isExperimental" Content="Use Experimental Build" Canvas.Left="306" Canvas.Top="265" FontWeight="Bold" Foreground="#FFFF685A" Width="175" HorizontalContentAlignment="Center" Click="isExperimental_Click"/>
|
||||
<CheckBox x:Name="isKeepingCustoms" Content="Keep Custom Files" Canvas.Left="102" Canvas.Top="265" FontWeight="Bold" Foreground="#FFFF965A" Width="175" HorizontalContentAlignment="Center" Click="KeepCustom_Click"/>
|
||||
</Canvas>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
@ -44,21 +44,8 @@ namespace NaturalLauncher
|
|||
ParamNameTxtbox.SpellCheck.CustomDictionaries.Add(new Uri("pack://application:,,,/Ressources/Commande.lex")); //add the command custom dictonary
|
||||
|
||||
//RefreshNLInstallButtonState(); //nl pack based
|
||||
string HUDStyleparam = "0";
|
||||
|
||||
try
|
||||
{
|
||||
Util.GetAValueInCfg("hud_style", out HUDStyleparam);
|
||||
}
|
||||
catch
|
||||
{
|
||||
System.Windows.MessageBox.Show("Could not read config.cfg, please verify the file exists (and ns is installed) !" + Environment.NewLine +
|
||||
"The launcher will continue running but settings are not usable !", "Couldnt read", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MainWindow.sw = null;
|
||||
MainWindowReference.SettingButton.IsEnabled = false;
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
Util.GetAValueInCfg("hud_style",out string HUDStyleparam);
|
||||
switch(HUDStyleparam)
|
||||
{
|
||||
case "0":
|
||||
|
@ -74,12 +61,10 @@ namespace NaturalLauncher
|
|||
|
||||
try
|
||||
{
|
||||
XmlBuilder.ReadConfigXml(out string uno, out bool isXP, out string discordStatus, out bool keepAlive, out bool keepCustoms);
|
||||
XmlBuilder.ReadConfigXml(out string uno, out bool dos, out string discordStatus, out bool keepAlive);
|
||||
Launcher.keepLauncherAlive = keepAlive;
|
||||
DiscordTxtbox.Text = discordStatus;
|
||||
KeepAliveChecker.IsChecked = keepAlive;
|
||||
isExperimental.IsChecked = isXP;
|
||||
isKeepingCustoms.IsChecked = keepCustoms;
|
||||
windowfullyopen = true;
|
||||
}
|
||||
catch(Exception exception)
|
||||
|
@ -274,30 +259,11 @@ namespace NaturalLauncher
|
|||
XmlBuilder.CreateConfigXml();
|
||||
}
|
||||
|
||||
private void isExperimental_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Launcher.isExperimental = isExperimental.IsChecked.Value;
|
||||
|
||||
XmlBuilder.CreateConfigXml();
|
||||
|
||||
MainWindowReference.CallUpdateGame();
|
||||
MainWindowReference.SettingButton.IsEnabled = false;
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
|
||||
private void ChangeDiscord_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Launcher.discordCustomStatus = DiscordTxtbox.Text;
|
||||
Launcher.UpdateDiscord(false);
|
||||
XmlBuilder.CreateConfigXml();
|
||||
}
|
||||
|
||||
private void KeepCustom_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Launcher.keepCustomFiles = isKeepingCustoms.IsChecked.Value;
|
||||
|
||||
XmlBuilder.CreateConfigXml();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,35 +275,28 @@ namespace NaturalLauncher
|
|||
|
||||
public static int ReadGathererCount()
|
||||
{
|
||||
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");
|
||||
|
||||
try
|
||||
for(int i = 0; i < nodal.Count(); i++)
|
||||
{
|
||||
var url = Properties.Settings.Default.GatherURL;
|
||||
var web = new HtmlWeb();
|
||||
var doc = web.Load(url);
|
||||
string htmlstring = doc.Text;
|
||||
// need to retrieve this : <ul id="gatherers">
|
||||
var nodal = doc.DocumentNode.Descendants("ul");
|
||||
|
||||
for (int i = 0; i < nodal.Count(); i++)
|
||||
try
|
||||
{
|
||||
try
|
||||
if (nodal.ElementAt(i).Id == "gatherers")
|
||||
{
|
||||
if (nodal.ElementAt(i).Id == "gatherers")
|
||||
{
|
||||
Count = nodal.ElementAt(i).SelectNodes("li").Count(); //and count the <li> inside
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Count = 0;
|
||||
Count = nodal.ElementAt(i).SelectNodes("li").Count(); //and count the <li> inside
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Count = 0;
|
||||
catch
|
||||
{
|
||||
Count = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Count;
|
||||
|
@ -672,44 +665,5 @@ namespace NaturalLauncher
|
|||
|
||||
|
||||
}
|
||||
|
||||
public static void AskForCustomFiles()
|
||||
{
|
||||
string sMessageBoxText = "Do you want to preserve your custom files?" + Environment.NewLine + "(can be changed in the settings)";
|
||||
string sCaption = "Keep Custom Files";
|
||||
|
||||
MessageBoxButton btnMessageBox = MessageBoxButton.YesNo;
|
||||
MessageBoxImage icnMessageBox = MessageBoxImage.Warning;
|
||||
|
||||
MessageBoxResult rsltMessageBox = System.Windows.MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);
|
||||
|
||||
switch (rsltMessageBox)
|
||||
{
|
||||
case MessageBoxResult.Yes:
|
||||
Launcher.keepCustomFiles = true;
|
||||
break;
|
||||
|
||||
case MessageBoxResult.No:
|
||||
Launcher.keepCustomFiles = false;
|
||||
break;
|
||||
}
|
||||
|
||||
XmlBuilder.CreateConfigXml();
|
||||
|
||||
// if we keept the custom files, it's better to use them (thus the hud_style 0)
|
||||
if (Launcher.keepCustomFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
Util.ChangeAValueInCfg("hud_style ", "0"); // change
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBoxResult AlertBox = System.Windows.MessageBox.Show("Could not write config file to change hud_style 0" + Environment.NewLine +
|
||||
"please note that you might need to change it manually to use your custom files");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,60 +81,28 @@ namespace NaturalLauncher
|
|||
return xmlInfo;
|
||||
}
|
||||
|
||||
public static bool ReadConfigXml(out string HLFolder, out bool isXP, out string customDiscordStatus, out bool keepLauncherAlive, out bool keepCustomFiles)
|
||||
public static bool ReadConfigXml(out string HLFolder, out bool IsNlPack, out string customDiscordStatus, out bool keepLauncherAlive)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
try
|
||||
{
|
||||
doc.Load(Launcher.curDir + Path.DirectorySeparatorChar + Launcher.configName);
|
||||
XmlNodeList nodelist = doc.SelectNodes("/LauncherConfiguration");
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new FileNotFoundException("Could not read xml config file, please check read only status");
|
||||
}
|
||||
try
|
||||
{
|
||||
HLFolder = doc.SelectSingleNode("//HLFolder").InnerText;
|
||||
IsNlPack = doc.SelectSingleNode("//NLPack").InnerText == "True";
|
||||
customDiscordStatus = doc.SelectSingleNode("//DiscordStatus").InnerText;
|
||||
keepLauncherAlive = doc.SelectSingleNode("//keeplauncherAlive").InnerText == "True";
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
HLFolder = "";
|
||||
}
|
||||
try
|
||||
{
|
||||
isXP = doc.SelectSingleNode("//isXP").InnerText == "True";
|
||||
}
|
||||
catch
|
||||
{
|
||||
isXP = false;
|
||||
}
|
||||
try
|
||||
{
|
||||
customDiscordStatus = doc.SelectSingleNode("//DiscordStatus").InnerText;
|
||||
}
|
||||
catch
|
||||
{
|
||||
IsNlPack = false;
|
||||
customDiscordStatus = "Gather forming";
|
||||
}
|
||||
try
|
||||
{
|
||||
keepLauncherAlive = doc.SelectSingleNode("//keeplauncherAlive").InnerText == "True";
|
||||
}
|
||||
catch
|
||||
{
|
||||
keepLauncherAlive = true;
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
keepCustomFiles = doc.SelectSingleNode("//keepCustomFiles").InnerText == "True";
|
||||
}
|
||||
catch
|
||||
{
|
||||
keepCustomFiles = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
@ -142,10 +110,9 @@ namespace NaturalLauncher
|
|||
{
|
||||
var xmlInfo = new XElement("LauncherConfiguration");
|
||||
xmlInfo.Add(new XElement("HLFolder", Launcher.HLFolder));
|
||||
xmlInfo.Add(new XElement("isXP", Launcher.isExperimental.ToString()));
|
||||
xmlInfo.Add(new XElement("NLPack", "False"/*Launcher.IsNLPack().ToString()*/)); //doesnt matter anymore, also, can't use this function cause it asks for the config file...
|
||||
xmlInfo.Add(new XElement("DiscordStatus", Launcher.discordCustomStatus));
|
||||
xmlInfo.Add(new XElement("keeplauncherAlive", Launcher.keepLauncherAlive.ToString()));
|
||||
xmlInfo.Add(new XElement("keepCustomFiles", Launcher.keepCustomFiles.ToString()));
|
||||
|
||||
var doc = new XDocument(new XDeclaration("1.0", "UTF-8", "yes"), xmlInfo);
|
||||
|
||||
|
|
Loading…
Reference in a new issue