示例#1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            var packageType        = (PackageType)listBox1.SelectedItem;
            IInstallationStep step = null;

            switch (packageType)
            {
            case PackageType.Executable:
                step = new Executable();
                break;

            case PackageType.PIDataArchiveLegacy:
                step = new PIDataArchive();
                break;

            case PackageType.OSIAutoExtractSetupPackageLegacy:
                step = new OSIAutoExtractSetupPackage();
                break;
            }

            step.DisplayName = "Package " + packageType.ToString();

            this.CurrentInstallationStep = step;
            this.DialogResult            = DialogResult.OK;
            this.Close();
        }
示例#2
0
        private static List <string> CreateInstallObject(int indent, OSIAutoExtractSetupPackage package)
        {
            var obj = PsObject.GetPSObject();

            obj.AppendProperty(NewProp("install", package.Install.ToString()));
            obj.AppendProperty(NewProp("type", package.Type.ToString()));
            obj.AppendProperty(NewProp("displayName", package.DisplayName));
            obj.AppendProperty(NewProp("package", package.FileInfo.FileName));

            // INI replacements
            if (package.IniReplacements.Count > 0)
            {
                var iniFileReplaces = PsArray.GetArrayProperty("IniFileReplaces");
                foreach (var iniReplacement in package.IniReplacements)
                {
                    var replaceObj = PsObject.GetPSObject();
                    replaceObj.AppendProperty(NewProp("default", iniReplacement.DefaultValue));
                    replaceObj.AppendProperty(NewProp("newSetting", iniReplacement.ReplaceValue));

                    iniFileReplaces.AppendObject(replaceObj.ToList(indent));
                }

                obj.AppendItem(iniFileReplaces.ToList(indent));
            }

            return(obj.ToList(indent));
        }
示例#3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (_currentFile == null)
            {
                MessageBox.Show("Can't proceed because no file is selected in the grid.");
                return;
            }


            if (cmbPackagetypes.SelectedItem == null)
            {
                MessageBox.Show("Can't proceed because no package type is selected in the combo box.");
            }


            var packageType = (PackageType)cmbPackagetypes.SelectedItem;
            IInstallationStep newInstallationStep = null;

            switch (packageType)
            {
            case PackageType.Executable:
                newInstallationStep = new Executable()
                {
                    FileInfo = _currentFile
                };
                break;

            case PackageType.PIDataArchive:
                newInstallationStep = new PIDataArchive()
                {
                    FileInfo = _currentFile
                };
                break;

            case PackageType.OSIAutoExtractSetupPackage:
                newInstallationStep = new OSIAutoExtractSetupPackage()
                {
                    FileInfo = _currentFile
                };
                break;
            }

            newInstallationStep.DisplayName = _currentFile.FileName;

            _model.Items.Add(newInstallationStep);

            Program.ShowPackageEditor(newInstallationStep);

            this.Close();
        }
示例#4
0
        public void TestCanAddNewInstallPackages()
        {
            var model    = new InstallModel();
            var package1 = new PIDataArchive();
            var package2 = new Executable();
            var package3 = new OSIAutoExtractSetupPackage();
            var package4 = new PowerShellCodeBlock();

            model.Add(package1);
            model.Add(package2);
            model.Add(package3);
            model.Add(package4);

            Assert.IsTrue(model.Items.Count == 4);
        }
示例#5
0
        public static InstallModel GetTestModel()
        {
            var model    = new InstallModel();
            var package1 = new OSIAutoExtractSetupPackage()
            {
                DisplayName       = "package 1"
                , IniReplacements = new BindingList <IniReplacement>()
                {
                    new IniReplacement()
                    {
                        DefaultValue = "16 = ...", ReplaceValue = "16 = abc"
                    }
                }
                , FileInfo = new PackageFileInfo()
                {
                    FilePath = "c:\\test.exe"
                }
            };
            var package2 = new PowerShellCodeBlock()
            {
                DisplayName = "package 2", Code = "Restart-Computer",
            };
            var package3 = new Executable()
            {
                DisplayName = "Executable package", Arguments = "/silent"
            };
            var package4 = new PIDataArchive()
            {
                DisplayName = "PI DA package", IniReplacements = new BindingList <IniReplacement>()
                {
                    new IniReplacement()
                    {
                        DefaultValue = "16 = ...", ReplaceValue = "16 = abc"
                    }
                }
            };

            model.Add(package1);
            model.Add(package2);
            model.Add(package3);
            model.Add(package4);

            return(model);
        }