Esempio n. 1
0
        /// <summary>
        /// Downloads engine update info
        /// </summary>
        public static EngineUpdateInfo DownloadEngineUpdateInfo()
        {
            string           url  = Configurations.AutoUpdate.UpdateInfoUrl;
            EngineUpdateInfo info = (EngineUpdateInfo)Updaters.DownloadUpdateInfo(typeof(EngineUpdateInfo), url);

            return(info);
        }
Esempio n. 2
0
        /// <summary>
        /// Download and update the package
        /// </summary>
        public static bool Install()
        {
            // Download the engine update info
            EngineUpdateInfo updateInfo = DownloadEngineUpdateInfo();

            // Check if update is required
            if (Common.CompareASProxyVersions(updateInfo.UpdateVersion, Consts.General.ASProxyVersion) == 1)
            {
                // Download the package and install it
                return(Install(updateInfo));
            }

            return(false);
        }
Esempio n. 3
0
        /// <summary>
        /// Download the engine update package and install it
        /// </summary>
        public static void Install(EngineUpdateInfo updateInfo)
        {
            string tempFile = Path.GetTempFileName();
            try
            {
                // download the package
                Updaters.GetDataFile(updateInfo.UpdatePackageUrl, tempFile);

                // apply the downloaded package
                ApplyPackage(updateInfo, tempFile);
            }
            catch (Exception)
            {
            }
            finally
            {
                // delete downloaded package
                File.Delete(tempFile);
            }
        }
Esempio n. 4
0
        //static void Save()
        //{
        //    var serializer = new System.Xml.Serialization.XmlSerializer(typeof(EngineUpdateInfo));
        //    using (var ff = File.OpenWrite("f:\\temp.xml"))
        //    {
        //        var en = new EngineUpdateInfo()
        //        {
        //            UpdateVersion = "a213.234.12",
        //            UpdatePackageUrl = "asdsad",
        //            Date = DateTime.Now
        //        };
        //        serializer.Serialize(ff, en);
        //    }
        //}


        /// <summary>
        /// Download the engine update package and install it
        /// </summary>
        public static bool Install(EngineUpdateInfo updateInfo)
        {
            string tempFile = Path.GetTempFileName();

            try
            {
                // download the package
                Updaters.GetDataFile(updateInfo.UpdatePackageUrl, tempFile);

                // apply the downloaded package
                ApplyPackage(updateInfo, tempFile);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                // delete downloaded package
                File.Delete(tempFile);
            }
        }
Esempio n. 5
0
	private void DisplayEngineUpdate(EngineUpdateInfo updateInfo, bool installed, string message)
	{
		pgUpdateASProxy.Visible = true;
		lblUpASProxyVersion.Text = Consts.General.ASProxyVersionFull;

		if (installed)
		{
			lblUpASProxyStatus.Text = "Update was successful";
			lblUpASProxyStatus.ForeColor = Color.Green;
			btnUpASProxyUpdate.Enabled = false;
		}
		else if (updateInfo == null)
		{
			lblUpASProxyStatus.Text = "Unable to check for update.";
			lblUpASProxyStatus.ForeColor = Color.Red;
			btnUpASProxyUpdate.Enabled = false;
		}
		else
		{
			lblUpASProxyVersion.Text = updateInfo.UpdateVersion;
			if (Common.CompareASProxyVersions(updateInfo.UpdateVersion, Consts.General.ASProxyVersionFull) == 1)
			{
				lblUpASProxyStatus.Text = "Update is available.";
				lblUpASProxyStatus.ForeColor = Color.Green;
				btnUpASProxyUpdate.Enabled = true;
			}
			else
			{
				lblUpASProxyStatus.Text = "Update is not available.";
				lblUpASProxyStatus.ForeColor = Color.Red;
				btnUpASProxyUpdate.Enabled = false;
			}
		}
		if (!string.IsNullOrEmpty(message))
			lblUpASProxyStatus.Text = message;
	}
Esempio n. 6
0
 /// <summary>
 /// Saves the package file to ASProxy location
 /// </summary>
 static void ApplyPackage(EngineUpdateInfo updateInfo, string zipFile)
 {
     // installs engine files
     Updaters.InstallUpdatePackage(zipFile);
 }
Esempio n. 7
0
 /// <summary>
 /// Saves the package file to ASProxy location
 /// </summary>
 static void ApplyPackage(EngineUpdateInfo updateInfo, string zipFile)
 {
     // installs engine files
     Updaters.InstallUpdatePackage(zipFile);
 }