示例#1
0
        /// <summary>
        /// Stop the timers and dispose of the shared memory handles
        /// </summary>
        public void Stop()
        {
            memStatus = MEMORY_STATUS.DISCONNECTED;
            memoryTimer.Stop();

            // Stop the timers
            physicsTimer.Stop();
            graphicsTimer.Stop();
            staticDataTimer.Stop();
        }
示例#2
0
        /// <summary>
        /// Assigns MMF files with the path to shared memory location and calls for processing to begin if files are found.
        /// </summary>
        /// <returns>True if a connection is made, false if no file is found.</returns>
        private bool ConnectToMemory()
        {
            try
            {
                //Starting attempt to connect to memory
                memStatus = MEMORY_STATUS.CONNECTING;

                //Open MMF paths
                staticDataMMF   = MemoryMappedFile.OpenExisting("Local\\acpmf_static");
                graphicsDataMMF = MemoryMappedFile.OpenExisting("Local\\acpmf_graphics");
                physicsDataMMF  = MemoryMappedFile.OpenExisting("Local\\acpmf_physics");

                //Start processing data from memory files
                graphicsTimer.Start();
                ProcessGraphicsData();

                physicsTimer.Start();
                ProcessPhysicsData();

                staticDataTimer.Start();
                ProcessStaticData();

                //Connected successfully
                memStatus = MEMORY_STATUS.CONNECTED;
                //Stop resetting connection-timer
                memoryTimer.Stop();
                return(true);
            }
            catch (FileNotFoundException)
            {
                staticDataTimer.Stop();
                graphicsTimer.Stop();
                physicsTimer.Stop();
                return(false);
            }
        }
 static extern void GlobalMemoryStatus(ref MEMORY_STATUS buf);