コード例 #1
0
        public void UpdateApplication(MBApplication app, IApplicationPaths appPaths, string archive)
        {
            // First see if there is a version file and read that in
            var version = "Unknown";

            if (File.Exists(archive + ".ver"))
            {
                version = File.ReadAllText(archive + ".ver");
            }

            // Use our installer passing it the specific archive
            // We need to copy to a temp directory and execute it there
            var source      = Path.Combine(appPaths.ProgramSystemPath, UpdaterExe);
            var tempUpdater = Path.Combine(Path.GetTempPath(), UpdaterExe);

            File.Copy(source, tempUpdater, true);
            source = Path.Combine(appPaths.ProgramSystemPath, UpdaterDll);
            var tempUpdaterDll = Path.Combine(Path.GetTempPath(), UpdaterDll);

            File.Copy(source, tempUpdaterDll, true);
            var product = app == MBApplication.MBTheater ? "mbt" : "server";

            // Our updater needs SS and ionic
            source = Path.Combine(appPaths.ProgramSystemPath, "ServiceStack.Text.dll");
            File.Copy(source, Path.Combine(Path.GetTempPath(), "ServiceStack.Text.dll"), true);
            source = Path.Combine(appPaths.ProgramSystemPath, "Ionic.Zip.dll");
            File.Copy(source, Path.Combine(Path.GetTempPath(), "Ionic.Zip.dll"), true);
            Process.Start(tempUpdater, string.Format("product={0} archive=\"{1}\" caller={2} pismo=false version={3}", product, archive, Process.GetCurrentProcess().Id, version));

            // That's it.  The installer will do the work once we exit
        }
コード例 #2
0
        public void UpdateApplication(MBApplication app, IApplicationPaths appPaths, string archive, ILogger logger, string restartServiceName)
        {
            // First see if there is a version file and read that in
            var version = "Unknown";
            if (File.Exists(archive + ".ver"))
            {
                version = File.ReadAllText(archive + ".ver");
            }

            // Use our installer passing it the specific archive
            // We need to copy to a temp directory and execute it there
            var source = Path.Combine(appPaths.ProgramSystemPath, UpdaterExe);

            logger.Info("Copying updater to temporary location");
            var tempUpdater = Path.Combine(Path.GetTempPath(), UpdaterExe);
            File.Copy(source, tempUpdater, true);
            source = Path.Combine(appPaths.ProgramSystemPath, UpdaterDll);
            var tempUpdaterDll = Path.Combine(Path.GetTempPath(), UpdaterDll);

            logger.Info("Copying updater dependencies to temporary location");
            File.Copy(source, tempUpdaterDll, true);
            var product = app == MBApplication.MBTheater ? "mbt" : "server";
            // Our updater needs SS and ionic
            source = Path.Combine(appPaths.ProgramSystemPath, "ServiceStack.Text.dll");
            File.Copy(source, Path.Combine(Path.GetTempPath(), "ServiceStack.Text.dll"), true);
            source = Path.Combine(appPaths.ProgramSystemPath, "SharpCompress.dll");
            File.Copy(source, Path.Combine(Path.GetTempPath(), "SharpCompress.dll"), true);

            logger.Info("Starting updater process.");
            Process.Start(tempUpdater, string.Format("product={0} archive=\"{1}\" caller={2} pismo=false version={3} service={4} installpath=\"{5}\"", product, archive, Process.GetCurrentProcess().Id, version, restartServiceName ?? string.Empty, appPaths.ProgramDataPath));

            // That's it.  The installer will do the work once we exit
        }
コード例 #3
0
        public void UpdateApplication(MBApplication app, IApplicationPaths appPaths, string archive)
        {
            // Use our installer passing it the specific archive
            // We need to copy to a temp directory and execute it there
            var source      = Path.Combine(appPaths.ProgramSystemPath, UpdaterExe);
            var tempUpdater = Path.Combine(Path.GetTempPath(), UpdaterExe);
            var product     = app == MBApplication.MBTheater ? "mbt" : "server";

            File.Copy(source, tempUpdater, true);
            // Our updater needs SS and ionic
            source = Path.Combine(appPaths.ProgramSystemPath, "ServiceStack.Text.dll");
            File.Copy(source, Path.Combine(Path.GetTempPath(), "ServiceStack.Text.dll"), true);
            source = Path.Combine(appPaths.ProgramSystemPath, "Ionic.Zip.dll");
            File.Copy(source, Path.Combine(Path.GetTempPath(), "Ionic.Zip.dll"), true);
            Process.Start(tempUpdater, string.Format("product={0} archive=\"{1}\" caller={2} pismo=false", product, archive, Process.GetCurrentProcess().Id));

            // That's it.  The installer will do the work once we exit
        }