Exemplo n.º 1
0
 public HttpTask(string URL, Product product)
     : base(product)
 {
     m_webRequest = HttpWebRequest.Create(URL);
 }
Exemplo n.º 2
0
        public WebDownload(Product product)
            : base(product.URL, product)
        {
            Uri uri = new Uri(product.URL);
            string fileName = Path.GetFileName(uri.PathAndQuery);

            // Prepare to save the installer inside the user's temporary directory.
            m_tmpInstallerPath = Path.Combine(Path.GetTempPath(), fileName);

            // Create a file stream to save the file while downloading.
            m_fileStream = new FileStream(m_tmpInstallerPath, FileMode.Create, FileAccess.Write);
        }
Exemplo n.º 3
0
 public WebCheck(Product product)
     : base(product.URL, product)
 {
 }
Exemplo n.º 4
0
 public Task(Product product)
 {
     TaskProduct = product;
 }
Exemplo n.º 5
0
 public Installer(Product product)
     : base(product)
 {
 }
Exemplo n.º 6
0
        /// <summary>
        /// Poke the registry for all Teambox products that we can update. Return
        /// a list of products that can be updated.
        /// </summary>
        private List<Product> GetProductsInfo()
        {
            string baseKey = @"Software\Teambox";
            Dictionary<string, Product> prods = new Dictionary<string, Product>();
            RegistryKey key = Registry.LocalMachine.OpenSubKey(baseKey);
            string[] products;

            if (key == null) return new List<Product>(prods.Values);

            products = key.GetSubKeyNames();

            foreach (string pname in products)
            {
                RegistryKey productKey = key.OpenSubKey(pname);

                // Get the update URL.
                object productUrlObject = productKey.GetValue("URL");
                object productIncludesObject = productKey.GetValue("Includes");
                object productVersionObject = productKey.GetValue("InstallVersion");
                if (productUrlObject == null || productVersionObject == null) continue;

                if (productIncludesObject != null)
                {
                    // If this product includes other products, mark the other products
                    // has IncludedElsewhere.
                    string[] productIncludes = ((string)productIncludesObject).Split(new char[] {','});

                    foreach (string prodInc in productIncludes)
                    {
                        if (prods.ContainsKey(prodInc))
                        {
                            if (!prods.ContainsKey(prodInc)) prods[prodInc] = new Product();
                            prods[prodInc].IncludedElsewhere = true;
                        }
                    }
                }

                // Add the product to the list of manageable products.
                if (!prods.ContainsKey(pname)) prods[pname] = new Product();
                prods[pname].Name = pname;
                prods[pname].URL = (string)productUrlObject;
                prods[pname].LocalVersion = (string)productVersionObject;
            }

            List<Product> updateProducts = new List<Product>();

            // Create a list that removes the product included elsewhere.
            foreach (Product p in prods.Values) if (!p.IncludedElsewhere) updateProducts.Add(p);

            return updateProducts;
        }