public Task <PluginInstallationResult> install(Uri download, Uri website)
        {
            return(Task.Run(async() =>
            {
                List <FileInfo> dependecys = new List <FileInfo>();
                UniversalWebClient client = new UniversalWebClient();
                FileInfo tmpFile = new FileInfo(manager.PluginFolder.FullName + "\\plugin.tmp");

                await client.DownloadFileTaskAsync(download.ToString(), tmpFile.FullName);


                ZipFile archive = new ZipFile(tmpFile.FullName);
                if (archive.TestArchive(true))
                {
                    try
                    {
                        RocketPlugin plugin = null;

                        ExtractZipResult res = await extractZip(archive);
                        List <FileInfo> dependencys = new List <FileInfo>();
                        FileInfo plFile = null;
                        foreach (ExtractEntryResult entry in res.entries)
                        {
                            switch (entry.Type)
                            {
                            case PluginEntryType.Plugin:
                                plFile = entry.File;
                                break;

                            case PluginEntryType.Dependency:
                                dependencys.Add(entry.File);
                                break;

                            case PluginEntryType.Unknown:
                                continue;

                            default:
                                break;
                            }
                        }
                        plugin = new RocketPlugin(plFile, website.ToString(), plugin.ServerVersion, dependencys);


                        archive.Close();
                        manager.add(plugin);


                        return PluginInstallationResult.OK;
                    }
                    catch (Exception)
                    {
                        return PluginInstallationResult.Failed;
                    }
                }
                else
                {
                    return PluginInstallationResult.FailedNotAZip;
                }
            }));
        }
        public Task <RocketPlugin> installZip(string zipfile)
        {
            return(Task.Run(async() =>
            {
                RocketPlugin plugin = null;

                try
                {
                    ZipFile archive = new ZipFile(zipfile);
                    ExtractZipResult res = await extractZip(archive);
                    archive.Close();

                    List <FileInfo> dependencys = new List <FileInfo>();
                    FileInfo plFile = null;
                    foreach (ExtractEntryResult entry in res.entries)
                    {
                        switch (entry.Type)
                        {
                        case PluginEntryType.Plugin:
                            plFile = entry.File;
                            break;

                        case PluginEntryType.Dependency:
                            dependencys.Add(entry.File);
                            break;

                        case PluginEntryType.Unknown:
                            continue;

                        default:
                            break;
                        }
                    }
                    plugin = new RocketPlugin(plFile, "", "", dependencys);
                }
                catch (Exception)
                {
                    return null;
                }

                return plugin;
            }));
        }
        private Task <ExtractZipResult> extractZip(ZipFile archive)
        {
            return(Task.Run(async() =>
            {
                ExtractZipResult result = new ExtractZipResult();

                foreach (ZipEntry entry in archive)
                {
                    if (entry.IsFile)
                    {
                        if (entry.ExtraData != null)
                        {
                            result.entries.Add(await extractEntry(archive, entry));
                        }
                        else
                        {
                            throw new Exception("data is null");
                        }
                    }
                }
                return result;
            }));
        }