/// <summary> /// Serializes class into WiX document. /// </summary> /// <param name="context">Processing context for WiX Document.</param> public void Process(ProcessingContext context) { string[] AdvertiseParents = { "Fragment", "Module", "Product" }; // If the parent element is a Fragment, Module, or Product, ensure Advertised is true. if (!Advertise && AdvertiseParents.Any(s => s == context.XParent.Name.LocalName)) { throw new ValidationException($"If {nameof(AppId)} is a child of the elements " + $"{AdvertiseParents.JoinBy(", ")}, then {nameof(Advertise)} must be set to true."); } if (Advertise && Description != null) { throw new ValidationException($"If {nameof(AppId)} is Advertised, {nameof(Description)} cannot be set."); } XElement element = this.ToXElement("AppId"); ComClasses?.ForEach(appChild => element.Add(appChild.ToXElement())); context.XParent.Add(element); }
/// <summary> /// Adds itself as an XML content into the WiX source being generated from the <see cref="WixSharp.Project"/>. /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly. /// </summary> /// <param name="context">The context.</param> public void Process(ProcessingContext context) { context.Project.IncludeWixExtension(WixExtension.Fire); var firewallElement = this.ToXElement(WixExtension.Fire, "FirewallException"); RemoteAddress.ForEach(address => { firewallElement.Add(WixExtension.Fire.XElement("RemoteAddress", (object)address.Trim())); }); var findComponent = context.XParent.FindFirst("Component"); if (findComponent != null) { XElement newComponent = this.CreateParentComponent(); newComponent.Add(firewallElement); findComponent.Parent?.Add(newComponent); if (ActualFeatures.Any()) { context.FeatureComponents.Map(ActualFeatures, Id); } else if (context.FeatureComponents.ContainsKey(context.Project.DefaultFeature)) { context.FeatureComponents[context.Project.DefaultFeature].Add(Id); } else { context.FeatureComponents[context.Project.DefaultFeature] = new List <string> { Id } }; } else { context.XParent.Add(firewallElement); } }
/// <summary> /// Adds itself as an XML content into the WiX source being generated from the <see cref="WixSharp.Project"/>. /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly. /// </summary> /// <param name="context">The context.</param> public void Process(ProcessingContext context) { XElement component = this.CreateParentComponent(); component.Add(this.ToXElement("RemoveRegistryKey")); context.XParent.FindFirst("Component").Parent?.Add(component); if (ActualFeatures.Any()) { context.FeatureComponents.Map(ActualFeatures, Id); } else if (context.FeatureComponents.ContainsKey(context.Project.DefaultFeature)) { context.FeatureComponents[context.Project.DefaultFeature].Add(Id); } else { context.FeatureComponents[context.Project.DefaultFeature] = new List <string> { Id } }; } }
/// <summary> /// Maps the component to features. If no features specified then the component is added to the default ("Complete") feature. /// </summary> /// <param name="componentId">The component identifier.</param> /// <param name="features">The features.</param> /// <param name="context">The context.</param> public static void MapComponentToFeatures(string componentId, Feature[] features, ProcessingContext context) { var project = (Project)context.Project; if (features.Any()) { context.FeatureComponents.Map(features, componentId); } else if (context.FeatureComponents.ContainsKey(project.DefaultFeature)) { context.FeatureComponents[project.DefaultFeature].Add(componentId); } else { context.FeatureComponents[project.DefaultFeature] = new List <string> { componentId } }; } }
/// <summary> /// Adds itself as an XML content into the WiX source being generated from the <see cref="WixSharp.Project" />. /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly. /// </summary> /// <param name="context">The context.</param> public void Process(ProcessingContext context) { XElement component = this.CreateAndInsertParentComponent(context); component.Add(this.ToXElement("CopyFile")); }
/// <summary> /// Adds itself as an XML content into the WiX source being generated from the <see cref="WixSharp.Project"/>. /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly. /// </summary> /// <param name="context">The context.</param> public void Process(ProcessingContext context) { context.XParent.Add(this.ToXElement(GetType().Name)); }
/// <summary> /// Adds itself as an XML content into the WiX source being generated from the <see cref="WixSharp.Project"/>. /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly. /// </summary> /// <param name="context">The context.</param> public void Process(ProcessingContext context) { this.CreateAndInsertParentComponent(context) .Add(this.ToXElement("RemoveRegistryValue")); }
/// <summary> /// Adds itself as an XML content into the WiX source being generated from the <see cref="WixSharp.Project" />. /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly. /// </summary> /// <param name="context">The context.</param> public void Process(ProcessingContext context) { context.XParent .Add(this.ToXElement("MediaTemplate")); }
/// <summary> /// Adds itself as an XML content into the WiX source being generated from the <see cref="WixSharp.Project"/>. /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly. /// </summary> /// <param name="context">The context.</param> public void Process(ProcessingContext context) { if (RequiresConfig()) { Config = new ServiceConfig { DelayedAutoStart = DelayedAutoStart, PreShutdownDelay = PreShutdownDelay, ServiceSid = ServiceSid, ConfigureServiceTrigger = ConfigureServiceTrigger, }; } if (RequiresConfigUtil()) { ConfigUtil = new ServiceConfigUtil { FirstFailureActionType = FirstFailureActionType, SecondFailureActionType = SecondFailureActionType, ThirdFailureActionType = ThirdFailureActionType, ProgramCommandLine = ProgramCommandLine, RebootMessage = RebootMessage, ResetPeriodInDays = ResetPeriodInDays, RestartServiceDelayInSeconds = RestartServiceDelayInSeconds, }; } XElement ServiceInstaller = this.ToXElement("ServiceInstall"); if (PermissionEx != null) { ServiceInstaller.AddElement(this.PermissionEx.ToXElement(WixExtension.Util, "PermissionEx")); } context.XParent.Add(ServiceInstaller); var newContext = new ProcessingContext { Project = context.Project, Parent = context.Project, XParent = ServiceInstaller, FeatureComponents = context.FeatureComponents, }; if (DependsOn != null) { foreach (ServiceDependency dependency in DependsOn) { dependency.Process(newContext); } } Config?.Process(newContext); if (UrlReservations != null) { foreach (IGenericEntity urlReservation in UrlReservations) { urlReservation.Process(newContext); } } ConfigUtil?.Process(newContext); StopOn?.Process(context); StartOn?.Process(context); RemoveOn?.Process(context); }
/// <summary> /// Adds itself as an XML content into the WiX source being generated from the <see cref="WixSharp.Project"/>. /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly. /// </summary> /// <param name="context">The context.</param> public void Process(ProcessingContext context) { context.Project.Include(WixExtension.Util); context.XParent.Add(this.ToXElement(WixExtension.Util, "ServiceConfig")); }
/// <summary> /// Adds itself as an XML content into the WiX source being generated from the <see cref="T:WixSharp.Project" />. /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly. /// </summary> /// <param name="context">The context.</param> public void Process(ProcessingContext context) { base.Process(context, "SqlString"); }
/// <summary> /// Adds itself as an XML content into the WiX source being generated from the <see cref="T:WixSharp.Project" />. /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly. /// </summary> /// <param name="context">The context.</param> public void Process(ProcessingContext context) { base.Process(context, "SqlScript"); }