Esempio n. 1
0
        /// <summary>
        /// This will Register the NoCache provider if it's not present in the list. HOWEVER, if no provider is
        /// registered at all, it won't be able to work.
        /// </summary>

        protected virtual void Application_End(object sender, EventArgs e)
        {
            ApplicationLevelEventHandlers.Application_End(sender, e);
        }
Esempio n. 2
0
 public override string GetVaryByCustomString(HttpContext context, string custom)
 {
     return(ApplicationLevelEventHandlers.GetVaryByCustomString(context, custom) ?? base.GetVaryByCustomString(context, custom));
 }
Esempio n. 3
0
        /// <exclude />
        public static bool SetUp(string setupDescriptionXml, string username, string password, string email, string language, string consoleLanguage, bool newsletter)
        {
            ApplicationOnlineHandlerFacade.TurnApplicationOffline(false);

            username = username.Trim().ToLowerInvariant();

            XElement setupDescription = XElement.Parse(setupDescriptionXml);

            XElement setupRegistrationDescription = new XElement("registration",
                                                                 new XElement("user_email", email),
                                                                 new XElement("user_newsletter", newsletter),
                                                                 new XElement("user_consolelanguage", consoleLanguage),
                                                                 new XElement("user_websitelanguage", language),
                                                                 setupDescription);

            bool success = false;

            try
            {
                Log.LogInformation(VerboseLogTitle, "Downloading packages");

                string[]       packageUrls = GetPackageUrls(setupDescription).ToArray();
                MemoryStream[] packages    = new MemoryStream[packageUrls.Length];

                Parallel.For(0, packageUrls.Length, i =>
                {
                    packages[i] = DownloadPackage(packageUrls[i]);
                });

                Log.LogInformation(VerboseLogTitle, "Setting up the system for the first time");

                CultureInfo locale      = new CultureInfo(language);
                CultureInfo userCulture = new CultureInfo(consoleLanguage);

                ApplicationLevelEventHandlers.ApplicationStartInitialize();

                Log.LogInformation(VerboseLogTitle, "Creating first locale: " + language);
                LocalizationFacade.AddLocale(locale, "", true, false);
                LocalizationFacade.SetDefaultLocale(locale);


                Log.LogInformation(VerboseLogTitle, "Creating first user: "******"Installing package from url " + packageUrls[i]);
                        InstallPackage(packageUrls[i], packages[i]);

                        // Releasing a reference to reduce memory usage
                        packages[i].Dispose();
                        packages[i] = null;
                    }
                }

                RegisterSetup(setupRegistrationDescription.ToString(), "");

                Log.LogInformation(VerboseLogTitle, "Done setting up the system for the first time! Enjoy!");

                success = true;
            }
            catch (Exception ex)
            {
                Log.LogCritical(LogTitle, ex);
                Log.LogWarning(LogTitle, "First time setup failed - could not download, install package or otherwise complete the setup.");
                RegisterSetup(setupRegistrationDescription.ToString(), ex.ToString());

                if (RuntimeInformation.IsDebugBuild)
                {
                    ApplicationOnlineHandlerFacade.TurnApplicationOnline();
                    throw;
                }
            }

            ApplicationOnlineHandlerFacade.TurnApplicationOnline();
            return(success);
        }
Esempio n. 4
0
 protected virtual void Application_BeginRequest(object sender, EventArgs e)
 {
     ApplicationLevelEventHandlers.Application_BeginRequest(sender, e);
 }