mirror of
https://github.com/GittyMac/OpenFK.git
synced 2026-08-05 12:01:56 -05:00
Added FetchOCX
This commit is contained in:
parent
0e68207472
commit
90d5e1c2c7
|
|
@ -1,5 +1,6 @@
|
|||
using AxShockwaveFlashObjects;
|
||||
using DiscordRPC;
|
||||
using Microsoft.Win32;
|
||||
using OpenFK.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -137,6 +138,11 @@ namespace OpenFK
|
|||
|
||||
if (Settings.Default.USBSupport == true)
|
||||
{
|
||||
var key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", true);
|
||||
if (key == null)
|
||||
throw new InvalidOperationException(@"Cannot open registry key HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers.");
|
||||
using (key)
|
||||
key.SetValue(Directory.GetParent(Directory.GetCurrentDirectory()) + @"\MegaByte\" + "MegaByte.exe", "VISTASP2");
|
||||
Process MBRun = new Process();
|
||||
ProcessStartInfo MBData = new ProcessStartInfo();
|
||||
MBData.FileName = Directory.GetParent(Directory.GetCurrentDirectory()) + @"\MegaByte\" + "MegaByte.exe";
|
||||
|
|
@ -469,8 +475,15 @@ namespace OpenFK
|
|||
}
|
||||
if(Settings.Default.USBSupport == true)
|
||||
{
|
||||
Process process = Process.GetProcessesByName("MegaByte")[0];
|
||||
process.Kill();
|
||||
try
|
||||
{
|
||||
Process process = Process.GetProcessesByName("MegaByte")[0];
|
||||
process.Kill();
|
||||
}
|
||||
catch
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
Application.Exit(); //Closes OpenFK
|
||||
Debug.WriteLine("radicaclose called, goodbye!"); //Debug output
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@
|
|||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Resources\FetchOCX.bat" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="AxShockwaveFlashObjects">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
|
@ -22,8 +23,24 @@ namespace OpenFK
|
|||
}
|
||||
else if (File.Exists(Directory.GetCurrentDirectory() + @"\Flash.ocx"))
|
||||
{
|
||||
Application.Run(new Form1());
|
||||
}else MessageBox.Show("Flash.ocx is not found!", "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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
21
OpenFK/Properties/Resources.Designer.cs
generated
21
OpenFK/Properties/Resources.Designer.cs
generated
|
|
@ -59,5 +59,26 @@ namespace OpenFK.Properties {
|
|||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to @echo off
|
||||
///echo Welcome to OpenFK OCX fetcher!
|
||||
///echo Written by GittyMac
|
||||
///echo ------------------------------
|
||||
///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"
|
||||
///echo Extracting MSU...
|
||||
///expand -f:* update.msu ./
|
||||
///echo Extracting CAB...
|
||||
///expand Windows10.0-KB3087040-x64.cab -F:* ./
|
||||
///echo Fetching OCX... [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string FetchOCX {
|
||||
get {
|
||||
return ResourceManager.GetString("FetchOCX", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
|
|
@ -60,6 +60,7 @@
|
|||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
|
|
@ -68,9 +69,10 @@
|
|||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
|
|
@ -85,9 +87,10 @@
|
|||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
|
|
@ -109,9 +112,13 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="FetchOCX" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\FetchOCX.bat;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||
</data>
|
||||
</root>
|
||||
27
OpenFK/Resources/FetchOCX.bat
Normal file
27
OpenFK/Resources/FetchOCX.bat
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
@echo off
|
||||
echo Welcome to OpenFK OCX fetcher!
|
||||
echo Written by GittyMac
|
||||
echo ------------------------------
|
||||
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"
|
||||
echo Extracting MSU...
|
||||
expand -f:* update.msu ./
|
||||
echo Extracting CAB...
|
||||
expand Windows10.0-KB3087040-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"
|
||||
GOTO END
|
||||
|
||||
:32BIT
|
||||
copy "%cd%\wow64_adobe-flash-for-windows_31bf3856ad364e35_10.0.10240.16513_none_3df79e2d389b2288\flash.ocx" "..\Flash.ocx"
|
||||
GOTO END
|
||||
|
||||
:END
|
||||
cd ..
|
||||
rmdir /s /q tempdl
|
||||
echo Your Flash.OCX is served!
|
||||
Loading…
Reference in New Issue
Block a user