示例#1
0
        private void SMPpatch_Load(object sender, EventArgs e)
        {
            //Ensure this is always on top
              //this.TopMost = true;

              //Display full screen Splash if in unattended mode.
              if (unattendedInatall)
              {
            Version patchVersion = new Version(Application.ProductVersion);
            splash.statusTextLine1 = "Applying StreamedMP Patch Revision (" + patchVersion.ToString() + ")";
            splash.statusTextLine2 = " ";
            splash.Show();
            splash.Refresh();

              }
              if (skInfo.configuredSkin != "StreamedMP")
              {
            MessageBox.Show("Sorry, the StreamedMP is configured as your default skin.\n\nThis patch updates StreamedMP only - Please install StreamedMP\n or set StreamedMP as your defult skin before running this patch.", "Patch Installation Error");
            Environment.Exit(0);
              }

              string processess = null;

              CheckProcesses mediaportal = new CheckProcesses("mediaportal");
              CheckProcesses configuration = new CheckProcesses("configuration");
              CheckProcesses smpeditor = new CheckProcesses("smpeditor");
              CheckProcesses pluginconfigloader = new CheckProcesses("pluginconfigloader");

              if (skInfo.minimiseMPOnExit.ToLower() == "yes")
              {
            mediaportal.kill();
            Thread.Sleep(3000);
              }

              introBox.SelectionStart = 0;

              int waitCount = 0;
              while (!checkRunningProcess())
              {
            // Check running process and wait 10sec for processes to exit
            if (!checkRunningProcess())
              if (mediaportal.running)
            processess = "MediaPortal\n";
            if (configuration.running)
              processess += "Configuration.exe\n";
            if (smpeditor.running)
              processess += "StreamedMP basicHome Editor\n";
            if (pluginconfigloader.running)
              processess += "Plugin Config Loader\n";

            if (waitCount > 10)
            {
              DialogResult result = MessageBox.Show("The Follow Process are Still Running\n\n" + processess + "\nPlease close application and Retry\n\nPressing Cancel will Abort the Upgrade Process",
                "Retry",
                MessageBoxButtons.RetryCancel,
                MessageBoxIcon.Question,
                MessageBoxDefaultButton.Button2);

              if (result == DialogResult.Cancel)
              {
            Application.Exit();
              }
            }
            else
              Thread.Sleep(1000);

            processess = null;
            waitCount++;
              }

              // Create the temp directory to store the extracted patches
              Directory.CreateDirectory(tempExtractPath);
              readPatchControl();
              if (skInfo.skinVersion.CompareTo(minSMPVersion) < 0)
              {
            MessageBox.Show("The Installed Version of StreamedMP V" + skInfo.skinVersion + " does not support this patch.\n\n  Please install StreamedMP V" + minSMPVersion.ToString() + " or greater before applying this patch.\n\n                                  This program will now terminate", "Incompatible Skin Version");
            Application.Exit();
              }
              // First check if we have any patches to install - this could be being run on a system that is already patched
              foreach (patchFile patch in patchFiles)
              {
            if (thePatches.Items[i].ImageIndex != 0)
              patchesToInstall = true;
            i++;
              }
              if (!patchesToInstall)
            btInstallPatch.Enabled = false;

              if (unattendedInatall)
              {
            if (patchesToInstall)
            {
              installThePatches();
              splash.statusTextLine1 = "StreamedMP Sucessfully Updated to Version : " + skInfo.skinVersion.ToString();
              splash.Refresh();
            }
            else
            {
              splash.statusTextLine1 = "StreamedMP is fully patched - no updates are required.";
              splash.Refresh();
            }
            for (int i = 5; i > 0; i--)
            {
              if (restartMediaPortal)
            splash.statusTextLine2 = String.Format("Restarting MediaPortal ({0})",i);
              else if (restartConfiguration)
            splash.statusTextLine2 = String.Format("Restarting Configuration ({0})",i);
              else
              {
            splash.Refresh();
            Thread.Sleep(2000);
            break;
              }
              splash.Refresh();
              Thread.Sleep(1000);
            }
            exitAndCleanup();
              }
        }
示例#2
0
        bool checkRunningProcess()
        {
            CheckProcesses mediaportal = new CheckProcesses("mediaportal");
              CheckProcesses configuration = new CheckProcesses("configuration");
              CheckProcesses smpeditor = new CheckProcesses("smpeditor");
              CheckProcesses pluginconfigloader = new CheckProcesses("pluginconfigloader");

              if (!mediaportal.running)
              {
            mediaportalStatus.ForeColor = Color.Green;
            mediaportalStatus.Text = "Shutdown";
              }
              else
            return false;

              if (!configuration.running)
              {
            configurationStatus.ForeColor = Color.Green;
            configurationStatus.Text = "Shutdown";
              }
              else
            return false;

              if (!smpeditor.running)
              {
            smpeditorStatus.ForeColor = Color.Green;
            smpeditorStatus.Text = "Shutdown";
              }
              else
            return false;

              if (!pluginconfigloader.running)
              {
            configLoaderStatus.ForeColor = Color.Green;
            configLoaderStatus.Text = "Shutdown";
              }
              else
            return false;

              return true;
        }