示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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()));
        }
示例#4
0
文件: TText.cs 项目: Maxim4iik/Labs
 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();");
 }
示例#8
0
 public DType Accept(TText type, Sheet.NamedRow x, bool multirow, bool nullable)
 {
     throw new NotSupportedException();
 }
示例#9
0
 public string Accept(TText type)
 {
     return("FJsonValueString");
 }
示例#10
0
 public string Accept(TText type, string bufName, string fieldName)
 {
     return($"{bufName}.WriteString({fieldName});");
 }
示例#11
0
 public DType Accept(TText type, string x)
 {
     //var (key, text) = DataUtil.ExtractText(x);
     //return new DText(key, text);
     throw new NotSupportedException();
 }
示例#12
0
 public string Accept(TText type)
 {
     return("STRING");
 }
示例#13
0
 public override string Accept(TText type)
 {
     return("\"\"");
 }
 public void Accept(TText type, Dictionary <string, DefTypeBase> x)
 {
 }
示例#15
0
 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)
 {
 }
示例#18
0
 public override bool Accept(TText type)
 {
     return(true);
 }
 public override string Accept(TText type)
 {
     return("Bright.Config.EditorText");
 }
示例#20
0
 public string Accept(TText type)
 {
     return("readString");
 }
 public virtual void Accept(TText type, T x)
 {
     DoAccept(type, x);
 }
示例#22
0
 public string Accept(TText type, string x)
 {
     return("\"" + x + "\"");
 }
示例#23
0
 public string Accept(TText type, string bufName, string fieldName)
 {
     return($"if(!{bufName}.readString({fieldName})) return false;");
 }
示例#24
0
 public virtual TR Accept(TText type)
 {
     return DoAccept(type);
 }
 public virtual string Accept(TText type)
 {
     return("string");
 }
示例#26
0
 public string Accept(TText type, string json, string field)
 {
     return(DefaultLoad(json, field));
 }
示例#27
0
 public void Accept(TText type, HashSet <DefTypeBase> x)
 {
     throw new NotImplementedException();
 }
示例#28
0
 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();");
 }
示例#30
0
 public string Accept(TText type, string jsonVarName, string fieldName)
 {
     return($"{fieldName} = {jsonVarName}");
 }