Jump to content

Recommended Posts

OK, try something like this:

using Arma2Net.AddInProxy;
using System.IO;
using System.Linq;

namespace ReadWriteFileAddIn
{
   [AddIn("ReadWriteFile")]
   public class ReadWriteFile : MethodAddIn
   {
       public string SaveStuff(string stuff) { save stuff here; }
       public string ReadStuff() { return stuff here; }
   }
}

Then you'd go like...

"Arma2Net.Unmanaged" callExtension "ReadWriteFile [saveStuff, stuff goes here]"

"Arma2Net.Unmanaged" callExtension "ReadWriteFile [ReadStuff]"

So this is in response to a post from 2012 but I too have found, that returned variables have extra quotes for some reason. I had a heap of trouble trying to pull an int from the db to use in my SQF so I gutted the method and just had the below code.

SQF:

_tmp = "Arma2Net.Unmanaged" callExtension format ["Epoch_Stats [set,'%1','%2']",_characterID,_stats];

hint format ["%1", _tmp];

then in my C# code:

string _tmpVariable = "12345";

return _tmpVariable;

On screen it outputs

"12345"

instead of

12345

I spent around three hours trying to figure out why I couldn't parsenumber(_tmp) but it turned out it was because everything the method was sending back had extra quotes. I ended up toarray(_tmp) seeing what numeric code equals quotation marks then writing a short block to remove them, turn them back into a string then into an int so my SQF could use them.

Share this post


Link to post
Share on other sites

I have an issue that has been driving me crazy. Has anyone else had any trouble with the return value from your addin depending on where its called from? I added a column to my db named Money and wanted to keep track of how money was spent on my server. To test it I made a .bat file to call arma2oa.exe with arma2net and in single player mode, using

_tmp = "Arma2Net.Unmanaged" callExtension format ["Epoch_Money_Get '%1']",_characterID];
hint format ["_tmp=%1", _tmp];
sleep 2; 
_tmp1=parseNumber(_tmp);
_tmp2=_tmp1*2;
hint format ["new value = %1", _tmp2]; 

the exact number I expected is pulled from the database and multiplied by two then is shown as a hint. When I edited my compiles.sqf in order to utilize this code with epoch it doesn't return anything. I can't tell what the problem could be. I added in C# code to my addin that wrote the return value to a text file so I know for a fact that the call to arma2net is working just fine, when its called from compiles.sqf, as the text file is being created every time the call is made. Are there known issues with certain usage of this addon? I just can't get my head around how one call to the dll works in every way intended when called from a single player instance of Arma2OA.exe but the exact same sqf code fails to collect the returned value when used in compiles.sqf. Inside one of the trade_whatever.sqf is a line

_total_currency = call epoch_totalCurrency;

and I have the code to call arma2net inside the definition of epoch_totalCurrency inside my compiles.sqf. Its almost like doing it this way doesn't allow return values maybe? Below is the code that I am using. Any help or advice on this would be MUCH appreciated!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
using Arma2Net.AddInProxy;
using MySql.Data.MySqlClient;

namespace Epoch_Money_Get
{
   [AddIn("Epoch_Money_Get")]
   public class Epoch_Money_Get : AddIn
   {
       public override string Invoke(string args, int maxResultSize)
       {
           string _CharacterID = args;
           string _Character_Money = "";
           string _convertCID = _CharacterID.Trim();
           char[] _chars = { ',', ' ', '[', ']', '\'', '\"' };

           _convertCID = _convertCID.TrimStart(_chars);
           _convertCID = _convertCID.TrimEnd(_chars);

           string MyConnectionString = "Server=127.0.0.1;Port=3306;Database=dayz_epoch;Uid=root;password=;";

           MySqlConnection _con = new MySqlConnection(MyConnectionString);

           MySqlCommand _command = _con.CreateCommand();
           _command.CommandText = String.Format("select Money from character_data where characterID={0}", _convertCID);
           try
           {
               _con.Open();
           }
           catch (Exception ex)
           {
               return "0";
               //Console.WriteLine(ex.Message);
           }

           MySqlDataReader _reader = _command.ExecuteReader();

           while (_reader.Read())
           {
               _Character_Money = _reader["money"].ToString();
           }

           _con.Close();

           TextWriter tw = new StreamWriter("stuff.txt");
           //String writerfile = String.Format("{0}", _Character_Money);
           tw.WriteLine("{0}", _Character_Money);
           tw.Close();

           return _Character_Money;
       }

   }

Edited by hogscraper

Share this post


Link to post
Share on other sites

I have a problem and dont know why.

I set it up correctly.

Database.txt is in my arma3 directory and in Arma2NETMySQLPlugin folder.

I edited my life_server.pbo ini.sqf correctly.

Get always this errors:

05/24/2014 14:09:31 Arma2NET 2.3.0.0 running on CLR 4.0.30319.34014

05/24/2014 14:09:31 Loaded into process Arma2NetExplorer

05/24/2014 14:09:31 Loading add-ins

05/24/2014 14:09:31 Domain Name Version Publisher Description

05/24/2014 14:09:31 Arma2NetExplorer.exe ClrVersion 2.0.0.0 Scott_NZ Retrieves the version of the Common Language Runtime.

05/24/2014 14:09:31 Arma2NetExplorer.exe CompareVersion 2.0.0.0 Scott_NZ Compares two version strings and returns an integer indicating how they compare.

05/24/2014 14:09:31 Arma2NetExplorer.exe Version 2.0.0.0 Scott_NZ Returns the version of Arma2NET.

05/24/2014 14:09:31 Arma2NetExplorer.exe GetClipboardText 1.0.0.0 Scott_NZ Gets the clipboard text value.

05/24/2014 14:09:31 Arma2NetExplorer.exe SetClipboardText 1.0.0.0 Scott_NZ Sets the clipboard to a text value.

05/24/2014 14:09:31 Arma2NetExplorer.exe CommandLine 2.0.0.0 Scott_NZ Returns the command line used to start the application.

05/24/2014 14:09:31 Arma2NetExplorer.exe DateTime 2.0.0.0 Scott_NZ Returns the current date and time.

05/24/2014 14:09:31 Arma2NET initialized in 00:00:00.0519747

05/24/2014 14:09:31 function: AddIns

05/24/2014 14:09:31 maxResultSize: 4095

05/24/2014 14:09:31 Result size: 110

05/24/2014 14:09:31 Result: ["ClrVersion", "CompareVersion", "Version", "GetClipboardText", "SetClipboardText", "CommandLine", "DateTime"]

05/24/2014 14:26:48 Arma2NET 2.3.0.0 running on CLR 4.0.30319.34014

05/24/2014 14:26:48 Loaded into process arma3server

05/24/2014 14:26:48 Loading add-ins

05/24/2014 14:26:48 Caught exception of type System.Reflection.TargetInvocationException while loading add-in DefaultDomain

05/24/2014 14:26:48 System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> System.IO.FileLoadException: Die Datei oder Assembly "System.Data.SQLite, Version=1.0.89.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" oder eine Abhängigkeit davon wurde nicht gefunden. Es wird versucht, eine nicht überprüfbare ausführbare Datei mit Fixups zu laden (IAT mit mehr als 2 Abschnitten oder ein TLS-Abschnitt). (Ausnahme von HRESULT: 0x80131019) ---> System.IO.FileLoadException: Es wird versucht, eine nicht überprüfbare ausführbare Datei mit Fixups zu laden (IAT mit mehr als 2 Abschnitten oder ein TLS-Abschnitt). (Ausnahme von HRESULT: 0x80131019)

--- Ende der internen Ausnahmestapelüberwachung ---

bei System.Reflection.RuntimeAssembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection, SecurityContextSource securityContextSource)

bei System.Reflection.Assembly.Load(Byte[] rawAssembly)

bei Arma2Net.Managed.AddInManager.DomainLoadAddIn(String assemblyFile)

--- Ende der internen Ausnahmestapelüberwachung ---

bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

bei System.Reflection.RuntimeMethodInfo.UnsafeInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

bei System.Delegate.DynamicInvokeImpl(Object[] args)

bei Arma2Net.Managed.AddInManager.DomainDoCallback()

bei System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)

bei Arma2Net.Managed.AddInManager.DoCallbackImpl(AppDomain domain, Delegate func, Object arg)

bei Arma2Net.Managed.AddInManager.DoCallbackWithResult[T,TResult](AppDomain domain, Func`2 func, T arg)

bei Arma2Net.Managed.AddInManager.LoadAddIn(String assemblyFile)

05/24/2014 14:26:48 Domain Name Version Publisher Description

05/24/2014 14:26:48 DefaultDomain Arma2NETMySQL 0.1.0.0 firefly2442 Runs MySQL procedure commands.

05/24/2014 14:26:48 DefaultDomain Arma2NETMySQLCommand0.1.0.0 firefly2442 Runs raw MySQL/SQLite commands

05/24/2014 14:26:48 DefaultDomain ClrVersion 2.0.0.0 Scott_NZ Retrieves the version of the Common Language Runtime.

05/24/2014 14:26:48 DefaultDomain CompareVersion 2.0.0.0 Scott_NZ Compares two version strings and returns an integer indicating how they compare.

05/24/2014 14:26:48 DefaultDomain Version 2.0.0.0 Scott_NZ Returns the version of Arma2NET.

05/24/2014 14:26:48 DefaultDomain GetClipboardText 1.0.0.0 Scott_NZ Gets the clipboard text value.

05/24/2014 14:26:48 DefaultDomain SetClipboardText 1.0.0.0 Scott_NZ Sets the clipboard to a text value.

05/24/2014 14:26:48 DefaultDomain CommandLine 2.0.0.0 Scott_NZ Returns the command line used to start the application.

05/24/2014 14:26:48 DefaultDomain DateTime 2.0.0.0 Scott_NZ Returns the current date and time.

05/24/2014 14:26:48 Arma2NET initialized in 00:00:00.0675622

05/24/2014 14:26:48 function: Arma2NETMySQLCommand ['arma3life', 'CALL resetLifeVehicles();']

05/24/2014 14:26:48 maxResultSize: 10239

05/24/2014 14:26:48 Result size: 13

05/24/2014 14:26:48 Result: [[["Error"]]]

05/24/2014 14:26:48 function: Arma2NETMySQLCommand ['arma3life', 'CALL deleteDeadVehicles();']

05/24/2014 14:26:48 maxResultSize: 10239

05/24/2014 14:26:48 Result size: 13

05/24/2014 14:26:48 Result: [[["Error"]]]

Fixed errors above now a new problem:

Info: 14:48:38 - Received - Database: arma3life MySQL Command: CALL resetLifeVehicles();

Warning: 14:48:38 - MySQL error. MySql.Data.MySqlClient.MySqlException (0x80004005): The user specified as a definer ('arma3'@'localhost') does not exist

bei MySql.Data.MySqlClient.MySqlStream.ReadPacket()

bei MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)

bei MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)

bei MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)

bei MySql.Data.MySqlClient.MySqlDataReader.NextResult()

bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)

bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()

bei Arma2NETMySQLPlugin.MySQL.RunOnDatabase(MySqlCommand command, Int32 maxResultSize)

Info: 14:48:38 - Received - Database: arma3life MySQL Command: CALL deleteDeadVehicles();

Warning: 14:48:38 - MySQL error. MySql.Data.MySqlClient.MySqlException (0x80004005): The user specified as a definer ('root'@'localhost') does not exist

bei MySql.Data.MySqlClient.MySqlStream.ReadPacket()

bei MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)

bei MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)

bei MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)

bei MySql.Data.MySqlClient.MySqlDataReader.NextResult()

bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)

bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()

bei Arma2NETMySQLPlugin.MySQL.RunOnDatabase(MySqlCommand command, Int32 maxResultSize)

Edited by RiDDiX

Share this post


Link to post
Share on other sites

It's right there in the warning messages. You need a user for the MySQL database. Don't use "root" as this is a security risk.

I have a problem and dont know why.

I set it up correctly.

Database.txt is in my arma3 directory and in Arma2NETMySQLPlugin folder.

I edited my life_server.pbo ini.sqf correctly.

Get always this errors:

05/24/2014 14:09:31 Arma2NET 2.3.0.0 running on CLR 4.0.30319.34014

05/24/2014 14:09:31 Loaded into process Arma2NetExplorer

05/24/2014 14:09:31 Loading add-ins

05/24/2014 14:09:31 Domain Name Version Publisher Description

05/24/2014 14:09:31 Arma2NetExplorer.exe ClrVersion 2.0.0.0 Scott_NZ Retrieves the version of the Common Language Runtime.

05/24/2014 14:09:31 Arma2NetExplorer.exe CompareVersion 2.0.0.0 Scott_NZ Compares two version strings and returns an integer indicating how they compare.

05/24/2014 14:09:31 Arma2NetExplorer.exe Version 2.0.0.0 Scott_NZ Returns the version of Arma2NET.

05/24/2014 14:09:31 Arma2NetExplorer.exe GetClipboardText 1.0.0.0 Scott_NZ Gets the clipboard text value.

05/24/2014 14:09:31 Arma2NetExplorer.exe SetClipboardText 1.0.0.0 Scott_NZ Sets the clipboard to a text value.

05/24/2014 14:09:31 Arma2NetExplorer.exe CommandLine 2.0.0.0 Scott_NZ Returns the command line used to start the application.

05/24/2014 14:09:31 Arma2NetExplorer.exe DateTime 2.0.0.0 Scott_NZ Returns the current date and time.

05/24/2014 14:09:31 Arma2NET initialized in 00:00:00.0519747

05/24/2014 14:09:31 function: AddIns

05/24/2014 14:09:31 maxResultSize: 4095

05/24/2014 14:09:31 Result size: 110

05/24/2014 14:09:31 Result: ["ClrVersion", "CompareVersion", "Version", "GetClipboardText", "SetClipboardText", "CommandLine", "DateTime"]

05/24/2014 14:26:48 Arma2NET 2.3.0.0 running on CLR 4.0.30319.34014

05/24/2014 14:26:48 Loaded into process arma3server

05/24/2014 14:26:48 Loading add-ins

05/24/2014 14:26:48 Caught exception of type System.Reflection.TargetInvocationException while loading add-in DefaultDomain

05/24/2014 14:26:48 System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> System.IO.FileLoadException: Die Datei oder Assembly "System.Data.SQLite, Version=1.0.89.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" oder eine Abhängigkeit davon wurde nicht gefunden. Es wird versucht, eine nicht überprüfbare ausführbare Datei mit Fixups zu laden (IAT mit mehr als 2 Abschnitten oder ein TLS-Abschnitt). (Ausnahme von HRESULT: 0x80131019) ---> System.IO.FileLoadException: Es wird versucht, eine nicht überprüfbare ausführbare Datei mit Fixups zu laden (IAT mit mehr als 2 Abschnitten oder ein TLS-Abschnitt). (Ausnahme von HRESULT: 0x80131019)

--- Ende der internen Ausnahmestapelüberwachung ---

bei System.Reflection.RuntimeAssembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection, SecurityContextSource securityContextSource)

bei System.Reflection.Assembly.Load(Byte[] rawAssembly)

bei Arma2Net.Managed.AddInManager.DomainLoadAddIn(String assemblyFile)

--- Ende der internen Ausnahmestapelüberwachung ---

bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

bei System.Reflection.RuntimeMethodInfo.UnsafeInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

bei System.Delegate.DynamicInvokeImpl(Object[] args)

bei Arma2Net.Managed.AddInManager.DomainDoCallback()

bei System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)

bei Arma2Net.Managed.AddInManager.DoCallbackImpl(AppDomain domain, Delegate func, Object arg)

bei Arma2Net.Managed.AddInManager.DoCallbackWithResult[T,TResult](AppDomain domain, Func`2 func, T arg)

bei Arma2Net.Managed.AddInManager.LoadAddIn(String assemblyFile)

05/24/2014 14:26:48 Domain Name Version Publisher Description

05/24/2014 14:26:48 DefaultDomain Arma2NETMySQL 0.1.0.0 firefly2442 Runs MySQL procedure commands.

05/24/2014 14:26:48 DefaultDomain Arma2NETMySQLCommand0.1.0.0 firefly2442 Runs raw MySQL/SQLite commands

05/24/2014 14:26:48 DefaultDomain ClrVersion 2.0.0.0 Scott_NZ Retrieves the version of the Common Language Runtime.

05/24/2014 14:26:48 DefaultDomain CompareVersion 2.0.0.0 Scott_NZ Compares two version strings and returns an integer indicating how they compare.

05/24/2014 14:26:48 DefaultDomain Version 2.0.0.0 Scott_NZ Returns the version of Arma2NET.

05/24/2014 14:26:48 DefaultDomain GetClipboardText 1.0.0.0 Scott_NZ Gets the clipboard text value.

05/24/2014 14:26:48 DefaultDomain SetClipboardText 1.0.0.0 Scott_NZ Sets the clipboard to a text value.

05/24/2014 14:26:48 DefaultDomain CommandLine 2.0.0.0 Scott_NZ Returns the command line used to start the application.

05/24/2014 14:26:48 DefaultDomain DateTime 2.0.0.0 Scott_NZ Returns the current date and time.

05/24/2014 14:26:48 Arma2NET initialized in 00:00:00.0675622

05/24/2014 14:26:48 function: Arma2NETMySQLCommand ['arma3life', 'CALL resetLifeVehicles();']

05/24/2014 14:26:48 maxResultSize: 10239

05/24/2014 14:26:48 Result size: 13

05/24/2014 14:26:48 Result: [[["Error"]]]

05/24/2014 14:26:48 function: Arma2NETMySQLCommand ['arma3life', 'CALL deleteDeadVehicles();']

05/24/2014 14:26:48 maxResultSize: 10239

05/24/2014 14:26:48 Result size: 13

05/24/2014 14:26:48 Result: [[["Error"]]]

Fixed errors above now a new problem:

Info: 14:48:38 - Received - Database: arma3life MySQL Command: CALL resetLifeVehicles();

Warning: 14:48:38 - MySQL error. MySql.Data.MySqlClient.MySqlException (0x80004005): The user specified as a definer ('arma3'@'localhost') does not exist

bei MySql.Data.MySqlClient.MySqlStream.ReadPacket()

bei MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)

bei MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)

bei MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)

bei MySql.Data.MySqlClient.MySqlDataReader.NextResult()

bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)

bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()

bei Arma2NETMySQLPlugin.MySQL.RunOnDatabase(MySqlCommand command, Int32 maxResultSize)

Info: 14:48:38 - Received - Database: arma3life MySQL Command: CALL deleteDeadVehicles();

Warning: 14:48:38 - MySQL error. MySql.Data.MySqlClient.MySqlException (0x80004005): The user specified as a definer ('root'@'localhost') does not exist

bei MySql.Data.MySqlClient.MySqlStream.ReadPacket()

bei MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)

bei MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)

bei MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)

bei MySql.Data.MySqlClient.MySqlDataReader.NextResult()

bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)

bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()

bei Arma2NETMySQLPlugin.MySQL.RunOnDatabase(MySqlCommand command, Int32 maxResultSize)

Share this post


Link to post
Share on other sites

I was wondering if there was a way to use the explorer with the beta because I'm finding testing considerably arduous without it.

Edit:

I found the immensely beautiful Arma2Net.RVExtensionTest.exe :)

Edited by Polaris

Share this post


Link to post
Share on other sites

By the way I'd suggest adding a unique result for if the queue is empty because returning an empty string could very well indicate a normal result. Or at the vest least I'd appreciate if you could help me implement it because so far I've tried modifying AsyncAddinInvocationMethod.cpp to no avail.

Edited by Polaris

Share this post


Link to post
Share on other sites
If you want to test the current Linux code, make sure you have a recent enough version of 32-bit Mono (can try 64-bit but I doubt it will work on the Linux server later) and MonoDevelop and then do the following:

7. Test by using ./RVExtensionTest and then trying eg 'DateTime now' in the prompt.

just managed it! have compiled your addins and was able to produce a RVExtensionTest. I get no error since today but no aswer too, It just put back a blank line. Hopefully you are on it to finalize your code, just want to say thank you for all your work! keep on...

HOLY shit IT WORKS :) //20minutes after i tryed to use super user priviliges to ask for DateTime now ...and voila !

Edited by aircode

Share this post


Link to post
Share on other sites

So sudo/root was required for DateTime to work?

just managed it! have compiled your addins and was able to produce a RVExtensionTest. I get no error since today but no aswer too, It just put back a blank line. Hopefully you are on it to finalize your code, just want to say thank you for all your work! keep on...

HOLY shit IT WORKS :) //20minutes after i tryed to use super user priviliges to ask for DateTime now ...and voila !

Share this post


Link to post
Share on other sites
So sudo/root was required for DateTime to work?

yep ! sudo ./RVExtensionTest

edit; i tryed before some minutes serveral things again &

after i mixed up Scott ´s code with yours in the early evening, iam able to call 'DateTime now' without sudo. Dunno why but iam on to reproduce it tommorrow after work...

Edited by aircode

Share this post


Link to post
Share on other sites

If it all works you can try running it on an Arma 3 server. Try placing the .so in the server root folder and have an Addins subfolder with the usual things inside there.

Share this post


Link to post
Share on other sites
If it all works you can try running it on an Arma 3 server. Try placing the .so in the server root folder and have an Addins subfolder with the usual things inside there.

ok, doing some stuff @my work and ported all to my arma3 server @datacenter. After installation of all mono-* dependences, ./RVExtensionTest could be called without sudo and answers me with the actual date & time,

if i aks him DateTime now. This was proven on Ubuntu Server 14.04 LTS.

...later @home i will check the next step and test call functions from Arma3-Server

Share this post


Link to post
Share on other sites

Would it be possible for you to post additional details on how you have everything setup and compiled? What version of Mono (packages and so on), how you setup the projects to build, etc.? I've tried compiling it myself but have had issues. I think it would help us to test this and get the ball rolling so to speak. Cheers. :)

ok, doing some stuff @my work and ported all to my arma3 server @datacenter. After installation of all mono-* dependences, ./RVExtensionTest could be called without sudo and answers me with the actual date & time,

if i aks him DateTime now. This was proven on Ubuntu Server 14.04 LTS.

...later @home i will check the next step and test call functions from Arma3-Server

Share this post


Link to post
Share on other sites

Distribution; Linux Mint Qiana "Cinnamon"

arch; amd64

Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1)

Copyright © 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com

TLS: __thread

SIGSEGV: altstack

Notifications: epoll

Architecture: amd64

Disabled: none

Misc: softdebug

LLVM: supported, not enabled.

GC: sgen

the following packets additional installed:

via synaptic;

libart2.0-cil (2.24.2-3)

libgnome-vfs2.0-cil (2.24.2-3)

libgnome2.24-cil (2.24.2-3)

libicsharpcode-nrefactory-cecil5.0-cil (5.3.0+20130718.73b6d0f-1)

libicsharpcode-nrefactory-csharp5.0-cil (5.3.0+20130718.73b6d0f-1)

libicsharpcode-nrefactory5.0-cil (5.3.0+20130718.73b6d0f-1)

libmono-addins-cil-dev (1.0+git20130406.adcd75b-3)

libmono-addins-msbuild-cil-dev (1.0+git20130406.adcd75b-3)

libmono-addins-msbuild0.2-cil (1.0+git20130406.adcd75b-3)

libmono-cecil-vb0.9-cil (3.0~pre20130627.4dcc70f-1)

libmono-debugger-soft-cil (0+20131201.3459502-1)

libmono-debugging-cil (0+20131201.3459502-1)

libmono-debugging-soft-cil (0+20131201.3459502-1)

libmono-microsoft-visualbasic10.0-cil (3.0~pre20130627.4dcc70f-1)

libmono-microsoft-visualbasic11.0-cil (3.0~pre20130627.4dcc70f-1)

libmono-microsoft-visualbasic8.0-cil (3.0~pre20130627.4dcc70f-1)

libmonosgen-2.0-dev (3.2.8+dfsg-4ubuntu1)

mono-basic-dbg (3.0~pre20130627.4dcc70f-1)

mono-dbg (3.2.8+dfsg-4ubuntu1)

mono-dmcs (3.2.8+dfsg-4ubuntu1)

mono-gmcs (3.2.8+dfsg-4ubuntu1)

mono-runtime-boehm (3.2.8+dfsg-4ubuntu1)

mono-vbnc (3.0~pre20130627.4dcc70f-1)

monodevelop (4.0.12+dfsg-2)

via shell:

Commandline: apt-get install mono-mcs

Commandline: apt-get install mono-devel

Commandline: apt-get install mono-complete

Next step get the sources;

1. git clone https://github.com/ScottNZ/Arma2NET.git

2. cd Arma2NET

3. git checkout linux

4. change the "ToolsVersion=" version in the *.csproj files from 12.0 > 4.0

-line 2 looks after change <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

-You need to change this line in the files; Arma2Net.Addins.csproj, DateTimeAddin.csproj, TestAddin.csproj

-to change the files, open it in a Text editor (eg. vi or nano)

5. Open the Arma2Net.sln in monodevelop, it complain about Scotts unidentified project but this is anyway.

debug or realease to compile, after this you get Arma2Net.Addins.dll, DateTimeAddin.dll, TestAddin.dll which are located in the debug or release folders.

or do xbuild Arma2Net.sln

7. now copy the Addins;

8. copy all the files into the Linux folder

>>>>>>Linux folder (inside of Arma2NET) needed! structure<<<<<<<<<

Linux>Arma2Net.Addins.dll

Linux>DateTimeAddin.dll

Linux>TestAddin.dll

Linux>DateTimeAddin.dll

Linux>Addins>Arma2Net.Addins.dll

Linux>Addins>DateTimeAddin.dll

Linux>Addins>TestAddin.dll

Linux>Addins>DateTime.Addin>DateTimeAddin.dll

9. open a terminal and "make" in "Linux" folder, build a pretty working Arma2Net.so and RVExtensionTest

10. now ./RVExtensionTest and ask for DateTime now

I think this ll help everybody build, additional i can drop the compiled package on github. If anyone got a simple testmission for arma3, it would be gentle to share me. thx

compiled i testet it on Ubuntu 14.04 LTS Server additional packages needed are mono-complete & libmonoboehm-2.0-1 and it pretty run:>

(tested with xbuild & monodevelop 4.0, i had serveral problems before, most based on mono --version)

Edited by aircode

Share this post


Link to post
Share on other sites

OK, I was able to replicate the build. Thank you again for the instructions. Just FYI, I was not able to get this working on Ubuntu 12.04 and Mono v2. I had to upgrade Ubuntu to 14.04 which has Mono v3 and Monodevelop v4. I also noticed it didn't seem to work without sudo initially. Then I installed the following extra packages and it seemed to "fix" it.

libmono-addins-cil-dev
libmono-addins-msbuild0.2-cil
libmono-cecil-cil

I don't know if it was just a fluke or what but it now appears to work without sudo.

Edited by firefly2442

Share this post


Link to post
Share on other sites

libmono-addins-cil-dev
libmono-addins-msbuild0.2-cil
libmono-cecil-cil

installed this packages too and it not help me out with the "sudo" madness, so i still get confused! because it is sometimes need to sudo ./RVExtension and sometimes not (very strange) and for ingame testing ive no working testmission. All my setups not working atm including try to setup "DateTimePluginDemo.Takistan" on aoa_server...

when iam able to call datetime function ingame i start over to compile your mysql src. There are several #PATH problems which i need to change first

..but i`m on, testing...

Share this post


Link to post
Share on other sites

Hey there,

first of all: thank you for this huge thread, that helped me a lot, to run my copy of Arma2net. However there is a little problem I can't imagine. My Insert-Into-Query works wonderful - but every second time only.

_query = "INSERT INTO `units` (idnr) VALUES ('works fine')";
_return = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQLCommandAsync ['armadb', '%1']", _query];

If I display the _return-Varable by hint '_return' it returns nothing, when it worked and [[]], when it didn't work. Always alternately without any changes in the script. I just restart the mission from the editor.

Has anybody an idea?

Thank you in advance!

Share this post


Link to post
Share on other sites

We should probably continue this discussion over here: http://forums.bistudio.com/showthread.php?128795-Arma2MySQL

Since this thread is for Arma2NET specifically. However, you're using the Async command which is exactly what it's supposed to do. See the online readme for more details and examples. If you want it to run and block until it returns, use Arma2NETMySQLCommand.

Hey there,

first of all: thank you for this huge thread, that helped me a lot, to run my copy of Arma2net. However there is a little problem I can't imagine. My Insert-Into-Query works wonderful - but every second time only.

_query = "INSERT INTO `units` (idnr) VALUES ('works fine')";
_return = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQLCommandAsync ['armadb', '%1']", _query];

If I display the _return-Varable by hint '_return' it returns nothing, when it worked and [[]], when it didn't work. Always alternately without any changes in the script. I just restart the mission from the editor.

Has anybody an idea?

Thank you in advance!

Share this post


Link to post
Share on other sites

Getting this error, Error in expression <throw "System.IO.FileNotFoundException"> Error position: <throw "System.IO.FileNotFoundException"> Error

Share this post


Link to post
Share on other sites

You're probably missing a dependency.

Getting this error, Error in expression <throw "System.IO.FileNotFoundException"> Error position: <throw "System.IO.FileNotFoundException"> Error

Share this post


Link to post
Share on other sites
Getting this error, Error in expression <throw "System.IO.FileNotFoundException"> Error position: <throw "System.IO.FileNotFoundException"> Error

try catch wherever you read a file, log the message and see if it's just a broken file path.

Share this post


Link to post
Share on other sites

This is for the database reference dependencies (I'm assuming) so there's no way to check.

try catch wherever you read a file, log the message and see if it's just a broken file path.

Share this post


Link to post
Share on other sites

Hi Scott_NZ,

We are unable to use the ARMA2NET dll for MONO.

When we try to link it or register it, MONO says the assembly is invalid.

	# gacutil -i Arma2Net.Unmanaged.dll 
Failure adding assembly Arma2Net.Unmanaged.dll to the cache: The file specified is not a valid assembly.

(note the dll is actually the MONO version.. with filename renamed like you instructed)

root@server:~# mono --version
Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-8)
Copyright (coffee) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. 
TLS:           __thread
SIGSEGV:       altstack
Notifications: epoll
Architecture:  x86
Disabled:      none
Misc:          softdebug 
LLVM:          supported, not enabled.
GC:            Included Boehm (with typed GC and Parallel Mark)

When we try to compile the application, using -r:Arma2Net.Unmanaged.dll we get:

"error CS0009: Metadata file `Arma2Net.Unmanaged.dll' does not contain valid metadata. Compilation failed: 1 error(s), 0 warnings"

We are using Debian 7 x86

Is there anything we can do?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×