Ejemplo n.º 1
0
        void Analyze(NameService service, DotProtectContext context, ProtectionParameters parameters, TypeDef type)
        {
            if (IsVisibleOutside(context, parameters, type))
            {
                service.SetCanRename(type, false);
            }
            else if (type.IsRuntimeSpecialName || type.IsGlobalModuleType)
            {
                service.SetCanRename(type, false);
            }
            else if (type.FullName == "ConfusedByAttribute")
            {
                // Courtesy
                service.SetCanRename(type, false);
            }

            /*
             * Can't rename Classes/Types that will be serialized
             */
            if (type != null)
            {
                if (type.IsSerializable)
                {
                    service.SetCanRename(type, false);
                }

                if (type.DeclaringType != null)
                {
                    if (type.DeclaringType.IsSerializable)
                    {
                        service.SetCanRename(type, false);
                    }
                }
            }

            if (parameters.GetParameter(context, type, "forceRen", false))
            {
                return;
            }

            if (type.InheritsFromCorlib("System.Attribute"))
            {
                service.ReduceRenameMode(type, RenameMode.ASCII);
            }

            if (type.InheritsFrom("System.Configuration.SettingsBase"))
            {
                service.SetCanRename(type, false);
            }
        }