예제 #1
0
        private static PackageMetadata LoadPackage(string packagePath, RegistryKey packageKey, PackageState state)
        {
            string[] files = Directory.GetFiles(packagePath, "*.nuspec").ToArray();

            if (files.Length != 1)
                throw new PackageUpdateException(Labels.CouldNotFindNuSpecManifest);

            var nuSpec = Serialization.Deserialize<NuSpec>(files[0]);

            var metadata = nuSpec.Metadata;

            metadata.GalleryDetailsUrl = (string)packageKey.GetValue("GalleryDetailsUrl");
            metadata.NuGetSite = (string)packageKey.GetValue("NuGetSite");
            metadata.Version = (string)packageKey.GetValue("Version");
            metadata.PendingVersion = (string)packageKey.GetValue("PendingVersion");
            metadata.State = state;

            return metadata;
        }
예제 #2
0
파일: EventArgs.cs 프로젝트: Jeremiahf/wix3
 /// <summary>
 /// Creates a new instance of the <see cref="DetectMsiFeatureEventArgs"/> class.
 /// </summary>
 /// <param name="packageId">Detected package identifier.</param>
 /// <param name="productCode">Detected product code.</param>
 /// <param name="state">Package state detected.</param>
 public DetectTargetMsiPackageEventArgs(string packageId, string productCode, PackageState state)
 {
     this.packageId = packageId;
     this.productCode = productCode;
     this.state = state;
 }
예제 #3
0
 void IBootstrapperApplication.OnPlanPackageComplete(string wzPackageId, int hrStatus, PackageState state, RequestState requested, ActionState execute, ActionState rollback)
 {
     this.OnPlanPackageComplete(new PlanPackageCompleteEventArgs(wzPackageId, hrStatus, state, requested, execute, rollback));
 }
 /// <summary>
 /// Initializes a new instance of the ApplicationPackage class with
 /// required arguments.
 /// </summary>
 public ApplicationPackage(PackageState state)
     : this()
 {
     this.State = state;
 }
예제 #5
0
 void IBootstrapperApplication.OnDetectPackageComplete(string wzPackageId, int hrStatus, PackageState state)
 {
     this.OnDetectPackageComplete(new DetectPackageCompleteEventArgs(wzPackageId, hrStatus, state));
 }
예제 #6
0
        Result IBootstrapperApplication.OnDetectTargetMsiPackage(string wzPackageId, string wzProductCode, PackageState patchState)
        {
            DetectTargetMsiPackageEventArgs args = new DetectTargetMsiPackageEventArgs(wzPackageId, wzProductCode, patchState);
            this.OnDetectTargetMsiPackage(args);

            return args.Result;
        }
예제 #7
0
        public Task SetState(IPackage p, PackageState state)
        {
            return Task.Factory.StartNew(() =>
                {
                                                 var a = CreateActivity(p, ActivityType.SetState);
                                                 Activities.Add(a);

                                                 var task = CoApp.SetState(p.CanonicalName, state);
                                                 task.Wait();

                                                 a.State = task.Exception != null ? State.Failed : State.Finished;

                                                 //task.RethrowWhenFaulted();
                });
        }
예제 #8
0
 public string GetTooltipByState(PackageState state)
 {
     return(string.Format(k_TooltipsByState[(int)state], package.GetDescriptor()));
 }
예제 #9
0
        private async Task <bool> ProcessPackage(UserInfo userInfo, string feedName, PackageName packageName, PackageState packageState, PackageState damagedPackageState, Func <IPackageStorageItem, Task <IPackageStorageItem> > tryWithPackageItemBefore, Func <IPackageStorageItem, ZipPackage, Task> tryWithPackage, Func <IPackageStorageItem, Task> tryWithPackageItemAfter)
        {
            var feed        = storage.GetFeed(feedName);
            var packageItem = feed.GetPackage(null, packageState, packageName);
            var traceName   = packageItem.ToString();

            try
            {
                packageItem = await tryWithPackageItemBefore(packageItem);

                if (packageItem == null)
                {
                    throw new Exception(string.Format("Missing package {0}", traceName));
                }

                using (var packageStream = await packageItem.Get())
                {
                    if (packageStream == null)
                    {
                        throw new Exception(string.Format("Missing package data {0}", traceName));
                    }

                    var package = new ZipPackage(packageStream);
                    await tryWithPackage(packageItem, package);
                }

                await tryWithPackageItemAfter(packageItem);

                return(true);
            }
            catch (Exception e)
            {
                support.TrackException(e, new { packageName });
                Trace.TraceError("Unexpected error while processing package {0}:\n{1}", traceName, e);
                notifier.Damaged(userInfo, packageName).Wait();

                if (packageItem != null)
                {
                    packageItem.Move(damagedPackageState, packageName).Wait();
                }

                return(false);
            }
        }
예제 #10
0
 public static string GetIconStateId(PackageState state)
 {
     return(state.ToString().ToLower());
 }
예제 #11
0
        public AzureBlob GetBlobReference(PackageState packageState, string userName, PackageName packageName)
        {
            var path = GetPath(packageState, userName, packageName);

            return(new AzureBlob(container.GetBlockBlobReference(path)));
        }
예제 #12
0
 private static string GetPath(PackageState packageState, string userName, PackageName packageName)
 {
     return(string.Format("{0}/{1}", GetDirectoryPath(packageState, userName), GetPackagePath(packageName)));
 }
예제 #13
0
 private static string GetDirectoryPath(PackageState packageState, string userName)
 {
     return(string.Format("pkg/{0}/{1}", packageState.ToString().ToLower(), userName));
 }
예제 #14
0
파일: EventArgs.cs 프로젝트: Jeremiahf/wix3
 /// <summary>
 /// Creates a new instance of the <see cref="DetectPackageCompleteEventArgs"/> class.
 /// </summary>
 /// <param name="packageId">The identity of the package detected.</param>
 /// <param name="status">The return code of the operation.</param>
 /// <param name="state">The state of the specified package.</param>
 public DetectPackageCompleteEventArgs(string packageId, int status, PackageState state)
     : base(status)
 {
     this.packageId = packageId;
     this.state = state;
 }
예제 #15
0
 public Task SetState(CanonicalName packageName, PackageState state)
 {
     return EPM.SetGeneralPackageInformation(50, packageName, "state", state.ToString());
 }
예제 #16
0
파일: EventArgs.cs 프로젝트: Jeremiahf/wix3
 /// <summary>
 /// Creates a new instance of the <see cref="PlanPackageCompleteEventArgs"/> class.
 /// </summary>
 /// <param name="packageId">The identity of the package planned for.</param>
 /// <param name="status">The return code of the operation.</param>
 /// <param name="state">The current state of the package.</param>
 /// <param name="requested">The requested state for the package</param>
 /// <param name="execute">The execution action to take.</param>
 /// <param name="rollback">The rollback action to take.</param>
 public PlanPackageCompleteEventArgs(string packageId, int status, PackageState state, RequestState requested, ActionState execute, ActionState rollback)
     : base(status)
 {
     this.packageId = packageId;
     this.state = state;
     this.requested = requested;
     this.execute = execute;
     this.rollback = rollback;
 }
예제 #17
0
 public static string GetTooltipByState(PackageState state)
 {
     return(ApplicationUtil.instance.GetTranslationForText(k_TooltipsByState[(int)state]));
 }