Пример #1
0
 /// <summary>
 /// Instantiate a new Librarian class.
 /// </summary>
 /// <param name="smallTables">Use small table definitions for MSI/MSM.</param>
 public Librarian(bool smallTables)
 {
     this.tableDefinitions = Common.GetTableDefinitions(smallTables);
     this.extensions = new Hashtable();
     this.intermediates = new ArrayList();
     this.foundError = false;
     this.extensionMessages = new ExtensionMessages(this);
 }
Пример #2
0
 /// <summary>
 /// Instantiate a new Librarian class.
 /// </summary>
 /// <param name="smallTables">Use small table definitions for MSI/MSM.</param>
 public Librarian(bool smallTables)
 {
     this.tableDefinitions  = Common.GetTableDefinitions(smallTables);
     this.extensions        = new Hashtable();
     this.intermediates     = new ArrayList();
     this.foundError        = false;
     this.extensionMessages = new ExtensionMessages(this);
 }
Пример #3
0
        /// <summary>
        /// Creates a linker.
        /// </summary>
        /// <param name="smallTables">Use small table definitions for MSI/MSM.</param>
        public Linker(bool smallTables)
        {
            this.standardActions = Common.GetStandardActions();
            this.tableDefinitions = Common.GetTableDefinitions(smallTables);
            this.extensions = new Hashtable();
            this.extensionMessages = new ExtensionMessages(this);

            this.intermediates = new ArrayList();
        }
Пример #4
0
        /// <summary>
        /// Creates a new preprocesor.
        /// </summary>
        public Preprocessor()
        {
            this.extensionMessages = new ExtensionMessages(this);
            this.variables = new Hashtable();
            this.includeSearchPaths = new StringCollection();
            this.extensionTypes = new Hashtable();

            this.currentLineNumber = null;
            this.sourceStack = new Stack();

            this.includeNextStack = new Stack();

            this.foundError = false;
            this.preprocessOut = null;

            // add the system variables
            this.variables.Add("sys.CURRENTDIR", String.Concat(Directory.GetCurrentDirectory(), "\\"));
        }
Пример #5
0
 /// <summary>
 /// Construct Decompiler object
 /// </summary>
 public Decompiler()
 {
     this.foundError = false;
     this.extensionMessages = new ExtensionMessages(this);
     this.extensionList = new ArrayList();
     this.tidy = true;
     this.lastSequence = new SortedList();
 }
Пример #6
0
        /// <summary>
        /// Creates a linker.
        /// </summary>
        /// <param name="smallTables">Use small table definitions for MSI/MSM.</param>
        public Binder(bool smallTables)
        {
            this.tableDefinitions = Common.GetTableDefinitions(smallTables);

            this.extension = new BinderExtension();
            this.extensionMessages = new ExtensionMessages(this);
            this.fileCopyHandler = new FileCopyHandler(File.Copy);
            this.fileMoveHandler = new FileMoveHandler(File.Move);
        }
Пример #7
0
        /// <summary>
        /// Compiles the provided Xml document into an intermediate object
        /// </summary>
        /// <param name="source">Source xml document to compile.</param>
        /// <param name="sourcePath">Optional original path to xml document on disk.</param>
        /// <returns>Intermediate object representing compiled source document.</returns>
        /// <remarks>This method is not thread-safe.</remarks>
        public Intermediate Compile(XmlDocument source, string sourcePath)
        {
            if (null == source)
            {
                throw new ArgumentNullException("source");
            }

            bool encounteredError = true; // assume we'll hit an error

            // create the intermediate
            Intermediate target = new Intermediate();
            target.SourcePath = sourcePath;

            // try to compile it
            try
            {
                this.core = new CompilerCore(target, this.tableDefinitions, this.Message);
                this.core.PedanticLevel = this.pedanticLevel;
                this.extensionMessages = new ExtensionMessages(this.core);

                foreach (CompilerExtension extension in this.extensions.Values)
                {
                    extension.Core = this.core;
                    extension.Messages = this.extensionMessages;
                    extension.InitializeCompile();
                }

                // parse the document
                if ("Wix" == source.DocumentElement.LocalName)
                {
                    this.ParseWixElement(source.DocumentElement);
                }
                else
                {
                    this.core.OnMessage(WixErrors.InvalidDocumentElement(null, source.DocumentElement.Name, "source", "Wix"));
                }

                // perform schema validation if there were no errors and validation isn't suppressed
                if (!this.core.EncounteredError && !this.suppressValidation)
                {
                    this.ValidateDocument(source);
                }
            }
            finally
            {
                encounteredError = this.core.EncounteredError;

                foreach (CompilerExtension extension in this.extensions.Values)
                {
                    extension.FinalizeCompile();
                    extension.Core = null;
                }
                this.core = null;
            }

            // return the compiled intermediate only if it completed successfully
            return (encounteredError ? null : target);
        }