mirror of
https://github.com/GittyMac/OpenFK.git
synced 2026-04-19 15:37:21 -05:00
Initial Release
This commit is contained in:
parent
72b8f33fbd
commit
bd92cd45b3
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2020 GittyMac
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
34
NOTICES
Normal file
34
NOTICES
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
discord-rpc-csharp
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Lachee
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
Newtonsoft.Json
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007 James Newton-King
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
29
OpenFK/Form1.Designer.cs
generated
29
OpenFK/Form1.Designer.cs
generated
|
|
@ -29,39 +29,38 @@
|
|||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
||||
this.axShockwaveFlash1 = new AxShockwaveFlashObjects.AxShockwaveFlash();
|
||||
((System.ComponentModel.ISupportInitialize)(this.axShockwaveFlash1)).BeginInit();
|
||||
this.AS2Container = new AxShockwaveFlashObjects.AxShockwaveFlash();
|
||||
((System.ComponentModel.ISupportInitialize)(this.AS2Container)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// axShockwaveFlash1
|
||||
// AS2Container
|
||||
//
|
||||
this.axShockwaveFlash1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.axShockwaveFlash1.Enabled = true;
|
||||
this.axShockwaveFlash1.Location = new System.Drawing.Point(0, 0);
|
||||
this.axShockwaveFlash1.Name = "axShockwaveFlash1";
|
||||
this.axShockwaveFlash1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axShockwaveFlash1.OcxState")));
|
||||
this.axShockwaveFlash1.Size = new System.Drawing.Size(800, 600);
|
||||
this.axShockwaveFlash1.TabIndex = 0;
|
||||
this.AS2Container.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.AS2Container.Enabled = true;
|
||||
this.AS2Container.Location = new System.Drawing.Point(0, 0);
|
||||
this.AS2Container.Name = "AS2Container";
|
||||
this.AS2Container.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("AS2Container.OcxState")));
|
||||
this.AS2Container.Size = new System.Drawing.Size(800, 600);
|
||||
this.AS2Container.TabIndex = 0;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(800, 600);
|
||||
this.Controls.Add(this.axShockwaveFlash1);
|
||||
this.Controls.Add(this.AS2Container);
|
||||
this.Name = "Form1";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultBounds;
|
||||
this.Text = "OpenFK";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_FormClosing);
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.axShockwaveFlash1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.AS2Container)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private AxShockwaveFlashObjects.AxShockwaveFlash axShockwaveFlash1;
|
||||
private AxShockwaveFlashObjects.AxShockwaveFlash AS2Container;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
409
OpenFK/Form1.cs
409
OpenFK/Form1.cs
|
|
@ -1,4 +1,6 @@
|
|||
using AxShockwaveFlashObjects;
|
||||
using DiscordRPC;
|
||||
using OpenFK.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
|
@ -7,15 +9,38 @@ using System.Diagnostics;
|
|||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace OpenFK
|
||||
{
|
||||
|
||||
// ===================================
|
||||
// ____ ______ _ __
|
||||
// / __ \ | ____| |/ /
|
||||
//| | | |_ __ ___ _ __ | |__ | ' /
|
||||
//| | | | '_ \ / _ \ '_ \| __| | <
|
||||
//| |__| | |_) | __/ | | | | | . \
|
||||
// \____/| .__/ \___|_| |_|_| |_|\_\
|
||||
// | |
|
||||
// |_|
|
||||
// ===================================
|
||||
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public string Host; //Host
|
||||
public string Host2; //Host2
|
||||
public string Store; //FilestoreV2 (For updates)
|
||||
public string TStore; //Trunk
|
||||
public DiscordRpcClient client;
|
||||
private FileSystemWatcher watcher;
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
|
@ -23,108 +48,370 @@ namespace OpenFK
|
|||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
axShockwaveFlash1.Movie = Directory.GetCurrentDirectory() + @"\Main.swf"; //Sets Main.swf as the Flash Movie to Play.
|
||||
axShockwaveFlash1.Play(); //Plays Main.swf
|
||||
//Checks if the main SWF exists
|
||||
if(!File.Exists(Directory.GetCurrentDirectory() + @"\Main.swf"))
|
||||
{
|
||||
MessageBox.Show("Could not find Main.swf!", "OpenFK", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Application.Exit();
|
||||
}
|
||||
//End of Main.SWF check
|
||||
|
||||
//RP Initialize
|
||||
if (Settings.Default.RPC == true)
|
||||
{
|
||||
client = new DiscordRpcClient("CLIENTID"); //Redacted client ID.
|
||||
client.Initialize();
|
||||
setRP("Main Menu", "At the main menu");
|
||||
}
|
||||
//End of RP Initialize
|
||||
|
||||
//Flash initialization
|
||||
AS2Container.Movie = Directory.GetCurrentDirectory() + @"\Main.swf"; //Sets Main.swf as the Flash Movie to Play.
|
||||
AS2Container.Play(); //Plays Main.swf
|
||||
Debug.WriteLine("Main.swf is Loaded");
|
||||
axShockwaveFlash1.FSCommand += new _IShockwaveFlashEvents_FSCommandEventHandler(flashPlayer_FSCommand); //This sets up the FSCommand handler, which CCommunicator likes to use a lot.
|
||||
AS2Container.FSCommand += new _IShockwaveFlashEvents_FSCommandEventHandler(flashPlayer_FSCommand); //This sets up the FSCommand handler, which CCommunicator likes to use a lot.
|
||||
//End of Flash initialization
|
||||
|
||||
//customF Initialization
|
||||
if (Settings.Default.customF == true) //If using no USB
|
||||
{
|
||||
this.watcher = new FileSystemWatcher();
|
||||
watcher.Path = Directory.GetCurrentDirectory();
|
||||
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
|
||||
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
|
||||
watcher.Filter = "customF.txt";
|
||||
watcher.Changed += OnChanged;
|
||||
watcher.EnableRaisingEvents = true;
|
||||
}
|
||||
//End of customF Initialization
|
||||
}
|
||||
|
||||
//
|
||||
//CUSTOMF
|
||||
//
|
||||
private void OnChanged(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
setVar(@"<bitybyte id=""" + File.ReadAllText(Directory.GetCurrentDirectory() + @"\customF.txt").Remove(0, 14) + "00000000" + @""" />");
|
||||
}
|
||||
|
||||
//
|
||||
//FSCOMMAND HANDLER
|
||||
//
|
||||
|
||||
void flashPlayer_FSCommand(object sender, _IShockwaveFlashEvents_FSCommandEvent e) //FSCommand Handler
|
||||
{
|
||||
Debug.WriteLine("NEW COMMAND!" + " - " + e.command + " " + e.args);
|
||||
if (e.args.Contains("<load ")) //RDF loading
|
||||
|
||||
//
|
||||
// XML LOAD COMMANDS
|
||||
//
|
||||
|
||||
if (e.args.Contains("<load ")) //load
|
||||
{
|
||||
//Removes Commands section
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(e.args.ToString());
|
||||
var nodeList = doc.SelectNodes("commands");
|
||||
string commandLimited = "";
|
||||
foreach (XmlNode node in nodeList)
|
||||
//XML PARSING
|
||||
string filename; //section
|
||||
string foldername; //name
|
||||
XmlDocument request = new XmlDocument(); //e.args to xml
|
||||
request.LoadXml(e.args);
|
||||
XmlNodeList xnList = request.SelectNodes("/commands/load"); //filters xml to the load info
|
||||
foreach (XmlNode xn in xnList) //fetches the information to load
|
||||
{
|
||||
Console.WriteLine(node.InnerXml);
|
||||
commandLimited = node.InnerXml;
|
||||
//XML LOADING
|
||||
filename = xn.Attributes["section"].Value;
|
||||
foldername = xn.Attributes["name"].Value;
|
||||
Debug.WriteLine("RDF Request: Section - {0} Name - {1}", filename, foldername);
|
||||
loadFile(filename, foldername);
|
||||
|
||||
//Server Data
|
||||
//TO BE IMPLEMENTED!!!
|
||||
if (e.args.Contains("config"))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//BityByte
|
||||
if (Settings.Default.customF == true) //If using no USB
|
||||
{
|
||||
if (e.args.Contains("trunk_main"))
|
||||
{
|
||||
setVar(@"<bitybyte id=""FFFFFFF000000000"" />");
|
||||
}
|
||||
}
|
||||
|
||||
//Rich Prescense
|
||||
if (Settings.Default.RPC == true)
|
||||
{
|
||||
if (e.args.Contains(@"=""city"""))
|
||||
{
|
||||
setRP("Exploring", "Funkeystown");
|
||||
}
|
||||
else if (e.args.Contains(@"=""lava"""))
|
||||
{
|
||||
setRP("Exploring", "Magma Gorge");
|
||||
}
|
||||
else if (e.args.Contains(@"=""space"""))
|
||||
{
|
||||
setRP("Exploring", "Laputta Station");
|
||||
}
|
||||
else if (e.args.Contains(@"=""underwater"""))
|
||||
{
|
||||
setRP("Exploring", "Kelpy Basin");
|
||||
}
|
||||
else if (e.args.Contains(@"=""island"""))
|
||||
{
|
||||
setRP("Exploring", "Funkiki Island");
|
||||
}
|
||||
else if (e.args.Contains(@"=""racer"""))
|
||||
{
|
||||
setRP("Exploring", "Royalton Racing Complex");
|
||||
}
|
||||
else if (e.args.Contains(@"=""night"""))
|
||||
{
|
||||
setRP("Exploring", "Nightmare Rift");
|
||||
}
|
||||
else if (e.args.Contains(@"=""day"""))
|
||||
{
|
||||
setRP("Exploring", "Daydream Oasis");
|
||||
}
|
||||
else if (e.args.Contains(@"=""realm"""))
|
||||
{
|
||||
setRP("Exploring", "Hidden Realm");
|
||||
}
|
||||
else if (e.args.Contains(@"=""ssl"""))
|
||||
{
|
||||
setRP("Exploring", "Angus Manor");
|
||||
}
|
||||
else if (e.args.Contains(@"=""green"""))
|
||||
{
|
||||
setRP("Exploring", "Paradox Green");
|
||||
}
|
||||
}
|
||||
}
|
||||
XmlDocument doc2 = new XmlDocument();
|
||||
doc2.LoadXml(commandLimited);
|
||||
XmlElement root = doc2.DocumentElement;
|
||||
//Checks filename.
|
||||
string name = root.GetAttribute("section");
|
||||
//Gets filename
|
||||
string index = File.ReadAllText(@"C:\Users\Lako\Documents\UB Funkeys\RadicaGame\data\system\" + name + ".xml");
|
||||
Debug.WriteLine("RDF - Sent " + name + ".xml");
|
||||
//Sends filename to the game
|
||||
axShockwaveFlash1.SetVariable("msg", index.ToString());
|
||||
}
|
||||
if (e.args.Contains("<save")) //Save
|
||||
|
||||
//
|
||||
// END OF XML LOAD COMMANDS
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// XML SAVE COMMANDS
|
||||
//
|
||||
|
||||
if (e.args.Contains("<save "))
|
||||
{
|
||||
//Removes the Commands Section
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(e.args.ToString());
|
||||
var nodeList = doc.SelectNodes("commands");
|
||||
string commandLimited = "";
|
||||
foreach (XmlNode node in nodeList)
|
||||
//XML PARSING
|
||||
|
||||
string filename; //section
|
||||
string foldername; //name
|
||||
XmlDocument request = new XmlDocument(); //e.args to xml
|
||||
request.LoadXml(e.args);
|
||||
XmlNodeList xnList = request.SelectNodes("/commands/save"); //filters xml to the load info;
|
||||
foreach (XmlNode xn in xnList) //fetches the information to load
|
||||
{
|
||||
Console.WriteLine(node.InnerXml);
|
||||
commandLimited = node.InnerXml;
|
||||
filename = xn.Attributes["section"].Value;
|
||||
foldername = xn.Attributes["name"].Value;
|
||||
Debug.WriteLine("RDF Request: Section - {0} Name - {1}", filename, foldername); //debug output
|
||||
|
||||
XDocument args = XDocument.Parse(e.args);
|
||||
|
||||
var save = args.Root.Element("save"); //Removing save element
|
||||
save.Remove();
|
||||
args.Root.Add(save.Elements());
|
||||
|
||||
XElement firstChild = args.Root.Elements().First(); //Removing commands element
|
||||
XDocument output = new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
|
||||
firstChild);
|
||||
|
||||
if(!Directory.Exists(Directory.GetCurrentDirectory() + @"\data\" + foldername))
|
||||
{
|
||||
Directory.CreateDirectory(Directory.GetCurrentDirectory() + @"\data\" + foldername);
|
||||
}
|
||||
File.WriteAllText(Directory.GetCurrentDirectory() + @"\data\" + foldername + @"\" + filename + ".xml", output.ToString()); //saves
|
||||
}
|
||||
//Removes the Save section
|
||||
XmlDocument doc2 = new XmlDocument();
|
||||
doc2.LoadXml(commandLimited);
|
||||
XmlElement root = doc2.DocumentElement;
|
||||
//Gets the filename to save.
|
||||
string name = root.GetAttribute("section");
|
||||
var nodeList2 = doc.SelectNodes("save");
|
||||
string commandLimited2 = "";
|
||||
foreach (XmlNode node in nodeList2)
|
||||
{
|
||||
Console.WriteLine(node.InnerXml);
|
||||
commandLimited2 = node.InnerXml;
|
||||
}
|
||||
XmlDocument doc3 = new XmlDocument();
|
||||
doc3.LoadXml(commandLimited2);
|
||||
//Saves XML
|
||||
File.WriteAllText(@"C:\Users\Lako\Documents\UB Funkeys\RadicaGame\data\system\" + name + ".xml", commandLimited2);
|
||||
Debug.WriteLine("RDF - Saved " + name + ".xml");
|
||||
axShockwaveFlash1.SetVariable("msg", @"<save name=""system"" section=""" + name + @""" result=""0"" />");
|
||||
}
|
||||
|
||||
//
|
||||
// END OF XML SAVE COMMANDS
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// CLOSE COMMAND
|
||||
//
|
||||
|
||||
if (e.args.Contains("radicaclose")) //Exit
|
||||
{
|
||||
Application.Exit();
|
||||
Debug.WriteLine("radicaclose called, goodbye!");
|
||||
if (Settings.Default.RPC == true)
|
||||
{
|
||||
client.Dispose(); //Disposes RP
|
||||
}
|
||||
Application.Exit(); //Closes OpenFK
|
||||
Debug.WriteLine("radicaclose called, goodbye!"); //Debug output
|
||||
}
|
||||
|
||||
//
|
||||
//END OF CLOSE COMMAND
|
||||
//
|
||||
|
||||
//
|
||||
//FULLSCREEN COMMAND
|
||||
//
|
||||
|
||||
if (e.args.Contains("fullscreen")) //Fullscreen
|
||||
{
|
||||
|
||||
//PARSE OF XML DATA
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(e.args.ToString());
|
||||
var nodeList = doc.SelectNodes("commands");
|
||||
string commandLimited = "";
|
||||
foreach (XmlNode node in nodeList)
|
||||
{
|
||||
Console.WriteLine(node.InnerXml);
|
||||
Debug.WriteLine(node.InnerXml);
|
||||
commandLimited = node.InnerXml;
|
||||
}
|
||||
XmlDocument doc2 = new XmlDocument();
|
||||
doc2.LoadXml(commandLimited);
|
||||
var nodeList2 = doc2.SelectNodes("state");
|
||||
XmlElement root = doc2.DocumentElement;
|
||||
String name = root.GetAttribute("state");
|
||||
if(name == "1")
|
||||
string name = root.GetAttribute("state"); //Fullscreen status
|
||||
|
||||
//AFTER PARSE
|
||||
|
||||
if (name == "1") //Fullscreen Mode
|
||||
{
|
||||
this.FormBorderStyle = FormBorderStyle.None;
|
||||
this.WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
else if (name == "0") //Window Mode
|
||||
{
|
||||
this.FormBorderStyle = FormBorderStyle.Sizable;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//END OF FULLSCREEN COMMAND
|
||||
//
|
||||
|
||||
//
|
||||
//HTTP NETCOMMANDS
|
||||
//
|
||||
|
||||
//HTTP POST (CRIB SAVING + POSTCARDS)
|
||||
if (e.args.Contains("<netcommands"))
|
||||
{
|
||||
Debug.WriteLine("NETCOMMAND!");
|
||||
//AS2Container.SetVariable("msg", HTTPPost(e.args, Host).ToString()); //Sends the result of the POST request. It's usually a command for the game to handle.
|
||||
}
|
||||
|
||||
//UPDATE CHECKS (Not standard netcommands)
|
||||
if (e.args.Contains("checkupdate"))
|
||||
{
|
||||
Debug.WriteLine("UPDATE - Requested!");
|
||||
}
|
||||
|
||||
//
|
||||
//END OF HTTP NETCOMMANDS
|
||||
//
|
||||
}
|
||||
void Form_FormClosing(object sender, FormClosingEventArgs e) //Exit button
|
||||
|
||||
//
|
||||
//END OF FSCOMMAND HANDLER
|
||||
//
|
||||
|
||||
//
|
||||
//CLOSE BUTTON
|
||||
//
|
||||
|
||||
void Form_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
e.Cancel = (e.CloseReason == CloseReason.UserClosing);
|
||||
if (e.CloseReason == CloseReason.UserClosing)
|
||||
if (e.CloseReason == CloseReason.UserClosing) //If user clicked the close button
|
||||
{
|
||||
axShockwaveFlash1.SetVariable("msg", @"<radicaclose />");
|
||||
AS2Container.SetVariable("msg", @"<radicaclose />");
|
||||
}
|
||||
if (e.CloseReason == CloseReason.WindowsShutDown)
|
||||
if (e.CloseReason == CloseReason.WindowsShutDown) //If windows is shutting down
|
||||
{
|
||||
Application.Exit();
|
||||
if (Settings.Default.RPC == true)
|
||||
{
|
||||
client.Dispose(); //Disposes RP
|
||||
}
|
||||
Application.Exit(); //Closes OpenFK
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//END OF CLOSE BUTTON
|
||||
//
|
||||
|
||||
//
|
||||
//FILE LOADING
|
||||
//
|
||||
|
||||
public void loadFile(string file, string folder)
|
||||
{
|
||||
string index = @"<commands><load section=""" + file + @""" name=""" + folder + @""" result=""0"" reason="""">" + File.ReadAllText(Directory.GetCurrentDirectory() + @"\data\"+ folder + @"\" + file + ".xml") + @"</load></commands>"; //Puts XML file to string
|
||||
setVar(index.ToString()); //Sends XML data to the game
|
||||
Debug.WriteLine("RDF - Sent " + file + ".xml"); //Debug Output
|
||||
}
|
||||
|
||||
//
|
||||
//END OF FILE LOADING
|
||||
//
|
||||
|
||||
//
|
||||
//SET FLASH VARIABLE
|
||||
//
|
||||
|
||||
public void setVar(string msg)
|
||||
{
|
||||
AS2Container.SetVariable("msg", msg); //Sends message (msg) to the game
|
||||
}
|
||||
|
||||
//
|
||||
//END OF SET FLASH VARIABLE
|
||||
//
|
||||
|
||||
//
|
||||
//RICH PRESENCE
|
||||
//
|
||||
|
||||
void setRP(string title, string info)
|
||||
{
|
||||
client.SetPresence(new RichPresence()
|
||||
{
|
||||
Details = info,
|
||||
State = title,
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
//END OF RICH PRESENCE
|
||||
//
|
||||
|
||||
//
|
||||
//POST REQUESTS
|
||||
//
|
||||
public string HTTPPost(string info, string uri)
|
||||
{
|
||||
var request = (HttpWebRequest)WebRequest.Create(uri);
|
||||
var data = Encoding.ASCII.GetBytes(info);
|
||||
request.Method = "POST";
|
||||
request.ContentType = "application/xml";
|
||||
request.ContentLength = data.Length;
|
||||
using (var stream = request.GetRequestStream())
|
||||
{
|
||||
stream.Write(data, 0, data.Length);
|
||||
}
|
||||
var response = (HttpWebResponse)request.GetResponse();
|
||||
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
|
||||
return responseString;
|
||||
}
|
||||
//
|
||||
//END OF POST REQUESTS
|
||||
//
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="axShockwaveFlash1.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<data name="AS2Container.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
|
||||
|
|
|
|||
|
|
@ -8,12 +8,13 @@
|
|||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>OpenFK</RootNamespace>
|
||||
<AssemblyName>OpenFK</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
|
|
@ -21,19 +22,30 @@
|
|||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DiscordRPC, Version=1.0.150.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DiscordRichPresence.1.0.150\lib\net35\DiscordRPC.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
|
@ -65,6 +77,8 @@
|
|||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
|
@ -82,7 +96,7 @@
|
|||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>aximp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<Isolated>True</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Include="ShockwaveFlashObjects">
|
||||
<Guid>{D27CDB6B-AE6D-11CF-96B8-444553540000}</Guid>
|
||||
|
|
@ -90,7 +104,7 @@
|
|||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<Isolated>True</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ using System.Runtime.InteropServices;
|
|||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenFunkeys")]
|
||||
[assembly: AssemblyTitle("OpenFK")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("OpenFunkeys")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyProduct("OpenFK")]
|
||||
[assembly: AssemblyCopyright("Copyright © Lako 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
|
|
|||
24
OpenFK/Properties/Settings.Designer.cs
generated
24
OpenFK/Properties/Settings.Designer.cs
generated
|
|
@ -22,5 +22,29 @@ namespace OpenFK.Properties {
|
|||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool customF {
|
||||
get {
|
||||
return ((bool)(this["customF"]));
|
||||
}
|
||||
set {
|
||||
this["customF"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool RPC {
|
||||
get {
|
||||
return ((bool)(this["RPC"]));
|
||||
}
|
||||
set {
|
||||
this["RPC"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="OpenFK.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="customF" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="RPC" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
20
OpenFK/app.config
Normal file
20
OpenFK/app.config
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="OpenFK.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup><userSettings>
|
||||
<OpenFK.Properties.Settings>
|
||||
<!-- If you use the customF.txt file, enable this. -->
|
||||
<setting name="customF" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<!-- You can show your RPC status here. -->
|
||||
<setting name="RPC" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
</OpenFK.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
5
OpenFK/packages.config
Normal file
5
OpenFK/packages.config
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DiscordRichPresence" version="1.0.150" targetFramework="net40" />
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net40" />
|
||||
</packages>
|
||||
26
README.md
Normal file
26
README.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# OpenFK
|
||||
##### An open source replacement for the U.B. Funkeys executable.
|
||||
|
||||
OpenFK adds new features while doing the same functions as the executable.
|
||||
|
||||
### What does OpenFK do currently?
|
||||
| Functional | Broken |
|
||||
| ------------ | ------------ |
|
||||
| File loading via XMLs | Native RDF loading |
|
||||
| Saving files | Checking updates |
|
||||
| Fullscreen and Windowed mode | ActionScript 3 Elements |
|
||||
| Basic online functionality | USB connectivity |
|
||||
| Mod support |
|
||||
| Closing the game |
|
||||
|
||||
###Installing OpenFK
|
||||
OpenFK requires some manual work to set it up fully.
|
||||
|
||||
First, convert the RDF files in data/system and your user profile in data/YOURUSERNAME to an XML, you can do this in many ways, like using the debug logs or using an RDF converter utility.
|
||||
|
||||
You will also need to find the Flash.ocx file, it is usually found in the `C:\Windows\System32\Macromed\Flash\` directory. Put the Flash.ocx file with your OpenFK.exe file.
|
||||
|
||||
Be sure to check the OpenFK.exe.config file for options you can set with it. Put OpenFK.exe and its required files in the RadicaGame folder.
|
||||
|
||||
###Building OpenFK
|
||||
You can build OpenFK with anything that can build dotNET 4.5 projects, like Visual Studio.
|
||||
Loading…
Reference in New Issue
Block a user