public InstallerInfo(string installerPath)
        {
            Languages             = new List <string>();
            RetailProducts        = new List <string>();
            VolumeProducts        = new List <string>();
            InstallerArchitecture = string.Empty;
            InstallerPath         = installerPath;
            SetupVersionMajor     = 0;
            SetupVersionFull      = string.Empty;

            // Determine What Products are in the Installer and their License Channels
            ProductListRetail retailList = new ProductListRetail();

            foreach (string productFolder in retailList.GetFolders())
            {
                if (Directory.Exists(InstallerPath + productFolder))
                {
                    RetailProducts.Add(retailList.GetProductName(productFolder));
                }
            }
            ProductListVolume volumeList = new ProductListVolume();

            foreach (string productFolder in volumeList.GetFolders())
            {
                if (Directory.Exists(InstallerPath + productFolder))
                {
                    VolumeProducts.Add(volumeList.GetProductName(productFolder));
                }
            }

            // Determine Installer Languages and Installer Architecture
            LanguageList languageList = new LanguageList();

            foreach (string languageCode in languageList.GetLanguageCodes())
            {
                if (Directory.Exists(InstallerPath + "Office64." + languageCode))
                {
                    Languages.Add(languageList.GetLanguageName(languageCode));
                    InstallerArchitecture = Architecture.X86;
                }
                else if (Directory.Exists(InstallerPath + "Office32." + languageCode))
                {
                    Languages.Add(languageList.GetLanguageName(languageCode));
                    InstallerArchitecture = Architecture.X64;
                }
            }

            // Get Microsoft Office Setup Version
            FileVersionInfo setupVersion = FileVersionInfo.GetVersionInfo(InstallerPath + "setup.exe");

            SetupVersionMajor = setupVersion.FileMajorPart;
            if (SetupVersionMajor <= 14)
            {
                // Microsoft Office 2010 and Older
                SetupVersionFull = setupVersion.FileVersion;
            }
            else
            {
                // Microsoft Office 2013 and Newer
                try
                {
                    FileVersionInfo setupDLLVersion = FileVersionInfo.GetVersionInfo(InstallerPath + "setup.dll");
                    SetupVersionFull = setupDLLVersion.FileVersion;
                }
                catch (FileNotFoundException)
                {
                    throw new ApplicationException("This is not a valid/supported Microsoft Office installer!");
                }
            }
        }
        /// <summary>
        /// Convert a Microsoft Office installer from Retail to Volume, or vice-versa
        /// </summary>
        /// <param name="licenseChannel">Current License Channel</param>
        /// <param name="productName">Microsoft Office Product to Convert</param>
        public static void ChangeChannel(string licenseChannel, string productName)
        {
            string architecture = InstallerInformation.InstallerArchitecture;
            string retailFolder = new ProductListRetail().GetProductFolder(productName);
            string volumeFolder = new ProductListVolume().GetProductFolder(productName);

            string fullInstallerPath = string.Empty;

            if (licenseChannel == "Retail")
            {
                fullInstallerPath = InstallerInformation.InstallerPath + retailFolder + Path.DirectorySeparatorChar;
            }
            else if (licenseChannel == "Volume")
            {
                fullInstallerPath = InstallerInformation.InstallerPath + volumeFolder + Path.DirectorySeparatorChar;
            }

            XmlDocument doc = new XmlDocument();

            byte[] patchXml;
            switch (InstallerInformation.SetupVersionFull)
            {
            case "14.0.4755.1000":
                patchXml = Resources.Office14_XML;
                break;

            case "15.0.4420.1017":
            case "15.0.4433.1506":
            case "15.0.4454.1000":
                patchXml = Resources.Office15_XML;
                break;

            case "15.0.4569.1503":
                patchXml = Resources.Office15SP1_XML;
                break;

            // TODO: Office 2016 Channel Changer
            default:
                throw new Exception("Unsupported Microsoft Office Edition!");
            }

            doc.Load(new MemoryStream(CommonUtilities.DecompressResource(patchXml)));

            // Root
            XmlElement root = doc.DocumentElement;

            if (root != null)
            {
                // Products Node
                XmlNodeList productList = root.ChildNodes;

                // Find Desired Product Node in Products Node
                XmlNode product = null;
                foreach (XmlNode productInstance in productList)
                {
                    XmlAttributeCollection productAttributes = productInstance.Attributes;
                    if (productAttributes != null && productAttributes["name"].Value == productName)
                    {
                        product = productInstance;
                        break;
                    }
                }

                // Product Unsupported
                if (product == null)
                {
                    throw new ApplicationException("This product is not supported due to lack of patches.");
                }

                // Patch Product
                PatchProcessor(product, fullInstallerPath, licenseChannel, architecture);
            }

            #region File Renaming, Zip Files, and Cleanup
            // Rename Folders
            if (licenseChannel == "Retail")
            {
                Directory.Move(fullInstallerPath, InstallerInformation.InstallerPath + Path.DirectorySeparatorChar + volumeFolder);
            }
            else if (licenseChannel == "Volume")
            {
                Directory.Move(fullInstallerPath, InstallerInformation.InstallerPath + Path.DirectorySeparatorChar + retailFolder);
            }

            // Get Extraction Folder
            string unpackDirectoryAdmin   = InstallerInformation.InstallerPath + Path.DirectorySeparatorChar + "Admin";
            string unpackDirectoryProduct = InstallerInformation.InstallerPath + Path.DirectorySeparatorChar;
            string unpackDirectorySetup   = InstallerInformation.InstallerPath + Path.DirectorySeparatorChar;
            if (licenseChannel == "Retail")
            {
                unpackDirectoryProduct += volumeFolder;
            }
            else if (licenseChannel == "Volume")
            {
                unpackDirectoryProduct += retailFolder;
            }

            // Create Admin Folder if it doesn't exist
            if (Directory.Exists(InstallerInformation.InstallerPath + Path.DirectorySeparatorChar + "Admin"))
            {
                return;
            }

            // Extract Archives
            byte[] x86, x64, shared, productZip32, setupZip32, productZip64, setupZip64;
            switch (InstallerInformation.SetupVersionFull)
            {
            case "14.0.4755.1000":
                x86          = Resources.Office14_Admin32;
                x64          = Resources.Office14_Admin64;
                shared       = Resources.Office14_AdminShared;
                productZip32 = null;
                productZip64 = null;
                setupZip32   = null;
                setupZip64   = null;
                break;

            case "15.0.4420.1017":
            case "15.0.4433.1506":
            case "15.0.4454.1000":
                x86          = Resources.Office15_Admin32;
                x64          = Resources.Office15_Admin64;
                shared       = Resources.Office15_AdminShared;
                productZip32 = Resources.Office15_ProductRoot32;
                productZip64 = Resources.Office15_ProductRoot64;
                setupZip32   = Resources.Office15_SetupRoot32;
                setupZip64   = Resources.Office15_SetupRoot64;
                break;

            case "15.0.4569.1503":
                x86          = Resources.Office15SP1_Admin32;
                x64          = Resources.Office15SP1_Admin64;
                shared       = Resources.Office15SP1_AdminShared;
                productZip32 = Resources.Office15SP1_ProductRoot32;
                productZip64 = Resources.Office15SP1_ProductRoot64;
                setupZip32   = Resources.Office15SP1_SetupRoot32;
                setupZip64   = Resources.Office15SP1_SetupRoot64;
                break;

            default:
                throw new Exception("Unsupported Microsoft Office Edition!");
            }

            if (InstallerInformation.InstallerArchitecture == Architecture.X86)
            {
                // Extract Admin Folder
                using (IArchive archive32 = ArchiveFactory.Open(new MemoryStream(x86)))
                {
                    foreach (IArchiveEntry entry in archive32.Entries)
                    {
                        if (!entry.IsDirectory)
                        {
                            entry.WriteToDirectory(unpackDirectoryAdmin, new ExtractionOptions()
                            {
                                ExtractFullPath = true, Overwrite = true
                            });
                        }
                    }
                }

                // Extract Product Folder
                if (productZip32 != null)
                {
                    using (IArchive archiveProduct = ArchiveFactory.Open(new MemoryStream(productZip32)))
                    {
                        foreach (IArchiveEntry entry in archiveProduct.Entries)
                        {
                            if (!entry.IsDirectory)
                            {
                                entry.WriteToDirectory(unpackDirectoryProduct, new ExtractionOptions()
                                {
                                    ExtractFullPath = true, Overwrite = true
                                });
                            }
                        }
                    }
                }

                // Extract Setup Folder
                if (setupZip32 != null)
                {
                    using (IArchive archiveSetup = ArchiveFactory.Open(new MemoryStream(setupZip32)))
                    {
                        foreach (IArchiveEntry entry in archiveSetup.Entries)
                        {
                            if (!entry.IsDirectory)
                            {
                                entry.WriteToDirectory(unpackDirectorySetup, new ExtractionOptions()
                                {
                                    ExtractFullPath = true, Overwrite = true
                                });
                            }
                        }
                    }
                }
            }
            else if (InstallerInformation.InstallerArchitecture == Architecture.X64)
            {
                // Extract Admin Folder
                using (IArchive archive64 = ArchiveFactory.Open(new MemoryStream(x64)))
                {
                    foreach (IArchiveEntry entry in archive64.Entries)
                    {
                        if (!entry.IsDirectory)
                        {
                            entry.WriteToDirectory(unpackDirectoryAdmin, new ExtractionOptions()
                            {
                                ExtractFullPath = true, Overwrite = true
                            });
                        }
                    }
                }

                // Extract Product Folder
                if (productZip64 != null)
                {
                    using (IArchive archiveProduct = ArchiveFactory.Open(new MemoryStream(productZip64)))
                    {
                        foreach (IArchiveEntry entry in archiveProduct.Entries)
                        {
                            if (!entry.IsDirectory)
                            {
                                entry.WriteToDirectory(unpackDirectoryProduct, new ExtractionOptions()
                                {
                                    ExtractFullPath = true, Overwrite = true
                                });
                            }
                        }
                    }
                }

                // Extract Setup Folder
                if (setupZip64 != null)
                {
                    using (IArchive archiveSetup = ArchiveFactory.Open(new MemoryStream(setupZip64)))
                    {
                        foreach (IArchiveEntry entry in archiveSetup.Entries)
                        {
                            if (!entry.IsDirectory)
                            {
                                entry.WriteToDirectory(unpackDirectorySetup, new ExtractionOptions()
                                {
                                    ExtractFullPath = true, Overwrite = true
                                });
                            }
                        }
                    }
                }
            }

            // Extract Admin Folder Components Shared Between x86 and x64
            using (IArchive archiveShared = ArchiveFactory.Open(new MemoryStream(shared)))
            {
                foreach (IArchiveEntry entry in archiveShared.Entries)
                {
                    if (!entry.IsDirectory)
                    {
                        entry.WriteToDirectory(unpackDirectoryAdmin, new ExtractionOptions()
                        {
                            ExtractFullPath = true, Overwrite = true
                        });
                    }
                }
            }
            #endregion
        }