Beispiel #1
0
        /// <summary>Get update and version information from specified online file - returns a List</summary>
        /// <param name="downloadsURL">URL to download file from</param>
        /// <param name="versionFile">Name of the pipe| delimited version file to download</param>
        /// <param name="resourceDownloadFolder">Folder on the local machine to download the version file to</param>
        /// <param name="startLine">Line number, of the version file, to read the version information from</param>
        /// <returns>List containing the information from the pipe delimited version file</returns>
        public static List <string> getUpdateInfo(string downloadsURL, string versionFile, string resourceDownloadFolder, int startLine)
        {
            bool updateChecked = false;

            //create download folder if it does not exist
            if (!Directory.Exists(resourceDownloadFolder))
            {
                Directory.CreateDirectory(resourceDownloadFolder);
            }

            //let's try and download update information from the web
            updateChecked = WebData.downloadFromWeb(downloadsURL, versionFile, resourceDownloadFolder);

            //if the download of the file was successful
            if (updateChecked)
            {
                //get information out of download info file
                return(populateInfoFromWeb(versionFile, resourceDownloadFolder, startLine));
            }
            //there is a chance that the download of the file was not successful
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>Download file from the web immediately</summary>
        /// <param name="downloadsURL">URL to download file from</param>
        /// <param name="filename">Name of the file to download</param>
        /// <param name="downloadTo">Folder on the local machine to download the file to</param>
        /// <param name="unzip">Unzip the contents of the file</param>
        /// <returns>Void</returns>
        public static void installUpdateNow(string downloadsURL, string filename, string downloadTo, bool unzip)
        {
            bool downloadSuccess = WebData.downloadFromWeb(downloadsURL, filename, downloadTo);

            if (unzip)
            {
                unZip(downloadTo + filename, downloadTo);
            }
        }