예제 #1
0
        object ReadObject(DataTypeInfo dt, FakeStruct fake, int dataIndex)
        {
            for (int i = 0; i < objList.Count; i++)
            {
                if (objList[i].index == dataIndex)
                {
                    return(objList[i].instance);
                }
            }
            var          obj = dt.Construction();
            ClassContext cc  = new ClassContext();

            cc.instance = obj;
            cc.index    = dataIndex;
            objList.Add(cc);
            var mf = dt.matchedFields;

            if (mf != null)
            {
                for (int i = 0; i < mf.Length; i++)
                {
                    ReadField(fake, 0, mf[i], obj);
                }
            }
            return(obj);
        }
예제 #2
0
        object ReadStruct(DataTypeInfo dt, FakeStruct fake, int offset)
        {
            var obj = dt.Construction();
            var mf  = dt.matchedFields;

            if (mf != null)
            {
                for (int i = 0; i < mf.Length; i++)
                {
                    ReadField(fake, offset, mf[i], obj);
                }
            }
            return(obj);
        }
예제 #3
0
        object ReadStructToObject(DataTypeInfo dt, FakeStruct fake, int start)
        {
            var    obj = dt.Construction();
            IntPtr ptr = UnsafeOperation.GetObjectAddr(obj);
            var    mf  = dt.matchedFields;

            if (mf != null)
            {
                for (int i = 0; i < mf.Length; i++)
                {
                    ReadField(fake, start, mf[i], ptr);
                }
            }
            return(obj);
        }