Launcher improvements

This commit is contained in:
Regalis
2015-09-12 10:23:05 +03:00
parent 29a6260d0f
commit d29ee03681
3 changed files with 13 additions and 10 deletions
+12 -9
View File
@@ -38,6 +38,8 @@ namespace Launcher2
private GUIProgressBar progressBar; private GUIProgressBar progressBar;
private GUIButton downloadButton; private GUIButton downloadButton;
GUIButton launchButton;
public bool FullScreenEnabled public bool FullScreenEnabled
{ {
get { return settings.FullScreenEnabled; } get { return settings.FullScreenEnabled; }
@@ -104,8 +106,8 @@ namespace Launcher2
guiRoot = new GUIFrame(new Rectangle(0,0,graphicsWidth, graphicsHeight), Color.Transparent); guiRoot = new GUIFrame(new Rectangle(0,0,graphicsWidth, graphicsHeight), Color.Transparent);
guiRoot.Padding = new Vector4(40.0f, 40.0f, 40.0f, 40.0f); guiRoot.Padding = new Vector4(40.0f, 40.0f, 40.0f, 40.0f);
GUIButton button = new GUIButton(new Rectangle(0,0,100,30), "START", Alignment.BottomRight, GUI.Style, guiRoot); launchButton = new GUIButton(new Rectangle(0,0,100,30), "START", Alignment.BottomRight, GUI.Style, guiRoot);
button.OnClicked = LaunchClick; launchButton.OnClicked = LaunchClick;
int y = 50; int y = 50;
@@ -360,7 +362,8 @@ namespace Launcher2
if (string.IsNullOrWhiteSpace(latestVersionFolder)) return false; if (string.IsNullOrWhiteSpace(latestVersionFolder)) return false;
button.Enabled = false; button.Enabled = false;
launchButton.Enabled = false;
XDocument doc = null; XDocument doc = null;
try try
@@ -371,6 +374,7 @@ namespace Launcher2
catch (Exception e) catch (Exception e)
{ {
SetUpdateInfoBox("Error while updating: " + e.Message); SetUpdateInfoBox("Error while updating: " + e.Message);
launchButton.Enabled = true;
return false; return false;
} }
@@ -420,12 +424,14 @@ namespace Launcher2
{ {
updateInfoText.Text = "Update failed"; updateInfoText.Text = "Update failed";
SetUpdateInfoBox("Error while installing the update: "+e.Message); SetUpdateInfoBox("Error while installing the update: "+e.Message);
launchButton.Enabled = true;
return; return;
} }
UpdaterUtil.CleanUnnecessaryFiles(latestVersionFiles); UpdaterUtil.CleanUnnecessaryFiles(latestVersionFiles);
updateInfoText.Text = "The game was updated succesfully!"; updateInfoText.Text = "The game was updated succesfully!";
launchButton.Enabled = true;
//MessageBox.Show("Download completed!"); //MessageBox.Show("Download completed!");
return; return;
@@ -442,16 +448,13 @@ namespace Launcher2
WebClient webClient = new WebClient(); WebClient webClient = new WebClient();
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed); webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
//webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
if (!Directory.Exists(dir)) if (!Directory.Exists(dir))
{ {
Directory.CreateDirectory(dir); Directory.CreateDirectory(dir);
} }
string fileDir = Path.GetDirectoryName(filesToDownload[filesDownloaded]); string fileDir = dir+"\\"+Path.GetDirectoryName(filesToDownload[filesDownloaded]);
if (!string.IsNullOrWhiteSpace(fileDir) && !Directory.Exists(fileDir)) if (!string.IsNullOrWhiteSpace(fileDir) && !Directory.Exists(fileDir))
{ {
Directory.CreateDirectory(fileDir); Directory.CreateDirectory(fileDir);
+1 -1
View File
@@ -150,7 +150,7 @@ namespace Subsurface
File.Move(file, fileRelPath); File.Move(file, fileRelPath);
} }
Directory.Delete(updateFileFolder); Directory.Delete(updateFileFolder, true);
} }
public static void CleanUnnecessaryFiles(List<string> filesToKeep) public static void CleanUnnecessaryFiles(List<string> filesToKeep)
Binary file not shown.