Example #1
0
        private void ReceivedFunc(XmReceiveData data)
        {
            TRResult tr_res = new TRResult();

            IntPtr cur_ptr = data.Data;

            t0424._t0424OutBlock out_block = (t0424._t0424OutBlock)Marshal.PtrToStructure(cur_ptr, typeof(t0424._t0424OutBlock));
            PushResult<t0424._t0424OutBlock>(out_block, "out_block", ref tr_res);
            cur_ptr = IntPtr.Add(cur_ptr, Marshal.SizeOf(out_block));

            //Extract occur count
            t0424.BlockCount block_count = (t0424.BlockCount)Marshal.PtrToStructure(cur_ptr, typeof(t0424.BlockCount));
            int count = Int32.Parse(Encoding.ASCII.GetString(block_count.count_).TrimStart('0'));
            cur_ptr = IntPtr.Add(cur_ptr, Marshal.SizeOf(block_count));

            //OutBlock1
            for (int i = 0; i < count; i++)
            {
                t0424._t0424OutBlock1 out_block1 = (t0424._t0424OutBlock1)Marshal.PtrToStructure(cur_ptr, typeof(t0424._t0424OutBlock1));
                PushResult<t0424._t0424OutBlock1>(out_block1, "out_block1", ref tr_res);
                cur_ptr = IntPtr.Add(cur_ptr, Marshal.SizeOf(out_block1));
            }

            if (CompleteCB != null) CompleteCB(ep_, tr_res);
        }
Example #2
0
        private void ReceivedFunc(XmReceiveData data)
        {
            TRResult tr_res = new TRResult();

            IntPtr cur_ptr = data.Data;

            t0424._t0424OutBlock out_block = (t0424._t0424OutBlock)Marshal.PtrToStructure(cur_ptr, typeof(t0424._t0424OutBlock));
            PushResult <t0424._t0424OutBlock>(out_block, "out_block", ref tr_res);
            cur_ptr = IntPtr.Add(cur_ptr, Marshal.SizeOf(out_block));

            //Extract occur count
            t0424.BlockCount block_count = (t0424.BlockCount)Marshal.PtrToStructure(cur_ptr, typeof(t0424.BlockCount));
            int count = Int32.Parse(Encoding.ASCII.GetString(block_count.count_).TrimStart('0'));

            cur_ptr = IntPtr.Add(cur_ptr, Marshal.SizeOf(block_count));

            //OutBlock1
            for (int i = 0; i < count; i++)
            {
                t0424._t0424OutBlock1 out_block1 = (t0424._t0424OutBlock1)Marshal.PtrToStructure(cur_ptr, typeof(t0424._t0424OutBlock1));
                PushResult <t0424._t0424OutBlock1>(out_block1, "out_block1", ref tr_res);
                cur_ptr = IntPtr.Add(cur_ptr, Marshal.SizeOf(out_block1));
            }

            if (CompleteCB != null)
            {
                CompleteCB(ep_, tr_res);
            }
        }
Example #3
0
        private void t1102OutBlock(XmReceiveData data)
        {
            TRResult tr_res = new TRResult();

            t1102._t1102OutBlock out_block = (t1102._t1102OutBlock)Marshal.PtrToStructure(data.Data, typeof(t1102._t1102OutBlock));
            PushResult<t1102._t1102OutBlock>(out_block, "out_block", ref tr_res);

            if (CompleteCB != null) CompleteCB(ep_, tr_res);
        }
Example #4
0
        private void ReceivedFunc(XmReceiveData data)
        {
            TRResult tr_res = new TRResult();

            CSPAQ12200._CSPAQ12200OutBlock1 out_block1 = (CSPAQ12200._CSPAQ12200OutBlock1)Marshal.PtrToStructure(data.Data, typeof(CSPAQ12200._CSPAQ12200OutBlock1));
            PushResult<CSPAQ12200._CSPAQ12200OutBlock1>(out_block1, "out_block1", ref tr_res);

            CSPAQ12200._CSPAQ12200OutBlock2 out_block2 = (CSPAQ12200._CSPAQ12200OutBlock2)Marshal.PtrToStructure(IntPtr.Add(data.Data, Marshal.SizeOf(out_block1)), typeof(CSPAQ12200._CSPAQ12200OutBlock2));
            PushResult<CSPAQ12200._CSPAQ12200OutBlock2>(out_block2, "out_block2", ref tr_res);

            if (CompleteCB != null) CompleteCB(ep_, tr_res);
        }
Example #5
0
        private void t1102OutBlock(XmReceiveData data)
        {
            TRResult tr_res = new TRResult();

            t1102._t1102OutBlock out_block = (t1102._t1102OutBlock)Marshal.PtrToStructure(data.Data, typeof(t1102._t1102OutBlock));
            PushResult <t1102._t1102OutBlock>(out_block, "out_block", ref tr_res);

            if (CompleteCB != null)
            {
                CompleteCB(ep_, tr_res);
            }
        }
Example #6
0
        private void ReceivedFunc(XmReceiveData data)
        {
            TRResult tr_res = new TRResult();

            CSPAQ12200._CSPAQ12200OutBlock1 out_block1 = (CSPAQ12200._CSPAQ12200OutBlock1)Marshal.PtrToStructure(data.Data, typeof(CSPAQ12200._CSPAQ12200OutBlock1));
            PushResult <CSPAQ12200._CSPAQ12200OutBlock1>(out_block1, "out_block1", ref tr_res);

            CSPAQ12200._CSPAQ12200OutBlock2 out_block2 = (CSPAQ12200._CSPAQ12200OutBlock2)Marshal.PtrToStructure(IntPtr.Add(data.Data, Marshal.SizeOf(out_block1)), typeof(CSPAQ12200._CSPAQ12200OutBlock2));
            PushResult <CSPAQ12200._CSPAQ12200OutBlock2>(out_block2, "out_block2", ref tr_res);

            if (CompleteCB != null)
            {
                CompleteCB(ep_, tr_res);
            }
        }
Example #7
0
        public void PushResult <T>(T inst, string obj_name, ref TRResult result)
        {
            Dictionary <string, string> kv = new Dictionary <string, string>();

            foreach (FieldInfo field in typeof(T).GetFields(BindingFlags.Public | BindingFlags.Instance))
            {
                if (field.FieldType.Name == "Byte[]")
                {
                    byte[] ori_val = (byte[])field.GetValue(inst);

                    string utf8_str = Encoding.GetEncoding(51949).GetString((byte[])ori_val, 0, ori_val.Length - 1).Trim();
                    kv.Add(field.Name, utf8_str);
                }
            }
            result.map_.Add(obj_name, kv);
        }