private static void AnalyseMethodsInType(SymbolTypeDefinition symbolType)
        {
            var overloads = new List <SymbolOverload>();

            foreach (var method in symbolType.Type.Methods)
            {
                if (method.IsSpecialName || method.IsRuntimeSpecialName || method.IsVirtual)
                {
                    continue;
                }

                var methodOverload = overloads.FirstOrDefault(
                    overload => overload.Symbols.All(
                        x =>
                {
                    var method2 = (MethodDefinition)x.Member;
                    return(method2.ReturnType != method.ReturnType ||
                           !method2.Parameters.SequenceEqual(method.Parameters, ParameterComparer.Instance));
                }));

                if (methodOverload == null)
                {
                    methodOverload = new SymbolOverload();
                    overloads.Add(methodOverload);
                    symbolType.MemberOverloads.Add(methodOverload);
                }

                methodOverload.Symbols.Add(new SymbolDefinition(method));
            }
        }
        private static void AnalyseFieldsInType(SymbolTypeDefinition symbolType)
        {
            var overloads = new List <SymbolOverload>();

            foreach (var field in symbolType.Type.Fields)
            {
                if (field.IsSpecialName || field.IsRuntimeSpecialName)
                {
                    continue;
                }

                var fieldOverload = overloads.FirstOrDefault(
                    overload => overload.Symbols.All(
                        x => ((FieldDefinition)x.Member).FieldType != field.FieldType));

                if (fieldOverload == null)
                {
                    fieldOverload = new SymbolOverload();
                    overloads.Add(fieldOverload);
                    symbolType.MemberOverloads.Add(fieldOverload);
                }

                fieldOverload.Symbols.Add(new SymbolDefinition(field));
            }
        }
Пример #3
0
        private static void AnalyseFieldsInType(SymbolTypeDefinition symbolType)
        {
            var overloads = new List <SymbolOverload>();

            foreach (var field in symbolType.Type.Fields)
            {
                if (field.IsSpecialName || field.IsRuntimeSpecialName || (Obfuscator.current.SkipPublicFields && field.IsPublic))
                {
#if DEBUG
                    Console.Write("Field in Symboltype skipped.");
                    Logger.logger("Field Skipped: " + field.Name);
#endif

                    continue;
                }

                var fieldOverload = overloads.FirstOrDefault(
                    overload => overload.Symbols.All(
                        x => ((FieldDefinition)x.Member).FieldType != field.FieldType));

                if (fieldOverload == null)
                {
                    fieldOverload = new SymbolOverload();
                    overloads.Add(fieldOverload);
                    symbolType.MemberOverloads.Add(fieldOverload);
                }

                fieldOverload.Symbols.Add(new SymbolDefinition(field));
            }
        }
        private void AnalysePropertiesInType(SymbolTypeDefinition symbolType)
        {
            var overloads = new List <SymbolOverload>();

            foreach (var property in symbolType.Type.Properties)
            {
                if (property.IsSpecialName || property.IsRuntimeSpecialName)
                {
                    continue;
                }

                var propertyOverload = overloads.FirstOrDefault(
                    overload => overload.Symbols.All(
                        x => ((PropertyDefinition)x.Member).PropertyType != property.PropertyType));

                if (propertyOverload == null)
                {
                    propertyOverload = new SymbolOverload();
                    overloads.Add(propertyOverload);
                    symbolType.MemberOverloads.Add(propertyOverload);
                }

                propertyOverload.Symbols.Add(new SymbolDefinition(property));
            }
        }
Пример #5
0
        private static void AnalyseMethodsInType(SymbolTypeDefinition symbolType)
        {
            var overloads = new List <SymbolOverload>();

            foreach (var method in symbolType.Type.Methods)
            {
                if (method.IsSpecialName || method.IsRuntimeSpecialName || method.IsVirtual || (Obfuscator.current.SkipPublicMethods && method.IsPublic) || (Obfuscator.current.SkipPrivateMethods && method.IsPrivate))
                {
                #if DEBUG
                    Console.Write("Method Skipped.");
                    Logger.logger("Method Skipped: " + method.Name);
                #endif
                    continue;
                }

                var methodOverload = overloads.FirstOrDefault(
                    overload => overload.Symbols.All(
                        x =>
                {
                    var method2 = (MethodDefinition)x.Member;
                    return(method2.ReturnType != method.ReturnType ||
                           !method2.Parameters.SequenceEqual(method.Parameters, ParameterComparer.Instance));
                }));

                if (methodOverload == null)
                {
                    methodOverload = new SymbolOverload();
                    overloads.Add(methodOverload);
                    symbolType.MemberOverloads.Add(methodOverload);
                }

                methodOverload.Symbols.Add(new SymbolDefinition(method));
            }
        }