Ejemplo n.º 1
0
        public string Run(string _input, int startAt = 0)
        {
            Match match = xpoMatch.Match(_input, startAt);

            if (match.Success)
            {
                string xml = _input;
                if (this.include(match.Value))
                {
                    string name = match.Groups[1].Value.Trim();

                    if (name.ToLowerInvariant() != "classdeclaration")
                    {
                        string AOTPath = MetaData.AOTPath(name);
                        using (StreamWriter sw = File.AppendText(this.logFileName()))
                        {
                            sw.WriteLine(AOTPath);
                            Hits++;
                        }
                    }
                    //Debug.WriteLine(string.Format("{0} has unknown table range {1} with value {2} on field {3}", Scanner.FILENAME, rangeName, value, fieldName));
                }

                _input = this.Run(_input, match.Index + 1);
            }

            return(_input);
        }
Ejemplo n.º 2
0
        public string Run(string _input, int _startAt = 0)
        {
            Match match = xpoMatch.Match(_input, _startAt);

            if (match.Success && match.Value.Contains(classAttribute))
            {
                string classInput     = match.Groups[1].Value.Trim();
                var    stringToUpdate = match.Value;
                string classPath      = MetaData.AOTPath("");
                string className      = classPath.Substring(classPath.LastIndexOf("\\") + 1);

                if (this.isClassExtended(className))
                {
                    _input = this.replaceAccessModifierForClasses(_input, stringToUpdate, className);
                    Hits++;
                }
                else
                {
                    _input = this.replaceAccessModifierForExtendedClasses(_input, stringToUpdate, className);
                    Hits++;
                }
            }

            return(_input);
        }
Ejemplo n.º 3
0
        public string Run(string _input, int _startAt = 0)
        {
            Match match = xpoMatch.Match(_input, _startAt);

            if (match.Success)
            {
                string methodName = MetaData.extractNextXMLElement("Name", match.Index, _input);
                if (methodName != string.Empty)
                {
                    string AOTPath = MetaData.AOTPath(methodName).ToLowerInvariant();
                    if (methodsToDelete.Contains(AOTPath))
                    {
                        string text = _input.Substring(match.Index, match.Length);
                        if (!text.Contains("SysObsolete"))
                        {
                            Debug.WriteLine(string.Format("{0} isn't marked with SysObsolete", AOTPath));
                        }
                        string updatedInput = _input.Remove(match.Index, match.Length);
                        Hits++;
                        return(this.Run(updatedInput, match.Index));
                    }
                }
                _input = this.Run(_input, match.Index + 50);
            }

            return(_input);
        }
        private string getDate(string methodName)
        {
            string AOTPath = MetaData.AOTPath(methodName).ToLowerInvariant();

            if (obsoleteDates.ContainsKey(AOTPath))
            {
                return(obsoleteDates[AOTPath]);
            }
            return(@"30\06\2021");
        }
Ejemplo n.º 5
0
        public string Run(string _input, int startAt = 0)
        {
            Match match = xpoMatch.Match(_input, startAt);

            if (match.Success)
            {
                string xml     = _input;
                string AOTPath = MetaData.AOTPath("") + this.AOTPath(xml, match.Index);
                Hits++;
                using (StreamWriter sw = File.AppendText(@"c:\temp\ObsoleteMetaData-all.txt"))
                {
                    sw.WriteLine(AOTPath);
                }

                _input = this.Run(_input.Remove(match.Index, match.Length), match.Index + 1);
            }

            return(_input);
        }
Ejemplo n.º 6
0
        static public bool isReferencedExternally(string methodName)
        {
            MetaData.ReadExternalReferences();
            string AOTPath = MetaData.AOTPath(methodName);

            if (methodName != String.Empty)
            {
                if (externallyReferencedPaths.Contains(AOTPath.ToLowerInvariant()))
                {
                    return(true);
                }
            }
            else
            {
                if (externallyReferencedTypes.Contains(AOTPath.ToLowerInvariant()))
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 7
0
        public string Run(string _input, int startAt = 0)
        {
            Match match = xpoMatch.Match(_input, startAt);

            if (match.Success)
            {
                string xml = _input;
                if (this.include(match.Value.ToLowerInvariant()))
                {
                    string name = match.Groups[1].Value.Trim();

                    string AOTPath = MetaData.AOTPath(name);
                    Hits++;
                    using (StreamWriter sw = File.AppendText(@"c:\temp\ObsoleteErrorMethods-all.txt"))
                    {
                        sw.WriteLine(AOTPath);
                    }

                    if (!MetaData.isReferencedExternally(name))
                    {
                        using (StreamWriter sw = File.AppendText(@"c:\temp\ObsoleteErrorMethods-unreferenced.txt"))
                        {
                            sw.WriteLine(AOTPath);
                        }
                    }
                    else
                    {
                        using (StreamWriter sw = File.AppendText(@"c:\temp\ObsoleteErrorMethods-referenced.txt"))
                        {
                            sw.WriteLine(AOTPath);
                        }
                    }
                    //Debug.WriteLine(string.Format("{0} has unknown table range {1} with value {2} on field {3}", Scanner.FILENAME, rangeName, value, fieldName));
                }

                _input = this.Run(_input, match.Index + 1);
            }

            return(_input);
        }
Ejemplo n.º 8
0
        public string Run(string _input, int startAt = 0)
        {
            Match match = xpoMatch.Match(_input, startAt);

            if (match.Success)
            {
                string xml = _input;
                string hookableWrappable = "";
                string accessModifier    = "";

                if (this.include(match.Value))
                {
                    var stringToUpdate = match.Value;

                    if (stringToUpdate.Contains("Hookable(false)"))
                    {
                        if (stringToUpdate.Contains("Hookable(false)"))
                        {
                            hookableWrappable = "Hookable(false)";
                        }
                        else if (stringToUpdate.Contains("Hookable(true)"))
                        {
                            hookableWrappable = "Hookable(true)";
                        }
                    }
                    if (stringToUpdate.Contains("Wrappable(false)"))
                    {
                        if (stringToUpdate.Contains("Wrappable(false)"))
                        {
                            hookableWrappable = "Wrappable(false)";
                        }
                        else if (stringToUpdate.Contains("Wrappable(true)"))
                        {
                            hookableWrappable = "Wrappable(true)";
                        }
                    }

                    if (stringToUpdate.Contains("public"))
                    {
                        accessModifier = "Public";
                    }
                    else if (stringToUpdate.Contains("internal") && stringToUpdate.Contains("protected"))
                    {
                        accessModifier = "Protected Internal";
                    }
                    else if (stringToUpdate.Contains("protected"))
                    {
                        accessModifier = "Protected";
                    }
                    else if (stringToUpdate.Contains("internal"))
                    {
                        accessModifier = "Internal";
                    }
                    else if (!stringToUpdate.Contains("private"))
                    {
                        accessModifier = "No Access Modifier";
                    }

                    string name = match.Groups[1].Value.Trim();

                    if (name.ToLowerInvariant() != "classdeclaration")
                    {
                        string AOTPath = MetaData.AOTPath(name);
                        using (StreamWriter sw = File.AppendText(this.logFileName()))
                        {
                            sw.WriteLine(AOTPath + "\\" + accessModifier + "\\" + hookableWrappable);
                        }
                    }
                }

                _input = this.Run(_input, match.Index + 1);
            }

            return(_input);
        }
Ejemplo n.º 9
0
        public string Run(string _input, int startAt = 0)
        {
            Match match = xpoMatch.Match(_input, startAt);

            if (match.Success)
            {
                string xml = _input;

                string final              = "";
                string abstractInterface  = "";
                string accessModifier     = "";
                string extends_string     = "";
                string implements_string  = "";
                string extensionOf_string = "";
                string extensionOf        = "";
                string extends            = "";
                string implements         = "";

                if (this.include(match.Value.ToLowerInvariant()))
                {
                    var stringToUpdate = match.Value;

                    if (stringToUpdate.Contains("final"))
                    {
                        final = "final";
                    }
                    if (stringToUpdate.Contains("interface"))
                    {
                        abstractInterface = "interface";
                    }
                    if (stringToUpdate.Contains("abstract"))
                    {
                        abstractInterface = "abstract";
                    }
                    if (stringToUpdate.Contains("internal"))
                    {
                        accessModifier = "internal";
                    }
                    if (stringToUpdate.Contains("public"))
                    {
                        accessModifier = "public";
                    }

                    if (stringToUpdate.Contains("extends ") &&
                        (stringToUpdate.LastIndexOf("extends") > (stringToUpdate.Contains("internal") ? stringToUpdate.LastIndexOf("internal") : stringToUpdate.LastIndexOf("public"))))
                    {
                        int position1 = stringToUpdate.LastIndexOf("extends");
                        int position2 = stringToUpdate.Contains("implements ") ? stringToUpdate.LastIndexOf("implements") - 1 : stringToUpdate.IndexOf("{") - 1;
                        extends_string = stringToUpdate.Substring(position1 + 8, position2 - position1 - 8).Trim().Replace("\r\n", "");
                        extends        = "extends";
                    }

                    if (stringToUpdate.Contains("implements ") &&
                        (stringToUpdate.LastIndexOf("implements") > (stringToUpdate.Contains("internal") ? stringToUpdate.LastIndexOf("internal") : stringToUpdate.LastIndexOf("public"))))
                    {
                        int position1 = stringToUpdate.LastIndexOf("implements");
                        int position2 = stringToUpdate.IndexOf("{") - 1;
                        implements_string = stringToUpdate.Substring(position1 + 11, position2 - position1 - 11).Trim().Replace("\r\n", "");
                        implements        = "implements";
                    }

                    if (stringToUpdate.Contains("ExtensionOf("))
                    {
                        int position1 = stringToUpdate.IndexOf("ExtensionOf(");
                        int position2 = stringToUpdate.IndexOf(")]");
                        extensionOf_string = stringToUpdate.Substring(position1 + 12, position2 - position1 - 12).Trim().Replace("\r\n", "");
                        extensionOf        = "extensionOf";
                    }

                    string AOTPath = MetaData.AOTPath("") + "\\" + final + "\\" + abstractInterface + "\\" + accessModifier + "\\" + extends + "\\" + extends_string + "\\" + implements + "\\" + implements_string + "\\" + extensionOf + "\\" + extensionOf_string;
                    AOTPath.Replace("\r\n", "");

                    using (StreamWriter sw = File.AppendText(@"c:\temp\Classes-all.txt"))
                    {
                        sw.WriteLine(AOTPath);
                    }
                }

                _input = this.Run(_input, match.Index + 1);
            }

            return(_input);
        }
        public string Run(string _input, int _startAt = 0)
        {
            Match match = xpoMatch.Match(_input, _startAt);

            if (match.Success &&
                !_input.ToLowerInvariant().Contains(" implements "))
            {
                string methodName     = match.Groups[1].Value.Trim();
                var    stringToUpdate = match.Value;
                string classPath      = MetaData.AOTPath("");
                string className      = classPath.Substring(classPath.LastIndexOf("\\") + 1);

                if (methodName != "classDeclaration")
                {
                    if (this.isOverRiddenMethod(methodName) || match.Value.Contains("super("))
                    {
                        if (!stringToUpdate.Contains("Replaceable") &&
                            !stringToUpdate.Contains("QueryRangeFunction") &&
                            !stringToUpdate.Contains("Hookable") &&
                            !stringToUpdate.Contains("Wrappable") &&
                            !stringToUpdate.Contains("SysObsolete"))
                        {
                            _input = this.appendAttributeHookableFalse(_input, stringToUpdate, methodName);
                            _input = this.replaceAccessModifierForOverriddenMethods(_input, stringToUpdate, methodName);
                            Hits++;
                        }
                    }
                    else if (match.Value.Contains("display "))
                    {
                        _input = removeAttributeHookableFalse(_input, stringToUpdate, methodName);
                        if (!this.isInternalMethod(className, methodName))
                        {
                            _input = this.replaceAccessModifierForDisplayMethods(_input, stringToUpdate, methodName);
                            Hits++;
                        }
                        else
                        {
                            _input = this.replaceAccessModifierForInternalMethods(_input, stringToUpdate, methodName);
                            Hits++;
                        }
                    }
                    else if (methodName.Contains(" parm"))
                    {
                        _input = removeAttributeHookableFalse(_input, stringToUpdate, methodName);
                        _input = this.replaceAccessModifierForParmMethods(_input, stringToUpdate, methodName);
                        Hits++;
                    }
                    else if (!match.Value.Contains(" extends "))
                    {
                        _input = removeAttributeHookableFalse(_input, stringToUpdate, methodName);
                        if (this.isInternalMethod(className, methodName))
                        {
                            _input = this.replaceAccessModifierForInternalMethods(_input, stringToUpdate, methodName);
                            Hits++;
                        }
                        else
                        {
                            _input = this.replaceAccessModifierForPrivateMethods(_input, stringToUpdate, methodName);
                            Hits++;
                        }
                    }
                }

                _input = this.Run(_input, match.Index + 1);
            }

            return(_input);
        }
Ejemplo n.º 11
0
        private bool isTargeted(string methodName)
        {
            string AOTPath = MetaData.AOTPath(methodName).ToLowerInvariant();

            return(classMethodHashSet.Contains(AOTPath));
        }