Exemplo n.º 1
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Executes the command.
        /// </summary>
        public void Execute()
        {
#if ENABLE_OLD_CODE
            //  TODO: This code is from the old AddCommand, so it needs to be
            //  updated eventually.

            Dataset dataset = Dataset.LoadOrCreate(Dataset.DefaultPath);
            EditableExtensionInfo.Dataset = dataset;
            ExtensionParser parser    = new ExtensionParser();
            ExtensionInfo   extension = Data.Load <ExtensionInfo>(extensionInfoPath, parser);

            List <string> missingLibs = new List <string>();
            foreach (string library in extension.ReferencedAssemblies)
            {
                if (!dataset.ReferencedByEntries(library))
                {
                    missingLibs.Add(library);
                }
            }

            List <string> libsToBeInstalled = new List <string>();
            foreach (string libPath in extension.LibraryPaths)
            {
                libsToBeInstalled.Add(Path.GetFileNameWithoutExtension(libPath));
            }

            foreach (string libToBeInstalled in libsToBeInstalled)
            {
                missingLibs.Remove(libToBeInstalled);
            }
            if (missingLibs.Count > 0)
            {
                MultiLineText message = new MultiLineText();
                message.Add("Error: The extension requires the following libraries which are not");
                message.Add("       currently installed and are not listed in the extension info file:");
                foreach (string lib in missingLibs)
                {
                    message.Add("         " + lib);
                }
                throw new MultiLineException(message);
            }

            Console.WriteLine("Installation directory: {0}", installDir);
            Console.WriteLine("Copying files to installation directory ...");
            CopyFileToInstallDir(extension.AssemblyPath);
            foreach (string libPath in extension.LibraryPaths)
            {
                CopyFileToInstallDir(libPath);
            }

            dataset.Add(extension);
            dataset.Save();
            Console.WriteLine("Extension {0} installed", extension.Name);
#endif
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Executes the command.
        /// </summary>
        public void Execute()
        {
            Dataset dataset = Util.OpenDatasetForChange(Dataset.DefaultPath);

            EditableExtensionInfo.Dataset = dataset;

            ExtensionParser parser    = new ExtensionParser();
            ExtensionInfo   extension = Data.Load <ExtensionInfo>(extensionInfoPath, parser);

            dataset.Add(extension);
            dataset.Save();
            Console.WriteLine("Added the extension \"{0}\"", extension.Name);
        }
Exemplo n.º 3
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Executes the command.
        /// </summary>
        public void Execute()
        {
            Dataset dataset = Util.OpenDatasetForChange(Dataset.DefaultPath);

            if (dataset.Count == 0)
            {
                Console.WriteLine("No extensions are installed.");
            }
            else
            {
                ExtensionInfo entry = dataset.Remove(extensionName);
                if (entry == null)
                {
                    Console.WriteLine("There is no extension named \"{0}\".", extensionName);
                }
                else
                {
                    Console.WriteLine("Removed the extension \"{0}\".", extensionName);
                    dataset.Save();
                }
            }
        }
        public void Save()
        {
            Dataset dataset = new Dataset();
            string path = Data.MakeOutputPath("Save_Test.xml");
            dataset.SaveAs(path);
            Assert.AreEqual(path, dataset.Path);

            dataset.Add(barExtension);
            dataset.Add(fooExtension);

            eventDataset = null;
            dataset.Save();
            Assert.AreEqual(path, dataset.Path);
            Assert.AreSame(dataset, eventDataset);

            Dataset loadedDataset = new Dataset(path);
            Assert.IsNotNull(loadedDataset);
            AssertAreEqual(dataset, loadedDataset);
        }