Results 1 to 9 of 9

Thread: error well compling MemoryMappedFiles in FMB complier.

  1. #1
    Student Pilot
    Join Date
    Jun 2020
    Posts
    2
    Post Thanks / Like
    Total Downloaded
    0

    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
    Team Fusion ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    516
    Post Thanks / Like
    Total Downloaded
    702.66 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,399
    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
    9,997
    Post Thanks / Like
    Total Downloaded
    114.86 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
    2
    Post Thanks / Like
    Total Downloaded
    0

    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
    9,997
    Post Thanks / Like
    Total Downloaded
    114.86 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
    Team Fusion ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    516
    Post Thanks / Like
    Total Downloaded
    702.66 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_Belial's Avatar
    Join Date
    Dec 2015
    Location
    Europe
    Posts
    1,839
    Post Thanks / Like
    Total Downloaded
    975.32 MB

    Re: error well compling MemoryMappedFiles in FMB complier.

    It's so nice, from time to time, seeing people writing in Aramaic...
    Visit the Jäger und Zerstörer Facebook Group at :Jäger und Zerstörer Facebook Group ( Left-click on the red link on the left to open the relative page! )
    Visit the Jäger und Zerstörer YouTube channel at : Jäger und Zerstörer YouTube Channel ( Left-click on the red link on the left to open the relative page! )
    *Important Note: You can also open the Jäger und Zerstörer 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
    Manual Creation Group ATAG_Noofy's Avatar
    Join Date
    Feb 2019
    Location
    Zulu +2
    Posts
    1,137
    Post Thanks / Like
    Total Downloaded
    810.78 MB

    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...
    Setup 1:
    Lenovo 10NK000TEX | i7 7700K @3.60GHz | 16.0 GB | Windows 10 Pro 64-Bit | NVIDIA GeForce GTX 1050 Ti
    T16000M FCS HOTAS | CH_PRO Pedals | TrackIR 5 | TeamSpeak 3.3.2 | TS Notifier 1.6.0h

    Setup 2:
    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_Belial liked this post

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
  •