Пример #1
0
        public void TestGetters()
        {
            Assert.AreEqual(5.0, _biDictionary.GetByFirst(10));
            Assert.AreEqual(int.MaxValue, _biDictionary.GetBySecond(double.MinValue));

            Assert.AreEqual(default(double), _biDictionary.GetByFirst(1));
            Assert.AreEqual(default(int), _biDictionary.GetBySecond(1.0));
        }
    public override string ServerGetClientAddress(int connectionId)
    {
        int directID = 0;

        if (connectedDirectClients.TryGetBySecond(connectionId, out directID))
        {
            return("DIRECT-" + directID);
        }

        return(connectedRelayClients.GetBySecond(connectionId).ToString());
    }
Пример #3
0
        public static Opcode GetOpcode(int opcodeId, Direction direction)
        {
            switch (direction)
            {
            case Direction.ClientToServer:
                return(ClientDict.GetBySecond(opcodeId));

            case Direction.ServerToClient:
                return(ServerDict.GetBySecond(opcodeId));

            case Direction.Bidirectional:
                return(MiscDict.GetBySecond(opcodeId));
            }
            return(default(Opcode)); // Can never be called, anyway.
        }
Пример #4
0
 public static Opcode GetOpcode(int opcodeId)
 {
     return(Dict.GetBySecond(opcodeId));
 }
Пример #5
0
 public static int getByValue(string value)
 {
     return(Dictionary.GetBySecond(value));
 }