Example #1
0
        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;
            }
        }
Example #2
0
 public BENObject(List <BENObject> list)
 {
     data = list;
     type = BENObjectType.List;
 }
Example #3
0
 public BENObject(Dictionary <BENObject, BENObject> dict)
 {
     data = dict;
     type = BENObjectType.Dictionary;
 }
Example #4
0
 public BENObject(long num)
 {
     data = num;
     type = BENObjectType.Integer;
 }
Example #5
0
 public BENObject(string str)
 {
     data = Encoding.Default.GetBytes(str);
     type = BENObjectType.String;
 }
Example #6
0
 public void setType(BENObjectType type)
 {
     this.type = type;
 }
Example #7
0
 public BENObject(byte[] str)
 {
     data = str;
     type = BENObjectType.String;
 }