Ejemplo n.º 1
0
        public static IntentSignature Parse(string action)
        {
            var intentName = new IntentSignature(action);

            Parse(action.Trim(), intentName);
            return(intentName);
        }
Ejemplo n.º 2
0
 private static void Parse(string action, IntentSignature name)
 {
     if (action.Contains("<") && action.EndsWith(">", StringComparison.Ordinal))
     {
         ParseComplex(action, name);
     }
     else
     {
         ParseSimple(action, name);
     }
 }
Ejemplo n.º 3
0
        private static void ParseSimple(string action, IntentSignature name)
        {
            int namespacePoint = action.LastIndexOf('.');

            if (namespacePoint == -1)
            {
                name.Action = action;
                return;
            }

            name.Namespace = action.Substring(0, namespacePoint);
            name.Action    = action.Substring(namespacePoint + 1);
        }
Ejemplo n.º 4
0
        private static void ParseComplex(string action, IntentSignature name)
        {
            int propertyPoint = action.IndexOf('<');

            ParseSimple(action.Substring(0, propertyPoint), name);

            string propertyPiece = action.Substring(propertyPoint + 1, action.Length - (propertyPoint + 2));

            IDictionary <string, IntentProperty> propertyDictionary = new Dictionary <string, IntentProperty>();

            foreach (Match match in PropertyFinder.Matches(propertyPiece))
            {
                propertyDictionary.Add(
                    match.Groups[1].Value,
                    new IntentProperty(match.Groups[2].Value, match.Groups[4].Value)
                    );
            }

            name.Properties = new System.Collections.ObjectModel.ReadOnlyDictionary <string, IntentProperty>(propertyDictionary);
        }