private void ProcessUpdate(ISourceProvider sourceProvider)
        {
            string appPath        = Path.GetDirectoryName(Assembly.GetEntryAssembly().FullName);
            string zipPackageName = Path.Combine(appPath, UpdatePackageName);
            string updaterFolder  = Path.Combine(appPath, UpdateFolderName);

            var packageInfo = sourceProvider.GetPackage();

            using (var fs = new FileStream(zipPackageName, FileMode.Create))
            {
                packageInfo.Stream.CopyTo(fs);
                fs.Close();
            }
            packageInfo.Stream.Dispose();

            if (Directory.Exists(updaterFolder))
            {
                Directory.Delete(updaterFolder, true);
            }

            ZipFile.ExtractToDirectory(zipPackageName, updaterFolder);
            File.Delete(zipPackageName);

            Process.Start(
                Path.Combine(updaterFolder, UpdaterName),
                String.Format("{0} {1}", Process.GetCurrentProcess().Id, Path.Combine(appPath, packageInfo.AppName)));
        }
Example #2
0
        private void ProcessUpdate(ISourceProvider sourceProvider)
        {
            string appPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().FullName);
            string zipPackageName = Path.Combine(appPath, UpdatePackageName);
            string updaterFolder = Path.Combine(appPath, UpdateFolderName);

            var packageInfo = sourceProvider.GetPackage();
            using (var fs = new FileStream(zipPackageName, FileMode.Create))
            {
                packageInfo.Stream.CopyTo(fs);
                fs.Close();
            }
            packageInfo.Stream.Dispose();

            if (Directory.Exists(updaterFolder))
            {
                Directory.Delete(updaterFolder, true);
            }

            ZipFile.ExtractToDirectory(zipPackageName, updaterFolder);
            File.Delete(zipPackageName);

            Process.Start(
                Path.Combine(updaterFolder, UpdaterName),
                String.Format("{0} {1}", Process.GetCurrentProcess().Id, Path.Combine(appPath, packageInfo.AppName)));
        }