public DType Accept(TText type, JsonElement x, DefAssembly ass) { if (!x.TryGetProperty("key", out var keyEle)) { throw new Exception("text 缺失 key属性"); } if (!x.TryGetProperty("text", out var textEle)) { throw new Exception("text 缺失 text属性"); } string key = keyEle.GetString(); if (key == null) { throw new Exception("text key不是字符串"); } string text = textEle.GetString(); if (text == null) { throw new Exception("text text不是字符串"); } DataUtil.ValidateText(key, text); return(new DText(key, text)); }
public DType Accept(TText type, XElement x, DefAssembly ass) { var key = x.Element("key").Value; var text = x.Element("text").Value; DataUtil.ValidateText(key, text); return(new DText(key, text)); }
public DType Accept(TText type, object converter, ExcelStream x, DefAssembly ass) { var d = x.Read(); if (d is string s && s == "null") { return(new DString("")); } return(new DString(d.ToString())); }
public TText(TText c) { arr = Arrays.InitializeWithDefaultInstances <TLine>(c.capacity); capacity = c.capacity; size = c.size; for (int i = 0; i < c.size; i++) { arr[i] = c.arr[i]; } }
public DType Accept(TText type, ExcelStream x) { //x = SepIfNeed(type, x); x = TrySep(type, x); string key = ParseString(x.Read()); if (key == null) { if (type.IsNullable) { return(null); } else { throw new InvalidExcelDataException("该字段不是nullable类型,不能为null"); } } string text = ParseString(x.Read()); DataUtil.ValidateText(key, text); return(new DText(key, text)); }
public override string Accept(TText type) { return(CfgConstStrings.EditorTextTypeName); }
public string Accept(TText type, string bufName, string fieldName) { return($"{fieldName}{TText.L10N_FIELD_SUFFIX} = {bufName}.ReadString(); {fieldName} = {bufName}.ReadString();"); }
public DType Accept(TText type, Sheet.NamedRow x, bool multirow, bool nullable) { throw new NotSupportedException(); }
public string Accept(TText type) { return("FJsonValueString"); }
public string Accept(TText type, string bufName, string fieldName) { return($"{bufName}.WriteString({fieldName});"); }
public DType Accept(TText type, string x) { //var (key, text) = DataUtil.ExtractText(x); //return new DText(key, text); throw new NotSupportedException(); }
public string Accept(TText type) { return("STRING"); }
public override string Accept(TText type) { return("\"\""); }
public void Accept(TText type, Dictionary <string, DefTypeBase> x) { }
public string Accept(TText type, string bufName) { return($"{bufName}.ReadString()"); }
public string Accept(TText type) { return("writeString"); }
public virtual void Accept(TText type, T x) { }
public override bool Accept(TText type) { return(true); }
public override string Accept(TText type) { return("Bright.Config.EditorText"); }
public string Accept(TText type) { return("readString"); }
public virtual void Accept(TText type, T x) { DoAccept(type, x); }
public string Accept(TText type, string x) { return("\"" + x + "\""); }
public string Accept(TText type, string bufName, string fieldName) { return($"if(!{bufName}.readString({fieldName})) return false;"); }
public virtual TR Accept(TText type) { return DoAccept(type); }
public virtual string Accept(TText type) { return("string"); }
public string Accept(TText type, string json, string field) { return(DefaultLoad(json, field)); }
public void Accept(TText type, HashSet <DefTypeBase> x) { throw new NotImplementedException(); }
public string Accept(TText type, string fieldName, string tablesName) { throw new NotImplementedException(); }
public string Accept(TText type, string bufName, string fieldName) { return($"{fieldName} = {bufName}.ReadString();"); }
public string Accept(TText type, string jsonVarName, string fieldName) { return($"{fieldName} = {jsonVarName}"); }