Пример #1
0
 /// <summary>
 /// Parse a string into a <see cref="IConceptValue"/> object.
 /// </summary>
 /// <param name="path">The string to parse</param>
 /// <param name="conceptValue">The concept value that was parsed from <paramref name="path"/>.</param>
 public static bool TryParse(string path, out IConceptValue conceptValue)
 {
     conceptValue = null;
     if (string.IsNullOrWhiteSpace(path))
     {
         return(false);
     }
     try
     {
         var result = PathRegex.Matches(path);
         if (result.Count != 1)
         {
             return(false);
         }
         var groups = result[0].Groups;
         if (groups.Count != 4)
         {
             return(false);
         }
         conceptValue = new ConceptValue
         {
             ConceptName = groups[1].Value,
             ContextName = groups[2].Value.StartsWith("~") ? null : groups[2].Value,
             ClientName  = groups[2].Value.StartsWith("~") ? groups[2].Value.Substring(1) : null,
             Value       = groups[3].Value
         };
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #2
0
 private bool IsDecorated(string value)
 {
     return(ConceptValue.TryParse(value, out _));
 }