Updated the fetched OCX

This commit is contained in:
GittyMac 2022-04-23 00:48:48 -04:00
parent dfdb929f07
commit 80affdba44
3 changed files with 50 additions and 17 deletions

View File

@ -349,14 +349,6 @@ namespace OpenFK
setRP("Exploring", "Paradox Green", currentBitty, currentBittyName);
}
}
if (Properties.Settings.Default.IsOnline)
{
if (e.args.Contains(@"=""config"""))
{
}
}
}
}

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Windows.Forms;
namespace OpenFK
@ -27,13 +28,41 @@ namespace OpenFK
}
else if (File.Exists(Directory.GetCurrentDirectory() + @"\Flash.ocx"))
{
try
if(CalculateMD5(Directory.GetCurrentDirectory() + @"\Flash.ocx") == "0c8fbd12f40dcd5a1975b671f9989900" ||
CalculateMD5(Directory.GetCurrentDirectory() + @"\Flash.ocx") == "28642aa6626e42701677a1f3822306b0")
{
Application.Run(new Form1());
if (MessageBox.Show("The current Flash.ocx is a buggy version! It causes several problems in the game. Do you want to fetch a compatible OCX?", "OpenFK", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{
File.WriteAllText(Directory.GetCurrentDirectory() + @"\FetchOCX.bat", Properties.Resources.FetchOCX);
ProcessStartInfo fetchocx = new ProcessStartInfo(Directory.GetCurrentDirectory() + @"\FetchOCX.bat");
fetchocx.UseShellExecute = false;
var ocxprocess = Process.Start(fetchocx);
ocxprocess.WaitForExit();
File.Delete(Directory.GetCurrentDirectory() + @"\FetchOCX.bat");
Application.Restart();
}
else
{
try
{
Application.Run(new Form1());
}
catch
{
MessageBox.Show("There was an error starting the game! This could happen because of a 64 bit OCX running on a 32 bit OpenFK.", "OpenFK", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
catch
else
{
MessageBox.Show("There was an error starting the game! This could happen because of a 64 bit OCX running on a 32 bit OpenFK.", "OpenFK", MessageBoxButtons.OK, MessageBoxIcon.Error);
try
{
Application.Run(new Form1());
}
catch
{
MessageBox.Show("There was an error starting the game! This could happen because of a 64 bit OCX running on a 32 bit OpenFK.", "OpenFK", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}else if (MessageBox.Show("Flash.ocx is not found! Do you want to fetch a compatible OCX?", "OpenFK", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{
@ -46,5 +75,17 @@ namespace OpenFK
Application.Restart();
}
}
static string CalculateMD5(string filename) //Generates the MD5 hash.
{
using (var md5 = MD5.Create())
{
using (var stream = File.OpenRead(filename))
{
var hash = md5.ComputeHash(stream); //Computes the MD5 hash of the swf.
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); //Converts the hash to a readable string to compare.
}
}
}
}
}

View File

@ -7,23 +7,23 @@ if %var% lss 3 @echo Your Powershell version is too old to fetch the OCX. Update
echo Downloading data...
mkdir tempdl
cd tempdl
powershell -Command "Invoke-WebRequest http://download.windowsupdate.com/d/msdownload/update/software/secu/2015/09/windows10.0-kb3087040-x64_ad0f78efb7b122fa9472dbb8050c4f358aceab49.msu -OutFile update.msu"
powershell -Command "Invoke-WebRequest http://download.windowsupdate.com/c/msdownload/update/software/secu/2019/06/windows10.0-kb4503308-x64_b6478017674279c8ba4f06e60fc3bab04ed7ae02.msu -OutFile update.msu"
echo Extracting MSU...
expand -f:* update.msu ./
echo Extracting CAB...
expand Windows10.0-KB3087040-x64.cab -F:* ./
expand Windows10.0-KB4503308-x64.cab -F:* ./
echo Fetching OCX...
IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)
:64BIT
copy "%cd%\amd64_adobe-flash-for-windows_31bf3856ad364e35_10.0.10240.16513_none_33a2f3db043a608d\flash.ocx" "..\Flash.ocx"
copy "%cd%\amd64_adobe-flash-for-windows_31bf3856ad364e35_10.0.18362.172_none_815470a5fb446c4e\flash.ocx" "..\Flash.ocx"
GOTO END
:32BIT
copy "%cd%\wow64_adobe-flash-for-windows_31bf3856ad364e35_10.0.10240.16513_none_3df79e2d389b2288\flash.ocx" "..\Flash.ocx"
copy "%cd%\wow64_adobe-flash-for-windows_31bf3856ad364e35_10.0.18362.172_none_8ba91af82fa52e49\flash.ocx" "..\Flash.ocx"
GOTO END
:END
cd ..
rmdir /s /q tempdl
echo Your Flash.OCX is served!
echo Your Flash.OCX is served!