/// <summary> /// Load from V8 string /// </summary> /// <param name="v8String"></param> void IV8Serializable.LoadFromV8String(string v8String) { var root = LexemV8Parser.Parse(v8String); if (root == null || root.LexemType != LexemV8Type.Brace) { return; } root = root.FindFirstChild(LexemV8Type.Brace); string stCount = root.ChildLexemList[0].Data; Count = int.Parse(stCount); if (_elementTypeDesc != null && _elementTypeDesc.Types.Length == 1) { var valTypeInfo = _elementTypeDesc.Types[0]; if (valTypeInfo.IsPrimitiveType) { for (int i = 1; i < root.ChildLexemList.Count; i++) { var valLex = root.ChildLexemList[i]; object val; if (valTypeInfo.TryParseValueFromV8String(Session, valLex.ToString(), out val)) { this[i - 1] = val; } } } } }
public override string ToString() { if (_uuidStr == null) { var str = Session.ValueToStringInternal(Ptr); var lex = LexemV8Parser.Parse(str); if (lex.ChildLexemList.Count == 3) { _uuidStr = lex.ChildLexemList[2].Data; } } return(_uuidStr); }
internal bool TryParseValueFromV8String(Session session, string strValue, out object value) { return(TryParseValueFromV8String(session, LexemV8Parser.Parse(strValue), out value)); }