Example #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());
        }
Example #2
0
        public void SetExecuteType(Wix.Custom custom)
        {
            switch (ExecuteType)
            {
            case CustomActionExecuteType.Installation: custom.Value = "2>ProductState"; break;

            case CustomActionExecuteType.Uninstallation: custom.Value = "ProductState>=2"; break;
            }
        }
Example #3
0
 public void SetExecutionSequence(Wix.Custom custom)
 {
     if (this.ExecuteType == CustomActionExecuteType.Installation)
     {
         custom.After = "InstallFinalize";
     }
     else
     {
         custom.After = "InstallInitialize";
     }
 }
Example #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 (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());
        }
Example #5
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());
        }