Ejemplo n.º 1
0
        /// <summary>
        /// Meant to be run at startup
        /// </summary>
        /// <param name="webRootPath"></param>
        /// <param name="contentRootPath"></param>
        public void LoadStaticData(string webRootPath, string contentRootPath)
        {
            this.FullDataFilesPath                 = Path.Combine(contentRootPath, this.DataFilesPath);
            this.NoiseWords                        = GuiHelper.LoadNoiseWordsIntoHashSet(this.FullDataFilesPath);
            this.RegistrationReplyMailTemplate     = File.ReadAllText(Path.Combine(this.DataFilesPath, "RegistrationReplyMail.template"));
            this.ThreadUpdatedNotificationTemplate = File.ReadAllText(Path.Combine(this.DataFilesPath, "ThreadUpdatedNotification.template"));
            this.ResetPasswordLinkTemplate         = File.ReadAllText(Path.Combine(this.DataFilesPath, "ResetPasswordLink.template"));

            // Don't prefix the urlpath with the virtual root yet, as we use the path also for folder names below
            var emojiUrlPath = this.EmojiFilesPath ?? string.Empty;

            // replace / with \ if we're on windows and / with \ if we're on linux
            var emojiUrlPathForFilename = emojiUrlPath.TrimStart('\\', '/').Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
            var emojiFilesPath          = Path.Combine(webRootPath ?? string.Empty, emojiUrlPathForFilename);

            // We have to prefix the emojiUrlPath with the virtual root now.
            emojiUrlPath = (this.VirtualRoot + emojiUrlPath).Replace("//", "/");
            this.EmojiFilenamesPerName = LoadEmojiFilenames(emojiFilesPath, emojiUrlPath);

            // load nicks of banned users
            var bannedNicknames = UserGuiHelper.GetAllBannedUserNicknames();

            _volatileDataLock.EnterWriteLock();
            try
            {
                _usersToLogoutByForce.AddRange(bannedNicknames);
            }
            finally
            {
                _volatileDataLock.ExitWriteLock();
            }
        }