Esempio n. 1
0
        public static UpdateInfo CheckForLauncherUpdate()
        {
            WebClient webClient = Helpers.BuildWebClient();

            string[] lines          = webClient.DownloadString(LauncherSetup.FTP_LAUNCHER_VERSION_FILE).Replace("\r", String.Empty).Split('\n');
            string   productVersion = Application.ProductVersion;
            string   onlineVersion  = String.Empty;
            string   address        = String.Empty;

            foreach (string line in lines)
            {
                if (line.StartsWith("VERSION="))
                {
                    onlineVersion = line.Replace("VERSION=", String.Empty);
                }
                else if (line.StartsWith("FILENAME="))
                {
                    address = line.Replace("FILENAME=", String.Empty);
                }
            }
            if (String.IsNullOrEmpty(address) || String.IsNullOrEmpty(onlineVersion))
            {
                return(UpdateInfo.NotAvailable());
            }
            if (onlineVersion == productVersion)
            {
                return(UpdateInfo.NotAvailable());
            }
            return(UpdateInfo.Available(address));
        }