Microsoft.Web.Administration.ServerManager.Initialize C# (CSharp) Method

Initialize() private method

private Initialize ( ) : void
return void
        private void Initialize()
        {
            if (this.Initialized)
            {
                return;
            }

            this.Initialized = true;
            PreInitialize();
            var machineConfig = Helper.IsRunningOnMono()
                ? "/Library/Frameworks/Mono.framework/Versions/Current/etc/mono/4.5/machine.config"
                : Path.Combine(
                                    Environment.GetFolderPath(Environment.SpecialFolder.Windows),
                                    "Microsoft.NET",
                                    IntPtr.Size == 2 ? "Framework" : "Framework64",
                                    "v4.0.30319",
                                    "config",
                                    "machine.config");
            var machine =
                new Configuration(
                    new FileContext(
                        this,
                        machineConfig,
                        null,
                        null,
                        false,
                        true,
                        true));
            var webConfig = Helper.IsRunningOnMono()
                ? "/Library/Frameworks/Mono.framework/Versions/Current/etc/mono/4.5/web.config"
                : Path.Combine(
                                Environment.GetFolderPath(Environment.SpecialFolder.Windows),
                                "Microsoft.NET",
                                IntPtr.Size == 2 ? "Framework" : "Framework64",
                                "v4.0.30319",
                                "config",
                                "web.config");
            var web =
                new Configuration(
                    new FileContext(
                        this,
                        webConfig,
                        machine.FileContext,
                        null,
                        false,
                        true,
                        true));

            _applicationHost =
                new Configuration(
                new FileContext(this, this.FileName, web.FileContext, null, true, false, this.ReadOnly));

            this.LoadCache();

            var poolSection = _applicationHost.GetSection("system.applicationHost/applicationPools");
            _applicationPoolDefaults =
                new ApplicationPoolDefaults(poolSection.GetChildElement("applicationPoolDefaults"), poolSection);
            this.ApplicationPoolCollection = new ApplicationPoolCollection(poolSection, this);
            var siteSection = _applicationHost.GetSection("system.applicationHost/sites");
            _siteDefaults = new SiteDefaults(siteSection.GetChildElement("siteDefaults"), siteSection);
            _applicationDefaults = new ApplicationDefaults(
                siteSection.GetChildElement("applicationDefaults"),
                siteSection);
            _virtualDirectoryDefaults =
                new VirtualDirectoryDefaults(siteSection.GetChildElement("virtualDirectoryDefaults"), siteSection);
            this.SiteCollection = new SiteCollection(siteSection, this);

            PostInitialize();
        }