Exemplo n.º 1
0
 public static IMethodName Method([NotNull] string input)
 {
     try
     {
         var ctx = TypeNameParseUtil.ValidateMethodName(input);
         if (ctx.UNKNOWN() != null)
         {
             return(UnknownName.Get(typeof(IMethodName)));
         }
         return(new MethodName(ctx));
     }
     catch (Exception)
     {
         try
         {
             var ctx = TypeNameParseUtil.ValidateMethodName(CsNameFixer.HandleOldMethodNames(input));
             if (ctx.UNKNOWN() != null)
             {
                 return(UnknownName.Get(typeof(IMethodName)));
             }
             return(new MethodName(ctx));
         }
         catch (Exception)
         {
             return(UnknownName.Get(typeof(IMethodName)));
         }
     }
 }
Exemplo n.º 2
0
        public static IFieldName Field(string input)
        {
            var name = GetMemberName(input);

            if (name != null)
            {
                return(name);
            }
            return(UnknownName.Get(typeof(IFieldName)));
        }
Exemplo n.º 3
0
        public static IPropertyName Property(string input)
        {
            var name = GetMemberName(input);

            if (name != null)
            {
                return(name);
            }
            return(UnknownName.Get(typeof(IPropertyName)));
        }
Exemplo n.º 4
0
        public static IEventName Event(string inputB, params object[] args)
        {
            var input = string.Format(inputB, args);
            var name  = GetMemberName(input);

            if (name != null)
            {
                return(name);
            }
            return(UnknownName.Get(typeof(IEventName)));
        }
Exemplo n.º 5
0
        public static UnknownName Get(Type t)
        {
            if (NameCache.ContainsKey(t))
            {
                return(NameCache[t]);
            }
            var name = new UnknownName(t);

            NameCache.Add(t, name);
            return(name);
        }
Exemplo n.º 6
0
 public static IAssemblyName Assembly(string input)
 {
     try
     {
         var ctx = TypeNameParseUtil.ValidateAssemblyName(input);
         return(new AssemblyName(ctx));
     }
     catch (Exception)
     {
         return(UnknownName.Get(typeof(IAssemblyName)));
     }
 }
Exemplo n.º 7
0
 public static INamespaceName Namespace(string input)
 {
     try
     {
         var ctx = TypeNameParseUtil.ValidateNamespaceName(input);
         return(new NamespaceName(ctx));
     }
     catch (Exception)
     {
         return(UnknownName.Get(typeof(INamespaceName)));
     }
 }
Exemplo n.º 8
0
 public static IParameterName Parameter(string input)
 {
     try
     {
         var ctx = TypeNameParseUtil.ValidateParameterName(input);
         return(new ParameterName(ctx));
     }
     catch (AssertException)
     {
         return(UnknownName.Get(typeof(IParameterName)));
     }
 }
Exemplo n.º 9
0
 public static ILambdaName GetLambdaName(string input)
 {
     try
     {
         var ctx = TypeNameParseUtil.ValidateLambdaName(input);
         if (ctx.UNKNOWN() != null)
         {
             return(UnknownName.Get(typeof(ILambdaName)));
         }
         return(new LambdaName(ctx));
     }
     catch (AssertException)
     {
         return(UnknownName.Get(typeof(ILambdaName)));
     }
 }