Пример #1
0
        /// <summary>
        /// Decompile the HelpNamespace table.
        /// </summary>
        /// <param name="table">The table to decompile.</param>
        private void DecompileHelpNamespaceTable(Table table)
        {
            foreach (Row row in table.Rows)
            {
                VS.HelpCollection helpCollection = new VS.HelpCollection();

                helpCollection.Id = (string)row[0];

                helpCollection.Name = (string)row[1];

                if (null != row[3])
                {
                    helpCollection.Description = (string)row[3];
                }

                if (this.Core.RootElement is Wix.Module)
                {
                    helpCollection.SuppressCustomActions = VS.YesNoType.yes;
                }

                Wix.File file = (Wix.File) this.Core.GetIndexedElement("File", (string)row[2]);
                if (null != file)
                {
                    file.AddChild(helpCollection);
                }
                else if (0 != String.Compare(helpCollection.Id, "MS_VSIPCC_v80", StringComparison.Ordinal) &&
                         0 != String.Compare(helpCollection.Id, "MS.VSIPCC.v90", StringComparison.Ordinal))
                {
                    this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerCore.PrimaryKeyDelimiter), "File_Collection", (string)row[2], "File"));
                }
                this.Core.IndexElement(row, helpCollection);
            }
        }
Пример #2
0
        /// <summary>
        /// Decompile the HelpNamespace table.
        /// </summary>
        /// <param name="table">The table to decompile.</param>
        private void DecompileHelpNamespaceTable(Table table)
        {
            foreach (Row row in table.Rows)
            {
                VS.HelpCollection helpCollection = new VS.HelpCollection();

                helpCollection.Id = (string)row[0];

                helpCollection.Name = (string)row[1];

                if (null != row[3])
                {
                    helpCollection.Description = (string)row[3];
                }

                Wix.File file = (Wix.File) this.Core.GetIndexedElement("File", (string)row[2]);
                if (null != file)
                {
                    file.AddChild(helpCollection);
                }
                else
                {
                    this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerCore.PrimaryKeyDelimiter), "File_Collection", (string)row[2], "File"));
                }
                this.Core.IndexElement(row, helpCollection);
            }
        }
Пример #3
0
        /// <summary>
        /// Finalize the Perfmon table.
        /// </summary>
        /// <param name="tables">The collection of all tables.</param>
        /// <remarks>
        /// Since the PerfCounter element nests under a File element, but
        /// the Perfmon table does not have a foreign key relationship with
        /// the File table (instead it has a formatted string that usually
        /// refers to a file row - but doesn't have to), the nesting must
        /// be inferred during finalization.
        /// </remarks>
        private void FinalizePerfmonTable(TableCollection tables)
        {
            Table perfmonTable = tables["Perfmon"];

            if (null != perfmonTable)
            {
                foreach (Row row in perfmonTable.Rows)
                {
                    string           formattedFile = (string)row[1];
                    Util.PerfCounter perfCounter   = (Util.PerfCounter) this.Core.GetIndexedElement(row);

                    // try to "de-format" the File column's value to determine the proper parent File element
                    if ((formattedFile.StartsWith("[#") || formattedFile.StartsWith("[!")) && formattedFile.EndsWith("]"))
                    {
                        string fileId = formattedFile.Substring(2, formattedFile.Length - 3);

                        Wix.File file = (Wix.File) this.Core.GetIndexedElement("File", fileId);
                        if (null != file)
                        {
                            file.AddChild(perfCounter);
                        }
                        else
                        {
                            this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, perfmonTable.Name, row.GetPrimaryKey(DecompilerCore.PrimaryKeyDelimiter), "File", formattedFile, "File"));
                        }
                    }
                    else
                    {
                        // TODO: warn about this being undecompilable because its not well-formed
                    }
                }
            }
        }
Пример #4
0
        private void CreateShortcut(Artifact artifact, Directory directory, string shortcutName, string shortcutPath, File file)
        {
            if (string.IsNullOrEmpty(shortcutName))
            {
                shortcutName = Path.GetFileNameWithoutExtension(file.Name);
            }

            // Create the shortcut.

            Shortcut shortcut = CreateShortcut(artifact.ProjectRelativePath, shortcutName);

            if (directory != null)
            {
                shortcut.WorkingDirectory = directory.Id;
            }
            file.AddChild(shortcut);

            // Need to add the shortcut directory.

            Directory targetDirectory      = GetTargetDirectory(file);
            Directory programMenuDirectory = GetChildDirectory(targetDirectory, Wix.Xml.Directory.ProgramMenu.Id, Wix.Xml.Directory.ProgramMenu.Name);

            Directory shortcutDirectory;

            if (string.IsNullOrEmpty(shortcutPath))
            {
                shortcutDirectory = programMenuDirectory;
            }
            else
            {
                // Create an application directory with a fixed id (not sure why this has to be like this but tried a few variations which did not seem to work).

                string name;
                int    pos = shortcutPath.IndexOf('\\');
                if (pos == -1)
                {
                    name         = shortcutPath;
                    shortcutPath = string.Empty;
                }
                else
                {
                    name         = shortcutPath.Substring(pos);
                    shortcutPath = shortcutPath.Substring(pos + 1);
                }

                Directory appProgramMenuDirectory = GetChildDirectory(programMenuDirectory, Wix.Xml.Directory.AppProgramMenu.Id, name);
                shortcutDirectory = appProgramMenuDirectory;
                if (!string.IsNullOrEmpty(shortcutPath))
                {
                    shortcutDirectory = GetDirectory(shortcutDirectory, shortcutPath);
                }
            }

            shortcut.Directory = shortcutDirectory.Id;
        }
Пример #5
0
        /// <summary>
        /// Decompile the HelpFile table.
        /// </summary>
        /// <param name="table">The table to decompile.</param>
        private void DecompileHelpFileTable(Table table)
        {
            foreach (Row row in table.Rows)
            {
                VS.HelpFile helpFile = new VS.HelpFile();

                helpFile.Id = (string)row[0];

                helpFile.Name = (string)row[1];

                if (null != row[2])
                {
                    helpFile.Language = (int)row[2];
                }

                if (null != row[4])
                {
                    helpFile.Index = (string)row[4];
                }

                if (null != row[5])
                {
                    helpFile.Search = (string)row[5];
                }

                if (null != row[6])
                {
                    helpFile.AttributeIndex = (string)row[6];
                }

                if (null != row[7])
                {
                    helpFile.SampleLocation = (string)row[7];
                }

                if (this.Core.RootElement is Wix.Module)
                {
                    helpFile.SuppressCustomActions = VS.YesNoType.yes;
                }

                Wix.File file = (Wix.File) this.Core.GetIndexedElement("File", (string)row[3]);
                if (null != file)
                {
                    file.AddChild(helpFile);
                }
                else
                {
                    this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerCore.PrimaryKeyDelimiter), "File_HxS", (string)row[3], "File"));
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Decompile the WixGameExplorer table.
        /// </summary>
        /// <param name="table">The table to decompile.</param>
        private void DecompileWixGameExplorerTable(Table table)
        {
            foreach (Row row in table.Rows)
            {
                Gaming.Game game = new Gaming.Game();

                game.Id = (string)row[0];

                Wix.File file = (Wix.File) this.Core.GetIndexedElement("File", (string)row[1]);
                if (null != file)
                {
                    file.AddChild(game);
                }
                else
                {
                    this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerCore.PrimaryKeyDelimiter), "File_", (string)row[1], "File"));
                }
            }
        }
Пример #7
0
        /// <summary>
        /// Creates the shim component.
        /// </summary>
        /// <returns>Component for the shim.</returns>
        private Wix.Component GenerateShimComponent()
        {
            Wix.Component shimComponent = new Wix.Component();

            if (Guid.Empty == this.shimGuid)
            {
                this.shimGuid = Guid.NewGuid();
            }

            shimComponent.Id   = "ThisApplicationShimDllComponent";
            shimComponent.Guid = this.shimGuid.ToString("B");

            Wix.File file = new Wix.File();
            file.Id      = "ThisApplicationShimDll";
            file.Name    = String.Concat(Path.GetFileNameWithoutExtension(this.entryFileRelativePath), "Shim.dll");
            file.Vital   = Wix.YesNoType.yes;
            file.KeyPath = Wix.YesNoType.yes;
            file.Source  = this.shimPath;
            shimComponent.AddChild(file);

            // Add the CLSID and ProgId to the component.
            Wix.Class classId = new Wix.Class();
            classId.Id      = this.ShimClsid.ToString("B");
            classId.Context = Wix.Class.ContextType.InprocServer32;
            if (null != this.Description && String.Empty != this.Description)
            {
                classId.Description = this.Description;
            }

            classId.ThreadingModel = Wix.Class.ThreadingModelType.apartment;
            file.AddChild(classId);

            Wix.ProgId progId = new Wix.ProgId();
            progId.Id          = this.ShimProgid;
            progId.Description = "Connect Class";
            classId.AddChild(progId);

            // Add the Addin to the extended Office applications.
            foreach (OfficeAddinFabricator.OfficeApplications extendedOfficeApp in this.extendedOfficeApplications)
            {
                Wix.RegistryKey registryKey = new Wix.RegistryKey();
                registryKey.Root = Wix.RegistryRootType.HKMU;
                registryKey.Key  = String.Format("Software\\Microsoft\\Office\\{0}\\Addins\\{1}", OfficeAddinFabricator.OfficeApplicationStrings[(int)extendedOfficeApp], this.ShimProgid);
                shimComponent.AddChild(registryKey);

                Wix.RegistryValue registryValue = new Wix.RegistryValue();
                registryValue.Name  = "Description";
                registryValue.Value = "[ProductName] v[ProductVersion]";
                registryValue.Type  = Wix.RegistryValue.TypeType.@string;
                registryKey.AddChild(registryValue);

                registryValue       = new Wix.RegistryValue();
                registryValue.Name  = "FriendlyName";
                registryValue.Value = "[ProductName]";
                registryValue.Type  = Wix.RegistryValue.TypeType.@string;
                registryKey.AddChild(registryValue);

                registryValue       = new Wix.RegistryValue();
                registryValue.Name  = "LoadBehavior";
                registryValue.Value = "3";
                registryValue.Type  = Wix.RegistryValue.TypeType.integer;
                registryKey.AddChild(registryValue);
            }

            return(shimComponent);
        }
Пример #8
0
        /// <summary>
        /// Creates the shim component.
        /// </summary>
        /// <returns>Component for the shim.</returns>
        private Wix.Component GenerateShimComponent()
        {
            Wix.Component shimComponent = new Wix.Component();

            if (Guid.Empty == this.shimGuid)
            {
                this.shimGuid = Guid.NewGuid();
            }

            shimComponent.Id = "ThisApplicationShimDllComponent";
            shimComponent.Guid = this.shimGuid.ToString("B");

            Wix.File file = new Wix.File();
            file.Id = "ThisApplicationShimDll";
            file.Name = String.Concat(Path.GetFileNameWithoutExtension(this.entryFileRelativePath), "Shim.dll");
            file.Vital = Wix.YesNoType.yes;
            file.KeyPath = Wix.YesNoType.yes;
            file.Source = this.shimPath;
            shimComponent.AddChild(file);

            // Add the CLSID and ProgId to the component.
            Wix.Class classId = new Wix.Class();
            classId.Id = this.ShimClsid.ToString("B");
            classId.Context = Wix.Class.ContextType.InprocServer32;
            if (null != this.Description && String.Empty != this.Description)
            {
                classId.Description = this.Description;
            }

            classId.ThreadingModel = Wix.Class.ThreadingModelType.apartment;
            file.AddChild(classId);

            Wix.ProgId progId = new Wix.ProgId();
            progId.Id = this.ShimProgid;
            progId.Description = "Connect Class";
            classId.AddChild(progId);

            // Add the Addin to the extended Office applications.
            foreach (OfficeAddinFabricator.OfficeApplications extendedOfficeApp in this.extendedOfficeApplications)
            {
                Wix.RegistryKey registryKey = new Wix.RegistryKey();
                registryKey.Root = Wix.RegistryRootType.HKMU;
                registryKey.Key = String.Format("Software\\Microsoft\\Office\\{0}\\Addins\\{1}", OfficeAddinFabricator.OfficeApplicationStrings[(int)extendedOfficeApp], this.ShimProgid);
                shimComponent.AddChild(registryKey);

                Wix.RegistryValue registryValue = new Wix.RegistryValue();
                registryValue.Name = "Description";
                registryValue.Value = "[ProductName] v[ProductVersion]";
                registryValue.Type = Wix.RegistryValue.TypeType.@string;
                registryKey.AddChild(registryValue);

                registryValue = new Wix.RegistryValue();
                registryValue.Name = "FriendlyName";
                registryValue.Value = "[ProductName]";
                registryValue.Type = Wix.RegistryValue.TypeType.@string;
                registryKey.AddChild(registryValue);

                registryValue = new Wix.RegistryValue();
                registryValue.Name = "LoadBehavior";
                registryValue.Value = "3";
                registryValue.Type = Wix.RegistryValue.TypeType.integer;
                registryKey.AddChild(registryValue);
            }

            return shimComponent;
        }
Пример #9
0
        /// <summary>
        /// Decompile the NetFxNativeImage table.
        /// </summary>
        /// <param name="table">The table to decompile.</param>
        private void DecompileNetFxNativeImageTable(Table table)
        {
            foreach (Row row in table.Rows)
            {
                NetFx.NativeImage nativeImage = new NetFx.NativeImage();

                nativeImage.Id = (string)row[0];

                switch ((int)row[2])
                {
                case 0:
                    nativeImage.Priority = NetFx.NativeImage.PriorityType.Item0;
                    break;

                case 1:
                    nativeImage.Priority = NetFx.NativeImage.PriorityType.Item1;
                    break;

                case 2:
                    nativeImage.Priority = NetFx.NativeImage.PriorityType.Item2;
                    break;

                case 3:
                    nativeImage.Priority = NetFx.NativeImage.PriorityType.Item3;
                    break;
                }

                if (null != row[3])
                {
                    int attributes = (int)row[3];

                    if (0x1 == (attributes & 0x1))
                    {
                        nativeImage.Debug = NetFx.YesNoType.yes;
                    }

                    if (0x2 == (attributes & 0x2))
                    {
                        nativeImage.Dependencies = NetFx.YesNoType.no;
                    }

                    if (0x4 == (attributes & 0x4))
                    {
                        nativeImage.Profile = NetFx.YesNoType.yes;
                    }

                    if (0x8 == (attributes & 0x8) && 0x10 == (attributes & 0x10))
                    {
                        nativeImage.Platform = NetFx.NativeImage.PlatformType.all;
                    }
                    else if (0x8 == (attributes & 0x8))
                    {
                        nativeImage.Platform = NetFx.NativeImage.PlatformType.Item32bit;
                    }
                    else if (0x10 == (attributes & 0x10))
                    {
                        nativeImage.Platform = NetFx.NativeImage.PlatformType.Item64bit;
                    }
                }

                if (null != row[4])
                {
                    nativeImage.AssemblyApplication = (string)row[4];
                }

                if (null != row[5])
                {
                    nativeImage.AppBaseDirectory = (string)row[5];
                }

                Wix.File file = (Wix.File) this.Core.GetIndexedElement("File", (string)row[1]);
                if (null != file)
                {
                    file.AddChild(nativeImage);
                }
                else
                {
                    this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerCore.PrimaryKeyDelimiter), "File_", (string)row[1], "File"));
                }
            }
        }