Example #1
0
        /// <summary>
        /// Get the lexeme for this word
        /// </summary>
        /// <returns>the lexeme</returns>
        public ILexeme GetLexeme()
        {
            ILexeme lex = ConfigDataCache.Get <ILexeme>(string.Format("{0}_{1}_{2}", ConfigDataType.Dictionary, Language.Name, Name));

            if (lex != null)
            {
                if (!lex.WordForms.Any(form => form == this))
                {
                    lex.AddNewForm(this);
                    lex.SystemSave();
                    lex.PersistToCache();
                }
            }
            else
            {
                lex = new Lexeme()
                {
                    Name     = Name,
                    Language = Language
                };

                lex.SystemSave();
                lex.PersistToCache();

                lex.AddNewForm(this);
            }

            return(lex);
        }
Example #2
0
        public ActionResult Edit(string id, AddEditDictionaryViewModel vModel)
        {
            ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId());

            ILexeme obj = ConfigDataCache.Get<ILexeme>(new ConfigDataCacheKey(typeof(ILexeme), id, ConfigDataType.Dictionary));
            string message;
            if (obj == null)
            {
                message = "That does not exist";
                return RedirectToAction("Index", new { Message = message });
            }

            obj.Name = vModel.DataObject.Name;
            obj.Language = vModel.DataObject.Language;

            if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User)))
            {
                LoggingUtility.LogAdminCommandUsage("*WEB* - EditLexeme[" + obj.UniqueKey + "]", authedUser.GameAccount.GlobalIdentityHandle);
                message = "Edit Successful.";
            }
            else
            {
                message = "Error; Edit failed.";
            }

            return RedirectToAction("Index", new { Message = message });
        }
Example #3
0
        /// <summary>
        /// Verify the dictionary has this word already
        /// </summary>
        /// <param name="lexeme">dictata to check</param>
        public static ILexeme VerifyLexeme(ILexeme lexeme)
        {
            if (lexeme == null || string.IsNullOrWhiteSpace(lexeme.Name) || lexeme.Name.IsNumeric())
            {
                return(null);
            }

            //Set the language to default if it is absent and save it, if it has a language it already exists
            if (lexeme.Language == null)
            {
                IGlobalConfig globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));

                if (globalConfig.BaseLanguage != null)
                {
                    lexeme.Language = globalConfig.BaseLanguage;
                }
            }

            ConfigDataCacheKey cacheKey = new ConfigDataCacheKey(lexeme);

            ILexeme maybeLexeme = ConfigDataCache.Get <ILexeme>(cacheKey);

            if (maybeLexeme != null)
            {
                lexeme = maybeLexeme;
            }

            lexeme.IsSynMapped = false;
            lexeme.MapSynNet();
            lexeme.FillLanguages();

            return(lexeme);
        }
Example #4
0
        public ActionResult Remove(string removeId = "", string authorizeRemove = "")
        {
            string message;
            if (!string.IsNullOrWhiteSpace(authorizeRemove) && removeId.Equals(authorizeRemove))
            {
                ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId());

                ILexeme obj = ConfigDataCache.Get<ILexeme>(new ConfigDataCacheKey(typeof(ILexeme), removeId, ConfigDataType.Dictionary));

                if (obj == null)
                {
                    message = "That does not exist";
                }
                else if (obj.Remove(authedUser.GameAccount, authedUser.GetStaffRank(User)))
                {
                    LoggingUtility.LogAdminCommandUsage("*WEB* - RemoveConstants[" + removeId + "]", authedUser.GameAccount.GlobalIdentityHandle);
                    message = "Delete Successful.";
                }
                else
                {
                    message = "Error; Removal failed.";
                }
            }
            else
            {
                message = "You must check the proper remove or unapprove authorization radio button first.";
            }

            return RedirectToAction("Index", new { Message = message });
        }
Example #5
0
        public ActionResult MarkAsReadNotification(string id, AddViewNotificationViewModel vModel)
        {
            string          message    = string.Empty;
            string          userId     = User.Identity.GetUserId();
            ApplicationUser authedUser = UserManager.FindById(userId);

            try
            {
                if (!string.IsNullOrWhiteSpace(id))
                {
                    IPlayerMessage notification = ConfigDataCache.Get <IPlayerMessage>(id);

                    if (notification != null)
                    {
                        notification.Read = true;
                        notification.Save(authedUser.GameAccount, authedUser.GetStaffRank(User));
                    }
                }
                else
                {
                    message = "Invalid message.";
                }
            }
            catch (Exception ex)
            {
                LoggingUtility.LogError(ex, LogChannels.SystemWarnings);
            }

            return(RedirectToAction("Notifications", new { Message = message }));
        }
Example #6
0
        public AccountConfig(IAccount account)
        {
            _account = account;

            Acquaintences = new List <IAcquaintence>();
            Notifications = new List <IPlayerMessage>();
            Playlists     = new HashSet <IPlaylist>();
            Combos        = Enumerable.Empty <IFightingArtCombination>();
            UIModules     = Enumerable.Empty <Tuple <IUIModule, int> >();

            if (string.IsNullOrWhiteSpace(Name))
            {
                Name = _account.GlobalIdentityHandle;
            }

            IGlobalConfig globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));

            if (globalConfig != null)
            {
                UILanguage = globalConfig.BaseLanguage;
            }

            UITutorialMode   = true;
            MusicMuted       = true;
            GossipSubscriber = true;
        }
Example #7
0
        public ActionResult RestartGossipServer()
        {
            IEnumerable <WebSocket> gossipServers = LiveCache.GetAll <WebSocket>();

            foreach (WebSocket server in gossipServers)
            {
                server.Abort();
            }

            IGossipConfig   gossipConfig = ConfigDataCache.Get <IGossipConfig>(new ConfigDataCacheKey(typeof(IGossipConfig), "GossipSettings", ConfigDataType.GameWorld));
            Func <Member[]> playerList   = () => LiveCache.GetAll <IPlayer>()
                                           .Where(player => player.Descriptor != null && player.Template <IPlayerTemplate>().Account.Config.GossipSubscriber)
                                           .Select(player => new Member()
            {
                Name           = player.AccountHandle,
                WriteTo        = (message) => player.WriteTo(new string[] { message }),
                BlockedMembers = player.Template <IPlayerTemplate>().Account.Config.Acquaintences.Where(acq => !acq.IsFriend).Select(acq => acq.PersonHandle),
                Friends        = player.Template <IPlayerTemplate>().Account.Config.Acquaintences.Where(acq => acq.IsFriend).Select(acq => acq.PersonHandle)
            }).ToArray();

            void exceptionLogger(Exception ex) => LoggingUtility.LogError(ex);
            void activityLogger(string message) => LoggingUtility.Log(message, LogChannels.GossipServer);

            GossipClient gossipServer = new GossipClient(gossipConfig, exceptionLogger, activityLogger, playerList);

            Task.Run(() => gossipServer.Launch());

            LiveCache.Add(gossipServer, "GossipWebClient");

            return(RedirectToAction("Index", new { Message = "Gossip Server Restarted" }));
        }
Example #8
0
        public ActionResult GlobalConfig(DashboardViewModel vModel)
        {
            ApplicationUser authedUser   = UserManager.FindById(User.Identity.GetUserId());
            IGlobalConfig   globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));

            globalConfig.WebsocketPortalActive = vModel.WebsocketPortalActive;
            globalConfig.AdminsOnly            = vModel.AdminsOnly;
            globalConfig.UserCreationActive    = vModel.UserCreationActive;
            globalConfig.BaseLanguage          = vModel.BaseLanguage;

            globalConfig.AzureTranslationKey = vModel.AzureTranslationKey;
            globalConfig.TranslationActive   = vModel.TranslationActive;

            globalConfig.DeepLexActive        = vModel.DeepLexActive;
            globalConfig.MirriamDictionaryKey = vModel.MirriamDictionaryKey;
            globalConfig.MirriamThesaurusKey  = vModel.MirriamThesaurusKey;

            string message;

            if (globalConfig.Save(authedUser.GameAccount, authedUser.GetStaffRank(User)))
            {
                LoggingUtility.LogAdminCommandUsage("*WEB* - EditGlobalConfig[" + globalConfig.UniqueKey.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle);
                message = "Edit Successful.";
            }
            else
            {
                message = "Error; Edit failed.";
            }

            return(RedirectToAction("Index", new { Message = message }));
        }
Example #9
0
        public ActionResult GossipConfig(DashboardViewModel vModel)
        {
            ApplicationUser authedUser   = UserManager.FindById(User.Identity.GetUserId());
            IGossipConfig   gossipConfig = ConfigDataCache.Get <IGossipConfig>(new ConfigDataCacheKey(typeof(IGossipConfig), "GossipSettings", ConfigDataType.GameWorld));

            gossipConfig.GossipActive             = vModel.GossipActive;
            gossipConfig.ClientId                 = vModel.ClientId;
            gossipConfig.ClientName               = vModel.ClientName;
            gossipConfig.ClientSecret             = vModel.ClientSecret;
            gossipConfig.SuspendMultiplierMaximum = vModel.SuspendMultiplierMaximum;
            gossipConfig.SuspendMultiplier        = vModel.SuspendMultiplier;
            gossipConfig.SupportedChannels        = vModel.SupportedChannels;
            gossipConfig.SupportedFeatures        = vModel.SupportedFeatures;

            string message;

            if (gossipConfig.Save(authedUser.GameAccount, authedUser.GetStaffRank(User)))
            {
                LoggingUtility.LogAdminCommandUsage("*WEB* - EditGossipConfig[" + gossipConfig.UniqueKey.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle);
                message = "Edit Successful.";
            }
            else
            {
                message = "Error; Edit failed.";
            }

            return(RedirectToAction("Index", new { Message = message }));
        }
Example #10
0
        public ActionResult AddDictata(string lexemeId, AddEditDictataViewModel vModel)
        {
            ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId());

            ILexeme lex = ConfigDataCache.Get<ILexeme>(new ConfigDataCacheKey(typeof(ILexeme), lexemeId, ConfigDataType.Dictionary));
            if (lex == null)
            {
                return RedirectToAction("Index", new { Message = "That does not exist" });
            }

            IDictata newObj = vModel.DataObject;

            lex.AddNewForm(newObj);

            string message;
            if (lex.Save(authedUser.GameAccount, authedUser.GetStaffRank(User)))
            {
                LoggingUtility.LogAdminCommandUsage("*WEB* - AddDictata[" + newObj.UniqueKey + "]", authedUser.GameAccount.GlobalIdentityHandle);
                message = "Creation Successful.";
            }
            else
            {
                message = "Error; Creation failed.";
            }

            return RedirectToAction("Index", new { Message = message });
        }
Example #11
0
        public ActionResult RemoveDictata(string removeId = "", string authorizeRemove = "")
        {
            string message;
            if (!string.IsNullOrWhiteSpace(authorizeRemove) && removeId.Equals(authorizeRemove))
            {
                ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId());

                ILexeme lex = ConfigDataCache.Get<ILexeme>(removeId.Substring(0, removeId.LastIndexOf("_") - 1));
                IDictata obj = lex?.WordForms?.FirstOrDefault(form => form.UniqueKey == removeId);

                if (obj == null)
                {
                    message = "That does not exist";
                }
                else 
                {
                    HashSet<IDictata> wordForms = lex.WordForms.ToHashSet();
                    wordForms.RemoveWhere(form => form.UniqueKey == removeId);
                    lex.WordForms = wordForms.ToArray();

                    lex.Save(authedUser.GameAccount, authedUser.GetStaffRank(User));
                    LoggingUtility.LogAdminCommandUsage("*WEB* - RemoveConstants[" + removeId + "]", authedUser.GameAccount.GlobalIdentityHandle);
                    message = "Delete Successful.";
                }
            }
            else
            {
                message = "You must check the proper remove or unapprove authorization radio button first.";
            }

            return RedirectToAction("Index", new { Message = message });
        }
Example #12
0
        /// <summary>
        /// Make a dictata from a lexica
        /// </summary>
        /// <param name="lexica">the incoming lexica phrase</param>
        public Dictata(ILexica lexica)
        {
            Name           = "";
            Antonyms       = new HashSet <IDictata>();
            Synonyms       = new HashSet <IDictata>();
            PhraseAntonyms = new HashSet <IDictataPhrase>();
            PhraseSynonyms = new HashSet <IDictataPhrase>();
            Semantics      = new HashSet <string>();

            IGlobalConfig globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));

            if (lexica.Context?.Language == null)
            {
                if (globalConfig?.BaseLanguage == null)
                {
                    Language = ConfigDataCache.GetAll <ILanguage>().FirstOrDefault();
                }
                else
                {
                    Language = globalConfig.BaseLanguage;
                }
            }
            else
            {
                Language = lexica.Context.Language;
            }

            ILexeme maybeLex = ConfigDataCache.Get <ILexeme>(
                new ConfigDataCacheKey(typeof(ILexeme), string.Format("{0}_{1}", Language.Name, lexica.Phrase), ConfigDataType.Dictionary));

            if (maybeLex == null)
            {
                Name     = lexica.Phrase;
                WordType = lexica.Type;
            }
            else if (maybeLex.WordForms.Any(form => form.WordType == lexica.Type))
            {
                IDictata wordForm = maybeLex.WordForms.FirstOrDefault(form => form.WordType == lexica.Type);

                Name           = lexica.Phrase;
                WordType       = lexica.Type;
                Synonyms       = wordForm.Synonyms;
                Antonyms       = wordForm.Antonyms;
                PhraseSynonyms = wordForm.PhraseSynonyms;
                PhraseAntonyms = wordForm.PhraseAntonyms;
                Determinant    = wordForm.Determinant;
                Elegance       = wordForm.Elegance;
                Feminine       = wordForm.Feminine;
                Perspective    = wordForm.Perspective;
                Plural         = wordForm.Plural;
                Positional     = wordForm.Positional;
                Possessive     = wordForm.Possessive;
                Quality        = wordForm.Quality;
                Semantics      = wordForm.Semantics;
                Severity       = wordForm.Severity;
                Tense          = wordForm.Tense;
            }
        }
Example #13
0
        /// <summary>
        /// Get the dictata from this lexica
        /// </summary>
        /// <returns>A dictata</returns>
        public IDictata GetDictata()
        {
            ILexeme  lex  = ConfigDataCache.Get <ILexeme>(new ConfigDataCacheKey(typeof(ILexeme), string.Format("{0}_{1}", Context?.Language?.Name, Phrase), ConfigDataType.Dictionary));
            IDictata dict = lex?.GetForm(Type);

            if (dict == null)
            {
                dict = GenerateDictata();
            }

            return(dict);
        }
Example #14
0
        public override object Convert(object input)
        {
            string stringInput = input.ToString();

            if (string.IsNullOrWhiteSpace(stringInput))
            {
                return(null);
            }

            IDictata returnValue = ConfigDataCache.Get <ILexeme>(new ConfigDataCacheKey(typeof(ILexeme), stringInput, ConfigDataType.Dictionary))?.WordForms.FirstOrDefault();

            return(returnValue);
        }
Example #15
0
        public override object Convert(object input)
        {
            string stringInput = input.ToString();

            if (string.IsNullOrWhiteSpace(stringInput))
            {
                return(null);
            }

            ILanguage returnValue = ConfigDataCache.Get <ILanguage>(new ConfigDataCacheKey(typeof(ILanguage), stringInput, ConfigDataType.Language));

            return(returnValue);
        }
Example #16
0
        public ActionResult Register()
        {
            IGlobalConfig     globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));
            RegisterViewModel vModel       = new RegisterViewModel();

            if (!globalConfig.UserCreationActive)
            {
                ModelState.AddModelError("", "New account registration is currently locked.");
                vModel.NewUserLocked = true;
            }

            return(View(vModel));
        }
Example #17
0
        public static IDictataPhrase GetPhrase(LexicalContext context)
        {
            if (context.Language == null)
            {
                IGlobalConfig globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));

                context.Language = globalConfig.BaseLanguage;
            }

            IEnumerable <IDictataPhrase> possibleWords = ConfigDataCache.GetAll <IDictataPhrase>().Where(dict => dict.Language == context.Language && dict.SuitableForUse);

            return(possibleWords.OrderByDescending(word => GetSynonymRanking(word, context)).FirstOrDefault());
        }
Example #18
0
        private void SetLanguage(ILanguage language)
        {
            if (language == null || language.SentenceRules == null || !language.SentenceRules.Any())
            {
                IGlobalConfig globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));

                Language = globalConfig.BaseLanguage;
            }
            else
            {
                Language = language;
            }
        }
        public override object Convert(object input)
        {
            string stringInput = input.ToString();

            if (string.IsNullOrWhiteSpace(stringInput))
            {
                return(null);
            }

            IDictataPhrase returnValue = ConfigDataCache.Get <IDictataPhrase>(new ConfigDataCacheKey(typeof(IDictataPhrase), stringInput, ConfigDataType.Dictionary));

            return(returnValue);
        }
Example #20
0
        public ActionResult Remove(string removeId = "", string authorizeRemove = "", string unapproveId = "", string authorizeUnapprove = "")
        {
            string message;

            if (!string.IsNullOrWhiteSpace(authorizeRemove) && removeId.ToString().Equals(authorizeRemove))
            {
                ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId());

                ILanguage obj = ConfigDataCache.Get <ILanguage>(removeId);

                if (obj == null)
                {
                    message = "That does not exist";
                }
                else if (obj.Remove(authedUser.GameAccount, authedUser.GetStaffRank(User)))
                {
                    LoggingUtility.LogAdminCommandUsage("*WEB* - RemoveLanguage[" + removeId.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle);
                    message = "Delete Successful.";
                }
                else
                {
                    message = "Error; Removal failed.";
                }
            }
            else if (!string.IsNullOrWhiteSpace(authorizeUnapprove) && unapproveId.ToString().Equals(authorizeUnapprove))
            {
                ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId());

                ILanguage obj = ConfigDataCache.Get <ILanguage>(unapproveId);

                if (obj == null)
                {
                    message = "That does not exist";
                }
                else if (obj.ChangeApprovalStatus(authedUser.GameAccount, authedUser.GetStaffRank(User), ApprovalState.Returned))
                {
                    LoggingUtility.LogAdminCommandUsage("*WEB* - UnapproveLanguage[" + unapproveId.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle);
                    message = "Unapproval Successful.";
                }
                else
                {
                    message = "Error; Unapproval failed.";
                }
            }
            else
            {
                message = "You must check the proper remove or unapprove authorization radio button first.";
            }

            return(RedirectToAction("Index", new { Message = message }));
        }
Example #21
0
        public AccountConfig()
        {
            Acquaintences = new List <IAcquaintence>();
            Notifications = new List <IPlayerMessage>();
            Playlists     = new HashSet <IPlaylist>();
            UIModules     = Enumerable.Empty <Tuple <IUIModule, int> >();

            IGlobalConfig globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));

            if (globalConfig != null)
            {
                UILanguage = globalConfig.BaseLanguage;
            }
        }
Example #22
0
        public JsonResult <bool> ChangeUILanguage(string language)
        {
            ApplicationUser user = UserManager.FindById(User.Identity.GetUserId());

            ILanguage lang = ConfigDataCache.Get <ILanguage>(new ConfigDataCacheKey(typeof(ILanguage), language, ConfigDataType.Language));

            if (user != null && lang != null)
            {
                user.GameAccount.Config.UILanguage = lang;
                user.GameAccount.Config.Save(user.GameAccount, StaffRank.Admin);
            }

            return(Json(user.GameAccount.Config.UITutorialMode));
        }
Example #23
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            ApplicationUser potentialUser = UserManager.FindByName(model.Email);

            if (potentialUser != null)
            {
                IGlobalConfig globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));
                if (globalConfig.AdminsOnly && potentialUser.GetStaffRank(User) == StaffRank.Player)
                {
                    ModelState.AddModelError("", "The system is currently locked to staff members only. Please try again later and check the home page for any announcements and news.");

                    return(View(model));
                }
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            SignInStatus result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : false);

            switch (result)
            {
            case SignInStatus.Success:
                //Check for a valid character, zone and account
                Account account = potentialUser.GameAccount;

                if (account == null)
                {
                    ModelState.AddModelError("", "Your account is having technical difficulties. Please contact an administrator.");
                    return(View(model));
                }

                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, model.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }
        }
Example #24
0
        public static IDictata ObscureWord(IDictata word, short obscureStrength)
        {
            if (word.Language == null)
            {
                IGlobalConfig globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));

                word.Language = globalConfig.BaseLanguage;
            }

            IEnumerable <IDictata> possibleWords = ConfigDataCache.GetAll <IDictata>().Where(dict => dict.GetLexeme().SuitableForUse &&
                                                                                             dict.Language == word.Language &&
                                                                                             dict.WordType == word.WordType);

            return(GetObscuredWord(word, possibleWords, obscureStrength));
        }
Example #25
0
        public Lexeme()
        {
            WordForms = new IDictata[0];
            Name      = string.Empty;

            IGlobalConfig globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));

            if (globalConfig?.BaseLanguage == null)
            {
                Language = ConfigDataCache.GetAll <ILanguage>().FirstOrDefault();
            }
            else
            {
                Language = globalConfig.BaseLanguage;
            }
        }
Example #26
0
        public ActionResult AddDictata(string lexemeId)
        {
            ILexeme lex = ConfigDataCache.Get<ILexeme>(new ConfigDataCacheKey(typeof(ILexeme), lexemeId, ConfigDataType.Dictionary));
            if (lex == null)
            {
                string message = "That does not exist";
                return RedirectToAction("Index", new { Message = message });
            }

            AddEditDictataViewModel vModel = new AddEditDictataViewModel(lex)
            {
                AuthedUser = UserManager.FindById(User.Identity.GetUserId())
            };

            return View("~/Views/GameAdmin/Dictionary/AddDictata.cshtml", vModel);
        }
Example #27
0
        public ActionResult Edit(string id, string ArchivePath = "")
        {
            ILanguage obj = ConfigDataCache.Get <ILanguage>(new ConfigDataCacheKey(typeof(ILanguage), id, ConfigDataType.Language));

            if (obj == null)
            {
                string message = "That does not exist";
                return(RedirectToAction("Index", new { Message = message }));
            }

            AddEditLanguageViewModel vModel = new AddEditLanguageViewModel(ArchivePath, obj)
            {
                AuthedUser = UserManager.FindById(User.Identity.GetUserId())
            };

            return(View("~/Views/GameAdmin/Language/Edit.cshtml", vModel));
        }
Example #28
0
        /// <summary>
        /// Map the synnet of this word
        /// </summary>
        public bool MapSynNet()
        {
            //Not a whole lot of point here
            if (IsSynMapped)
            {
                return(true);
            }

            IGlobalConfig globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld));

            if (globalConfig?.DeepLexActive ?? false)
            {
                Processor.StartSubscriptionLoop("WordNetMapping", DeepLex, 2000, true);
            }

            return(true);
        }
Example #29
0
        public ActionResult EditDictata(string lexemeId, string id)
        {
            ILexeme lex = ConfigDataCache.Get<ILexeme>(new ConfigDataCacheKey(typeof(ILexeme), lexemeId, ConfigDataType.Dictionary));
            IDictata obj = lex?.WordForms?.FirstOrDefault(form => form.UniqueKey == id);

            if (obj == null)
            {
                return RedirectToAction("Index", new { Message = "That does not exist" });
            }

            AddEditDictataViewModel vModel = new AddEditDictataViewModel(lex, obj)
            {
                AuthedUser = UserManager.FindById(User.Identity.GetUserId())
            };

            return View("~/Views/GameAdmin/Dictionary/EditDictata.cshtml", vModel);
        }
Example #30
0
        public ActionResult Edit(string id)
        {
            ILexeme obj = ConfigDataCache.Get<ILexeme>(new ConfigDataCacheKey(typeof(ILexeme), id, ConfigDataType.Dictionary));

            if (obj == null)
            {
                string message = "That does not exist";
                return RedirectToAction("Index", new { Message = message });
            }

            AddEditDictionaryViewModel vModel = new AddEditDictionaryViewModel(obj.WordForms)
            {
                AuthedUser = UserManager.FindById(User.Identity.GetUserId()),
                DataObject = (Lexeme)obj
            };

            return View("~/Views/GameAdmin/Dictionary/Edit.cshtml", vModel);
        }