protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (this.DesignMode)
                return;

            this.listView1.SelectedIndexChanged += new EventHandler(listView1_SelectedIndexChanged);
            this.listView1.ItemChecked += new ItemCheckedEventHandler(listView1_ItemChecked);

            JsonFileHandler<ScriptRepository> h = new JsonFileHandler<ScriptRepository>();
            this.installedScripts = h.Read(installedScriptsFile);
            if (installedScripts == null)
            {
                MessageBox.Show("Error loading installed scripts xml:\n" + installedScriptsFile, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            /*
            foreach (ScriptManifestReference r in this.installedScripts.Scripts)
            {
                this.LoadManifest(r.URI);
            }
            */
        }
Exemple #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (this.DesignMode)
                return;

            this.repositoryTree.BeginUpdate();

            listView1.SelectedIndexChanged += new EventHandler(listView1_SelectedIndexChanged);
            listView1.ItemChecked += new ItemCheckedEventHandler(listView1_ItemChecked);

            this.repositories = new List<ScriptRepository>();

            JsonFileHandler<ScriptRepositoryList> h = new JsonFileHandler<ScriptRepositoryList>();
            this.repositoryList = h.Read(repositoryListFile);
            if (this.repositoryList != null)
            {
                foreach (ScriptRepositoryReference r in this.repositoryList.Repositories)
                {
                    this.repositoryTree.Nodes.Add(String.Format("{0} - {1}", r.Name, r.URI));
                }
            }

            this.repositoryTree.EndUpdate();
        }
Exemple #3
0
        public Installer(IPath installerDirectory, IPath manifestFile, IPath configFile)
        {
            this.InstallerDirectory = installerDirectory.AbsolutePath;
            this.ResourcesDirectory = this.InstallerDirectory + "\\" + PackageBuilder.ResourcesArchivePath;

            JsonFileHandler<ScriptManifest> manifestHandler = new JsonFileHandler<ScriptManifest>();
            this.Manifest = manifestHandler.Read(manifestFile);
            JsonFileHandler<InstallerConfiguration> configHandler = new JsonFileHandler<InstallerConfiguration>();
            this.Configuration = configHandler.Read(configFile);
        }
        public void ReadRepositoryListTest()
        {
            this.WriteRepositoryListTest();

            JsonFileHandler<ScriptRepositoryList> handler = new JsonFileHandler<ScriptRepositoryList>();
            IPath path = new BasePath(TestHelperMethods.GetOutputDirectory() + "repositoryList.json");
            ScriptRepositoryList readList = handler.Read(path);
            Assert.IsNotNull(readList);
            Assert.IsNotNull(readList.Repositories);
            Assert.AreEqual(this.repoList.Repositories.Count, readList.Repositories.Count);
            Assert.AreEqual(this.repoList.Repositories[0].Name, readList.Repositories[0].Name);
            Assert.AreEqual(this.repoList.Repositories[0].URI, readList.Repositories[0].URI);
        }
Exemple #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            JsonFileHandler<ScriptManifest> handler = new JsonFileHandler<ScriptManifest>();
            ScriptManifest manifest = handler.Read(new BasePath("C:/temp/scriptcenter/unpacked_installer/outliner.manifest.xml"));

            JsonFileHandler<InstallerConfiguration> configHandler = new JsonFileHandler<InstallerConfiguration>();
            InstallerConfiguration config = configHandler.Read(new BasePath("C:/temp/scriptcenter/unpacked_installer/config.installer.xml"));

            Package.Installer installer = new Package.Installer("C:/temp/scriptcenter/unpacked_installer", manifest, config);
            InstallerUIConfiguration uiConfig = new InstallerUIConfiguration();

            ScriptCenter.Package.InstallerUI.InstallerDialog d = new ScriptCenter.Package.InstallerUI.InstallerDialog(installer, uiConfig);
            d.Show();
        }
        private void LoadManifest(IPath path)
        {
            JsonFileHandler<ScriptManifest> h = new JsonFileHandler<ScriptManifest>();
            ScriptManifest m = h.Read(path);

            ListViewItem i = new ListViewItem();
            if (m == null)
                i.Text = "Error loading manifest " + path.AbsolutePath;
            else
            {
                i.Text = m.Name;
                //i.SubItems.Add(m.Version.ToString());
            }

            this.listView1.Items.Add(i);
        }
        public void ReadTest()
        {
            IPath inputFile = new BasePath(TestHelperMethods.GetOutputDirectory() + "repo" + ScriptRepository.DefaultExtension);
            if (!File.Exists(inputFile.AbsolutePath))
                this.WriteTest();

            Assert.IsTrue(File.Exists(inputFile.AbsolutePath), "File to read does not exist");

            JsonFileHandler<ScriptRepository> handler = new JsonFileHandler<ScriptRepository>();
            ScriptRepository readRepo = handler.Read(inputFile);

            Assert.IsNotNull(readRepo, "Repository should not be null");
            Assert.AreEqual(repo.Scripts.Count, readRepo.Scripts.Count, "Number of scripts in default category incorrect");
            Assert.AreEqual(repo.Name, readRepo.Name, "Repository name incorrect");
            Assert.AreEqual(repo.Categories.Count, readRepo.Categories.Count, "Category count incorrect");
            Assert.AreEqual(repo.Categories[0].Scripts.Count, readRepo.Categories[0].Scripts.Count, "Category.Scripts count incorrect");
        }
        public void ReadTest()
        {
            // Write manifest.
            this.WriteTest();

            // Read and compare manifest
            JsonFileHandler<ScriptManifest> handler = new JsonFileHandler<ScriptManifest>();
            ScriptManifest readManifest = handler.Read(outputFile);
            Assert.IsNotNull(readManifest);
            Assert.AreEqual(this.manifest.Id, readManifest.Id);
            Assert.AreEqual(this.manifest.Name, readManifest.Name);
            Assert.AreEqual(this.manifest.Author, readManifest.Author);
            Assert.AreEqual(this.manifest.Versions.Count, readManifest.Versions.Count);
            Assert.AreEqual(this.manifest.Versions[0].VersionNumber.Major, readManifest.Versions[0].VersionNumber.Major);
            Assert.AreEqual(this.manifest.Versions[0].VersionNumber.Minor, readManifest.Versions[0].VersionNumber.Minor);
            Assert.AreEqual(this.manifest.Versions[0].VersionNumber.Revision, readManifest.Versions[0].VersionNumber.Revision);
            Assert.AreEqual(this.manifest.Metadata["description"], readManifest.Metadata["description"]);
        }
        public void ReadTest()
        {
            // Write installer config.
            this.WriteTest();

            // Read and compare manifest
            JsonFileHandler<InstallerConfiguration> handler = new JsonFileHandler<InstallerConfiguration>();
            IPath path = new BasePath(TestHelperMethods.GetOutputDirectory() + "/myscript" + InstallerConfiguration.DefaultExtension);
            InstallerConfiguration readConfig = handler.Read(path);
            Assert.IsNotNull(readConfig);
            Assert.AreEqual(config.Actions.Count, readConfig.Actions.Count);
            Assert.AreEqual(config, config.Actions[0].Configuration);
            Assert.AreEqual(((CopyFileAction)config.Actions[0]).Source, ((CopyFileAction)readConfig.Actions[0]).Source);
            Assert.AreEqual(((CopyFileAction)config.Actions[0]).Target, ((CopyFileAction)readConfig.Actions[0]).Target);
            Assert.AreEqual(((CopyFileAction)config.Actions[0]).UseScriptId, ((CopyFileAction)readConfig.Actions[0]).UseScriptId);
            Assert.AreEqual(((CopyDirAction)config.Actions[1]).Source, ((CopyDirAction)readConfig.Actions[1]).Source);
            Assert.AreEqual(((CopyDirAction)config.Actions[1]).Target, ((CopyDirAction)readConfig.Actions[1]).Target);
            Assert.AreEqual(((CopyDirAction)config.Actions[1]).UseScriptId, ((CopyDirAction)readConfig.Actions[1]).UseScriptId);
            Assert.AreEqual(((AssignHotkeyAction)config.Actions[2]).Keys, ((AssignHotkeyAction)readConfig.Actions[2]).Keys);
            Assert.AreEqual(((RunMaxscriptAction)config.Actions[3]).Source, ((RunMaxscriptAction)readConfig.Actions[3]).Source);
        }
Exemple #10
0
 private void readRepository(String file)
 {
     JsonFileHandler<ScriptRepository> handler = new JsonFileHandler<ScriptRepository>();
     try
     {
     ScriptRepository repo = handler.Read(new BasePath(file));
     TreeNode tn = this.addRepositoryToTree(repo, file);
     filesTree.SelectedNode = tn;
     }
     catch (Exception exc)
     {
     MessageBox.Show(exc.Message);
     }
 }
Exemple #11
0
 private void readPackage(String file)
 {
     JsonFileHandler<ScriptPackage> handler = new JsonFileHandler<ScriptPackage>();
     try
     {
     ScriptPackage pack = handler.Read(new BasePath(file));
     TreeNode tn = this.addPackageToTree(pack, file);
     filesTree.SelectedNode = tn;
     }
     catch (Exception exc)
     {
     MessageBox.Show(exc.Message);
     }
 }
Exemple #12
0
 private void readManifest(String file)
 {
     JsonFileHandler<ScriptManifest> handler = new JsonFileHandler<ScriptManifest>();
     try
     {
     ScriptManifest manif = handler.Read(new BasePath(file));
     TreeNode tn = this.addManifestToTree(manif, file);
     filesTree.SelectedNode = tn;
     }
     catch (Exception exc)
     {
     MessageBox.Show(exc.Message);
     }
 }