Exemple #1
0
        public void Init()
        {
            listener = new AppHTTPListener();
            listener.Init();

            wrapper  = new AgentInterface.MMFWrapper();
            bkStruct = new AgentInterface.InterfaceStruct();
        }
Exemple #2
0
        private void WriteToMMF(InterfaceStruct st)
        {
            int size = System.Runtime.InteropServices.Marshal.SizeOf(typeof(InterfaceStruct));

            MemoryMappedViewAccessor accessor = mmfAgentStruct.CreateViewAccessor();

            accessor.WriteArray(0, StructureToByteArray((object)st), 0, size);
            accessor.Dispose();
        }
Exemple #3
0
 unsafe public void ReadMMF(ref InterfaceStruct st)
 {
     using (var stream = mmfAgentStruct.CreateViewStream())
     {
         using (BinaryReader binReader = new BinaryReader(stream))
         {
             object obj = (object)st;
             ByteArrayToStructure(binReader.ReadBytes((int)stream.Length), ref obj);
             st = (InterfaceStruct)obj;
         }
     }
 }
Exemple #4
0
        public void Update()
        {
            wrapper.ReadMMF(ref readStruct);

            if (bkStruct.state != readStruct.state)
            {
                Process_state((AppState)bkStruct.state, (AppState)readStruct.state);
            }


            bkStruct = DeepCopy <AgentInterface.InterfaceStruct>(readStruct);
            Thread.Sleep(100);
        }