Ejemplo 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)));
         }
     }
 }
Ejemplo n.º 2
0
        public static IFieldName Field(string input)
        {
            var name = GetMemberName(input);

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

            if (name != null)
            {
                return(name);
            }
            return(UnknownName.Get(typeof(IPropertyName)));
        }
Ejemplo 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)));
        }
Ejemplo n.º 5
0
 public static IAssemblyName Assembly(string input)
 {
     try
     {
         var ctx = TypeNameParseUtil.ValidateAssemblyName(input);
         return(new AssemblyName(ctx));
     }
     catch (Exception)
     {
         return(UnknownName.Get(typeof(IAssemblyName)));
     }
 }
Ejemplo n.º 6
0
 public static INamespaceName Namespace(string input)
 {
     try
     {
         var ctx = TypeNameParseUtil.ValidateNamespaceName(input);
         return(new NamespaceName(ctx));
     }
     catch (Exception)
     {
         return(UnknownName.Get(typeof(INamespaceName)));
     }
 }
Ejemplo n.º 7
0
 public static IParameterName Parameter(string input)
 {
     try
     {
         var ctx = TypeNameParseUtil.ValidateParameterName(input);
         return(new ParameterName(ctx));
     }
     catch (AssertException)
     {
         return(UnknownName.Get(typeof(IParameterName)));
     }
 }
Ejemplo n.º 8
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)));
     }
 }