Example #1
0
 /// <summary>
 /// Downloads the files that must be updated into a temporary folder.
 /// </summary>
 /// <param name="progress">Progress.</param>
 void DownloadFiles(Action <float> progress)
 {
     progress(0);
     if (mustUpdate != null && mustUpdate.Count > 0)
     {
         foreach (UpdateItem item in mustUpdate)
         {
             Debug.WriteLine(server.Request("updater.php?file=" + item.RemotePath));
             using (StreamReader reader = server.RawRequest("updater.php?file=" + item.RemotePath + "&os=" + GetOS(), "", "")) {
                 FileInfo tempFile = new FileInfo(Path.Combine(Settings.TEMP_PATH.FullName, item.GetHashCode().ToString()));
                 using (StreamWriter writer = new StreamWriter(tempFile.Open(FileMode.Create))) {
                     int i = reader.Read();
                     Console.Write("Int " + i);
                     writer.Write(i);
                 }
                 tempFile.Delete();
             }
         }
     }
     progress(1);
 }