예제 #1
0
 public IfDefEventArgs(SourceLineNumberCollection sourceLineNumbers, bool isIfDef, bool isDefined, string variableName)
 {
     this.sourceLineNumbers = sourceLineNumbers;
     this.isIfDef = isIfDef;
     this.isDefined = isDefined;
     this.variableName = variableName;
 }
 /// <summary>
 /// Instantiate a new WixUnknownMergeLanguageException.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line information of the exception.</param>
 /// <param name="mergeId">Name of the file which could not be found.</param>
 /// <param name="mergeModulePath">Path to the merge module.</param>
 /// <param name="lcid">User-specified lcid.</param>
 /// <param name="innerException">The exception that is the cause of the current exception.</param>
 public WixUnknownMergeLanguageException(SourceLineNumberCollection sourceLineNumbers, string mergeId, string mergeModulePath, int lcid, Exception innerException)
     : base(sourceLineNumbers, ExceptionType, innerException)
 {
     this.mergeId = mergeId;
     this.mergeModulePath = mergeModulePath;
     this.lcid = lcid;
 }
예제 #3
0
        /// <summary>
        /// Processes an element for the Compiler.
        /// </summary>
        /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
        /// <param name="parentElement">Parent element of element to process.</param>
        /// <param name="element">Element to process.</param>
        /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
        public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element)
        {
            switch (parentElement.LocalName)
            {
                case "File":
                    switch (element.LocalName)
                    {
                        case "SnapIn":
                            string fileName = parentElement.GetAttribute("LongName");
                            if (null == fileName || String.Empty == fileName)
                            {
                                fileName = parentElement.GetAttribute("Name");
                            }

                            XmlElement grandparentElement = (XmlElement)parentElement.ParentNode;
                            string componentId = grandparentElement.GetAttribute("Id");

                            this.ParseSnapInElement(element, fileName, componentId);
                            break;
                        default:
                            this.Core.UnexpectedElement(parentElement, element);
                            break;
                    }
                    break;
                default:
                    this.Core.UnexpectedElement(parentElement, element);
                    break;
            }
        }
예제 #4
0
        /// <summary>
        /// Creates a new generc message event arg.
        /// </summary>
        /// <param name="sourceLineNumbers">Source line numbers for the message.</param>
        /// <param name="id">Id for the message.</param>
        /// <param name="level">Level for the message.</param>
        /// <param name="format">Format message for arguments.</param>
        /// <param name="messageArgs">Arguments for the format string.</param>
        public WixGenericMessageEventArgs(SourceLineNumberCollection sourceLineNumbers, int id, MessageLevel level, string format, params object[] messageArgs)
            : base(sourceLineNumbers, id, format, messageArgs)
        {
            this.resourceManager = new GenericResourceManager();

            this.Level = level;
        }
예제 #5
0
 /// <summary>
 /// Processes an attribute for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of element to process.</param>
 /// <param name="attribute">Attribute to process.</param>
 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
 public override void ParseAttribute(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlAttribute attribute, Dictionary<string, string> contextValues)
 {
     switch (parentElement.LocalName)
     {
         case "Extension":
             // at the time the IsRichSavedGame extension attribute is parsed, the compiler
             // might not yet have parsed the Id attribute, so we need to get it directly
             // from the parent element and put it into the contextValues dictionary.
             string extensionId = parentElement.GetAttribute("Id");
             if (String.IsNullOrEmpty(extensionId))
             {
                 this.Core.OnMessage(WixErrors.ExpectedParentWithAttribute(sourceLineNumbers, "Extension", "IsRichSavedGame", "Id"));
             }
             else
             {
                 contextValues["ExtensionId"] = extensionId;
                 switch (attribute.LocalName)
                 {
                     case "IsRichSavedGame":
                         if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attribute))
                         {
                             this.ProcessIsRichSavedGameAttribute(sourceLineNumbers, contextValues);
                         }
                         break;
                     default:
                         this.Core.UnexpectedAttribute(sourceLineNumbers, attribute);
                         break;
                 }
             }
             break;
         default:
             this.Core.UnexpectedElement(parentElement, parentElement);
             break;
     }
 }
예제 #6
0
 /// <summary>
 /// Processes an element for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of element to process.</param>
 /// <param name="element">Element to process.</param>
 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
 public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, params string[] contextValues)
 {
     switch (parentElement.LocalName)
     {
         case "Bundle":
         case "Fragment":
             switch (element.LocalName)
             {
                 case "Condition":
                     this.ParseConditionElement(element);
                     break;
                 default:
                     this.Core.UnexpectedElement(parentElement, element);
                     break;
             }
             break;
         case "BootstrapperApplicationRef":
             switch (element.LocalName)
             {
                 case "WixStandardBootstrapperApplication":
                     this.ParseWixStandardBootstrapperApplicationElement(element);
                     break;
                 case "WixManagedBootstrapperApplicationHost":
                     this.ParseWixManagedBootstrapperApplicationHostElement(element);
                     break;
                 default:
                     this.Core.UnexpectedElement(parentElement, element);
                     break;
             }
             break;
         default:
             this.Core.UnexpectedElement(parentElement, element);
             break;
     }
 }
예제 #7
0
파일: Output.cs 프로젝트: zooba/wix3
 /// <summary>
 /// Creates a new empty output object.
 /// </summary>
 /// <param name="sourceLineNumbers">The source line information for the output.</param>
 internal Output(SourceLineNumberCollection sourceLineNumbers)
 {
     this.sections = new SectionCollection();
     this.sourceLineNumbers = sourceLineNumbers;
     this.subStorages = new ArrayList();
     this.tables = new TableCollection();
 }
예제 #8
0
파일: BalCompiler.cs 프로젝트: zooba/wix3
 /// <summary>
 /// Processes an attribute for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of element to process.</param>
 /// <param name="attribute">Attribute to process.</param>
 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
 public override void ParseAttribute(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlAttribute attribute, Dictionary<string, string> contextValues)
 {
     switch (parentElement.LocalName)
     {
         case "ExePackage":
         case "MsiPackage":
         case "MspPackage":
         case "MsuPackage":
             string packageId;
             if (!contextValues.TryGetValue("PackageId", out packageId) || String.IsNullOrEmpty(packageId))
             {
                 this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, parentElement.LocalName, "Id", attribute.LocalName));
             }
             else
             {
                 switch (attribute.LocalName)
                 {
                     case "PrereqSupportPackage":
                         if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attribute))
                         {
                             Row row = this.Core.CreateRow(sourceLineNumbers, "MbaPrerequisiteSupportPackage");
                             row[0] = packageId;
                         }
                         break;
                     default:
                         this.Core.UnexpectedAttribute(sourceLineNumbers, attribute);
                         break;
                 }
             }
                 break;
         case "Variable":
             // at the time the extension attribute is parsed, the compiler might not yet have
             // parsed the Name attribute, so we need to get it directly from the parent element.
             string variableName = parentElement.GetAttribute("Name");
             if (String.IsNullOrEmpty(variableName))
             {
                 this.Core.OnMessage(WixErrors.ExpectedParentWithAttribute(sourceLineNumbers, "Variable", "Overridable", "Name"));
             }
             else
             {
                 switch (attribute.LocalName)
                 {
                     case "Overridable":
                         if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attribute))
                         {
                             Row row = this.Core.CreateRow(sourceLineNumbers, "WixStdbaOverridableVariable");
                             row[0] = variableName;
                         }
                         break;
                     default:
                         this.Core.UnexpectedAttribute(sourceLineNumbers, attribute);
                         break;
                 }
             }
             break;
         default:
             this.Core.UnexpectedAttribute(sourceLineNumbers, attribute);
             break;
     }
 }
 /// <summary>
 /// Instantiate new WixInvalidElementException.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line information of the exception.</param>
 /// <param name="elementName">Name of the invalid element.</param>
 /// <param name="detail">Detail about the exception.</param>
 /// <param name="id">Id of the invalid element.</param>
 public WixInvalidElementException(SourceLineNumberCollection sourceLineNumbers, string elementName, string detail, string id)
     : base(sourceLineNumbers, WixExceptionType.InvalidElement)
 {
     this.element = elementName;
     this.id = id;
     this.detail = detail;
 }
예제 #10
0
 /// <summary>
 /// Creates a new MessageEventArgs.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line numbers for the message.</param>
 /// <param name="id">Id for the message.</param>
 /// <param name="level">Level for the message.</param>
 /// <param name="resourceName">Name of the resource.</param>
 /// <param name="messageArgs">Arguments for the format string.</param>
 public MessageEventArgs(SourceLineNumberCollection sourceLineNumbers, int id, int level, string resourceName, params object[] messageArgs)
 {
     this.sourceLineNumbers = sourceLineNumbers;
     this.id = id;
     this.level = level;
     this.resourceName = resourceName;
     this.messageArgs = messageArgs;
 }
 /// <summary>
 /// Instantiate a new WixDuplicatePrimaryKeyException.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line information of the exception.</param>
 /// <param name="tableName">Name of the table with duplicate primary keys.</param>
 /// <param name="keyValues">List of key values that are duplicated.</param>
 /// <param name="columnNames">List of columns with duplicated values.</param>
 /// <param name="detail">Detail information about the exception.</param>
 /// <param name="innerException">The exception that is the cause of the current exception.</param>
 public WixDuplicatePrimaryKeyException(SourceLineNumberCollection sourceLineNumbers, string tableName, ArrayList keyValues, ArrayList columnNames, string detail, Exception innerException)
     : base(sourceLineNumbers, WixExceptionType.DuplicateSymbol, innerException)
 {
     this.tableName = tableName;
     this.keyValues = keyValues;
     this.columnNames = columnNames;
     this.detail = detail;
 }
 /// <summary>
 /// Instantiate a new WixProhibitedAttributeException.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line information of the exception.</param>
 /// <param name="elementName">Name of the element containing the prohibited attribute.</param>
 /// <param name="attributeName">Name of the prohibited attribute.</param>
 /// <param name="id">Id of the element containing the prohibited attribute.</param>
 /// <param name="otherAttribute">Name of another attribute that makes this one prohibited.</param>
 /// <param name="otherAttributeValue">Value of another attribute that makes this one prohibited.</param>
 public WixProhibitedAttributeException(SourceLineNumberCollection sourceLineNumbers, string elementName, string attributeName, string id, string otherAttribute, string otherAttributeValue)
     : base(sourceLineNumbers, WixExceptionType.ProhibitedAttribute)
 {
     this.element = elementName;
     this.id = id;
     this.attribute = attributeName;
     this.otherAttribute = otherAttribute;
     this.otherAttributeValue = otherAttributeValue;
 }
예제 #13
0
파일: Row.cs 프로젝트: bleissem/wix3
        /// <summary>
        /// Creates a row that belongs to a table.
        /// </summary>
        /// <param name="sourceLineNumbers">Original source lines for this row.</param>
        /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
        /// <remarks>The compiler should use this constructor exclusively.</remarks>
        public Row(SourceLineNumberCollection sourceLineNumbers, Table table)
            : this(sourceLineNumbers, (null != table ? table.Definition : null))
        {
            if (null == table)
            {
                throw new ArgumentNullException("table");
            }

            this.table = table;
        }
예제 #14
0
파일: FileRow.cs 프로젝트: zooba/wix3
 /// <summary>
 /// Creates a File row that belongs to a table.
 /// </summary>
 /// <param name="sourceLineNumbers">Original source lines for this row.</param>
 /// <param name="table">Table this File row belongs to and should get its column definitions from.</param>
 public FileRow(SourceLineNumberCollection sourceLineNumbers, Table table)
     : base(sourceLineNumbers, table)
 {
     this.assemblyType = FileAssemblyType.NotAnAssembly;
     this.previousSource = new string[1];
     this.previousSymbols = new string[1];
     this.previousRetainOffsets = new string[1];
     this.previousRetainLengths = new string[1];
     this.previousIgnoreOffsets = new string[1];
     this.previousIgnoreLengths = new string[1];
 }
예제 #15
0
파일: VSCompiler.cs 프로젝트: zooba/wix3
 /// <summary>
 /// Processes an element for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of element to process.</param>
 /// <param name="element">Element to process.</param>
 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
 public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, params string[] contextValues)
 {
     switch (parentElement.LocalName)
     {
         case "Component":
             switch (element.LocalName)
             {
                 case "VsixPackage":
                     this.ParseVsixPackageElement(element, contextValues[0], null);
                     break;
                 default:
                     base.ParseElement(sourceLineNumbers, parentElement, element, contextValues);
                     break;
             }
             break;
         case "File":
             switch (element.LocalName)
             {
                 case "HelpCollection":
                     this.ParseHelpCollectionElement(element, contextValues[0]);
                     break;
                 case "HelpFile":
                     this.ParseHelpFileElement(element, contextValues[0]);
                     break;
                 case "VsixPackage":
                     this.ParseVsixPackageElement(element, contextValues[1], contextValues[0]);
                     break;
                 default:
                     base.ParseElement(sourceLineNumbers, parentElement, element, contextValues);
                     break;
             }
             break;
         case "Fragment":
         case "Module":
         case "Product":
             switch (element.LocalName)
             {
                 case "HelpCollectionRef":
                     this.ParseHelpCollectionRefElement(element);
                     break;
                 case "HelpFilter":
                     this.ParseHelpFilterElement(element);
                     break;
                 default:
                     base.ParseElement(sourceLineNumbers, parentElement, element, contextValues);
                     break;
             }
             break;
         default:
             base.ParseElement(sourceLineNumbers, parentElement, element, contextValues);
             break;
     }
 }
예제 #16
0
        /// <summary>
        /// Creates a new MessageEventArgs.
        /// </summary>
        /// <param name="sourceLineNumbers">Source line numbers for the message.</param>
        /// <param name="id">Id for the message.</param>
        /// <param name="resourceName">Name of the resource.</param>
        /// <param name="messageArgs">Arguments for the format string.</param>
        protected MessageEventArgs(SourceLineNumberCollection sourceLineNumbers, int id, string resourceName, params object[] messageArgs)
        {
            this.sourceLineNumbers = sourceLineNumbers;
            this.id = id;
            this.resourceName = resourceName;
            this.messageArgs = messageArgs;

            // Default to Nothing, since the default MessageEventArgs container
            // classes define a level, and only WixErrorEventArgs previously
            // determined that an error occured without throwing.
            this.level = MessageLevel.Nothing;
        }
예제 #17
0
        public PayloadInfoRow(SourceLineNumberCollection sourceLineNumbers, Output output, string id, string name, string sourceFile,
            bool contentFile, bool suppressSignatureValidation, string downloadUrl, string container, PackagingType packaging) :
            base(sourceLineNumbers, output.Tables["PayloadInfo"])
        {
            this.Id = id;
            this.Name = name;
            this.SourceFile = sourceFile;
            this.ContentFile = contentFile;
            this.SuppressSignatureValidation = suppressSignatureValidation;
            this.DownloadUrl = downloadUrl;
            this.Container = container;
            this.Packaging = packaging;

            this.Resolve();
        }
예제 #18
0
        /// <summary>
        /// Processes an element for the Compiler.
        /// </summary>
        /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
        /// <param name="parentElement">Parent element of element to process.</param>
        /// <param name="element">Element to process.</param>
        /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
        public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement,
                                          XmlElement element, params string[] contextValues)
        {
            switch (parentElement.LocalName)
            {
                case "File":
                    string componentId = contextValues[1];

                    var fileName =
                        Core.GetAttributeLongFilename(sourceLineNumbers, parentElement.Attributes["Name"], false);

                    switch (element.LocalName)
                    {
                        case "PublishStencil":
                            ParseVisioElement(element, componentId, fileName, VisioContentType.Stencil);
                            break;

                        case "PublishTemplate":
                            ParseVisioElement(element, componentId, fileName, VisioContentType.Template);
                            break;

                        case "PublishHelpFile":
                            ParseVisioElement(element, componentId, fileName, VisioContentType.Help);
                            break;

                        case "PublishAddon":
                            ParseVisioElement(element, componentId, fileName, VisioContentType.Addon);
                            break;

                        case "Publish":
                            Core.OnMessage(VisioErrors.UsingPublish(sourceLineNumbers));
                            break;

                        default:
                            Core.UnexpectedElement(parentElement, element);
                            break;
                    }
                    break;
                default:
                    Core.UnexpectedElement(parentElement, element);
                    break;
            }
        }
예제 #19
0
   public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, 
 XmlElement parentElement, XmlElement element, params string[] contextValues)
   {
       switch (parentElement.LocalName)
         {
       case "Product":
         switch (element.LocalName)
         {
       case "UIType":
         ParseUITypeElement(element);
         break;
       case "MefPlugin":
         ParseMefPluginElement(element);
         break;
       default:
         Core.UnexpectedElement(parentElement, element);
         break;
         }
         break;
       case "Component":
         string componentId = contextValues[0];
         switch (element.LocalName)
         {
       case "SqlTemplateFiles":
         ParseSqlTemplateFilesElement(element, componentId);
         break;
       case "SqlScriptFile":
         ParseSqlScriptFileElement(element, componentId);
         break;
       case "SqlExtendedProcedures":
         ParseSqlExtendedProcedures(element, componentId);
         break;
       default:
         Core.UnexpectedElement(parentElement, element);
         break;
         }
         break;
       default:
         Core.UnexpectedElement(parentElement, element);
         break;
         }
   }
예제 #20
0
 /// <summary>
 /// Processes an element for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of element to process.</param>
 /// <param name="element">Element to process.</param>
 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
 public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, params string[] contextValues)
 {
     switch (parentElement.LocalName)
     {
         case "Bundle":
             switch (element.LocalName)
             {
                 case "Tag":
                     this.ParseBundleTagElement(element);
                     break;
                 default:
                     this.Core.UnexpectedElement(parentElement, element);
                     break;
             }
             break;
         case "Product":
             switch (element.LocalName)
             {
                 case "Tag":
                     this.ParseProductTagElement(element);
                     break;
                 default:
                     this.Core.UnexpectedElement(parentElement, element);
                     break;
             }
             break;
         case "PatchFamily":
             switch (element.LocalName)
             {
                 case "TagRef":
                     this.ParseTagRefElement(element);
                     break;
                 default:
                     this.Core.UnexpectedElement(parentElement, element);
                     break;
             }
             break;
         default:
             this.Core.UnexpectedElement(parentElement, element);
             break;
     }
 }
예제 #21
0
 /// <summary>
 /// Processes an element for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of element to process.</param>
 /// <param name="element">Element to process.</param>
 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
 public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, params string[] contextValues)
 {
     switch (parentElement.LocalName)
     {
         case "Component":
             switch (element.LocalName)
             {
                 case "JavaArchive":
                     this.ParseJavaArchiveElement(element);
                     break;
                 default:
                     this.Core.UnexpectedElement(parentElement, element);
                     break;
             }
             break;
         default:
             this.Core.UnexpectedElement(parentElement, element);
             break;
     }
 }
 /// <summary>
 /// Processes an attribute for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of attribute.</param>
 /// <param name="attribute">Attribute to process.</param>
 public override void ParseAttribute(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlAttribute attribute)
 {
     switch (parentElement.LocalName)
     {
         case "Bundle":
             switch (attribute.LocalName)
             {
                 case "ProviderKey":
                     this.ParseProviderKeyAttribute(sourceLineNumbers, parentElement, attribute);
                     break;
                 default:
                     this.Core.UnexpectedAttribute(sourceLineNumbers, attribute);
                     break;
             }
             break;
         default:
             this.Core.UnexpectedAttribute(sourceLineNumbers, attribute);
             break;
     }
 }
예제 #23
0
파일: NetFxCompiler.cs 프로젝트: zooba/wix3
        /// <summary>
        /// Processes an element for the Compiler.
        /// </summary>
        /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
        /// <param name="parentElement">Parent element of element to process.</param>
        /// <param name="element">Element to process.</param>
        /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
        public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, params string[] contextValues)
        {
            switch (parentElement.LocalName)
            {
                case "File":
                    string fileId = contextValues[0];

                    switch (element.LocalName)
                    {
                        case "NativeImage":
                            this.ParseNativeImageElement(element, fileId);
                            break;
                        default:
                            this.Core.UnexpectedElement(parentElement, element);
                            break;
                    }
                    break;
                default:
                    this.Core.UnexpectedElement(parentElement, element);
                    break;
            }
        }
예제 #24
0
        /// <summary>
        /// Processes an element for the Compiler.
        /// </summary>
        /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
        /// <param name="parentElement">Parent element of element to process.</param>
        /// <param name="element">Element to process.</param>
        /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
        public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, params string[] contextValues)
        {
            switch (parentElement.LocalName)
            {
                case "Component":
                    string componentId = contextValues[0];
                    string directoryId = contextValues[1];

                    switch (element.LocalName)
                    {
                        case "Driver":
                            this.ParseDriverElement(element, componentId);
                            break;
                        default:
                            this.Core.UnexpectedElement(parentElement, element);
                            break;
                    }
                    break;
                default:
                    this.Core.UnexpectedElement(parentElement, element);
                    break;
            }
        }
예제 #25
0
파일: LuxCompiler.cs 프로젝트: zooba/wix3
 /// <summary>
 /// Processes an element for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of element to process.</param>
 /// <param name="element">Element to process.</param>
 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
 public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, params string[] contextValues)
 {
     switch (parentElement.LocalName)
     {
         case "Product":
             switch (element.LocalName)
             {
                 case "UnitTestRef":
                     this.ParseUnitTestRefElement(element);
                     break;
                 default:
                     this.Core.UnexpectedElement(parentElement, element);
                     break;
             }
             break;
         case "Fragment":
             switch (element.LocalName)
             {
                 case "Mutation":
                     this.ParseMutationElement(element);
                     break;
                 case "UnitTest":
                     this.ParseUnitTestElement(element, null);
                     break;
                 case "UnitTestRef":
                     this.ParseUnitTestRefElement(element);
                     break;
                 default:
                     this.Core.UnexpectedElement(parentElement, element);
                     break;
             }
             break;
         default:
             this.Core.UnexpectedElement(parentElement, element);
             break;
     }
 }
예제 #26
0
        /// <summary>
        /// Processes an element for the Compiler.
        /// </summary>
        /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
        /// <param name="parentElement">Parent element of element to process.</param>
        /// <param name="element">Element to process.</param>
        /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
        public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, params string[] contextValues)
        {
            switch (parentElement.LocalName)
            {
                case "ServiceInstall":
                    string serviceInstallName = contextValues[1];
                    string serviceUser = String.IsNullOrEmpty(serviceInstallName) ? null : String.Concat("NT SERVICE\\", serviceInstallName);
                    string serviceComponentId = contextValues[2];

                    switch (element.LocalName)
                    {
                        case "UrlReservation":
                            this.ParseUrlReservationElement(element, serviceComponentId, serviceUser);
                            break;
                        default:
                            this.Core.UnexpectedElement(parentElement, element);
                            break;
                    }
                    break;
                case "Component":
                    string componentId = contextValues[0];

                    switch (element.LocalName)
                    {
                        case "UrlReservation":
                            this.ParseUrlReservationElement(element, componentId, null);
                            break;
                        default:
                            this.Core.UnexpectedElement(parentElement, element);
                            break;
                    }
                    break;
                default:
                    this.Core.UnexpectedElement(parentElement, element);
                    break;
            }
        }
예제 #27
0
        /// <summary>
        /// Processes an element for the Compiler.
        /// </summary>
        /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
        /// <param name="parentElement">Parent element of element to process.</param>
        /// <param name="element">Element to process.</param>
        /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
        public override void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, params string[] contextValues)
        {
            switch (parentElement.LocalName)
            {
                case "File":
                    string fileId = contextValues[0];
                    string fileComponentId = contextValues[1];

                    switch (element.LocalName)
                    {
                        case "FirewallException":
                            this.ParseFirewallExceptionElement(element, fileComponentId, fileId);
                            break;
                        default:
                            this.Core.UnexpectedElement(parentElement, element);
                            break;
                    }
                    break;
                case "Component":
                    string componentId = contextValues[0];

                    switch (element.LocalName)
                    {
                        case "FirewallException":
                            this.ParseFirewallExceptionElement(element, componentId, null);
                            break;
                        default:
                            this.Core.UnexpectedElement(parentElement, element);
                            break;
                    }
                    break;
                default:
                    this.Core.UnexpectedElement(parentElement, element);
                    break;
            }
        }
예제 #28
0
 /// <summary>
 /// Processes an attribute for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of attribute.</param>
 /// <param name="attribute">Attribute to process.</param>
 public abstract void ParseAttribute(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlAttribute attribute);
예제 #29
0
 /// <summary>
 /// Creates an Upgrade row that belongs to a table.
 /// </summary>
 /// <param name="sourceLineNumbers">Original source lines for this row.</param>
 /// <param name="table">Table this Upgrade row belongs to and should get its column definitions from.</param>
 public UpgradeRow(SourceLineNumberCollection sourceLineNumbers, Table table) :
     base(sourceLineNumbers, table)
 {
 }
예제 #30
0
 /// <summary>
 /// Instantiate a new WixInvalidIdtException.
 /// </summary>
 /// <param name="idtFile">The invalid idt file.</param>
 /// <param name="tableName">The table name of the invalid idt file.</param>
 public WixInvalidIdtException(string idtFile, string tableName) :
     base(WixErrors.InvalidIdt(SourceLineNumberCollection.FromFileName(idtFile), tableName))
 {
 }
예제 #31
0
 /// <summary>Creates a Merge row that belongs to a table.</summary>
 /// <param name="sourceLineNumbers">Original source lines for this row.</param>
 /// <param name="table">Table this Merge row belongs to and should get its column definitions from.</param>
 public WixMergeRow(SourceLineNumberCollection sourceLineNumbers, Table table) :
     base(sourceLineNumbers, table)
 {
 }
예제 #32
0
        /// <summary>
        /// Processes an XmlReader and builds up the output object.
        /// </summary>
        /// <param name="reader">Reader to get data from.</param>
        /// <param name="suppressVersionCheck">Suppresses wix.dll version mismatch check.</param>
        /// <returns>The Output represented by the Xml.</returns>
        internal static Output Parse(XmlReader reader, bool suppressVersionCheck)
        {
            Debug.Assert("wixOutput" == reader.LocalName);

            bool        empty       = reader.IsEmptyElement;
            Output      output      = new Output(SourceLineNumberCollection.FromUri(reader.BaseURI));
            SectionType sectionType = SectionType.Unknown;
            Version     version     = null;

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "codepage":
                    output.codepage = Convert.ToInt32(reader.Value, CultureInfo.InvariantCulture.NumberFormat);
                    break;

                case "type":
                    switch (reader.Value)
                    {
                    case "Bundle":
                        output.type = OutputType.Bundle;
                        sectionType = SectionType.Bundle;
                        break;

                    case "Module":
                        output.type = OutputType.Module;
                        sectionType = SectionType.Module;
                        break;

                    case "Patch":
                        output.type = OutputType.Patch;
                        break;

                    case "PatchCreation":
                        output.type = OutputType.PatchCreation;
                        sectionType = SectionType.PatchCreation;
                        break;

                    case "Product":
                        output.type = OutputType.Product;
                        sectionType = SectionType.Product;
                        break;

                    case "Transform":
                        output.type = OutputType.Transform;
                        break;

                    default:
                        throw new WixException(WixErrors.IllegalAttributeValue(SourceLineNumberCollection.FromUri(reader.BaseURI), "wixOutput", reader.Name, reader.Value, "Module", "Patch", "PatchCreation", "Product", "Transform"));
                    }
                    break;

                case "version":
                    version = new Version(reader.Value);
                    break;

                default:
                    if (!reader.NamespaceURI.StartsWith("http://www.w3.org/", StringComparison.Ordinal))
                    {
                        throw new WixException(WixErrors.UnexpectedAttribute(SourceLineNumberCollection.FromUri(reader.BaseURI), "wixOutput", reader.Name));
                    }
                    break;
                }
            }

            if (null != version && !suppressVersionCheck)
            {
                if (0 != currentVersion.CompareTo(version))
                {
                    throw new WixException(WixErrors.VersionMismatch(SourceLineNumberCollection.FromUri(reader.BaseURI), "wixOutput", version.ToString(), currentVersion.ToString()));
                }
            }

            // create a section for all the rows to belong to
            output.entrySection = new Section(null, sectionType, output.codepage);

            TableDefinitionCollection tableDefinitions = null;

            // loop through the rest of the xml building up the Output object
            if (!empty)
            {
                bool done = false;

                // loop through all the fields in a row
                while (!done && reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case XmlNodeType.Element:
                        switch (reader.LocalName)
                        {
                        case "subStorage":
                            output.SubStorages.Add(SubStorage.Parse(reader));
                            break;

                        case "table":
                            if (null == tableDefinitions)
                            {
                                throw new WixException(WixErrors.ExpectedElement(SourceLineNumberCollection.FromUri(reader.BaseURI), "wixOutput", "tableDefinitions"));
                            }
                            output.Tables.Add(Table.Parse(reader, output.entrySection, tableDefinitions));
                            break;

                        case "tableDefinitions":
                            tableDefinitions = TableDefinitionCollection.Parse(reader);
                            break;

                        default:
                            throw new WixException(WixErrors.UnexpectedElement(SourceLineNumberCollection.FromUri(reader.BaseURI), "wixOutput", reader.Name));
                        }
                        break;

                    case XmlNodeType.EndElement:
                        done = true;
                        break;
                    }
                }

                if (!done)
                {
                    throw new WixException(WixErrors.ExpectedEndElement(SourceLineNumberCollection.FromUri(reader.BaseURI), "wixOutput"));
                }
            }

            return(output);
        }
예제 #33
0
        /// <summary>
        /// Parse a section from the xml.
        /// </summary>
        /// <param name="reader">XmlReader where the intermediate is persisted.</param>
        /// <param name="tableDefinitions">TableDefinitions to use in the intermediate.</param>
        /// <returns>The parsed Section.</returns>
        internal static Section Parse(XmlReader reader, TableDefinitionCollection tableDefinitions)
        {
            Debug.Assert("section" == reader.LocalName);

            int         codepage = 0;
            bool        empty    = reader.IsEmptyElement;
            string      id       = null;
            Section     section  = null;
            SectionType type     = SectionType.Unknown;

            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                case "codepage":
                    codepage = Convert.ToInt32(reader.Value, CultureInfo.InvariantCulture);
                    break;

                case "id":
                    id = reader.Value;
                    break;

                case "type":
                    switch (reader.Value)
                    {
                    case "fragment":
                        type = SectionType.Fragment;
                        break;

                    case "module":
                        type = SectionType.Module;
                        break;

                    case "patchCreation":
                        type = SectionType.PatchCreation;
                        break;

                    case "product":
                        type = SectionType.Product;
                        break;

                    case "patch":
                        type = SectionType.Patch;
                        break;

                    default:
                        throw new WixException(WixErrors.IllegalAttributeValue(SourceLineNumberCollection.FromUri(reader.BaseURI), "section", reader.Name, reader.Value, "fragment", "module", "patchCreation", "product", "patch"));
                    }
                    break;

                default:
                    if (!reader.NamespaceURI.StartsWith("http://www.w3.org/"))
                    {
                        throw new WixException(WixErrors.UnexpectedAttribute(SourceLineNumberCollection.FromUri(reader.BaseURI), "section", reader.Name));
                    }
                    break;
                }
            }

            if (null == id && (SectionType.Unknown != type && SectionType.Fragment != type))
            {
                throw new WixException(WixErrors.ExpectedAttribute(SourceLineNumberCollection.FromUri(reader.BaseURI), "section", "id", "type", type.ToString()));
            }

            if (SectionType.Unknown == type)
            {
                throw new WixException(WixErrors.ExpectedAttribute(SourceLineNumberCollection.FromUri(reader.BaseURI), "section", "type"));
            }

            section = new Section(id, type, codepage);
            section.sourceLineNumbers = SourceLineNumberCollection.FromUri(reader.BaseURI);

            if (!empty)
            {
                bool done = false;

                while (!done && reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case XmlNodeType.Element:
                        switch (reader.LocalName)
                        {
                        case "table":
                            section.Tables.Add(Table.Parse(reader, section, tableDefinitions));
                            break;

                        default:
                            throw new WixException(WixErrors.UnexpectedElement(SourceLineNumberCollection.FromUri(reader.BaseURI), "section", reader.Name));
                        }
                        break;

                    case XmlNodeType.EndElement:
                        done = true;
                        break;
                    }
                }

                if (!done)
                {
                    throw new WixException(WixErrors.ExpectedEndElement(SourceLineNumberCollection.FromUri(reader.BaseURI), "section"));
                }
            }

            return(section);
        }
예제 #34
0
 /// <summary>
 /// Creates a Media row that belongs to a table.
 /// </summary>
 /// <param name="sourceLineNumbers">Original source lines for this row.</param>
 /// <param name="table">Table this Media row belongs to and should get its column definitions from.</param>
 public MediaRow(SourceLineNumberCollection sourceLineNumbers, Table table) :
     base(sourceLineNumbers, table)
 {
 }
예제 #35
0
 /// <summary>
 /// Creates a Media row that does not belong to a table.
 /// </summary>
 /// <param name="sourceLineNumbers">Original source lines for this row.</param>
 /// <param name="tableDef">TableDefinition this Media row belongs to and should get its column definitions from.</param>
 public MediaRow(SourceLineNumberCollection sourceLineNumbers, TableDefinition tableDef) :
     base(sourceLineNumbers, tableDef)
 {
 }
예제 #36
0
 /// <summary>
 /// Sends a warning to the message delegate if there is one.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line numbers.</param>
 /// <param name="warningLevel">Level of the warning message.</param>
 /// <param name="warningMessage">Warning message string.</param>
 public void OnExtensionWarning(SourceLineNumberCollection sourceLineNumbers, WarningLevel warningLevel, string warningMessage)
 {
     this.OnMessage(WixWarnings.LibrarianExtensionWarning(sourceLineNumbers, warningLevel, warningMessage));
 }
예제 #37
0
 /// <summary>
 /// Sends an error to the message delegate if there is one.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line numbers.</param>
 /// <param name="errorLevel">Level of the error message.</param>
 /// <param name="errorMessage">Error message string.</param>
 public void OnExtensionError(SourceLineNumberCollection sourceLineNumbers, ErrorLevel errorLevel, string errorMessage)
 {
     this.OnMessage(WixErrors.LibrarianExtensionError(sourceLineNumbers, errorLevel, errorMessage));
 }
예제 #38
0
 /// <summary>
 /// Instantiate a new WixSchemaValidationException.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line information of the exception.</param>
 /// <param name="innerException">The exception that is the cause of the current exception.</param>
 public WixInvalidXmlException(SourceLineNumberCollection sourceLineNumbers, XmlException innerException) :
     base(sourceLineNumbers, WixExceptionType.InvalidXml, innerException)
 {
 }
예제 #39
0
 /// <summary>
 /// Processes an element for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of element to process.</param>
 /// <param name="element">Element to process.</param>
 public abstract void ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element);
예제 #40
0
            /// <summary>
            /// Creates a file transfer if the source and destination are different.
            /// </summary>
            /// <param name="source">Source path to file.</param>
            /// <param name="destination">Destination path for file.</param>
            /// <param name="move">File if file should be moved (optimal).</param>
            /// <param name="type">Optional type of file this transfer is transferring.</param>
            /// <param name="sourceLineNumbers">Optional source line numbers wher this transfer originated.</param>
            /// <returns>true if the source and destination are the different, false if no file transfer is created.</returns>
            public static bool TryCreate(string source, string destination, bool move, string type, SourceLineNumberCollection sourceLineNumbers, out FileTransfer transfer)
            {
                string sourceFullPath     = null;
                string fileLayoutFullPath = null;

                try
                {
                    sourceFullPath = Path.GetFullPath(source);
                }
                catch (System.ArgumentException)
                {
                    throw new WixException(WixErrors.InvalidFileName(sourceLineNumbers, source));
                }
                catch (System.IO.PathTooLongException)
                {
                    throw new WixException(WixErrors.PathTooLong(sourceLineNumbers, source));
                }

                try
                {
                    fileLayoutFullPath = Path.GetFullPath(destination);
                }
                catch (System.ArgumentException)
                {
                    throw new WixException(WixErrors.InvalidFileName(sourceLineNumbers, destination));
                }
                catch (System.IO.PathTooLongException)
                {
                    throw new WixException(WixErrors.PathTooLong(sourceLineNumbers, destination));
                }

                // if the current source path (where we know that the file already exists) and the resolved
                // path as dictated by the Directory table are not the same, then propagate the file.  The
                // image that we create may have already been done by some other process other than the linker, so
                // there is no reason to copy the files to the resolved source if they are already there.
                if (String.Equals(sourceFullPath, fileLayoutFullPath, StringComparison.OrdinalIgnoreCase))
                {
                    // TODO: would prefer to return null here.
                    transfer           = new FileTransfer(); // create an empty transfer because we must.
                    transfer.Redundant = true;
                    return(false);
                }

                transfer = new FileTransfer(source, destination, move, type, sourceLineNumbers);
                return(true);
            }
 /// <summary>
 /// Instantiate a new WixInvalidIdtException.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line information of the exception.</param>
 /// <param name="tableName">Name of the table that could not be imported with an idt file.</param>
 /// <param name="fileName">Name of the idt file that was invalid.</param>
 /// <param name="innerException">The exception that is the cause of the current exception.</param>
 public WixInvalidIdtException(SourceLineNumberCollection sourceLineNumbers, string tableName, string fileName, Exception innerException) :
     base(sourceLineNumbers, WixExceptionType.InvalidIdt, innerException)
 {
     this.tableName = tableName;
     this.idtPath   = new FileInfo(fileName);
 }
예제 #42
0
 /// <summary>
 /// Resolves the source path of a file.
 /// </summary>
 /// <param name="source">Original source value.</param>
 /// <param name="type">Optional type of source file being resolved.</param>
 /// <param name="sourceLineNumbers">Optional source line of source file being resolved.</param>
 /// <returns>Should return a valid path for the stream to be imported.</returns>
 public virtual string ResolveFile(string source, string type, SourceLineNumberCollection sourceLineNumber)
 {
     return(ResolveFile(source));
 }
예제 #43
0
        /// <summary>
        /// Loads an output from a path on disk.
        /// </summary>
        /// <param name="stream">Stream containing the output file.</param>
        /// <param name="uri">Uri for finding this stream.</param>
        /// <param name="suppressVersionCheck">Suppresses wix.dll version mismatch check.</param>
        /// <param name="suppressSchema">Suppress xml schema validation while loading.</param>
        /// <returns>Returns the loaded output.</returns>
        /// <remarks>This method will set the Path and SourcePath properties to the appropriate values on successful load.</remarks>
        internal static Output Load(Stream stream, Uri uri, bool suppressVersionCheck, bool suppressSchema)
        {
            XmlReader          reader             = null;
            TempFileCollection tempFileCollection = null;
            string             cabPath            = null;

            // look for the Microsoft cabinet file header and save the cabinet data if found
            if ('M' == stream.ReadByte() && 'S' == stream.ReadByte() && 'C' == stream.ReadByte() && 'F' == stream.ReadByte())
            {
                long   cabFileSize  = 0;
                byte[] offsetBuffer = new byte[4];
                tempFileCollection = new TempFileCollection();
                cabPath            = tempFileCollection.AddExtension("cab", false);

                // skip the header checksum
                stream.Seek(4, SeekOrigin.Current);

                // get the cabinet file size
                stream.Read(offsetBuffer, 0, 4);
                cabFileSize = BitConverter.ToInt32(offsetBuffer, 0);

                stream.Seek(0, SeekOrigin.Begin);

                // Create the cab file from stream
                using (FileStream fs = File.Create(cabPath))
                {
                    for (int i = 0; i < cabFileSize; i++)
                    {
                        fs.WriteByte((byte)stream.ReadByte());
                    }
                }
            }
            else // plain xml file - start reading xml at the beginning of the stream
            {
                stream.Seek(0, SeekOrigin.Begin);
            }

            // read the xml
            try
            {
                reader = new XmlTextReader(uri.AbsoluteUri, stream);

                if (!suppressSchema)
                {
                    reader = new XmlValidatingReader(reader);
                    ((XmlValidatingReader)reader).Schemas.Add(GetSchemas());
                }

                reader.MoveToContent();

                if ("wixOutput" != reader.LocalName)
                {
                    throw new WixNotOutputException(WixErrors.InvalidDocumentElement(SourceLineNumberCollection.FromUri(reader.BaseURI), reader.Name, "output", "wixOutput"));
                }

                Output output = Parse(reader, suppressVersionCheck);
                output.tempFileCollection = tempFileCollection;
                output.cabPath            = cabPath;

                return(output);
            }
            catch (XmlException xe)
            {
                throw new WixException(WixErrors.InvalidXml(SourceLineNumberCollection.FromUri(reader.BaseURI), "output", xe.Message));
            }
            catch (XmlSchemaException xse)
            {
                throw new WixException(WixErrors.SchemaValidationFailed(SourceLineNumberCollection.FromUri(reader.BaseURI), xse.Message, xse.LineNumber, xse.LinePosition));
            }
            finally
            {
                if (null != reader)
                {
                    reader.Close();
                }
            }
        }
예제 #44
0
        /// <summary>
        /// Resolves the source path of a file.
        /// </summary>
        /// <param name="source">Original source value.</param>
        /// <param name="type">Optional type of source file being resolved.</param>
        /// <param name="sourceLineNumbers">Optional source line of source file being resolved.</param>
        /// <param name="bindStage">The binding stage used to determine what collection of bind paths will be used</param>
        /// <returns>Should return a valid path for the stream to be imported.</returns>
        public virtual string ResolveFile(string source, string type, SourceLineNumberCollection sourceLineNumbers, BindStage bindStage)
        {
            // the following new local variables are used for bind path and protect the changes to object field.
            StringCollection    currentBindPaths      = null;
            NameValueCollection currentNamedBindPaths = null;
            StringCollection    currentSourcePaths    = null;

            if (String.IsNullOrEmpty(source))
            {
                throw new ArgumentNullException("source");
            }

            // Call the original override function first. If it returns an answer then return that,
            // otherwise using the default resolving logic
            string filePath = this.ResolveFile(source, type, sourceLineNumbers);

            if (!String.IsNullOrEmpty(filePath))
            {
                return(filePath);
            }

            // Assign the correct bind path to file manager
            currentSourcePaths    = this.sourcePaths[bindStage];
            currentNamedBindPaths = this.namedBindPaths[bindStage];
            if (BindStage.Target != bindStage && BindStage.Updated != bindStage)
            {
                currentBindPaths = this.bindPaths[bindStage];
            }
            else
            {
                currentBindPaths = this.sourcePaths[bindStage];
            }

            // If the path is rooted, it better exist or we're not going to find it.
            if (Path.IsPathRooted(source))
            {
                if (BinderFileManager.CheckFileExists(source))
                {
                    return(source);
                }
            }
            else // not a rooted path so let's try applying all the different source resolution options.
            {
                const string bindPathOpenString = "!(bindpath.";

                if (source.StartsWith(bindPathOpenString, StringComparison.Ordinal) && source.IndexOf(')') != -1)
                {
                    int      bindpathSignatureLength = bindPathOpenString.Length;
                    string   name   = source.Substring(bindpathSignatureLength, source.IndexOf(')') - bindpathSignatureLength);
                    string[] values = currentNamedBindPaths.GetValues(name);

                    if (null != values)
                    {
                        foreach (string bindPath in values)
                        {
                            // Parse out '\\' chars that separate the "bindpath" variable and the next part of the path,
                            // because Path.Combine() thinks that rooted second paths don't need the first path.
                            string nameSection = string.Empty;
                            int    nameStart   = bindpathSignatureLength + 1 + name.Length; // +1 for the closing bracket.

                            nameSection = source.Substring(nameStart).TrimStart('\\');
                            filePath    = Path.Combine(bindPath, nameSection);

                            if (BinderFileManager.CheckFileExists(filePath))
                            {
                                return(filePath);
                            }
                        }
                    }
                }
                else if (source.StartsWith("SourceDir\\", StringComparison.Ordinal) || source.StartsWith("SourceDir/", StringComparison.Ordinal))
                {
                    foreach (string bindPath in currentBindPaths)
                    {
                        filePath = Path.Combine(bindPath, source.Substring(10));
                        if (BinderFileManager.CheckFileExists(filePath))
                        {
                            return(filePath);
                        }
                    }
                }
                else if (BinderFileManager.CheckFileExists(source))
                {
                    return(source);
                }

                foreach (string path in currentSourcePaths)
                {
                    filePath = Path.Combine(path, source);
                    if (BinderFileManager.CheckFileExists(filePath))
                    {
                        return(filePath);
                    }

                    if (source.StartsWith("SourceDir\\", StringComparison.Ordinal) || source.StartsWith("SourceDir/", StringComparison.Ordinal))
                    {
                        filePath = Path.Combine(path, source.Substring(10));
                        if (BinderFileManager.CheckFileExists(filePath))
                        {
                            return(filePath);
                        }
                    }
                }
            }

            // Didn't find the file.
            throw new WixFileNotFoundException(sourceLineNumbers, source, type);
        }
예제 #45
0
        /// <summary>
        /// Resolves the source path of a file related to another file's source.
        /// </summary>
        /// <param name="source">Original source value.</param>
        /// <param name="relatedSource">Source related to original source.</param>
        /// <param name="type">Optional type of source file being resolved.</param>
        /// <param name="sourceLineNumbers">Optional source line of source file being resolved.</param>
        /// <param name="bindStage">The binding stage used to determine what collection of bind paths will be used</param>
        /// <returns>Should return a valid path for the stream to be imported.</returns>
        public virtual string ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumberCollection sourceLineNumbers, BindStage bindStage)
        {
            string resolvedSource = this.ResolveFile(source, type, sourceLineNumbers, bindStage);

            return(Path.Combine(Path.GetDirectoryName(resolvedSource), relatedSource));
        }
예제 #46
0
        /// <summary>
        /// Display an unexepected element error.
        /// </summary>
        /// <param name="parentElement">The parent element.</param>
        /// <param name="childElement">The unexpected child element.</param>
        public void UnexpectedElement(XmlNode parentElement, XmlNode childElement)
        {
            SourceLineNumberCollection sourceLineNumbers = this.GetSourceLineNumbers(childElement);

            this.OnMessage(WixErrors.UnexpectedElement(sourceLineNumbers, parentElement.Name, childElement.Name));
        }
예제 #47
0
 /// <summary>
 /// Creates a Merge row that does not belong to a table.
 /// </summary>
 /// <param name="sourceLineNumbers">Original source lines for this row.</param>
 /// <param name="tableDef">TableDefinition this Merge row belongs to and should get its column definitions from.</param>
 public WixMergeRow(SourceLineNumberCollection sourceLineNumbers, TableDefinition tableDef) :
     base(sourceLineNumbers, tableDef)
 {
 }
예제 #48
0
 /// <summary>
 /// Get a guid attribute value and displays an error for an illegal guid value.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line information about the owner element.</param>
 /// <param name="attribute">The attribute containing the value to get.</param>
 /// <param name="generatable">Determines whether the guid can be automatically generated.</param>
 /// <returns>The attribute's guid value or a special value if an error occurred.</returns>
 public string GetAttributeGuidValue(SourceLineNumberCollection sourceLineNumbers, XmlAttribute attribute, bool generatable)
 {
     return(this.GetAttributeGuidValue(sourceLineNumbers, attribute, generatable, false));
 }
예제 #49
0
 /// <summary>
 /// Instantiate a new WixInvalidSequenceTypeException.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line information of the exception.</param>
 /// <param name="sequenceTypeName">Name of the invalid sequence type.</param>
 public WixInvalidSequenceTypeException(SourceLineNumberCollection sourceLineNumbers, string sequenceTypeName) :
     base(sourceLineNumbers, WixExceptionType.InvalidSequenceType)
 {
     this.sequenceTypeName = sequenceTypeName;
 }
예제 #50
0
 /// <summary>
 /// Creates a MediaTemplate row that belongs to a table.
 /// </summary>
 /// <param name="sourceLineNumbers">Original source lines for this row.</param>
 /// <param name="table">Table this MediaTeplate row belongs to and should get its column definitions from.</param>
 public WixMediaTemplateRow(SourceLineNumberCollection sourceLineNumbers, Table table)
     : base(sourceLineNumbers, table)
 {
 }
예제 #51
0
 /// <summary>
 /// Creates a Control row that belongs to a table.
 /// </summary>
 /// <param name="sourceLineNumbers">Original source lines for this row.</param>
 /// <param name="table">Table this Control row belongs to and should get its column definitions from.</param>
 public ControlRow(SourceLineNumberCollection sourceLineNumbers, Table table) :
     base(sourceLineNumbers, table)
 {
 }
예제 #52
0
 /// <summary>
 /// Creates a WixComplexReferenceRow row that belongs to a table.
 /// </summary>
 /// <param name="sourceLineNumbers">Original source lines for this row.</param>
 /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
 public WixComplexReferenceRow(SourceLineNumberCollection sourceLineNumbers, Table table)
     : base(sourceLineNumbers, table)
 {
 }
예제 #53
0
 private static SourceLineNumber SourceLineNumber4(Wix3.SourceLineNumberCollection source)
 {
     return(String.IsNullOrEmpty(source?.EncodedSourceLineNumbers) ? null : SourceLineNumber.CreateFromEncoded(source.EncodedSourceLineNumbers));
 }
예제 #54
0
 /// <summary>
 /// Instantiate new WixInvalidSequenceException.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line information of the exception.</param>
 /// <param name="actionId">Id of the custom action with an invalid sequence.</param>
 public WixInvalidSequenceException(SourceLineNumberCollection sourceLineNumbers, string actionId) :
     base(sourceLineNumbers, WixExceptionType.InvalidSequence)
 {
     this.actionId = actionId;
 }
예제 #55
0
파일: WixBundleRow.cs 프로젝트: zooba/wix3
 /// <summary>
 /// Creates a WixBundleRow row that belongs to a table.
 /// </summary>
 /// <param name="sourceLineNumbers">Original source lines for this row.</param>
 /// <param name="table">Table this WixBundleRow row belongs to and should get its column definitions from.</param>
 public WixBundleRow(SourceLineNumberCollection sourceLineNumbers, Table table)
     : base(sourceLineNumbers, table)
 {
 }
예제 #56
0
 /// <summary>
 /// Creates a Control row that belongs to a table.
 /// </summary>
 /// <param name="sourceLineNumbers">Original source lines for this row.</param>
 /// <param name="table">Table this Component row belongs to and should get its column definitions from.</param>
 public ComponentRow(SourceLineNumberCollection sourceLineNumbers, Table table) :
     base(sourceLineNumbers, table)
 {
 }
 /// <summary>
 /// Instantiate a new WixMultiplePrimaryReferencesException.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line information of the exception.</param>
 /// <param name="cref">Complex reference with conflicting primary references.</param>
 /// <param name="conflictingParentId">Id of the comflicting parent.</param>
 internal WixMultiplePrimaryReferencesException(SourceLineNumberCollection sourceLineNumbers, ComplexReference cref, string conflictingParentId)
     : base(sourceLineNumbers, WixExceptionType.MultiplePrimaryReferences)
 {
     this.cref = cref;
     this.conflictingParentId = conflictingParentId;
 }
 /// <summary>
 /// Instantiate a new WixMergeModuleMissingFeatureException.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number trace to where the exception occured.</param>
 /// <param name="mergeId">Identifier of the merge module.</param>
 public WixMergeModuleMissingFeatureException(SourceLineNumberCollection sourceLineNumbers, string mergeId)
     : base(sourceLineNumbers, WixExceptionType.MergeModuleMissingFeature)
 {
     this.mergeId = mergeId;
 }
예제 #59
0
 /// <summary>
 /// Sends an error to the message delegate if there is one.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line numbers.</param>
 /// <param name="verboseLevel">Level of the verbose message.</param>
 /// <param name="verboseMessage">Verbose message string.</param>
 public void OnExtensionVerbose(SourceLineNumberCollection sourceLineNumbers, VerboseLevel verboseLevel, string verboseMessage)
 {
     this.OnMessage(WixVerboses.LibrarianExtensionVerbose(sourceLineNumbers, verboseLevel, verboseMessage));
 }
예제 #60
0
            /// <summary>
            /// Prefer the TryCreate() method to create FileTransfer objects.
            /// </summary>
            /// <param name="source">Source path to file.</param>
            /// <param name="destination">Destination path for file.</param>
            /// <param name="move">File if file should be moved (optimal).</param>
            /// <param name="type">Optional type of file this transfer is transferring.</param>
            /// <param name="sourceLineNumbers">Optional source line numbers wher this transfer originated.</param>
            public FileTransfer(string source, string destination, bool move, string type, SourceLineNumberCollection sourceLineNumbers)
            {
                this.Source      = source;
                this.Destination = destination;
                this.Move        = move;

                this.Type = type;
                this.SourceLineNumbers = sourceLineNumbers;

                this.Built     = false;
                this.Redundant = false;
            }