Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C# Updater - SHA256 based

#21
I do not know if someone uses this updater but I've a problem.

I followed the steps and it shows me this error message :

[Image: 1482177602-capture.png]

I looked at the source level but I do not master the C # so I do not find the problem

The part of the code where the error message appears:

Code:
private void CompareFiles(Object sender, DoWorkEventArgs e) {
            var files   = e.Argument as XElement;
            var total   = files.Elements().Count();
            var current = 0;
            this.ThreadSafe(() => { TotalProgress.Maximum = total; });
            try {
                foreach (var file in files.Elements()) {
                    var dir = AppDomain.CurrentDomain.BaseDirectory + "\\";
                    var name = file.Attribute("name").Value;
                    var rhash = file.Attribute("hash").Value;
                    var download = false;
                    this.ThreadSafe(() => { ContentLabel.Content = String.Format("Checking {0}...", name); });
                    if (!File.Exists(dir + name)) {
                        download = true;
                    } else {
                        using (var f = File.OpenRead(dir + name)) {
                            var lhash = f.ToSha256();
                            if (!String.Equals(lhash, rhash)) download = true;
                        }
                    }

                    if (download) {
                        this.ThreadSafe(() => { ContentLabel.Content = String.Format("Downloading {0}...", name); });
                        if (!Directory.Exists(System.IO.Path.GetDirectoryName(dir + name))) Directory.CreateDirectory(System.IO.Path.GetDirectoryName(dir + name));
                        if (File.Exists(dir + name)) File.Delete(dir + name);
                        using (var client = new WebClient()) {
                            try {
                                client.DownloadFile(Options["RemoteDirectory"] + name, dir + name);
                            } catch { ReportError(String.Format("An error has occured while attempting to download '{0}'", name)); return; }
                        }
                    }

                    current++;
                    this.ThreadSafe(() => { TotalProgress.Value = current; });
                }
            } catch { ReportError("A fatal error has occured while attempting to process the updates."); return; }
        }

Someone can help me ?
Sorry for my bad English I am French.

[Image: ___signature____spiderman____by_lixblow-d8ifv4y.png]
Reply

#22
(12-19-2016, 08:04 PM)Escanor Wrote: I do not know if someone uses this updater but I've a problem.

I followed the steps and it shows me this error message :

[Image: 1482177602-capture.png]

I looked at the source level but I do not master the C # so I do not find the problem

The part of the code where the error message appears:

Code:
private void CompareFiles(Object sender, DoWorkEventArgs e) {
           var files   = e.Argument as XElement;
           var total   = files.Elements().Count();
           var current = 0;
           this.ThreadSafe(() => { TotalProgress.Maximum = total; });
           try {
               foreach (var file in files.Elements()) {
                   var dir = AppDomain.CurrentDomain.BaseDirectory + "\\";
                   var name = file.Attribute("name").Value;
                   var rhash = file.Attribute("hash").Value;
                   var download = false;
                   this.ThreadSafe(() => { ContentLabel.Content = String.Format("Checking {0}...", name); });
                   if (!File.Exists(dir + name)) {
                       download = true;
                   } else {
                       using (var f = File.OpenRead(dir + name)) {
                           var lhash = f.ToSha256();
                           if (!String.Equals(lhash, rhash)) download = true;
                       }
                   }

                   if (download) {
                       this.ThreadSafe(() => { ContentLabel.Content = String.Format("Downloading {0}...", name); });
                       if (!Directory.Exists(System.IO.Path.GetDirectoryName(dir + name))) Directory.CreateDirectory(System.IO.Path.GetDirectoryName(dir + name));
                       if (File.Exists(dir + name)) File.Delete(dir + name);
                       using (var client = new WebClient()) {
                           try {
                               client.DownloadFile(Options["RemoteDirectory"] + name, dir + name);
                           } catch { ReportError(String.Format("An error has occured while attempting to download '{0}'", name)); return; }
                       }
                   }

                   current++;
                   this.ThreadSafe(() => { TotalProgress.Value = current; });
               }
           } catch { ReportError("A fatal error has occured while attempting to process the updates."); return; }
       }

Someone can help me ?

Change this line of the source:
Code:
} catch { ReportError("A fatal error has occured while attempting to process the updates."); return; }

to

Code:
} catch (Exception e) { ReportError("A fatal error has occured while attempting to process the updates.\r\n" + e.ToString()); return; }


recompile, run it again, and post the error here
Reply

#23
The new message of error :

[Image: 1482237038-capture.png]
Sorry for my bad English I am French.

[Image: ___signature____spiderman____by_lixblow-d8ifv4y.png]
Reply

#24
Just use another updater lmao there are tons of them. (Damian literally just released one on agd lmao and I think one was released here a week ago)
[Image: Lxd0ays.png]
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
Wink Platformer - EO based Dragon Ball Engine Coyote 20 4,884 12-23-2016, 08:47 PM
Last Post: Coyote
  C# Launcher & Updater Xam 22 4,519 04-29-2016, 07:53 PM
Last Post: Xam
  C# Updater Joyce 10 2,499 08-25-2015, 04:24 PM
Last Post: joaovitor1819
  C# File Updater Matt 9 1,748 08-21-2015, 10:36 PM
Last Post: Matt
  LTGUpdater ~ MD5 MMO Auto Updater [console based] lexkymbeth 3 1,653 11-22-2013, 01:06 PM
Last Post: lexkymbeth

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB 1.8.4 Theme © iAndrew 2016