Results 1 to 10 of 10

Thread: error well compling MemoryMappedFiles in FMB complier.

  1. #1
    Student Pilot
    Join Date
    Jun 2020
    Posts
    3
    Post Thanks / Like
    Total Downloaded
    3.25 MB

    error well compling MemoryMappedFiles in FMB complier.

    hey all. i'm been working on a script and i've run into an error... i assume its kinda bug? as unless i'm wrong i thought il-2 codbliz did uses atlest .net 4? which was when i`m told the fonctionnalité was added.
    i'm very new to c# as im a c++ programmer, and untill this all my work was linux based, envroments and c++.. so forgive me if i've miss understood. however, i do get an "error" that being

    " error CS0234: The type or namespace name 'MemoryMappedFiles' does not exist in the namespace 'System.IO' (are you missing an assembly reference?)"

    well trying to compile the script in the FMB. this is by useing the line "using System.IO.MemoryMappedFiles;` in said script.
    the only things i can find online are saying that it would be due to outdated .net or that the `System.Core.dll assembly.`is not refrenced.. in the `complier`that is being used by il-2 blitz.. if i understand the flow of c#..

    apologies if this is the wrong place. but if anyone does know.. what steps could be taken or if theirs a speific reson why this functionality been left out! perhaps be good tooo add in later? lol

  2. Likes ATAG_Snapper liked this post
  3. #2
    ATAG Member ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    986
    Post Thanks / Like
    Total Downloaded
    908.31 MB

    Re: error well compling MemoryMappedFiles in FMB complier.

    Please post a code sample that shows the problem.

    Why are you using MemoryMappedFiles?

  4. #3
    Team Fusion ATAG_Slipstream's Avatar
    Join Date
    Aug 2012
    Location
    Coventry, England
    Posts
    1,576
    Post Thanks / Like
    Total Downloaded
    2.91 MB

    Re: error well compling MemoryMappedFiles in FMB complier.

    That's what I was wondering.

    IPC would be my first guess.

  5. #4
    ATAG_Colander's Avatar
    Join Date
    Nov 2011
    Location
    Bir Tawil
    Posts
    11,128
    Post Thanks / Like
    Total Downloaded
    255.73 MB

    Re: error well compling MemoryMappedFiles in FMB complier.

    if I remember correctly, you have to use something like
    Code:
    //include System.IO.MemoryMappedFiles
    Hopefully someone that remembers the exact syntax can chime in.

  6. #5
    Student Pilot
    Join Date
    Jun 2020
    Posts
    3
    Post Thanks / Like
    Total Downloaded
    3.25 MB

    Re: error well compling MemoryMappedFiles in FMB complier.

    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
    Last edited by zepalz; Jun-19-2020 at 23:26.

  7. #6
    ATAG_Colander's Avatar
    Join Date
    Nov 2011
    Location
    Bir Tawil
    Posts
    11,128
    Post Thanks / Like
    Total Downloaded
    255.73 MB

    Re: error well compling MemoryMappedFiles in FMB complier.

    add this line to the top and try again:
    Code:
    //$reference System.IO.MemoryMappedFiles.dll

  8. #7
    ATAG Member ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    986
    Post Thanks / Like
    Total Downloaded
    908.31 MB

    Re: error well compling MemoryMappedFiles in FMB complier.

    That seems like a complicated way to send data to an external process. Why not open a socket and write ASCII strings when events happen.

  9. #8
    Ace Erpr.Gr.210_Mölders's Avatar
    Join Date
    Dec 2015
    Location
    Italy
    Posts
    2,452
    Post Thanks / Like
    Total Downloaded
    1,002.26 MB

    Re: error well compling MemoryMappedFiles in FMB complier.

    It's so nice, from time to time, seeing people writing in Aramaic...
    Visit the Robert Mölders Facebook Group ( Left-click on the red link on the left to open the relative page! )
    Visit the Robert Mölders YouTube Channel ( Left-click on the red link on the left to open the relative page! )
    *Important Note: You can also open the Robert Mölders Facebook Group page by clicking directly on my signature image


    My PC specs
    Windows 10 Pro 64 bit ~ Intel Core i7-7700K 4.2GHz 8MB Cache Quad core
    ASUS ROG STRIX Z270H GAMING Motherboard, Socket 1151 ATX, Dual M.2, USB 3.1 Type-C ~ MSI GeForce GTX 1080 TI Gaming X 11G Graphic Card PCIE 3.0, 11 GB, GDDR5X 352 bit, 11.01 GHz, 1569 MHz
    Samsung MZ-V6E250BW SSD 960 EVO, 250 GB, M.2, NVMe ~ Western Digital WD Caviar Blue 2TB 64MB Cache, WD20EZRZ (64MB Cache) ~ Enermax Liqmax II 240 (ELC-LMR240S-BS)
    Corsair CMK16GX4M2B3000C15 Vengeance LPX RAM 16 GB, 2x8 GB, DDR4, 3000 MHz, CL15 ~ EVGA SuperNOVA GQ PSU 750W ~ NZXT CA-N450W-M1 Case for Gaming PC, Black
    LG 49UK6200PLA TV 49" 4K UltraHD, IPS Display, 4096 x 2160, Active HDR, Multitasking ~ LG 27UD68P Monitor 27" 4K UltraHD LED IPS, 3840 x 2160, AMD FreeSync, Multitasking
    Thrustmaster T.16000M FCS Joystick ~ Thrustmaster TWCS Throttle ~ Thrustmaster TFRP Pedals

  10. #9
    Team Fusion ATAG_Noofy's Avatar
    Join Date
    Feb 2019
    Location
    https://w3w.co/chat.hisses.lofty
    Posts
    2,602
    Post Thanks / Like
    Total Downloaded
    1.25 GB

    Re: error well compling MemoryMappedFiles in FMB complier.

    Quote Originally Posted by Erpr.Gr.210_Belial View Post
    It's so nice, from time to time, seeing people writing in Aramaic...
    That's due to the faith developers have in miracles...
    Gigabyte Z390 UD | i7 9700K @3.60GHz | 16.0 GB | Windows 10 Pro 64-Bit | NVIDIA GeForce GTX 1070 Ti
    TM Warthog HOTAS | Saitek pro rudder pedals | TrackIR 5 | TeamSpeak 3.3.2 | TS Notifier 1.6.0h

  11. Likes Erpr.Gr.210_Mölders liked this post
  12. #10
    Student Pilot
    Join Date
    Jun 2020
    Posts
    3
    Post Thanks / Like
    Total Downloaded
    3.25 MB

    Re: error well compling MemoryMappedFiles in FMB complier.

    hello, all sorry for a delayz time.we had a doomy heatwave here in québekystain and my home office has no outdoor windows... and then got caught up in database experiments. nevertheless.
    the solution to my original problem appear to have be this
    Code:
    //$reference System.Core.dll
    Thankz too ATAG_Colander for pointing me in the right direction seems this
    Code:
    //$reference
    is they key i was looking for..
    And I assume preparser command I was looking for!

    The
    Code:
    //$reference System.IO.MemoryMappedFiles.dll
    got me close. but it did give me an idea (it actually gave a different error
    Code:
    error CS1070: The type name 'MemoryMappedFile' could not be found. This type has been forwarded to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Consider adding a reference to that assembly.
    the docs on microsoft stuff is weak.. always assuming you use Visual Studio lol which im not
    anywho. i'm deep in other errors but at least solved this thanks all. i'll likely move future posts on this project to the more appropriate modding section... as my tests proved that directly depositing data from the il-2 engine into a SQLite database is performance heavy and also, prone to locking up the engine. thus think all my database stuff will be handled by the c++ program after the il-2 engine just writes data to the shared memory..

    And it is possible using “socket and write ASCII strings” is definitely a possibility... iz just that i’ve been interested in shared memory mapping for a while and it perhaps is more of an experiment to make it work and learn how to do it. Even if its overkill in this situation.. Though i’d be interested to see final performance situations.. I suppose for me, i'm more comfortable with the notion of it being very much like files, just in memory(my studies were more on OS and concurrency work when i studied programing academically and less so in networking aspect), and as I don't mind dealing with concurrency issues and atomics. And I plan to design it in a way which should avoid deadlock or racecontions.. So for a little extra design work, feel the outcome be more rewarding..

    Also found this neat wrapper i wanted to play with.
    https://github.com/carlomilanesi/cpp-mmf soo on the c++ side defy interested to see how my interactions work out...
    Anywhoz thanks all for the help!
    Seems latest original issue is resolved for now! Haha.i;ll see if i can break something else now!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •