示例#1
0
            public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
            {
                var s = reader.ReadAsString();

                return(ShortCode.TryParse(s, out var c)
                    ? c
                    : null);
            }
示例#2
0
 public static bool TryParse(string s, out ShortCode c)
 {
     if (s != null && s.Length == 22)
     {
         var g = Decode(s);
         c = g.HasValue
             ? new ShortCode(g.Value)
             : null;
         return(g.HasValue);
         // c = new ShortCode(Decode(s).Value);
         // return true;
     }
     c = null;
     return(false);
 }
示例#3
0
 public Image(ShortCode c, string fileName, string filePath = null)
 {
     Id       = c;
     Name     = fileName;
     Location = filePath ?? string.Empty;
 }