Beispiel #1
0
        public static void DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, string targetDirectory, string group, IDownloadNotification notification, DownloadOptions options)
        {
            Logger.AddMethodCall("DownloadDependencies called.");
            Logger.AddInternalState("sourceUriBase=" + (object)sourceUriBase);
            Logger.AddInternalState("targetDirectory=" + targetDirectory);
            Logger.AddInternalState("group=" + group);
            Logger.AddInternalState("DownloadOptions=" + (object)options);
            FileDownloader downloader = FileDownloader.Create();

            downloader.Options = options;
            if (group == null)
            {
                downloader.CheckForSizeLimit(appManifest.CalculateDependenciesSize(), false);
            }
            DownloadManager.AddDependencies(downloader, deployManifest, appManifest, sourceUriBase, targetDirectory, group);
            downloader.DownloadModified += new FileDownloader.DownloadModifiedEventHandler(DownloadManager.ProcessDownloadedFile);
            if (notification != null)
            {
                downloader.AddNotification(notification);
            }
            try
            {
                downloader.Download(subState, DownloadManager.ClientCertificate);
                downloader.ComponentVerifier.VerifyComponents();
                DownloadManager.VerifyRequestedPrivilegesSupport(appManifest, targetDirectory);
            }
            finally
            {
                if (notification != null)
                {
                    downloader.RemoveNotification(notification);
                }
                downloader.DownloadModified -= new FileDownloader.DownloadModifiedEventHandler(DownloadManager.ProcessDownloadedFile);
            }
        }
Beispiel #2
0
        private static void DownloadManifestAsRawFile(ref Uri sourceUri, string targetPath, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation)
        {
            Logger.AddMethodCall("DownloadManifestAsRawFile called.");
            FileDownloader fileDownloader = FileDownloader.Create();

            fileDownloader.Options = options;
            if (notification != null)
            {
                fileDownloader.AddNotification(notification);
            }
            try
            {
                fileDownloader.AddFile(sourceUri, targetPath, 16777216);
                fileDownloader.Download((SubscriptionState)null, DownloadManager.ClientCertificate);
                sourceUri         = fileDownloader.DownloadResults[0].ResponseUri;
                serverInformation = fileDownloader.DownloadResults[0].ServerInformation;
                DownloadManager.ClientCertificate = fileDownloader.ClientCertificate;
            }
            finally
            {
                if (notification != null)
                {
                    fileDownloader.RemoveNotification(notification);
                }
            }
        }
        private static void DownloadManifestAsRawFile(ref Uri sourceUri, string targetPath, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation)
        {
            Logger.AddMethodCall("DownloadManifestAsRawFile called.");
            FileDownloader downloader = FileDownloader.Create();

            downloader.Options = options;
            if (notification != null)
            {
                downloader.AddNotification(notification);
            }
            try
            {
                downloader.AddFile(sourceUri, targetPath, 0x1000000);
                downloader.Download(null);
                sourceUri         = downloader.DownloadResults[0].ResponseUri;
                serverInformation = downloader.DownloadResults[0].ServerInformation;
            }
            finally
            {
                if (notification != null)
                {
                    downloader.RemoveNotification(notification);
                }
            }
        }