private void AvalonPatch_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 Avalon Patch Revision (" + patchVersion.ToString() + ")";
splash.statusTextLine2 = " ";
splash.Show();
splash.Refresh();
}
if (skInfo.configuredSkin != "Avalon")
{
MessageBox.Show("Sorry, the Avalon is configured as your default skin.\n\nThis patch updates Avalon only - Please install Avalon\n or set Avalon 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 avaloneditor = new CheckProcesses("avaloneditor");
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 (avaloneditor.running)
processess += "Avalon 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 Avalon V" + skInfo.skinVersion + " does not support this patch.\n\n Please install Avalon 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 = "Avalon Sucessfully Updated to Version : " + skInfo.skinVersion.ToString();
splash.Refresh();
}
else
{
splash.statusTextLine1 = "Avalon 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();
}
}