mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
Sync launcher version with client version, display name of current resource being fetcehed in form title.
This commit is contained in:
parent
97ad029205
commit
6d6067ec1c
@ -25,7 +25,7 @@ namespace Launcher {
|
|||||||
|
|
||||||
protected HttpWebResponse MakeRequest( string uri, string referer, string data ) {
|
protected HttpWebResponse MakeRequest( string uri, string referer, string data ) {
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create( uri );
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create( uri );
|
||||||
request.UserAgent = "ClassicalSharp Launcher 0.1";
|
request.UserAgent = MainForm.AppName;
|
||||||
request.ReadWriteTimeout = 15 * 1000;
|
request.ReadWriteTimeout = 15 * 1000;
|
||||||
request.Timeout = 15 * 1000;
|
request.Timeout = 15 * 1000;
|
||||||
request.Referer = referer;
|
request.Referer = referer;
|
||||||
|
2
Launcher/MainForm.Designer.cs
generated
2
Launcher/MainForm.Designer.cs
generated
@ -764,7 +764,7 @@ namespace Launcher
|
|||||||
this.ClientSize = new System.Drawing.Size(432, 393);
|
this.ClientSize = new System.Drawing.Size(432, 393);
|
||||||
this.Controls.Add(this.tabs);
|
this.Controls.Add(this.tabs);
|
||||||
this.Name = "MainForm";
|
this.Name = "MainForm";
|
||||||
this.Text = "ClassicalSharp Launcher";
|
this.Text = Launcher.MainForm.AppName;
|
||||||
this.ResizeEnd += new System.EventHandler(this.MainFormResizeEnd);
|
this.ResizeEnd += new System.EventHandler(this.MainFormResizeEnd);
|
||||||
this.tabMinecraftNet.ResumeLayout(false);
|
this.tabMinecraftNet.ResumeLayout(false);
|
||||||
this.tabMC.ResumeLayout(false);
|
this.tabMC.ResumeLayout(false);
|
||||||
|
@ -13,6 +13,8 @@ namespace Launcher {
|
|||||||
|
|
||||||
public partial class MainForm : Form {
|
public partial class MainForm : Form {
|
||||||
|
|
||||||
|
public const string AppName = "ClassicalSharp Launcher 0.5";
|
||||||
|
|
||||||
public MainForm() {
|
public MainForm() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
AdjustTabs();
|
AdjustTabs();
|
||||||
@ -35,7 +37,8 @@ namespace Launcher {
|
|||||||
"Some required resources weren't found. Would you like to download them now?", "Missing resources",
|
"Some required resources weren't found. Would you like to download them now?", "Missing resources",
|
||||||
MessageBoxButtons.OKCancel );
|
MessageBoxButtons.OKCancel );
|
||||||
if( result == DialogResult.OK ) {
|
if( result == DialogResult.OK ) {
|
||||||
fetcher.Run();
|
fetcher.Run( this );
|
||||||
|
Text = AppName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,17 +11,18 @@ namespace Launcher {
|
|||||||
const string cloudsUri = "https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/master/src/main/resources/clouds.png";
|
const string cloudsUri = "https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/master/src/main/resources/clouds.png";
|
||||||
const string charUri = "https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/master/src/main/resources/char.png";
|
const string charUri = "https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/master/src/main/resources/char.png";
|
||||||
|
|
||||||
public void Run() {
|
public void Run( MainForm form ) {
|
||||||
using( WebClient client = new WebClient() ) {
|
using( WebClient client = new WebClient() ) {
|
||||||
client.Proxy = null;
|
client.Proxy = null;
|
||||||
if( !DownloadData( terrainUri, client, "terrain.png" ) ) return;
|
if( !DownloadData( terrainUri, client, "terrain.png", form ) ) return;
|
||||||
if( !DownloadData( cloudsUri, client, "clouds.png" ) ) return;
|
if( !DownloadData( cloudsUri, client, "clouds.png", form ) ) return;
|
||||||
if( !DownloadData( charUri, client, "char.png" ) ) return;
|
if( !DownloadData( charUri, client, "char.png", form ) ) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool DownloadData( string uri, WebClient client, string output ) {
|
static bool DownloadData( string uri, WebClient client, string output, MainForm form ) {
|
||||||
if( File.Exists( output ) ) return true;
|
if( File.Exists( output ) ) return true;
|
||||||
|
form.Text = MainForm.AppName + " - fetching " + output;
|
||||||
|
|
||||||
byte[] data = null;
|
byte[] data = null;
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user