private void Analyze2(BuildAssembly assembly)
        {
            if (_removeUnusedMembers)
            {
                StripAnalyzer.Analyze(assembly);
            }

            if (_sealTypes)
            {
                TypeSealer.Analyze(assembly);
            }

            if (CancellationPending)
            {
                return;
            }

            if (_devirtualizeMethods)
            {
                MethodDevirtualizer.Analyze(assembly);
            }

            if (_renameMembers)
            {
                MismatchTypeGenericArgumentAnalyzer.Analyze(assembly);
                MemberRenameHelper.FixExportedTypeNames(assembly, _nameGenerator);
            }

            SaveState();
        }
        private void Change(BuildAssembly assembly)
        {
            var module  = (BuildModule)assembly.Module;
            var strings = new HashList <string>();

            MainType.Create(assembly);

            if (assembly.EncryptIL)
            {
                strings.Add(".");                 // Dot is at index 0
            }
            if (_evaluationPeriodInDays > 0)
            {
                module.MainType.GenerateCheckForExpiredEvaluation(_evaluationPeriodInDays);
            }

            if (assembly.StripObfuscationAttributeExists)
            {
                ObfuscationAttributeStripper.Strip(assembly);
            }

            if (assembly.SuppressILdasm)
            {
                CA.SuppressIldasmAttribute.AddIfNotExists(assembly.CustomAttributes);
            }

            if (assembly.RenameMembers || assembly.DevirtualizeMethods)
            {
                ExplicitMethodCallBuilder.Build(assembly);
            }

            if (CancellationPending)
            {
                return;
            }

            if (_renameAssemblies)
            {
                MemberRenameHelper.BuildRenamedAssemblyResolver(assembly, _renamedAssemblyNames);
            }

            if (assembly.HasWpfResource && (_renameAssemblies || _renameMembers))
            {
                BamlMemberReferenceMapper.Map(assembly, _log);
            }

            if (assembly.HasWpfResource && _renameAssemblies)
            {
                ResourceHelper.RenameWpfResource(assembly);
            }

            if (_renameAssemblies)
            {
                ResourceHelper.RenameSatelliteAssemblies(assembly);
            }

            if (assembly.ObfuscateResources)
            {
                ResourceObfuscator.Obfuscate(assembly);
            }

            if (_obfuscateResources)
            {
                ResourceResolverGenerator.Generate(assembly);
            }

            if (assembly.ObfuscateStrings)
            {
                StringObfuscator.Obfuscate(assembly, strings);
            }

            if (CancellationPending)
            {
                return;
            }

            if (assembly.SealTypes)
            {
                TypeSealer.Seal(assembly);
            }

            if (assembly.DevirtualizeMethods)
            {
                MethodDevirtualizer.Devirtualize(assembly);
            }

            if (CancellationPending)
            {
                return;
            }

            if (_renameMembers)
            {
                ExplicitMethodOverrideBuilder.Build(assembly, _nameGenerator);
            }

            if (_encryptIL)
            {
                ILCryptoMapper.Map(assembly);
            }

            if (assembly.EncryptIL)
            {
                ILCryptoObfuscator.Obfuscate(assembly, strings);
            }

            if (CancellationPending)
            {
                return;
            }

            if (assembly.RemoveUnusedMembers)
            {
                Stripper.Strip(assembly);
            }

            if (assembly.ObfuscateControlFlow)
            {
                ControlFlowObfuscator.Obfuscate(assembly, true);
            }

            if (strings.Count > 0)
            {
                StringLoaderGenerator.Generate(assembly, strings);
            }

            if (CancellationPending)
            {
                return;
            }

            // From this point no more code can be added.

            MainType.Generate(assembly);
            DelegateTypeGenerator.Generate(assembly);
            GeneratedCodeObfuscator.Obfuscate(assembly, _nameGenerator);

            if (CancellationPending)
            {
                return;
            }

            ILCryptoBlobBuilder.MapMemberReferences(assembly);
            MemberReferenceMapper.Map(assembly);
            MemberNameChanger.Change(assembly);

            if (CancellationPending)
            {
                return;
            }

            assembly.Compile();

            Scavenge();
        }