Esempio n. 1
0
        /// <summary>
        /// Load or creates a dataset which will have its contents changed.
        /// </summary>
        /// <remarks>
        /// When the dataset is saved, the javascript file with extension
        /// information will be updated.
        /// </remarks>
        public static Dataset OpenDatasetForChange(string path)
        {
            Dataset dataset = Dataset.LoadOrCreate(path);

            Dataset.SavedEvent += WriteJavascriptFile;
            return(dataset);
        }
Esempio n. 2
0
        //---------------------------------------------------------------------

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

            if (dataset.Count == 0)
            {
                Console.WriteLine("No extensions are installed.");
            }
            else
            {
                List <ExtensionInfo> extensions = Util.GetExtsInAlphaOrder(dataset);
                for (int i = 0; i < extensions.Count; i++)
                {
                    if (i >= 1)
                    {
                        Console.WriteLine();
                    }
                    ExtensionInfo entry = extensions[i];
                    Console.WriteLine("Extension    {0}", Util.QuoteIfNeeded(entry.Name));
                    WriteOptionalInfo("Version      {0}", entry.Version);
                    Console.WriteLine("Type         {0}", Util.QuoteIfNeeded(entry.Type));
                    Console.WriteLine("Assembly     {0}", entry.AssemblyName);
                    Console.WriteLine("Class        {0}", entry.ClassName);
                    WriteOptionalInfo("Description  {0}", entry.Description);
                    WriteOptionalInfo("UserGuide    {0}", entry.UserGuidePath);
                    WriteOptionalInfo("CoreVersion  {0}", entry.CoreVersion);
                }
            }
        }
Esempio n. 3
0
        //---------------------------------------------------------------------

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

            if (dataset.Count == 0)
            {
                Console.WriteLine("No extensions are installed.");
            }
            else
            {
                List <ExtensionInfo> extensions = Util.GetExtsInAlphaOrder(dataset);

                const string nameHeading = "Extension";
                int          maxNameLen  = nameHeading.Length;
                foreach (ExtensionInfo extension in extensions)
                {
                    if (extension.Name.Length > maxNameLen)
                    {
                        maxNameLen = extension.Name.Length;
                    }
                }
                string format = string.Format("{{0,{0}}}  {{1}}", -maxNameLen);

                Console.WriteLine(format, nameHeading, "Description");
                Console.WriteLine(format, new string('-', nameHeading.Length), "-----------");
                foreach (ExtensionInfo extension in extensions)
                {
                    Console.WriteLine(format, extension.Name, extension.Description);
                }
            }
        }
Esempio n. 4
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
        }