public void NamedMappingsShareMemoryArea()
        {
            var name = MkNamedMapping();

            using (var m0 = MemoryMappedFile.CreateNew(name, 4096, MemoryMappedFileAccess.ReadWrite)) {
                using (var m1 = MemoryMappedFile.CreateOrOpen(name, 4096, MemoryMappedFileAccess.ReadWrite)) {
                    using (var m2 = MemoryMappedFile.OpenExisting(name)) {
                        using (MemoryMappedViewAccessor v0 = m0.CreateViewAccessor(), v1 = m1.CreateViewAccessor(), v2 = m2.CreateViewAccessor()) {
                            v0.Write(10, 0x12345);
                            Assert.AreEqual(0x12345, v1.ReadInt32(10));
                            Assert.AreEqual(0x12345, v2.ReadInt32(10));
                        }
                    }
                }
            }
        }
示例#2
0
        public void Connect()
        {
            string map = @"Local\SimTelemetryRfactor2"; // TODO: Fix this name :)

            try
            {
                _mMMF      = MemoryMappedFile.CreateOrOpen(map, 16 * 1024, MemoryMappedFileAccess.ReadWrite);
                _mAccessor = _mMMF.CreateViewAccessor(0, 16 * 1024);
                Hooked     = true;
            }
            catch (Exception e)
            {
                Hooked = false;
                //
            }
        }
        protected void Open()
        {
            if (_isOpen)
            {
                throw new AlreadyRunningException("The share memory is already opened");
            }

            _memMappedFile = MemoryMappedFile.CreateOrOpen(_uniqueName + ShareMemoryNameSuffix, _bufferSize, MemoryMappedFileAccess.ReadWrite);
            _stream        = _memMappedFile.CreateViewStream();
            bool bNew = false;

            _notifyEvent = new EventWaitHandle(false, EventResetMode.ManualReset, _uniqueName + NotifyEventNameSuffix, out bNew);
            _notifyEvent.Reset();
            _mutex = new Mutex(false, _uniqueName + MutexNameSuffix, out bNew);
            ClearData();
        }
示例#4
0
        /* Initialize Mod Loader (DLL_PROCESS_ATTACH) */

        /// <summary>
        /// Initializes the mod loader.
        /// Returns the port on the local machine (but that wouldn't probably be used).
        /// </summary>
        public static int Initialize(IntPtr unusedPtr, int unusedSize)
        {
            // Setup Loader
            SetupLoader();

            // Write port as a Memory Mapped File, to allow Mod Loader's Launcher to discover the mod port.
            int pid = Process.GetCurrentProcess().Id;

            _memoryMappedFile = MemoryMappedFile.CreateOrOpen(ServerUtility.GetMappedFileNameForPid(pid), sizeof(int));
            var view         = _memoryMappedFile.CreateViewStream();
            var binaryWriter = new BinaryWriter(view);

            binaryWriter.Write(_server.Port);

            return(_server?.Port ?? 0);
        }
示例#5
0
 // Start is called before the first frame update
 void Awake()
 {
     meshInfo = new MeshInfo(vert, face);
     capacity = 0;
     foreach (var info in infos)
     {
         capacity += GetInfoSize(info);
     }
     mmf          = MemoryMappedFile.CreateOrOpen(id, capacity, MemoryMappedFileAccess.ReadWrite);
     viewAccessor = mmf.CreateViewAccessor(0, capacity);
     if (viewAccessor == null)
     {
         Debug.Log("Error!Connect failed!");
     }
     Debug.Log(capacity);
 }
示例#6
0
 public ApplicationAdapterEndPoint(AdapterBase adapter, string applicationName, string sessionId)
     : base(adapter, new UriBuilder("app", sessionId).Uri)
 {
     _config                    = ConfigurationManager.GetSection(MessagingSection.SectionKey) as MessagingSection;
     _sessionId                 = sessionId;
     _applicationName           = applicationName;
     _mutex                     = new Mutex(false, string.Format("IMI_MOBILE_MUTEX_{0}", _sessionId));
     _memoryMappedFile          = MemoryMappedFile.CreateOrOpen(string.Format("IMI_MOBILE_QUEUE_{0}", _sessionId), MemoryMappedFileSize);
     _stream                    = _memoryMappedFile.CreateViewStream(0, 0, MemoryMappedFileAccess.ReadWrite);
     _serverNotifyEvent         = new EventWaitHandle(false, EventResetMode.AutoReset, string.Format("IMI_MOBILE_SERVER_NOTIFY_{0}", _sessionId));
     _serverReceivedNotifyEvent = new EventWaitHandle(false, EventResetMode.AutoReset, string.Format("IMI_MOBILE_SERVER_RECEIVED_NOTIFY_{0}", _sessionId));
     _clientNotifyEvent         = new EventWaitHandle(false, EventResetMode.AutoReset, string.Format("IMI_MOBILE_CLIENT_NOTIFY_{0}", _sessionId));
     _clientReceivedNotifyEvent = new EventWaitHandle(false, EventResetMode.AutoReset, string.Format("IMI_MOBILE_CLIENT_RECEIVED_NOTIFY_{0}", _sessionId));
     _clientProcessedEvent      = new EventWaitHandle(false, EventResetMode.ManualReset, string.Format("IMI_MOBILE_CLIENT_PROCESSED_NOTIFY_{0}", _sessionId));
     _abortEvent                = new EventWaitHandle(false, EventResetMode.ManualReset);
 }
示例#7
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        public bool CreateServer()
        {
            try
            {
                _memoryMappedFile = MemoryMappedFile.CreateOrOpen(_smKeyStoreName, _smKeyStoreSize);
                _reader           = _memoryMappedFile.CreateViewAccessor(0, _smKeyStoreSize, MemoryMappedFileAccess.ReadWrite);
                _writer           = _memoryMappedFile.CreateViewStream(0, _smKeyStoreSize, MemoryMappedFileAccess.ReadWrite);
                _keystoreLock     = new Mutex(true, LageantLock, out _isLocked);
            }
            catch
            {
                return(false);
            }

            return(true);
        }
 public static void CreateOrOpen(string data)
 {
     using (MemoryMappedFile mmf = MemoryMappedFile.CreateOrOpen("lipan", 1024000, MemoryMappedFileAccess.ReadWrite))
     {
         using (MemoryMappedViewStream stream = mmf.CreateViewStream())
         {
             var writer = new BinaryWriter(stream);
             for (int i = 0; i < 500; i++)
             {
                 writer.Write(i);
                 Debug.WriteLine("{0}位置写入流:{0}", i);
                 //Thread.Sleep(500);
             }
         }
     }
 }
示例#9
0
        public MainViewModel(IUIServices ui)
        {
            UI     = ui;
            _trace = new KernelTrace("DebugPrintTrace");
            var provider = new DebugPrintProvider();

            provider.OnEvent += OnEvent;
            _trace.Enable(provider);

            _bufferReadyEvent = new EventWaitHandle(false, EventResetMode.AutoReset, "DBWIN_BUFFER_READY");
            _dataReadyEvent   = new EventWaitHandle(false, EventResetMode.AutoReset, "DBWIN_DATA_READY");
            _stopEvent        = new AutoResetEvent(false);

            _mmf = MemoryMappedFile.CreateOrOpen("DBWIN_BUFFER", _bufferSize);
            _stm = _mmf.CreateViewStream();
        }
示例#10
0
        public bool Open()
        {
            try
            {
                Utility.Log(LogStatus.Debug, $"{this.fileName} - {this.mutexName} - {this.size} bytes");
                this.mmf      = MemoryMappedFile.CreateOrOpen(this.name, this.size);
                this.accessor = this.mmf.CreateViewAccessor(0, this.size, MemoryMappedFileAccess.ReadWrite);
                this.mutex    = new Mutex(true, this.mutexName, out this.locked);
            }
            catch
            {
                return(false);
            }

            return(true);
        }
示例#11
0
        /// <summary>
        /// Creates a new <see cref="Gw2MumbleClient"/>.
        /// </summary>
        /// <param name="connection">The connection used to make requests, see <see cref="IConnection"/>.</param>
        /// <param name="gw2Client">The Guild Wars 2 client.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connection"/> or <paramref name="gw2Client"/> is <c>null</c>.</exception>
        protected internal Gw2MumbleClient(IConnection connection, IGw2Client gw2Client) : base(connection, gw2Client)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }
            if (gw2Client == null)
            {
                throw new ArgumentNullException(nameof(gw2Client));
            }

            this.memoryMappedFile = new Lazy <MemoryMappedFile>(
                () => MemoryMappedFile.CreateOrOpen(MUMBLE_LINK_MAP_NAME, Gw2LinkedMem.SIZE, MemoryMappedFileAccess.ReadWrite), true);
            this.memoryMappedViewAccessor = new Lazy <MemoryMappedViewAccessor>(
                () => this.memoryMappedFile.Value.CreateViewAccessor(), true);
        }
        public void OpenWrite()
        {
            // Write-only access fails when the map doesn't exist
            AssertExtensions.Throws <ArgumentException>("access", () => MemoryMappedFile.CreateOrOpen(CreateUniqueMapName(), 4096, MemoryMappedFileAccess.Write));
            AssertExtensions.Throws <ArgumentException>("access", () => MemoryMappedFile.CreateOrOpen(CreateUniqueMapName(), 4096, MemoryMappedFileAccess.Write, MemoryMappedFileOptions.None, HandleInheritability.None));

            // Write-only access works when the map does exist
            const int Capacity = 4096;
            string    name     = CreateUniqueMapName();

            using (MemoryMappedFile mmf = MemoryMappedFile.CreateOrOpen(name, Capacity))
                using (MemoryMappedFile opened = MemoryMappedFile.CreateOrOpen(name, Capacity, MemoryMappedFileAccess.Write))
                {
                    ValidateMemoryMappedFile(mmf, Capacity, MemoryMappedFileAccess.Write);
                }
        }
 private void startChat()
 {
     try {
         using (mmf = MemoryMappedFile.CreateOrOpen("testmap", SizeOfMFF)) {
             Mutex mutex = new Mutex(true, "testmapmutex", out bool createdNew);
             sendMessage("Chat started");
             mutex.ReleaseMutex();
             isReadyMessage();
             lissenToConsole();
             mutex.ReleaseMutex();
         }
     }
     catch (FileNotFoundException ex) {
         Console.WriteLine("Send message to MMF failed: " + ex.Message);
     }
 }
示例#14
0
文件: Form1.cs 项目: vr3d/GodComplex
        public Form1()
        {
            InitializeComponent();

            m_Instance = new ParametersBlock()
            {
//              SunIntensity = 100.0f,				// Should never change!
//              AverageGroundReflectance = 0.1f,	// Should never change!
            };
            m_StructSize = System.Runtime.InteropServices.Marshal.SizeOf(m_Instance);
            InitFromUI();

            m_MMF  = MemoryMappedFile.CreateOrOpen(@"GlobalIllumination", m_StructSize, MemoryMappedFileAccess.ReadWrite);
            m_View = m_MMF.CreateViewAccessor(0, m_StructSize, MemoryMappedFileAccess.ReadWrite);
            UpdateMMF();
        }
示例#15
0
        //=========================================================================================
        // フォームロード
        //=========================================================================================
        private void Form1_Load(object sender, EventArgs e)
        {
            // 共有メモリ生成
            m_Mmf      = MemoryMappedFile.CreateOrOpen(@"SharedMemory", sizeof(UInt32));
            m_Accessor = m_Mmf.CreateViewAccessor();

            // タイマー1を起動
            timer1.Interval = 100;             // 5sec
            timer1.Enabled  = true;

            // 共有メモリの内容を取得
            m_iValue = GetSharedMemValue();

            // テキストボックスに値を表示
            textBox2.Text = String.Format("{0}", m_iValue);
        }
示例#16
0
                /// <summary>
                /// 向共享区域写入数据
                /// </summary>
                /// <param name="data"></param>
                public void Write(string data)
                {
                    var bytes = data.StringToBytes();
                    var mutex = Mutex.OpenExisting($"{ShareName}Mutex");

                    mutex.WaitOne();
                    MMF = MemoryMappedFile.CreateOrOpen(ShareName, MaxLength, MemoryMappedFileAccess.ReadWrite);
                    using (MemoryMappedViewStream stream = MMF.CreateViewStream())
                    {
                        var writer = new BinaryWriter(stream);
                        var write  = new byte[MaxLength];
                        bytes.CopyTo(write, 0);
                        writer.Write(write);
                    }
                    mutex.ReleaseMutex();
                }
示例#17
0
        public UnsafeHelp(string BitmapFileName, long CountOfEntries = 0, bool InMemory = false)
        {
            var  bitmapName = "UnsafeBitmap" + Path.GetFileNameWithoutExtension(BitmapFileName);
            long ByteSize   = (CountOfEntries >> MagicNumbers.BIT_SHIFT) + sizeof(long);

            if (InMemory)
            {
                try
                {
                    BitMap = MemoryMappedFile.CreateOrOpen(
                        bitmapName,
                        ByteSize,
                        MemoryMappedFileAccess.ReadWrite);
                } catch (Exception ex)
                {
                    throw new MemoryMapWindowFailedException($"Unable to setup mapping for {BitmapFileName}", ex);
                }
            }
            else
            {
                // is there a bitmap
                try
                {
                    BitMap = MemoryMappedFile.OpenExisting(bitmapName, MemoryMappedFileRights.ReadWrite);
                }
                catch (Exception ex)
                {
                    if (BitMap == null && !InMemory)
                    {
                        BitMap = MemoryMappedFile.CreateFromFile(
                            BitmapFileName,
                            FileMode.OpenOrCreate,
                            bitmapName,
                            ByteSize);
                    }
                }
            }

            if (File.Exists(BitmapFileName) && BitMap == null && !InMemory)
            {
                throw new FileLoadException($"Can not load bitmap from {BitmapFileName}");
            }

            BitMapView = BitMap.CreateViewAccessor();
            BitmapLen  = BitMapView.Capacity;
            GetBitmapHandle();
        }
示例#18
0
        public void Set <T>(string key, T obj, long size, DateTime expire)
        {
            try {
                if (String.IsNullOrEmpty(key))
                {
                    throw new Exception("The key can't be null or empty.");
                }

                if (key.Length >= this.MaxKeyLength)
                {
                    throw new Exception("The key has exceeded the maximum length.");
                }

                if (!this.IsConnected)
                {
                    return;
                }

                expire = expire.ToUniversalTime();

                if (!_keyExperations.ContainsKey(key))
                {
                    _keyExperations.Add(key, expire);
                }
                else
                {
                    _keyExperations[key] = expire;
                }

                var mmf = MemoryMappedFile.CreateOrOpen(key, size);
                var vs  = mmf.CreateViewStream();
                _bf.Serialize(vs, obj);

                var cmd = "{0}{1}{2}";
                cmd = string.Format(cmd, key, DELIM, expire.ToString("s"));

                var buf = this.Encoding.GetBytes(cmd);
                _ns.Write(buf, 0, buf.Length);
                _ns.Flush();
            }
            catch (NotSupportedException) {
                Console.WriteLine(String.Format("{0} is too small for {1}.", size, key));
            }
            catch (Exception ex) {
                Console.WriteLine("MemMapCache: Set Failed.\n\t" + ex.Message);
            }
        }
        public void Write(string text)
        {
            if (_Mmf != null)
            {
                _Mmf.Dispose();
            }

            _Mmf = MemoryMappedFile.CreateOrOpen(ShareName, 1000);


            using (MemoryMappedViewAccessor accessor = _Mmf.CreateViewAccessor())
            {
                byte[] Buffer = ASCIIEncoding.ASCII.GetBytes(text);
                accessor.Write(54, (ushort)Buffer.Length);
                accessor.WriteArray(54 + 2, Buffer, 0, Buffer.Length);
            }
        }
示例#20
0
 public void VerifyOpen(String strLoc, String mapName, long capacity, MemoryMappedFileAccess access, MemoryMappedFileOptions options, HandleInheritability inheritability, MemoryMappedFileAccess expectedAccess)
 {
     iCountTestcases++;
     try
     {
         using (MemoryMappedFile mmf = MemoryMappedFile.CreateOrOpen(mapName, capacity, access, options, inheritability))
         {
             VerifyHandleInheritability(strLoc, mmf.SafeMemoryMappedFileHandle, inheritability);
             VerifyAccess(strLoc, mmf, expectedAccess, 10);
         }
     }
     catch (Exception ex)
     {
         iCountErrors++;
         Console.WriteLine("ERROR, {0}: Unexpected exception, {1}", strLoc, ex);
     }
 }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (_isLoaded)
            {
                return;
            }
            ListenThread.StateSection =
                MemoryMappedFile.CreateOrOpen("TeknoParrot_NetState", Marshal.SizeOf <TpNetStateStruct.TpNetState>());
            ListenThread.StateView = ListenThread.StateSection.CreateViewAccessor();
            MainWindow mainWindow = Application.Current.Windows.OfType <MainWindow>().Single();

            _isLoaded = true;
            new Thread(() => ListenThread.Listen(GridLobbies, BtnRefresh, BtnJoinGame, mainWindow)).Start();
            ListenThread.SelectedGameId = (GameId)((FrameworkElement)GameListCombo.SelectedItem).Tag;
            BtnRefresh.IsEnabled        = false;
            ListenThread.RefreshList    = true;
        }
示例#22
0
        public static float[] SweepStore(ref int pointCount, int portCount)
        {
            string str = "S1_1";
            int    num = 0;

            gPNA.WriteString("CALC:PAR:EXT '" + str + "', '" + str + "'", true);
            gPNA.WriteString("CALC:PAR:SEL '" + str + "',fast", true);
            gPNA.WriteString("CALC:PAR:MNUM?", true);
            num = Convert.ToInt32(gPNA.ReadString());
            gPNA.WriteString("SENS1:SWE:POIN?", true);
            pointCount = Convert.ToInt32(gPNA.ReadString());
            gPNA.WriteString("SYST:DATA:MEM:INIT", true);
            int    num2 = ((pointCount * portCount) * portCount) * 2;
            string data = string.Concat(new object[] { "SYST:DATA:MEM:ADD '1:", num, ":CAL:", num2.ToString(), "'" });

            //string data = string.Concat(new object[] { "SYST:DATA:MEM:ADD '1:", num, ":SDATA:", num2.ToString(), "'" });
            gPNA.WriteString(data, true);
            gPNA.WriteString("SYST:DATA:MEM:OFFSet?", true);
            int offset = Convert.ToInt32(gPNA.ReadString());

            gPNA.WriteString("SYST:DATA:MEM:NAME?", true);
            string str3 = gPNA.ReadString();

            gPNA.WriteString("SYST:DATA:MEM:COMM '" + str3 + "'", true);
            gPNA.WriteString("SYST:DATA:MEM:SIZE?", true);
            int num3 = int.Parse(gPNA.ReadString());

            gPNA.WriteString("SENS:SWE:MODE SING", true);
            gPNA.WriteString("*OPC?", true);
            gPNA.ReadString();
            float[] arr = null;
            using (MemoryMappedFile file = MemoryMappedFile.CreateOrOpen(str3, (long)num3))
            {
                using (MemoryMappedViewAccessor accessor = file.CreateViewAccessor())
                {
                    arr = new float[num2];
                    ReadBytes(accessor, offset, num2, arr);
                }
            }
            gPNA.WriteString("SYST:DATA:MEM:RESET", true);
            gPNA.WriteString("*OPC?", true);
            gPNA.ReadString();
            gPNA.WriteString("CALC:PAR:SEL '" + str + "',fast", true);
            gPNA.WriteString("CALC:PAR:DEL '" + str + "'", true);
            return(arr);
        }
示例#23
0
        public ExternalControlServer(IPlaybackService playbackService, ICacheService cacheService)
        {
            this.playbackService = playbackService;
            this.cacheService    = cacheService;

            this.fftProviderDataTimer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromSeconds(2)
            };
            this.fftProviderDataTimer.Tick += FftProviderDataTimerElapsed;

            fftDataMemoryMappedFile             = MemoryMappedFile.CreateOrOpen("DopamineFftDataMemory", FftDataLength, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.DelayAllocatePages, null, HandleInheritability.None);
            fftDataMemoryMappedFileStream       = fftDataMemoryMappedFile.CreateViewStream(0, FftDataLength, MemoryMappedFileAccess.ReadWrite);
            fftDataMemoryMappedFileStreamWriter = new BinaryWriter(fftDataMemoryMappedFileStream);
            fftDataMemoryMappedFileMutex        = new Mutex(true, "DopamineFftDataMemoryMutex");
            fftDataMemoryMappedFileMutex.ReleaseMutex();
        }
示例#24
0
        private MapContainer GetFile(string pipeName)
        {
            lock (_lockingObject)
            {
                if (_files.ContainsKey(pipeName))
                {
                    return(_files[pipeName]);
                }
                MapContainer f = new MapContainer()
                {
                    File = MemoryMappedFile.CreateOrOpen(pipeName, 16 * 1024)
                };

                _files.Add(pipeName, f);
                return(f);
            }
        }
示例#25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MemoryNaturalKeyRepository"/> class.
        /// </summary>
        public MemoryNaturalKeyRepository()
        {
            var securitySettings = new MutexSecurity();

            securitySettings.AddAccessRule(
                new MutexAccessRule(
                    new SecurityIdentifier(WellKnownSidType.WorldSid, null),
                    MutexRights.FullControl,
                    AccessControlType.Allow));

            var mutexCreated = false;

            this.mutex = new Mutex(false, @"Global\MemoryNaturalKeyRepository3Mutex", out mutexCreated, securitySettings);
            this.file  = MemoryMappedFile.CreateOrOpen("MemoryNaturalKeyRepository3", 1 * 1024 * 1024 /* 1MB */);

            Serializer.RegisterConverters(new[] { new DateTimeConverter() });
        }
示例#26
0
        // Methods
        public bool Open()
        {
            try
            {
                // Create named MMF
                mmf = MemoryMappedFile.CreateOrOpen(smName, smSize);

                // Create lock
                smLock = new Mutex(true, "SM_LOCK", out locked);
            }
            catch
            {
                return(false);
            }

            return(true);
        }
示例#27
0
        public List <string> ReadFromMemory()
        {
            var lines = new List <string>();

            using (MemoryMappedFile mmf = MemoryMappedFile.CreateOrOpen(_memoryFileName, 1000))
            {
                using (MemoryMappedViewAccessor mmvsm = mmf.CreateViewAccessor())
                {
                    byte[] bytes = new byte[50];

                    var    a    = mmvsm.ReadArray(0, bytes, 0, bytes.Length);
                    string text = System.Text.Encoding.UTF8.GetString(bytes).Trim('\0');
                }
            }

            return(lines);
        }
示例#28
0
        private async void button1_Click(object sender, EventArgs e)
        {
            long capacity = 1 << 10 << 10;

            using (var mmf = MemoryMappedFile.CreateOrOpen("MMF1", capacity))
            {
                var viewAccessor = mmf.CreateViewAccessor(0, capacity);
                while (true)
                {
                    await Task.Delay(1000);

                    string input = $"测试时间{DateTime.Now.ToLongTimeString()}";
                    viewAccessor.Write(0, input.Length);
                    viewAccessor.WriteArray <char>(4, input.ToArray(), 0, input.Length);
                }
            }
        }
        public void OpenedAccessibilityLimitedBeyondOriginal()
        {
            const int Capacity = 4096;
            string    name     = CreateUniqueMapName();

            // Open the original as ReadWrite but the copy as Read
            using (MemoryMappedFile original = MemoryMappedFile.CreateNew(name, Capacity, MemoryMappedFileAccess.ReadWrite))
                using (MemoryMappedFile opened = MemoryMappedFile.CreateOrOpen(name, Capacity, MemoryMappedFileAccess.Read))
                {
                    // Even though we passed ReadWrite to CreateNew, trying to open a view accessor with ReadWrite should fail
                    Assert.Throws <UnauthorizedAccessException>(() => opened.CreateViewAccessor());
                    Assert.Throws <UnauthorizedAccessException>(() => opened.CreateViewAccessor(0, Capacity, MemoryMappedFileAccess.ReadWrite));

                    // But Read should succeed
                    opened.CreateViewAccessor(0, Capacity, MemoryMappedFileAccess.Read).Dispose();
                }
        }
示例#30
0
        static void Main(string[] args)
        {
            Console.Title = "Read";


            using (MemoryMappedFile.CreateOrOpen("MyMmf", 400 + FileHeader.SizeInBytes))
            {
                while (true)
                {
                    WriteLine("Нажмите Enter чтобы считать данные из общей памяти");
                    ReadLine();

                    var result = ReadFromSharedMemoryWithSleep(MemoryMappedFile.CreateOrOpen("MyMmf", 400 + FileHeader.SizeInBytes));
                    WriteLine(result);
                }
            }
        }