Ejemplo n.º 1
0
        /// <summary>
        /// Imports an installer text archive table (idt file) into an open database.
        /// </summary>
        /// <param name="idtPath">Specifies the path to the file to import.</param>
        /// <exception cref="WixInvalidIdtException">Attempted to import an IDT file with an invalid format or unsupported data.</exception>
        /// <exception cref="MsiException">Another error occured while importing the IDT file.</exception>
        public void Import(string idtPath)
        {
            var folderPath = Path.GetFullPath(Path.GetDirectoryName(idtPath));
            var fileName = Path.GetFileName(idtPath);

            var error = MsiInterop.MsiDatabaseImport(this.Handle, folderPath, fileName);
            if (1627 == error) // ERROR_FUNCTION_FAILED
            {
                throw new WixInvalidIdtException(idtPath);
            }
            else if (0 != error)
            {
                throw new MsiException(error);
            }
        }