private void CreateFromString(ref byte[] str, ref int index) { if (str != null && str.Length - index > 2) { switch (Convert.ToChar(str[index])) { case 'i': data = handleInteger(ref str, ref index); type = BENObjectType.Integer; break; case 'l': data = handleList(ref str, ref index); type = BENObjectType.List; break; case 'd': data = handleDictionary(ref str, ref index); type = BENObjectType.Dictionary; break; default: data = handleString(ref str, ref index); type = BENObjectType.String; break; } } else { data = null; } }
public BENObject(List <BENObject> list) { data = list; type = BENObjectType.List; }
public BENObject(Dictionary <BENObject, BENObject> dict) { data = dict; type = BENObjectType.Dictionary; }
public BENObject(long num) { data = num; type = BENObjectType.Integer; }
public BENObject(string str) { data = Encoding.Default.GetBytes(str); type = BENObjectType.String; }
public void setType(BENObjectType type) { this.type = type; }
public BENObject(byte[] str) { data = str; type = BENObjectType.String; }