|
-
October 7th, 2009, 11:32 PM
#1
Program Launcher Help
Hello;
I have just started programming in C# and I have a project I have been working on. first off i'm a video game programmer so I tend to not do visual things like C# so i'm a bit clueless and right now i'm trying to build a game launcher using C#. Now i think I got all the coding in place, but the problem is for some reason it wont check online files like it is suppose to so it wont check the version of the program i'm running, and then it wont download patch files either. Well i think the code might explain it better after looking at it.
Code:
using System;
using System.ComponentModel;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
using System.Net;
namespace Divine_Shadows
{
public partial class DSL : Form
{
public DSL()
{
InitializeComponent();
}
public WebClient update = new WebClient();
public FastZip zip = new FastZip();
private void DSL_Load(object sender, EventArgs e)
{
decimal Version = 0.0m;
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.divineshadowsonline.com/game/version.txt");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding(1252));
string Online = "0.0";
Online = sr.ReadToEnd();
if (Version >= Convert.ToDecimal(Online))
{
File_Progress_Title.Text = "100%";
Total_Progress_Title.Text = "100%";
}
else
{
VersionOld.Visible = true;
}
}
update.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback);
update.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadCompleted);
Update_Status.Text = "Updating...";
while (update.IsBusy)
{
Application.DoEvents();
}
update.DownloadFileAsync(new Uri("http://www.divineshadowsonline.com/game/updates/patch.zip"), @"C:\patch.zip");
}
public void DownloadProgressCallback(object sender, DownloadProgressChangedEventArgs e)
{
File_Progress_Display.Value = e.ProgressPercentage;
File_Progress_Title.Text = Convert.ToString(e.ProgressPercentage) + "%";
}
public void DownloadCompleted(Object sender, AsyncCompletedEventArgs e)
{
zip.ExtractZip(@"C:\patch.zip", Application.StartupPath.ToString(), @"C:\Program Files\Divine Shadows\");
}
private void Close_Click(object sender, EventArgs e)
{
Close();
}
private void Register_Click(object sender, EventArgs e)
{
Process.Start("http://www.divineshadowsonline.com/register.php");
}
private void Play_Click(object sender, EventArgs e)
{
Process.Start("Game.exe");
}
private void Minimize_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
}
}
Any and all help to let me know what i'm doing wrong will be greatly appreciated. And if you need to see an image of the launcher program let me know so I can et a screenshot so you can get an better idea of what the code is suppose to do.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|