public virtual bool FetchFileList(Configuration configuration)
        {
            DisplayMessage(Enums.HandlerMessageSeverity.Trace, "Retrive versions file list");

            _lastResponse = Classes.JsonObject.Instance.ReadWebObject<APIResponse>(configuration.Path(Enums.PathType.Version, _lastResponse.Version));
            if (_lastResponse.Equals(null) || !_lastResponse.Success)
            {
                DisplayMessage(Enums.HandlerMessageSeverity.Error, "Failed to load file list from server");
                if (ExitUpdateProcess != null) ExitUpdateProcess.Invoke();
                return false;
            }
            return true;
        }
        public virtual bool RetriveProjectInformations(Configuration configuration)
        {
            if (StartUpdateProcess != null) StartUpdateProcess.Invoke();
            DisplayMessage(Enums.HandlerMessageSeverity.Trace, "Get Project Information");

            _lastResponse = Classes.JsonObject.Instance.ReadWebObject<APIResponse>(configuration.Path(Enums.PathType.Project));
            if (_lastResponse.Equals(null) || !_lastResponse.Success)
            {
                DisplayMessage(Enums.HandlerMessageSeverity.Warning, "Failed to load Project Informations");
                if (ExitUpdateProcess != null) ExitUpdateProcess.Invoke();
                return false;
            }
            return true;
        }
        public virtual bool DownloadUpdate(Configuration configuration)
        {
            foreach (KeyValuePair<string, string> item in _lastResponse.Files)
            {
                Uri source = configuration.Path(Enums.PathType.File, _lastResponse.Version, item.Key);
                Classes.WebDownloader.Instance.AddDownloadFile(source, Path.Combine(configuration.UpdateDirectory, item.Value));
            }
            Classes.WebDownloader.Instance.DownloadQueue();

            while (Classes.WebDownloader.downloadQueue.Count != 0) { 
                //NOP - Wait for download complete!
            }
            return true;
        }
Beispiel #4
0
 public virtual bool DownloadUpdate(Configuration configuration)
 {
     foreach (KeyValuePair<string, string> item in _lastResponse.Files)
     {
         Uri source = configuration.Path(Enums.PathType.File, _lastResponse.Version, item.Key);
         Classes.WebDownloader.Instance.DownloadFile(source, Path.Combine(configuration.UpdateDirectory, item.Value));
     }
     
     Console.WriteLine(_lastResponse.Files.Count + " files insgesamt, aktuell bei " + Classes.WebDownloader.Instance.FileNumber);
     while (_lastResponse.Files.Count != Classes.WebDownloader.Instance.FileNumber && Classes.WebDownloader.Instance.Downloading) { }
     return true;
 }