From b61b777c25de3010d0fe589f6ae7d5f9aadf3121 Mon Sep 17 00:00:00 2001 From: firefly2442 Date: Sat, 21 Jul 2012 11:57:44 -0500 Subject: [PATCH] plugin now builds for Arma2NET version 2.0 --- Arma2NETMySQLPlugin/Arma2NETMySQLPlugin.cs | 19 +++++++++---------- .../Arma2NETMySQLPlugin.csproj | 6 ++---- Arma2NETMySQLPlugin/MySQL.cs | 3 ++- Arma2NETMySQLPlugin/Startup.cs | 5 ++--- ReadMe.html | 17 +++++++++-------- 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/Arma2NETMySQLPlugin/Arma2NETMySQLPlugin.cs b/Arma2NETMySQLPlugin/Arma2NETMySQLPlugin.cs index 868df5a..15ad3c1 100644 --- a/Arma2NETMySQLPlugin/Arma2NETMySQLPlugin.cs +++ b/Arma2NETMySQLPlugin/Arma2NETMySQLPlugin.cs @@ -3,19 +3,18 @@ using System.Collections.ObjectModel; using System.Linq; using System.Text; -using System.AddIn; using AddInView; -using Arma2Net.Managed; +using Arma2Net.AddInProxy; namespace Arma2NETMySQLPlugin { //the function name for the plugin (called from Arma side) [AddIn("Arma2NETMySQL", Version = "0.1.0.0", Publisher = "firefly2442", Description = "Runs MySQL procedure commands.")] - public class Arma2NETMySQLPlugin : Arma2NetLongOutputAddIn + public class Arma2NETMySQLPlugin : AddIn { //This method is called when callExtension is used from SQF: //"Arma2Net.Unmanaged" callExtension "Arma2NetMySQL ..." - public override string Run(string args, int maxResultSize) + public override string Invoke(string args, int maxResultSize) { //if we haven't setup the database connection and such yet, this will do it Startup.StartupConnection(); @@ -42,7 +41,7 @@ public override string Run(string args, int maxResultSize) if (MySQL.dbs.SQLProviderExists(database)) { IEnumerable returned = MySQL.dbs.getSQLProvider(database).RunProcedure(procedure, split.ToArray(), maxResultSize); - return Arma2Net.Managed.Format.ObjectAsSqf(returned); + return Format.ObjectAsSqf(returned); } else { @@ -50,7 +49,7 @@ public override string Run(string args, int maxResultSize) } //Logger.addMessage(Logger.LogType.Info, "Returning false object"); - return Arma2Net.Managed.Format.ObjectAsSqf(false); + return Format.ObjectAsSqf(false); } else { @@ -62,11 +61,11 @@ public override string Run(string args, int maxResultSize) //the function name for the plugin (called from Arma side) [AddIn("Arma2NETMySQLCommand", Version = "0.1.0.0", Publisher = "firefly2442", Description = "Runs raw MySQL commands")] - public class Arma2NETMySQLPluginCommand : Arma2NetLongOutputAddIn + public class Arma2NETMySQLPluginCommand : AddIn { //This method is called when callExtension is used from SQF: //"Arma2Net.Unmanaged" callExtension "Arma2NetMySQLCommand ..." - public override string Run(string args, int maxResultSize) + public override string Invoke(string args, int maxResultSize) { //if we haven't setup the database connection and such yet, this will do it Startup.StartupConnection(); @@ -82,7 +81,7 @@ public override string Run(string args, int maxResultSize) if (MySQL.dbs.SQLProviderExists(database)) { IEnumerable returned = MySQL.dbs.getSQLProvider(database).RunCommand(mysql_command, maxResultSize); - return Arma2Net.Managed.Format.ObjectAsSqf(returned); + return Format.ObjectAsSqf(returned); } else { @@ -90,7 +89,7 @@ public override string Run(string args, int maxResultSize) } //Logger.addMessage(Logger.LogType.Info, "Returning false object"); - return Arma2Net.Managed.Format.ObjectAsSqf(false); + return Format.ObjectAsSqf(false); } else { diff --git a/Arma2NETMySQLPlugin/Arma2NETMySQLPlugin.csproj b/Arma2NETMySQLPlugin/Arma2NETMySQLPlugin.csproj index b6c9c5b..e86c177 100644 --- a/Arma2NETMySQLPlugin/Arma2NETMySQLPlugin.csproj +++ b/Arma2NETMySQLPlugin/Arma2NETMySQLPlugin.csproj @@ -35,16 +35,14 @@ False ..\..\..\..\..\..\Program Files\Steam\steamapps\common\arma 2 operation arrowhead\@Arma2NET\AddInViews\AddInView.dll - - False - ..\..\..\..\..\..\Program Files\Steam\steamapps\common\arma 2 operation arrowhead\@Arma2NET\Arma2Net.Managed.dll + + ..\..\..\..\..\..\Program Files\Steam\steamapps\common\arma 2 operation arrowhead\@Arma2NET\Arma2Net.AddInProxy.dll False ..\..\..\..\..\..\..\Program Files (x86)\MySQL\MySQL Connector Net 6.2.4\Assemblies\MySql.Data.dll - diff --git a/Arma2NETMySQLPlugin/MySQL.cs b/Arma2NETMySQLPlugin/MySQL.cs index 1f22d3b..f89c7e0 100644 --- a/Arma2NETMySQLPlugin/MySQL.cs +++ b/Arma2NETMySQLPlugin/MySQL.cs @@ -4,6 +4,7 @@ using System.Text; using System.Threading; using MySql.Data.MySqlClient; +using Arma2Net.AddInProxy; namespace Arma2NETMySQLPlugin { @@ -165,7 +166,7 @@ private string[][] RunOnDatabase(MySqlCommand command, int maxResultSize) * The last character is reserved for null * */ - string formatted = Arma2Net.Managed.Format.ObjectAsSqf(string_array); + string formatted = Format.ObjectAsSqf(string_array); int size = Encoding.UTF8.GetByteCount(formatted.ToCharArray()); //Logger.addMessage(Logger.LogType.Info, "Size length: " + size); if (size > maxResultSize) { diff --git a/Arma2NETMySQLPlugin/Startup.cs b/Arma2NETMySQLPlugin/Startup.cs index 049c9b4..44afc5e 100644 --- a/Arma2NETMySQLPlugin/Startup.cs +++ b/Arma2NETMySQLPlugin/Startup.cs @@ -2,9 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.AddIn; using AddInView; -using Arma2Net.Managed; +using Arma2Net.AddInProxy; namespace Arma2NETMySQLPlugin { @@ -29,7 +28,7 @@ public static void StartupConnection() //http://stackoverflow.com/questions/64602/what-are-differences-between-assemblyversion-assemblyfileversion-and-assemblyin Logger.addMessage(Logger.LogType.Info, "Version number: " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); - Logger.addMessage(Logger.LogType.Info, "Compiled against Arma2NET Version: " + Utils.TargetFileVersion); + Logger.addMessage(Logger.LogType.Info, "Compiled against Arma2NET Version: " + Environment.Version); //Load in Databases.txt file //This also sets up the SQLProvider associated with the database diff --git a/ReadMe.html b/ReadMe.html index fff556e..4ec0bbf 100644 --- a/ReadMe.html +++ b/ReadMe.html @@ -119,12 +119,10 @@

Contents

to create manually. Note that the call names are different between running stored procedures versus straight queries. -
  • Run Arma2 and use this for your command line parameters (for the server which connects to the database): -
    -mod=expansion\beta;expansion\beta\expansion;@CBA;@CBA_A2;@CBA_OA;@Arma2NET -arma2netdev
    -

    Alternatively, you can not use the -arma2netdev commandline parameter and just edit one of the settings file. - Open up Settings.yaml and set "DisableSandboxing" to true. Essentially, the reason why all of this is necessary - is because only approved "signed" versions of plugins are accepted when the sandbox is active. This allows third-party - plugins to be run.

    +
  • Run Arma2 and add @Arma2NET as a mod. For example your command line parameters (for the server which connects to the database): +
    -mod=expansion\beta;expansion\beta\expansion;@Arma2NET
    +

    This plugin doesn't require any other third party mods like ACE or CBA. But, they do have some nice utility functions + and features that may be helpful when you make your missions.

    Arma2 player clients do not need to do any of this. They will interact with the Arma2 server and through SQF scripting, so you can pass the information from the database back to them or use it however you need.

  • @@ -139,7 +137,7 @@

    Contents

    Arma2NETMySQL Plugin uses the callExtension function, however, there are some technical considerations as part of this.

    -

    Returning results has a limit of 4000 characters. If you try to run a MySQL query that will return a result longer than 4000 characters, +

    Returning results has a limit of 4095 characters. If you try to run a MySQL query that will return a result longer than 4095 characters, it will return the string "TooLong". Then you know you will need to limit the number of results that are returned. In MySQL, you can use the limit parameter. This is a limitation of Arma2 so don't ask for this to be fixed.

    @@ -157,13 +155,16 @@

    Contents

    These can get very long so scroll all the way to the bottom to see the latest run. This will tell you if you have an error in your SQF scripting code or other such problems. Note, these path locations are for Windows 7 (and Vista?) and may be different for other versions of Windows.

    +

    If you're still having problems, please go back and double check that you did everything correctly. If you skipped a step +or got an error and just decided to continue to the next step, nothing will work.

    If you found a bug, please create an issue ticket here: Github page.

    There is also a thread on the BIS forums so if you're stuck, you can ask there. The forums are preferred over emailing me because then the question/answer is available to -future people who have similar problems.

    +future people who have similar problems. If you post any questions anywhere, please post ALL +log files, otherwise we will have problems helping you.

    Changelog