Пример #1
0
 public string GetString(string key)
 {
     return(Branding.GetString(key));
 }
Пример #2
0
        private Update CheckForUpdates()
        {
            string url = Branding.GetString("BRANDING_updaterURL");

            if (String.IsNullOrEmpty(url))
            {
                url = "https://pvupdates.vmd.citrix.com/updates.tsv";
            }
            if (update_url.Exists)
            {
                url = update_url.Value;
            }
            url = (string)GetReg("HKEY_LOCAL_MACHINE\\SOFTWARE\\Citrix\\XenTools", "update_url", url);

            if (String.IsNullOrEmpty(url))
            {
                session.Log("Update URL is Null or Empty");
                throw new ArgumentNullException("URL is empty");
            }
            session.Log("Checking URL: " + url + " for updates after: " + version.ToString());

            WebClient client   = new WebClient();
            string    contents = client.DownloadString(url);

            string        arch    = (Win32Impl.Is64BitOS() && (!Win32Impl.IsWOW64())) ? "x64" : "x86";
            List <Update> updates = new List <Update>();

            foreach (string line in contents.Split(new char[] { '\n' }))
            {
                if (String.IsNullOrEmpty(line))
                {
                    continue;
                }
                try
                {
                    Update update = new Update(line);
                    if (update.Arch != arch)
                    {
                        continue;
                    }
                    if (update.Version.CompareTo(version) <= 0)
                    {
                        continue;
                    }

                    updates.Add(update);
                    session.Log("Update Entry :" + update.ToString());
                }
                catch (Exception e)
                {
                    session.Log("Exception: " + e.Message);
                }
            }

            updates.Reverse();
            if (updates.Count > 0)
            {
                return(updates[0]);
            }

            session.Log("No updates found");
            return(null);
        }