Example #1
0
        public FieldInfo(String name)
        {
            PropertyName = null;
            TypeName     = null;
            FieldType    = FieldType.Scalar;
            SpecType     = SpecType.Unknown;
            var x = name.Split('!');

            if (x.Length > 0)
            {
                PropertyName = x[0];
            }
            CheckField(x);
            if (x.Length > 1)
            {
                TypeName  = x[1];
                FieldType = FieldType.Object;
            }
            if (x.Length > 2)
            {
                FieldType = DataHelpers.TypeName2FieldType(x[2]);
                if (FieldType == FieldType.Scalar || FieldType == FieldType.Array)
                {
                    SpecType = DataHelpers.TypeName2SpecType(x[2]);
                }
            }
            IsComplexField = PropertyName.Contains('.');
        }
Example #2
0
        /// <inheritdoc/>
        public string this[string columnName]
        {
            get
            {
                if (columnName == nameof(StringValue) && PropertyName.Contains("Url"))
                {
                    var stringValue = (StringValue ?? string.Empty).Trim();
                    if (stringValue.StartsWith("\\\\") || string.IsNullOrEmpty(stringValue))
                    {
                        return(null);
                    }

                    Uri result;
                    var supportingSchemes = new[]
                    {
                        Uri.UriSchemeHttp,
                        Uri.UriSchemeHttps
                    };

                    if (!Uri.TryCreate(stringValue, UriKind.RelativeOrAbsolute, out result) || !result.IsAbsoluteUri ||
                        !supportingSchemes.Contains(result.Scheme))
                    {
                        return("Warning: Incorrect HTTP(s) format.");
                    }
                }

                if (!_successInput)
                {
                    return(_currentErrorText);
                }

                return(null);
            }
        }
Example #3
0
 public virtual string ToSql(SqlConversionContext context)
 {
     if (PropertyName.Contains("."))
     {
         return(ToSubQuerySql(context));
     }
     else
     {
         return(ToSqlOn(context));
     }
 }
Example #4
0
        public FieldInfo(String name)
        {
            PropertyName = null;
            TypeName     = null;
            FieldType    = FieldType.Scalar;
            SpecType     = SpecType.Unknown;
            IsLazy       = false;
            IsMain       = false;
            MapFields    = null;
            var x = name.Split('!');

            if (x.Length > 0)
            {
                PropertyName = x[0];
            }
            CheckField(x);
            if (x.Length > 1)
            {
                TypeName  = x[1];
                FieldType = FieldType.Object;
            }
            if (x.Length > 2)
            {
                FieldType = DataHelpers.TypeName2FieldType(x[2]);
                if (FieldType == FieldType.Scalar || FieldType == FieldType.Array || FieldType == FieldType.Json)
                {
                    SpecType = DataHelpers.TypeName2SpecType(x[2]);
                }
                IsLazy = x[2].Contains("Lazy");
                IsMain = x[2].Contains("Main");
            }
            if (x.Length == 4)
            {
                FieldType = FieldType.MapObject;
                MapFields = x[3].Split(':');
            }
            IsComplexField = PropertyName.Contains('.');
            CheckReservedWords();
        }
Example #5
0
            public void SetupUIProps()
            {
                if (PropertyName.Contains("Color"))
                {
                    foreach (var v in Vectors)
                    {
                        v.IsColor = true;

                        var colorR = v.Vector.X;
                        var colorG = v.Vector.Y;
                        var colorB = v.Vector.Z;
                        if (MaxValue > 1)
                        {
                            colorR = colorR * 1 / MaxValue;
                            colorG = colorG * 1 / MaxValue;
                            colorB = colorB * 1 / MaxValue;
                        }
                        colorR           = Math.Min(colorR * 255, 255);
                        colorG           = Math.Min(colorG * 255, 255);
                        colorB           = Math.Min(colorB * 255, 255);
                        v.DisplayedColor = new SolidColorBrush(Color.FromRgb((byte)colorR, (byte)colorG, (byte)colorB));
                    }
                }
            }