public MessageProtocol(JsonObject dict, JsonObject serverProtos, JsonObject clientProtos)
 {
     foreach (string index1 in (IEnumerable <string>)dict.Keys)
     {
         ushort index2 = Convert.ToUInt16(dict[index1]);
         this.dict[index1]  = index2;
         this.abbrs[index2] = index1;
     }
     this.protobuf     = new Protobuf.Protobuf(clientProtos, serverProtos);
     this.encodeProtos = clientProtos;
     this.decodeProtos = serverProtos;
     this.reqMap       = new Dictionary <uint, string>();
 }
        public MessageProtocol(JsonObject dict, JsonObject serverProtos, JsonObject clientProtos)
        {
            ICollection<string> keys = dict.Keys;

            foreach(string key in keys){
                ushort value = Convert.ToUInt16(dict[key]);
                this.dict[key] = value;
                this.abbrs[value] = key;
            }

            protobuf = new Protobuf.Protobuf(clientProtos, serverProtos);
            this.encodeProtos = clientProtos;
            this.decodeProtos = serverProtos;

            this.reqMap = new Dictionary<uint, string>();
        }
Exemple #3
0
        public MessageProtocol(JsonObject dict, JsonObject serverProtos, JsonObject clientProtos)
        {
            ICollection <string> keys = dict.Keys;

            foreach (string key in keys)
            {
                ushort value = Convert.ToUInt16(dict[key]);
                this.dict[key]    = value;
                this.abbrs[value] = key;
            }

            protobuf          = new Protobuf.Protobuf(clientProtos, serverProtos);
            this.encodeProtos = clientProtos;
            this.decodeProtos = serverProtos;

            this.reqMap = new Dictionary <uint, string>();
        }
        public MessageProtocol(JObject routesDict, JObject serverProtos, JObject clientProtos)
        {
            var dict = routesDict.ToObject <Dictionary <string, ushort> >();

            foreach (KeyValuePair <string, ushort> pair in dict)
            {
                this.dict[pair.Key]    = pair.Value;
                this.abbrs[pair.Value] = pair.Key;
            }

            clientProtos      = clientProtos["nested"].ToObject <JObject>();
            serverProtos      = serverProtos["nested"].ToObject <JObject>();
            protobuf          = new Protobuf.Protobuf(clientProtos, serverProtos);
            this.encodeProtos = clientProtos;
            this.decodeProtos = serverProtos;

            this.reqMap = new Dictionary <uint, string>();
        }
Exemple #5
0
        public MessageProtocol(JsonData dict, JsonData serverProtos, JsonData clientProtos, string dictVersion, string protoVersion)
        {
            ICollection <string> keys = dict.Keys;

            foreach (string key in keys)
            {
                ushort value = Convert.ToUInt16(dict[key].ToString());
                this.dict[key]    = value;
                this.abbrs[value] = key;
            }

            protobuf          = new Protobuf.Protobuf(clientProtos, serverProtos);
            this.encodeProtos = clientProtos;
            this.decodeProtos = serverProtos;

            this.protoVersion = protoVersion;
            this.dictVersion  = dictVersion;

            this.reqMap = new Dictionary <uint, string>();
        }
Exemple #6
0
        public MessageProtocol(JSONNode dict, JSONClass serverProtos, JSONClass clientProtos)
        {
            Debug.Log(dict.GetType() + "MessageProtocol" + dict.ToString() + ((JSONClass)dict).Count);

            List <string> keys = ((JSONClass)dict).Keys();

            foreach (string key in keys)
            {
                Debug.Log(key);
                ushort value = Convert.ToUInt16(dict[key].AsInt);
                this.dict[key]    = value;
                this.abbrs[value] = key;
            }

            protobuf          = new Protobuf.Protobuf(clientProtos, serverProtos);
            this.encodeProtos = clientProtos;
            this.decodeProtos = serverProtos;

            this.reqMap = new Dictionary <uint, string>();
        }