forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerBag.cs
More file actions
31 lines (26 loc) · 907 Bytes
/
Copy pathPlayerBag.cs
File metadata and controls
31 lines (26 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Collections.Generic;
using System.Dynamic;
namespace L2dotNET.Models.Player.General
{
public class PlayerBag : DynamicObject
{
private readonly Dictionary<string, dynamic> _properties = new Dictionary<string, dynamic>(StringComparer.InvariantCultureIgnoreCase);
public override bool TryGetMember(GetMemberBinder binder, out dynamic result)
{
result = _properties.ContainsKey(binder.Name) ? _properties[binder.Name] : null;
return true;
}
public override bool TrySetMember(SetMemberBinder binder, dynamic value)
{
if (value == null)
{
if (_properties.ContainsKey(binder.Name))
_properties.Remove(binder.Name);
}
else
_properties[binder.Name] = value;
return true;
}
}
}