static MPMappings() { System.Type[] arr = new System.Type[] { typeof(Packet_Ability_InvocationTable), typeof(Packet_Basic_Destroy), typeof(Packet_Basic_Instantiate), typeof(Packet_Entity_AnimatorParameterChange), typeof(Packet_Entity_AnimatorStateChange), typeof(Packet_Entity_Kill), typeof(Packet_Entity_TransformSync), typeof(Packet_Event_EvtAttackLanded), typeof(Packet_Event_EvtBeingHit), typeof(Packet_Event_EvtBulletHit), typeof(Packet_Event_EvtEvadeSuccess), typeof(Packet_Event_EvtHittingOther), typeof(Packet_Level_CreateStageFullData), typeof(Packet_Level_PeerStageReady), typeof(Packet_Level_RequestLevelBuff), typeof(Packet_Level_ResultLevelBuff), typeof(Packet_Monster_MonsterCreation) }; MPPacketMapping = new IntMapping <System.Type>(arr); System.Type[] typeArray2 = new System.Type[] { typeof(AvatarIdentity), typeof(LevelIdentity), typeof(MonsterIdentity), typeof(PeerIdentity) }; MPPeerMapping = new IntMapping <System.Type>(typeArray2); _tableCache = new Dictionary <System.Type, Table>(); _structCache = new Dictionary <System.Type, Struct>(); }
public void TryParse() { var result = -1; Assert.True(IntMapping.TryParse("One", out result)); Assert.Equal(IntMapping.One, result); Assert.True(IntMapping.TryParse("tWo", ignoreCase: true, result: out result)); Assert.Equal(IntMapping.Two, result); Assert.True(IntMapping.TryParse("Two", out result)); Assert.Equal(IntMapping.Two, result); Assert.False(IntMapping.TryParse("tWO", out result)); }
public void PerformOnInt(int x, IntMapping mapping) { Console.Out.WriteLine("Map result is = " + mapping(x)); }