Ejemplo n.º 1
0
        public async Task CheckAndInstallPluginUpdates()
        {
            var updateDirectory = Path.Combine(ServerInfo.GetTempPath(), ServerInfo.PluginUpdateDirectoryName);

            if (!Directory.Exists(updateDirectory))
            {
                Directory.CreateDirectory(updateDirectory);
                return;
            }

            var files = Directory.GetFiles(updateDirectory);

            foreach (var f in files)
            {
                var tmp = Path.Combine(ServerInfo.GetTempPath(), Guid.NewGuid().ToString().Replace("-", ""));
                try
                {
                    var manifest = Common.Update.Plugin.GetPluginManifest(_logger, f, tmp);
                    await _pluginInstaller.InstallPlugin(manifest, f);
                }
                catch (Exception e)
                {
                    _logger.LogError(e, "Could not install plugin");
                }
                finally
                {
                    Directory.Delete(tmp, true);
                }
                File.Delete(f);
            }
        }
Ejemplo n.º 2
0
 public Task <bool> InstallPlugin(Plugin plugin, string fileName)
 {
     return(_pluginInstaller.InstallPlugin(plugin, fileName));
 }