示例#1
0
        public override object[] Build()
        {
            List <object> items = new List <object>();

            // create custom acton
            Wix.CustomAction action = new Wix.CustomAction();
            action.Id        = Common.GetId();
            action.Directory = "INSTALLDIR";
            if (SourcePath.Contains(":"))
            {
                action.ExeCommand = SourcePath + " " + Function; // EXE IN TARGET SYSTEM
            }
            else
            {
                action.ExeCommand = "[SystemFolder]" + SourcePath + " " + Function; // EXE IN TARGET SYSTEM
            }
            items.Add(action);
            // create install execute sequence
            Wix.InstallExecuteSequence executeSequence = new Wix.InstallExecuteSequence();
            executeSequence.ItemsElementName = new Wix.ItemsChoiceType2[] { Wix.ItemsChoiceType2.Custom };
            Wix.Custom custom = new Wix.Custom();
            custom.Action = action.Id;
            base.SetExecutionSequence(custom);
            base.SetExecuteType(custom);
            executeSequence.Items = new object[] { custom };
            items.Add(executeSequence);

            return(items.ToArray());
        }
示例#2
0
        public override object[] Build()
        {
            List <object> items = new List <object>();

            // create custom acton
            Wix.CustomAction action = new Wix.CustomAction();
            action.Id = Common.GetId();
            if (String.IsNullOrEmpty(SourcePath))
            {
                Wix.Property property = new Wix.Property();
                property.Id   = Common.GetId();
                property.Text = new string[] { "<![CDATA[" + Script + "]]>" };
                items.Add(property);
                action.Property = property.Id;
            }
            else
            {
                if (IsInstalledFile == "True")
                {
                    if (Tag != null)
                    {
                        action.FileKey = ((ComponentNode)Tag).Property.Id;
                    }
                }
                else
                {
                    Wix.Binary binary = new Wix.Binary();
                    binary.Id         = Common.GetId();
                    binary.SourceFile = SourcePath;
                    action.BinaryKey  = binary.Id;
                    items.Add(binary);
                }
            }
            action.JScriptCall = Function;
            items.Add(action);
            // create install execute sequence
            Wix.InstallExecuteSequence executeSequence = new Wix.InstallExecuteSequence();
            executeSequence.ItemsElementName = new Wix.ItemsChoiceType2[] { Wix.ItemsChoiceType2.Custom };
            Wix.Custom custom = new Wix.Custom();
            custom.Action = action.Id;
            base.SetExecutionSequence(custom);
            base.SetExecuteType(custom);
            executeSequence.Items = new object[] { custom };
            items.Add(executeSequence);

            return(items.ToArray());
        }
示例#3
0
        public override object[] Build()
        {
            List <object> items = new List <object>();

            // create custom acton
            Wix.CustomAction action = new Wix.CustomAction();
            action.Id = Common.GetId();
            if (IsInstalledFile == "True")
            {
                if (Tag != null)
                {
                    action.FileKey = ((ComponentNode)Tag).Property.Id;
                }
            }
            else
            {
                Wix.Binary binary = new Wix.Binary();
                binary.Id         = Common.GetId();
                binary.SourceFile = SourcePath;
                action.BinaryKey  = binary.Id;
                items.Add(binary);
            }
            action.ExeCommand = Function;
            items.Add(action);
            // create install execute sequence
            Wix.InstallExecuteSequence executeSequence = new Wix.InstallExecuteSequence();
            executeSequence.ItemsElementName = new Wix.ItemsChoiceType2[] { Wix.ItemsChoiceType2.Custom };
            Wix.Custom custom = new Wix.Custom();
            custom.Action = action.Id;
            base.SetExecutionSequence(custom);
            base.SetExecuteType(custom);
            executeSequence.Items = new object[] { custom };
            items.Add(executeSequence);

            return(items.ToArray());
        }