Ejemplo n.º 1
0
        public static bool IsReferenceToTypeWithChangedNamespace(string simpleOrQualifiedName)
        {
            bool result;

            try
            {
                Match match = Regex.Match(simpleOrQualifiedName, "^(?:(?<namespace>.*)(?=\\.)\\.)?(?<typename>[a-zA-Z_0-9]+)$");
                if (!match.Success)
                {
                    result = false;
                }
                else
                {
                    string typename      = match.Groups["typename"].Value;
                    string namespaceName = match.Groups["namespace"].Value;
                    Type   type          = APIUpdaterHelper.FindTypeInLoadedAssemblies((Type t) => t.Name == typename && APIUpdaterHelper.NamespaceHasChanged(t, namespaceName));
                    result = (type != null);
                }
            }
            catch (ReflectionTypeLoadException ex)
            {
                throw new Exception(ex.Message + ex.LoaderExceptions.Aggregate("", (string acc, Exception curr) => acc + "\r\n\t" + curr.Message));
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static bool IsReferenceToMissingObsoleteMember(string namespaceName, string className)
        {
            bool result;

            try
            {
                Type type = APIUpdaterHelper.FindTypeInLoadedAssemblies((Type t) => t.Name == className && t.Namespace == namespaceName && APIUpdaterHelper.IsUpdateable(t));
                result = (type != null);
            }
            catch (ReflectionTypeLoadException ex)
            {
                throw new Exception(ex.Message + ex.LoaderExceptions.Aggregate("", (string acc, Exception curr) => acc + "\r\n\t" + curr.Message));
            }
            return(result);
        }
Ejemplo n.º 3
0
        private static Type FindExactTypeMatchingMovedType(string simpleOrQualifiedName)
        {
            Match match = Regex.Match(simpleOrQualifiedName, "^(?:(?<namespace>.*)(?=\\.)\\.)?(?<typename>[a-zA-Z_0-9]+)$");
            Type  result;

            if (!match.Success)
            {
                result = null;
            }
            else
            {
                string typename      = match.Groups["typename"].Value;
                string namespaceName = match.Groups["namespace"].Value;
                result = APIUpdaterHelper.FindTypeInLoadedAssemblies((Type t) => t.Name == typename && APIUpdaterHelper.NamespaceHasChanged(t, namespaceName));
            }
            return(result);
        }