public unsafe static T IntToObject <T>(int Ptr) { byte[] by = new byte[4]; fixed(byte *pb = by) { *(int *)pb = Ptr; } TObjectPack op = (TObjectPack)rawDeserialize(by, typeof(TObjectPack)); return((T)op.Play); }
public unsafe static int ObjectToInt(object po) { TObjectPack pop = new TObjectPack(); pop.Play = po; byte[] by = rawSerialize(pop); int ret = 0; fixed(byte *pb = by) { ret = *(int *)pb; } return(ret); }
public unsafe static T IntToObject <T>(int Ptr) { byte[] by = new byte[4]; fixed(byte *pb = by) { *(int *)pb = Ptr; } TObjectPack op = (TObjectPack)rawDeserialize(by, typeof(TObjectPack)); if (op.Play.GetType().Name == "TUserEngine") { return(default(T)); } return((T)op.Play); }