Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d5b43b85b4 | |||
|
|
636ad3d6ae |
33
Form1.Designer.cs
generated
33
Form1.Designer.cs
generated
@@ -46,6 +46,8 @@
|
|||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.comboBox2Play = new System.Windows.Forms.ComboBox();
|
this.comboBox2Play = new System.Windows.Forms.ComboBox();
|
||||||
this.btnUninstallVersion = new System.Windows.Forms.Button();
|
this.btnUninstallVersion = new System.Windows.Forms.Button();
|
||||||
|
this.btnLauncherUpdate = new System.Windows.Forms.Button();
|
||||||
|
this.labelLauncherVersion = new System.Windows.Forms.Label();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// textBoxUsername
|
// textBoxUsername
|
||||||
@@ -118,9 +120,9 @@
|
|||||||
//
|
//
|
||||||
// btnPlay
|
// btnPlay
|
||||||
//
|
//
|
||||||
this.btnPlay.Location = new System.Drawing.Point(550, 26);
|
this.btnPlay.Location = new System.Drawing.Point(550, 150);
|
||||||
this.btnPlay.Name = "btnPlay";
|
this.btnPlay.Name = "btnPlay";
|
||||||
this.btnPlay.Size = new System.Drawing.Size(104, 104);
|
this.btnPlay.Size = new System.Drawing.Size(104, 50);
|
||||||
this.btnPlay.TabIndex = 9;
|
this.btnPlay.TabIndex = 9;
|
||||||
this.btnPlay.Text = "Play!";
|
this.btnPlay.Text = "Play!";
|
||||||
this.btnPlay.UseVisualStyleBackColor = true;
|
this.btnPlay.UseVisualStyleBackColor = true;
|
||||||
@@ -199,11 +201,33 @@
|
|||||||
this.btnUninstallVersion.UseVisualStyleBackColor = true;
|
this.btnUninstallVersion.UseVisualStyleBackColor = true;
|
||||||
this.btnUninstallVersion.Click += new System.EventHandler(this.btnUninstallVersion_Click);
|
this.btnUninstallVersion.Click += new System.EventHandler(this.btnUninstallVersion_Click);
|
||||||
//
|
//
|
||||||
|
// btnLauncherUpdate
|
||||||
|
//
|
||||||
|
this.btnLauncherUpdate.Location = new System.Drawing.Point(550, 26);
|
||||||
|
this.btnLauncherUpdate.Name = "btnLauncherUpdate";
|
||||||
|
this.btnLauncherUpdate.Size = new System.Drawing.Size(104, 104);
|
||||||
|
this.btnLauncherUpdate.TabIndex = 18;
|
||||||
|
this.btnLauncherUpdate.Text = "LAUNCHER UPDATE AVAILIBLE";
|
||||||
|
this.btnLauncherUpdate.UseVisualStyleBackColor = true;
|
||||||
|
this.btnLauncherUpdate.Click += new System.EventHandler(this.btnLauncherUpdate_Click);
|
||||||
|
//
|
||||||
|
// labelLauncherVersion
|
||||||
|
//
|
||||||
|
this.labelLauncherVersion.AutoSize = true;
|
||||||
|
this.labelLauncherVersion.Location = new System.Drawing.Point(9, 189);
|
||||||
|
this.labelLauncherVersion.Name = "labelLauncherVersion";
|
||||||
|
this.labelLauncherVersion.Size = new System.Drawing.Size(94, 13);
|
||||||
|
this.labelLauncherVersion.TabIndex = 19;
|
||||||
|
this.labelLauncherVersion.Text = "Unknown Version.";
|
||||||
|
this.labelLauncherVersion.Click += new System.EventHandler(this.labelLauncherVersion_Click);
|
||||||
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(684, 161);
|
this.ClientSize = new System.Drawing.Size(684, 211);
|
||||||
|
this.Controls.Add(this.labelLauncherVersion);
|
||||||
|
this.Controls.Add(this.btnLauncherUpdate);
|
||||||
this.Controls.Add(this.btnUninstallVersion);
|
this.Controls.Add(this.btnUninstallVersion);
|
||||||
this.Controls.Add(this.label2);
|
this.Controls.Add(this.label2);
|
||||||
this.Controls.Add(this.comboBox2Play);
|
this.Controls.Add(this.comboBox2Play);
|
||||||
@@ -224,6 +248,7 @@
|
|||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.Name = "Form1";
|
this.Name = "Form1";
|
||||||
this.Text = "IveBeenAlone\'s Hytale Launcher";
|
this.Text = "IveBeenAlone\'s Hytale Launcher";
|
||||||
|
this.Load += new System.EventHandler(this.Form1_Load);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@@ -246,6 +271,8 @@
|
|||||||
private System.Windows.Forms.Label label2;
|
private System.Windows.Forms.Label label2;
|
||||||
private System.Windows.Forms.ComboBox comboBox2Play;
|
private System.Windows.Forms.ComboBox comboBox2Play;
|
||||||
private System.Windows.Forms.Button btnUninstallVersion;
|
private System.Windows.Forms.Button btnUninstallVersion;
|
||||||
|
private System.Windows.Forms.Button btnLauncherUpdate;
|
||||||
|
private System.Windows.Forms.Label labelLauncherVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
131
Form1.cs
131
Form1.cs
@@ -22,9 +22,13 @@ namespace HelloWorld
|
|||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class Form1 : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private const string UpdateURL = "https://ibatv.xyz/data/lnch/hy.txt";
|
||||||
|
|
||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
btnLauncherUpdate.Visible = false;
|
||||||
LoadComboBoxItems();
|
LoadComboBoxItems();
|
||||||
LoadDownloadedFiles();
|
LoadDownloadedFiles();
|
||||||
|
|
||||||
@@ -32,8 +36,19 @@ namespace HelloWorld
|
|||||||
string path = ".ibalaunch";
|
string path = ".ibalaunch";
|
||||||
string uuidsave = ".ibalaunch\\uuid";
|
string uuidsave = ".ibalaunch\\uuid";
|
||||||
string usersave = ".ibalaunch\\username";
|
string usersave = ".ibalaunch\\username";
|
||||||
|
string verssave = ".ibalaunch\\lastplayedversion";
|
||||||
string HytaleUserData = "UserData";
|
string HytaleUserData = "UserData";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Version localVersion = GetLocalVersion();
|
||||||
|
|
||||||
|
|
||||||
|
string localversionstring = localVersion.ToString();
|
||||||
|
//Console.WriteLine("Version" + localversionstring);
|
||||||
|
labelLauncherVersion.Text = localversionstring;
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DirectoryInfo di = Directory.CreateDirectory(path);
|
DirectoryInfo di = Directory.CreateDirectory(path);
|
||||||
@@ -94,7 +109,61 @@ namespace HelloWorld
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UUID File Checking
|
||||||
|
if (File.Exists(verssave))
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new FileInfo(verssave);
|
||||||
|
if (fileInfo.Length == 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Last Played file is empty. Not setting anything.");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Last Played file is not empty. Size: " + fileInfo.Length + " bytes.");
|
||||||
|
|
||||||
|
comboBox2Play.Text = File.ReadAllText(verssave);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task CheckForUpdateAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Version localVersion = GetLocalVersion();
|
||||||
|
Version onlineVersion = await GetOnlineVersionAsync();
|
||||||
|
|
||||||
|
if (onlineVersion > localVersion)
|
||||||
|
{
|
||||||
|
btnLauncherUpdate.Visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Optional: log or ignore
|
||||||
|
Debug.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Version GetLocalVersion()
|
||||||
|
{
|
||||||
|
return Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<Version> GetOnlineVersionAsync()
|
||||||
|
{
|
||||||
|
using (HttpClient client = new HttpClient())
|
||||||
|
{
|
||||||
|
string versionText = await client.GetStringAsync(UpdateURL);
|
||||||
|
return new Version(versionText.Trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void button1_Click(object sender, EventArgs e){}
|
private void button1_Click(object sender, EventArgs e){}
|
||||||
private void lblHelloWorld_Click(object sender, EventArgs e){}
|
private void lblHelloWorld_Click(object sender, EventArgs e){}
|
||||||
@@ -455,5 +524,67 @@ namespace HelloWorld
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void btnLauncherUpdate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string tempExe = Path.Combine(Path.GetTempPath(), "latest.exe");
|
||||||
|
|
||||||
|
await DownloadUpdateAsync(tempExe);
|
||||||
|
|
||||||
|
StartUpdaterAndExit(tempExe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private async Task DownloadUpdateAsync(string destinationPath)
|
||||||
|
{
|
||||||
|
using (HttpClient client = new HttpClient())
|
||||||
|
using (var response = await client.GetAsync("https://ibatv.xyz/data/lnch/hy/latest.exe", HttpCompletionOption.ResponseHeadersRead))
|
||||||
|
{
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
|
using (var fs = new FileStream(
|
||||||
|
destinationPath,
|
||||||
|
FileMode.Create,
|
||||||
|
FileAccess.Write,
|
||||||
|
FileShare.None))
|
||||||
|
{
|
||||||
|
await response.Content.CopyToAsync(fs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void StartUpdaterAndExit(string newExePath)
|
||||||
|
{
|
||||||
|
string currentExe = Application.ExecutablePath;
|
||||||
|
|
||||||
|
string cmd =
|
||||||
|
$"/C timeout 2 >nul && " +
|
||||||
|
$"copy /Y \"{newExePath}\" \"{currentExe}\" && " +
|
||||||
|
$"start \"\" \"{currentExe}\"";
|
||||||
|
|
||||||
|
Process.Start(new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "cmd.exe",
|
||||||
|
Arguments = cmd,
|
||||||
|
WindowStyle = ProcessWindowStyle.Normal,
|
||||||
|
CreateNoWindow = true
|
||||||
|
});
|
||||||
|
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private async void Form1_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await CheckForUpdateAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void labelLauncherVersion_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("3.7.26.0")]
|
[assembly: AssemblyVersion("3.8.0.0")]
|
||||||
[assembly: AssemblyFileVersion("3.7.26.0")]
|
[assembly: AssemblyFileVersion("3.8.0.0")]
|
||||||
|
|||||||
Reference in New Issue
Block a user