hey all thanks for the quick responce here ill give more details!
yup IPC i'm writing a c++ program that collects info from the c# scripts polling the engine. and then produces files and like displayed stuff etc. and then generates mis files that are then dynamically loaded. back in. I want to make it sound like a weird economic aspect into a dynamic campaign and alike server side ability to command units in, and like display a delayed “warmap” like in the control rooms of the real warrooms of the time.. etc. perhaps more wargame(the film) style but same idea... . and i know my c++ better and also its faster to have it doing simulations on a separate process. And i don't want to slow down the il-2 engine with unnecessary scripting in c# and rather have an independent process which is optimized and using its own memory, processor cycles etc.
As for my code. It never gets past the
Code:
using System.IO.MemoryMappedFiles;
is what i tried... the error
Code:
"error CS0234: The type or namespace name 'MemoryMappedFiles' does not exist in the namespace 'System.IO' (are you missing an assembly reference?)
" and goes no further.
The rest is just really basic debug tests like right out of the windows documentation.. Not that it matters as the compiler won't find that memorymappedfile assembly thus “MemoryMappedFile” and all its functions are not found.
try a workaround loading in System.Core.dll into an assembly and then trying to create references to the functions. Via MethodInfo And then Invoke but that horror does not work,... as for the code itself its currently just testing the memmapfunction inside..
Code that uses that stuff..
Code:
//-$debug
//$reference parts\core\gamePlay.dll
using maddox.game;
using maddox.game.world;
using maddox.GP;
using System;
using System.IO;
using System.IO.MemoryMappedFiles; //THIS IS WHAT THROWS ERROR! and is what supposed to be used.. i think?
using System.Reflection;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Collections;
using System.Diagnostics;
public class Mission : AMission
{
...{lots otherstuff not relvent..}
...
public override void OnBattleStarted() {
...
File.AppendAllText(LOG_FILE, "debug::data:::headsize::"+ header_base_size+ " charsize::" + char_size + "\r\n");
List<string> sample_stringlist = new List<string>(new string[]{"somestring", "anotherone", "this is number2222", "403"});
long offset = 0x00000000;
long acess_length = 0x00100000;
int header_base_size = Marshal.SizeOf(typeof(header_base));
int char_size =sizeof(char);
using (var mmf = MemoryMappedFile.CreateFromFile(CLODO_FILE_PATH+@"missions\Multi\costumz\script_update_notice.dat", FileMode.Open,"update_notice"))
{
using (var accessor = mmf.CreateViewAccessor(offset, length))
{
long current_total =header_base_size;
long write_loc =header_base_size;
int i;
header_base read_head = new header_base();
accessor.Read(0, out read_head);
for(i =3; i <sample_stringlist.Count+3; i++)
{
string temp = sample_stringlist[i];
current_total += temp.Length*char_size;
if (current_total > acess_length)
{
File.AppendAllText(LOG_FILE, "###ERRROR::reached max virtual_shardfile.length..aborting write"+"\r\n");
break;
}
else
{
File.AppendAllText(LOG_FILE, "debug::forloop invoke"+ "\r\n");
accessor.Write(write_loc, ref temp );
write_loc = current_total;
}
}
File.AppendAllText(LOG_FILE, "debug::exitfoor"+ "\r\n");
read_head.line_num_data = i;
read_head.line_num_data -=3;
DateTime thisDay = DateTime.Today;
string c_date = thisDay.ToString("yyyyMMdd");
read_head.date_data = int.Parse(c_date);
accessor.Write(0, ref read_head);
}}
etc.
i then have other triggers and functions that track building destruction and where, and then will modfie the output from cities based on their destruction rigth now i just write it to file but to many diskwrites!
Code:
public override void OnBuildingKilled(string title, Point3d pos, AiDamageInitiator initiator, int eventArgInt)
{
write stuff.
{
etc i could post the "failed" workaround method i tried. if anyones really into deep c# like layers. but it seems to be a huuge brutal means for what appears to be just a missing the "refrence" on the complier engine/build side. my guess is the System.Core.dll being pointed do is not the proper one.. and the engine is just poiting to an old pre net4 verson? its abit opaque cuz i cant see how the complier works. atlest not at the level im at...
microsoft docs::
MemoryMappedFile Class
Definition
Namespace:
System.IO.MemoryMappedFiles
Assembly:
System.IO.MemoryMappedFiles.dll
according to a stackoverflow
"MemoryMappedFile class belongs on System.IO.MemoryMappedFiles namespace and it is in System.Core.dll assembly."
https://stackoverflow.com/questions/...amespace-error
Bookmarks