vForums Support :: Programming & Coding :: Programming Discussion :: C# Anyone??????? - View Topic
 |  |
| dog199200 Guest | | C# Anyone??????? (8th Oct 09 at 5:32am UTC) | | I'm just wondering, does anyone here know how to code in C#? I'm having problems with a code that i'm writing yet it gives no errors at all, and I'm looking for someone who can look it over and can possibly help me find out what I have done wrong.
 Code: - using System;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Diagnostics;
- using System.IO;
- using ICSharpCode.SharpZipLib.Zip;
- using System.Net;
- using System.Text;
-
- 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(), Encoding.GetEncoding(1252));
- decimal Online = 0.0m;
- Online = Convert.ToDecimal(sr.ReadToEnd());
-
- if (Version >= Online)
- {
- File_Progress_Title.Text = "100%";
- Total_Progress_Title.Text = "100%";
- VersionOld.Visible = false;
- VersionNew.Visible = true;
- }
- else
- {
- VersionNew.Visible = false;
- 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;
- }
-
- private void Help_Click(object sender, EventArgs e)
- {
- Process.Start("http://www.divineshadowsonline.com/faq.php");
- }
-
- private void Forum_Click(object sender, EventArgs e)
- {
- Process.Start("http://www.forum.divineshadowsonline.com");
- }
-
- private void WSite_Click(object sender, EventArgs e)
- {
- Process.Start("http://www.divineshadowsonline.com");
- }
-
- private void pictureBox4_Click(object sender, EventArgs e)
- {
- Process.Start("http://www.shiningashes.net");
- }
- }
- }
And for those that would like to see what i'm working on here is a picture:
 | |
| Jason Moderator
    
![[Avatar]](http://a.random-image.net/frufru/randimage.jpg) www.random-image.net Posts: 223 Status: Offline Gender: Male Location: University of Waterloo, Canada Age: 36 Joined:
Additional Groups: Spell Checker
 
pmwww | | Re: C# Anyone??????? (11th Oct 09 at 4:12am UTC) | | I'm just wondering, does anyone here know how to code in C#? I'm having problems with a code that i'm writing yet it gives no errors at all, and I'm looking for someone who can look it over and can possibly help me find out what I have done wrong.  Code: - using System;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Diagnostics;
- using System.IO;
- using ICSharpCode.SharpZipLib.Zip;
- using System.Net;
- using System.Text;
-
- 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(), Encoding.GetEncoding(1252));
- decimal Online = 0.0m;
- Online = Convert.ToDecimal(sr.ReadToEnd());
-
- if (Version >= Online)
- {
- File_Progress_Title.Text = "100%";
- Total_Progress_Title.Text = "100%";
- VersionOld.Visible = false;
- VersionNew.Visible = true;
- }
- else
- {
- VersionNew.Visible = false;
- 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;
- }
-
- private void Help_Click(object sender, EventArgs e)
- {
- Process.Start("http://www.divineshadowsonline.com/faq.php");
- }
-
- private void Forum_Click(object sender, EventArgs e)
- {
- Process.Start("http://www.forum.divineshadowsonline.com");
- }
-
- private void WSite_Click(object sender, EventArgs e)
- {
- Process.Start("http://www.divineshadowsonline.com");
- }
-
- private void pictureBox4_Click(object sender, EventArgs e)
- {
- Process.Start("http://www.shiningashes.net");
- }
- }
- }
And for those that would like to see what i'm working on here is a picture: 
Hmm... I know some things about C#... =P
So what exactly is the problem then?
| |
Image Randomizers - official vForums partner
 ^ Live stats ^ |
| dog199200 Guest | | Re: C# Anyone??????? (11th Oct 09 at 4:28am UTC) | | | well i figured out the problem, the launching code for the function didn't get added to the designer file. one small question, do you know how to track the bit rate of a file? | |
| Jason Moderator
    
![[Avatar]](http://a.random-image.net/frufru/randimage.jpg) www.random-image.net Posts: 223 Status: Offline Gender: Male Location: University of Waterloo, Canada Age: 36 Joined:
Additional Groups: Spell Checker
 
pmwww | | Re: C# Anyone??????? (12th Oct 09 at 7:50pm UTC) | | well i figured out the problem, the launching code for the function didn't get added to the designer file. one small question, do you know how to track the bit rate of a file?
Not too sure about that one. Maybe someone else here does... | |
Image Randomizers - official vForums partner
 ^ Live stats ^ |
| dog199200 Guest | | Re: C# Anyone??????? (13th Oct 09 at 1:00am UTC) | | | yea sadly everyone I asked is clueless lol | |
| |
 |  |
|