Ejemplo n.º 1
0
        public void ProgressTest()
        {
            InstallerConfiguration config = new InstallerConfiguration();
            config.AddAction(new MockInstallerAction());
            config.AddAction(new MockInstallerAction());
            config.AddAction(new MockInstallerAction());

            Installer installer = new Installer("", manifest, config);

            Int32 prevProgress = 0;
            ManualResetEvent manualEvent = new ManualResetEvent(false);
            installer.Progress += delegate(object sender, InstallerProgressEventArgs e)
            {
                Assert.IsTrue(e.Progress > prevProgress);
                prevProgress = e.Progress;
            };
            installer.Completed += delegate(object sender, EventArgs e)
            {
                manualEvent.Set();
            };
            installer.Install();
            manualEvent.WaitOne(1000, false);

            Assert.AreEqual(100, prevProgress, "Installer progress.");
        }
Ejemplo n.º 2
0
        public InstallerActionsForm(DevCenter devCenter, ScriptPackage package)
        {
            InitializeComponent();

            if (package == null)
                throw new ArgumentNullException("Package argument cannot be null");

            this.package = package;
            this.installerConfig = package.InstallerConfiguration;

            actionsComboBox.Format += new ListControlConvertEventHandler(actionsComboBox_Format);
            actionPropertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(actionPropertyGrid_PropertyValueChanged);

            if (package.RootPath.AbsolutePath == String.Empty)
            {
                PackageRootPathWarning w = new PackageRootPathWarning();
                w.Dock = DockStyle.Fill;
                this.Controls.Remove(this.tableLayoutPanel);
                this.Controls.Add(w);
            }
            else
            {
                fillActionsCombobox();
                fillActionsListView();
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the InstallerConfiguration to the zip package.
 /// </summary>
 /// <param name="config">The InstallerConfiguration instance to add.</param>
 public virtual void AddInstallerConfiguration(InstallerConfiguration config)
 {
     using (StringWriter stringWriter = new StringWriter())
     {
         JsonFileHandler<InstallerConfiguration> handler = new JsonFileHandler<InstallerConfiguration>();
         handler.Write(stringWriter, config);
         _currentZipFile.AddEntry(PackageBuilder.InstallerArchivePath + "script" + InstallerConfiguration.DefaultExtension, stringWriter.ToString());
     }
 }
Ejemplo n.º 4
0
        public void InstallFailTest()
        {
            InstallerConfiguration config = new InstallerConfiguration();
            MockFailingAction action = new MockFailingAction();
            config.AddAction(action);
            Installer installer = new Installer("", manifest, config);

            ManualResetEvent manualEvent = new ManualResetEvent(false);
            InstallerFailedEventArgs raisedEventArgs = null;
            installer.Failed += delegate(object sender, InstallerFailedEventArgs e)
            {
                raisedEventArgs = e;
                manualEvent.Set();
            };
            installer.Install();
            manualEvent.WaitOne(1000, false);

            Assert.IsNotNull(raisedEventArgs, "Failed event should be fired.");
            Assert.AreEqual(action.Exception, raisedEventArgs.Exception, "Exception should be set.");
        }
Ejemplo n.º 5
0
        public void InstallTest()
        {
            InstallerConfiguration config = new InstallerConfiguration();
            MockInstallerAction action = new MockInstallerAction();
            config.AddAction(action);

            Installer installer = new Installer("", manifest, config);

            Assert.IsFalse(action.ActionInstalled);

            Boolean installerCompleted = false;
            ManualResetEvent manualEvent = new ManualResetEvent(false);
            installer.Completed += delegate(object sender, EventArgs e)
            {
                installerCompleted = true;
                manualEvent.Set();
            };
            installer.Install();
            manualEvent.WaitOne(1000, false);

            Assert.IsTrue(installerCompleted, "Installer completed.");
            Assert.IsTrue(action.ActionInstalled, "Action installed.");
        }
Ejemplo n.º 6
0
 public Installer(String installerDirectory, ScriptManifest manifest, InstallerConfiguration config)
 {
     this.InstallerDirectory = installerDirectory;
     this.Manifest = manifest;
     this.Configuration = config;
 }
Ejemplo n.º 7
0
        private void button3_Click(object sender, EventArgs e)
        {
            InstallerConfiguration config = new InstallerConfiguration();
            config.AddAction(new CopyDirAction("scripts", AppPaths.Directory.Scripts));
            config.AddAction(new CopyDirAction("startupscripts", AppPaths.Directory.StartupScripts));
            config.AddAction(new AssignHotkeyAction(Keys.H | Keys.Alt, "", ""));

            JsonFileHandler<InstallerConfiguration> handler = new JsonFileHandler<InstallerConfiguration>();
            handler.Write(new BasePath("C:/temp/scriptcenter/config.installer"), config);
        }
Ejemplo n.º 8
0
        private void button2_Click(object sender, EventArgs e)
        {
            /*
            ScriptCenter.Installer.NewInstallerWizard.NewInstallerWizard w = new Installer.NewInstallerWizard.NewInstallerWizard();
            w.Show();
             */
            ScriptManifest m = new ScriptManifest();
            m.Id = new ScriptId("nl.threesixty.outliner");
            m.Name = "Outliner";
            m.Versions.Add(new ScriptVersion(2, 0, 96, ScriptReleaseStage.Release));

            InstallerConfiguration config = new InstallerConfiguration();
            InstallerUIConfiguration uiConfig = new InstallerUIConfiguration();
        }
 public void testInitialize()
 {
     this.config = new InstallerConfiguration();
     this.config.AddAction(new CopyFileAction("testFile", AppPaths.Directory.Icons));
     this.config.AddAction(new CopyDirAction("testDir/", AppPaths.Directory.Scripts));
     this.config.AddAction(new AssignHotkeyAction(System.Windows.Forms.Keys.H | System.Windows.Forms.Keys.Control, "toggleOutliner", "Outliner"));
     this.config.AddAction(new RunMaxscriptAction("test.ms"));
 }
Ejemplo n.º 10
0
        private void moveSelectedAction(InstallerConfiguration.MoveActionDirection direction)
        {
            if (actionsListView.SelectedItems.Count == 0)
                return;

            ListViewItem selItem = actionsListView.SelectedItems[0];
            Int32 oldIndex = selItem.Index;
            Int32 newIndex = this.installerConfig.MoveAction((InstallerAction)selItem.Tag, direction);
            if (oldIndex != newIndex)
            {
                actionsListView.Items.Remove(selItem);
                actionsListView.Items.Insert(newIndex, selItem);
            }
        }