Esempio n. 1
0
        public void ParseInfo(System.Collections.Hashtable info)
        {
            rawHash               = info;
            this.id               = info.GetValue <string>((int)SPC.Id, string.Empty);
            this.name             = info.GetValue <string>((int)SPC.Name, string.Empty);
            this.level            = info.GetValue <int>((int)SPC.Level, 0);
            this.workshop         = info.GetValue <byte>((int)SPC.Workshop, 0).toEnum <Workshop>();
            this.type             = info.GetValue <byte>((int)SPC.ItemType, 0).toEnum <InventoryObjectType>();
            this.targetTemplateId = info.GetValue <string>((int)SPC.Template, string.Empty);
            this.color            = (ObjectColor)(byte)info.GetValue <int>((int)SPC.Color, 0);

            if (info.ContainsKey((int)SPC.Set))
            {
                set = info.GetValue <string>((int)SPC.Set, string.Empty);
            }
            else
            {
                set = string.Empty;
            }

            Hashtable craftMaterialsHash = info.GetValue <Hashtable>((int)SPC.CraftMaterials, new Hashtable());

            this.craftMaterials = craftMaterialsHash.toDict <string, int>();
            binded = info.GetValue <bool>((int)SPC.Binded, false);
        }
Esempio n. 2
0
 public void ParseInfo(System.Collections.Hashtable info)
 {
     this.Id         = info.GetValue <string>((int)SPC.ChatMessageId, string.Empty);
     this.Group      = (ChatGroup)info.GetValue <byte>((int)SPC.ChatMessageGroup, (byte)0);
     this.Message    = info.GetValue <string>((int)SPC.ChatMessage, string.Empty);
     this.Sender     = info.GetValue <string>((int)SPC.ChatSourceLogin, string.Empty);
     this.SenderName = info.GetValue <string>((int)SPC.ChatMessageSourceName, string.Empty);
     this.Receiver   = info.GetValue <string>((int)SPC.ChatReceiverLogin, string.Empty);
     this.Time       = info.GetValue <float>((int)SPC.ChatMessageTime, 0.0f);
 }
Esempio n. 3
0
        public void ParseInfo(System.Collections.Hashtable info)
        {
            rawHash       = info;
            this.id       = info.GetValue <string>((int)SPC.Id, string.Empty);
            this.template = info.GetValue <string>((int)SPC.Template, string.Empty);
            this.level    = info.GetValue <int>((int)SPC.Level, 0);
            this.damage   = info.Value <float>((int)SPC.Damage);

            this.optimalDistance = info.GetValue <float>((int)SPC.OptimalDistance, 0f);

            this.color          = (ObjectColor)(byte)info.GetValue <int>((int)SPC.Color, (int)(byte)ObjectColor.white);
            this.damageType     = (WeaponDamageType)(byte)info.Value <byte>((int)SPC.DamageType);
            this.baseCritChance = (float)info.GetValue <float>((int)SPC.CritChance, 0f);
            workshop            = (Workshop)(byte)(int)info.GetValue <int>((int)SPC.Workshop, (int)Workshop.DarthTribe);
            binded = info.GetValue <bool>((int)SPC.Binded, binded);
        }
        public void getvalue_throws_argumentexception_when_value_is_not_present()
        {
            var dictionary = new Hashtable { { "question", "what is it" } };

            Expect(() => dictionary.GetValue<string>("answer"), Throws.ArgumentException.With.Property("ParamName").EqualTo("key"));
        }
        public void can_get_value_without_default_with_custom_converter()
        {
            var dictionary = new Hashtable { { "question", "what is it" } };

            var value = dictionary.GetValue("question", (object v) => v is string ? 10 : 20);

            Expect(value, Is.EqualTo(10));
        }
        public void can_get_value_without_default()
        {
            var dictionary = new Hashtable { { "question", "what is it" } };

            var value = dictionary.GetValue<string>("question");

            Expect(value, Is.EqualTo("what is it"));
        }