# Arma2NET

## Recommended Posts

This is amazing. Good work :D

yes so much possibility :) perhaps it will be a good idea to directly insert a serial dll in arma2net

##### Share on other sites

Lol... someone is using serial ports in 2012:eek:

##### Share on other sites

I''ve written 2 little plugins, one to write a file and one to read, both do the job i want but I can't get them into one plugin without the read part adding extra quotation marks eg:""gun"" instead of "gun"

any help would be appreciated.....I've only ever done one C# program and that was to read times off a microchip for a slotcar system.

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

namespace SaveStuffplugin
{
{

public override string Invoke(string args, int maxResultSize)
{
string path = (@"C:\file.txt");
File.WriteAllText(path, args);
return null;
}
}
}

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

{
{
public override string Invoke(string args, int maxResultSize)
{
if (File.Exists(@"C:\file.txt"))
{
return text;
}
else
{
return null;
}
}
}
}

##### Share on other sites

yes i call both

_stuff = "Arma2Net.Unmanaged" callExtension "ReadStuff";
and
call compile format["'Arma2Net.Unmanaged' callExtension 'SaveStuff %1%2%3%4%5%6'",
_mArray,_wArray,_pArray,str(typeof _Backpack),_BackpackmArray,_BackpackwArray];


but I'd like to make the 1 plugin called ReadWriteFile and call either method

_stuff = "Arma2Net.Unmanaged" callExtension "ReadWriteFile [ReadStuff]";
and
call compile format["'Arma2Net.Unmanaged' callExtension 'ReadWriteFile [saveStuff %1%2%3%4%5%6]'",
_mArray,_wArray,_pArray,str(typeof _Backpack),_BackpackmArray,_BackpackwArray];


##### Share on other sites

OK, try something like this:

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

{
{
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]"

##### Share on other sites

yep i did it that way.....txt file has ["gun"] but when i read it with that method i get "[""gun""]"

no big deal, I'll stick with the 2 plugins for now....thanks

##### Share on other sites

This is amazingly useful for what I do, thank you.. thank you so much.

##### Share on other sites

I have been redirected here from the PersistentDB thread by Jman. It seems I am having problems getting Arma2NET to run correctly on my dedicated server. The game is installed through steam and run using TA2DST. The errors I am receiving are shown below:

10/02/2012 20:54:56 Error Caught exception of type System.IO.FileNotFoundException
System.IO.FileNotFoundException: C:\Program Files (x86)\Steam\steamapps\common\arma 2 operation arrowhead\Expansion\beta\Arma2Net.Managed.dll
at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
at Arma2NETMySQLPlugin.Startup.StartupConnection()
at Arma2NETMySQLPlugin.Arma2NETMySQLPlugin.Invoke(String args, Int32 maxResultSize)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at Arma2Net.Managed.Bridge.InvokeFunction(String function, Int32 maxResultSize)
10/02/2012 20:54:56 Error function: Arma2NETMySQL ['arma','UpdatePlayer','tsc=any,tpos=4694.76|2591.53|0.00143909,tdam=0,tdhe=any,tdbo=any,tdha=any,tdle=any,tdir=148.695,tsta=Stand,tsid=any,tveh=any,tsea=,ttyp=BAF_Soldier_TL_MTP,trat=0,tvd=any,ttd=any,tran=any,tfir=any,tek=any,tck=any,tfk=any,tsui=any,tlif=ALIVE,tdea=any,ttp=any,tlc=any,tld="10/2/2012 7:54:56 PM",tpid=2413766,tna=Aenigma,tmid=any']
10/02/2012 20:54:56 Error maxResultSize: 4095
10/02/2012 20:55:02 Error Caught exception of type System.IO.FileNotFoundException
System.IO.FileNotFoundException: C:\Program Files (x86)\Steam\steamapps\common\arma 2 operation arrowhead\Expansion\beta\Arma2Net.Managed.dll
at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
at Arma2NETMySQLPlugin.Startup.StartupConnection()
at Arma2NETMySQLPlugin.Arma2NETMySQLPlugin.Invoke(String args, Int32 maxResultSize)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at Arma2Net.Managed.Bridge.InvokeFunction(String function, Int32 maxResultSize)
10/02/2012 20:55:02 Error function: Arma2NETMySQL ['arma','RemoveLandVehicles','[tmid=any]']
10/02/2012 20:55:02 Error maxResultSize: 4095

So from what I can see Arma2NET is calling for the required files in the wrong location. I have circumvented this problem by moving said files into the directory listed and this seemed to fix the errors.

I am posting here however to see if anyone has had a similar issue and if there is a fix for it.

##### Share on other sites

Are you using the latest version of Arma2NET? If so, this may be a bug which I thought I had fixed...

##### Share on other sites

I am using a version linked to me by Jman, I'm assuming it is the latest version but I shall check for sure once I am home from work.

EDIT: I am using version 2.2 of Arma2NET

Edited by iOGC_Aenigma

##### Share on other sites

A nice piece of software so far. I'm just beginning to explore the possibilities, but the fist question already popped up. How am I able to use a array as an argument for a method Add-In?

I'm using Lists as data type on the c# side, but I can't call my method from within arma2 or the Arma2Net Explorer. I always get a MissingMethodException. Any advice would be appreciated.

##### Share on other sites

Arma2NET converts them into ReadOnlyCollections. Here's an example from a Str plugin I wrote for string manipulation:

public string[] Split(string s, ReadOnlyCollection<object> separators)
{
return s.Split(separators.Cast<string>().ToArray(), StringSplitOptions.None);
}


Then you'd call it like so:

> Str [split, 'A|B\C', ['|','\']]
["A", "B", "C"]


There are some small limitations at the moment like not being able to specify IEnumerable as the parameter type.

Edited by Scott_NZ

##### Share on other sites

Thanks a lot!

I thought arrays from Arma were always interpreted as a list, thanks for the advice :)

##### Share on other sites

where should the arma2net folder be added? i have steam version arma2 combined operation

##### Share on other sites

It should be placed where you have your modfolders, usually in the main game directory.

##### Share on other sites

Just to let you know again Scott I checked my version of Arma2Net and my beta version and still after a fresh install of Arma and the plugins I still have to place the contents of @Arma2Net in my Expansion/Beta folder. Do you think this could have something to do with me using TA2DST launcher instead of a batch file?

##### Share on other sites

Well, does it work if you use a batch file?

##### Share on other sites

Is it possible to create a dialog / display with this mod? Like extending RscStandardDisplay ??

##### Share on other sites

Not in-game dialogs, no.

##### Share on other sites

Right for whatever reason it seems the TA2DST launcher causes problems for Arma2NET. When using a batch file to launch the server I had no need for the Arma2Net files to be duplicated in the Expansions\beta folder.

##### Share on other sites

Can anyone help me out? i get this error

Info: 21:19:21 - Arma2NETMySQL Plugin Started.
Info: 21:19:21 - Version number: 0.1.0.0
Info: 21:19:21 - Compiled against Arma2NET Version: 2.2.0.0
Error: 21:19:22 - The number and/or format of the arguments passed in doesn't match.

##### Share on other sites

That's wholly to do with the plugin. You'll have to refer to the PDB thread.

##### Share on other sites

Arma2NET has been updated to version 2.3 with the following changes:

- Added SetClipboardText <text> and GetClipboardText functions for manipulating the clipboard.

- Improved the startup time.

or

##### Share on other sites

New version frontpaged on the Armaholic homepage.