Пример #1
0
 /// <summary>
 /// Reads installed plugins from JSON and writes 'em to console
 /// </summary>
 public static void ListInstalledPlugins()
 {
     Console.WriteLine("Installed plugins\n");
     foreach (var pluginRecord in PluginDb.ReadFromJson())
     {
         Console.WriteLine($"{pluginRecord.name} ({pluginRecord.id}) version: {pluginRecord.version}");
     }
 }
Пример #2
0
        /// <summary>
        /// Installs plugin specified by resourceId
        /// TODO: Change this to any input and try to find desired plugin by name or directly by ID.
        /// </summary>
        /// <param name="resourceId"></param>
        public static void InstallPlugin(long resourceId)
        {
            var resourceDetails = Calls.GetResourceDetails(resourceId);

            Console.WriteLine($"Installing plugin {resourceDetails.Name}");

            //downloading plugin
            if (!PluginIO.DownloadPlugin(resourceDetails.Id))
            {
                return;
            }

            //writing record to DB
            PluginDb.WriteToJson(new []
            {
                new PluginRecord()
                {
                    name = resourceDetails.Name, id = resourceDetails.Id, version = resourceDetails.Version.Id
                },
            });
        }
Пример #3
0
 public static void UninstallPlugin(int resourceId)
 {
     //removing record from DB
     PluginDb.RemoveFromJson(resourceId);
     //deleting plugin from /plugins folder
 }