コード例 #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
ファイル: ExcelDataCreator.cs プロジェクト: zhangga/luban
        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];
     }
 }
コード例 #5
0
        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));
        }
コード例 #6
0
 public override string Accept(TText type)
 {
     return(CfgConstStrings.EditorTextTypeName);
 }
コード例 #7
0
 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("\"\"");
 }
コード例 #14
0
 public void Accept(TText type, Dictionary <string, DefTypeBase> x)
 {
 }
コード例 #15
0
ファイル: GoDeserializeVisitor.cs プロジェクト: zhangga/luban
 public string Accept(TText type, string bufName)
 {
     return($"{bufName}.ReadString()");
 }
コード例 #16
0
 public string Accept(TText type)
 {
     return("writeString");
 }
コード例 #17
0
 public virtual void Accept(TText type, T x)
 {
 }
コード例 #18
0
 public override bool Accept(TText type)
 {
     return(true);
 }
コード例 #19
0
 public override string Accept(TText type)
 {
     return("Bright.Config.EditorText");
 }
コード例 #20
0
 public string Accept(TText type)
 {
     return("readString");
 }
コード例 #21
0
 public virtual void Accept(TText type, T x)
 {
     DoAccept(type, x);
 }
コード例 #22
0
ファイル: CsConstValueVisitor.cs プロジェクト: zhangga/luban
 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);
 }
コード例 #25
0
 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();
 }
コード例 #29
0
 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}");
 }