示例#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());
        }
        void INvnControl.Build()
        {
            if (String.IsNullOrEmpty(txtDllEntry.Text) || String.IsNullOrEmpty(txtFalseValue.Text) || String.IsNullOrEmpty(txtProperty.Text) ||
                String.IsNullOrEmpty(txtTrueValue.Text) || String.IsNullOrEmpty(txtValidationDll.Text))
            {
                return;
            }
            else
            {
                // create custom actions
                Wix.Binary pidBinaryFile = new Wix.Binary();
                pidBinaryFile.Id             = "ProductKeyCode";
                pidBinaryFile.SourceFile     = txtValidationDll.Text;
                MsiBuilder.CustomActionItems = Common.AddItemToArray(MsiBuilder.CustomActionItems, pidBinaryFile);
                Wix.CustomAction pidCustomAction = new Wix.CustomAction();
                pidCustomAction.Id           = "MSIKey";// this must be same as in RegistrationDlg
                pidCustomAction.BinaryKey    = "ProductKeyCode";
                pidCustomAction.DllEntry     = txtDllEntry.Text;
                MsiBuilder.CustomActionItems = Common.AddItemToArray(MsiBuilder.CustomActionItems, pidCustomAction);
                // update user interface
                UICompiler.UpdatePIDInfo(txtProperty.Text, txtTrueValue.Text, txtFalseValue.Text);

                // compile user interface files
                UICompiler.Compile(true, MsiBuilder.UIRef[0].Id.Split("_".ToCharArray())[1]);
            }
        }
示例#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 (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());
        }
示例#4
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());
        }