private void Done(RequestState state)
        {
            string path = PluginSaveHelper.BuildSavePath(info, latest.CreationTime, ".zip");

            File.WriteAllBytes(path, state.ResponseContent.ToArray());

            string tmp = Path.Combine(Path.GetDirectoryName(path), "tmp");

            System.IO.Compression.ZipFile.ExtractToDirectory(path, tmp);
            File.Delete(path);
            string[] files = Directory.GetFiles(tmp, "*.exe");
            if (files.Length == 0)
            {
                return;
            }

            string newpath = PluginSaveHelper.BuildSavePath(info, latest.CreationTime);

            if (File.Exists(newpath))
            {
                File.Delete(newpath);
            }

            File.Move(files[0], newpath);

            BuildVersion(newpath);

            Directory.Delete(tmp, true);
            EventProcessing(this, new PluginEventArgs(latest.ToString()));
        }
Esempio n. 2
0
        private void Done(RequestState state)
        {
            string path = PluginSaveHelper.BuildSavePath(info, latest.CreationTime);

            File.WriteAllBytes(path, state.ResponseContent.ToArray());

            BuildVersion(null);
            EventProcessing(this, new PluginEventArgs(latest.ToString()));
        }