private void Awake() { Instance = this; Log.Init(Logger); TranslationUtils.LoadTranslations(); SetupStatusEffects(); harmony.PatchAll(); Utility.AssetHelper.Init(); Weapons.Greatswords.Init(); Weapons.AxeForstasca.Init(); Weapons.AtgeirSilver.Init(); Weapons.KnifeIron.Init(); Weapons.ParryingDagger.Init(); Weapons.BowBlackmetal.Init(); Weapons.PickaxeBlackmetal.Init(); Weapons.SpearBlackmetal.Init(); Weapons.Battleaxes.Init(); Weapons.FlametalWeapons.Init(); Weapons.TorchOlympia.Init(); Weapons.Bombs.Init(); Weapons.ThrowingAxes.Init(); //Weapons.Javelins.Init(); Log.LogInfo("Patching complete"); }
public QuestData Translate(ITranslationHelper translation) { var toTranslate = JObject.FromObject(this); return(TranslationUtils.Translate(translation, toTranslate) .ToObject <QuestData>()); }
private void Start() { if (Settings.Enabled.Value) { TranslationUtils.InsertTranslations(ModName, ModPath, Settings.OverwriteExisting.Value); } }
private void Awake() { Instance = this; Log.Init(Logger); TranslationUtils.LoadTranslations(); SetupStatusEffects(); harmony.PatchAll(); AssetHelper.Init(); AssetHelper.SetupVFX(); hasBarbarianArmor = UtilityFunctions.CheckBarbarian(); if ((bool)balance["armorChangesEnabled"]) { Armor.ModExistingSets.Init(); Armor.AddNewSets.Init(); } else { Log.LogInfo("Terraheim armor changes disabled!"); } Log.LogInfo("Patching complete"); }
private void Update() { if (Settings.Enabled.Value && Input.GetKeyDown(KeyCode.F4)) { Log.LogInfo("Reloading translations..."); TranslationUtils.ReloadTranslations(ModName, ModPath, Settings.OverwriteExisting.Value); } }
public Content Translate(ITranslationHelper translation) { return(new Content() { Format = this.Format, Quests = this.Quests.Select(q => q.Translate(translation)).ToList(), Offers = this.Offers.Select(o => TranslationUtils.TranslateOffer(translation, o)).ToList(), Owner = this.Owner, }); }
public void TestLocale_InvalidLanguageCodeNullCountryCode_ShouldReturnSameLanguageCodeLowerCase() { string languageCode = "XY"; string countryCode = null; string newLocale = TranslationUtils.Locale(languageCode, countryCode); Assert.AreEqual(newLocale, languageCode.ToLower(), "Invalid language code returned. Expected was the input language code"); }
public void TestLocale_NullLanguageCodeInvalidCountryCode_ShouldReturnSameCountryCodeUpperCase() { string languageCode = null; string countryCode = "xy"; string newLocale = TranslationUtils.Locale(languageCode, countryCode); Assert.AreEqual(newLocale, countryCode.ToUpper(), "Invalid country code returned. Expected was the input country code"); }
public void TestSplitLocale_NullLocale_ShouldReturnDefaultLanguageCountryCode() { string inputLocale = null; string languageCode; string countryCode; TranslationUtils.SplitLocale(inputLocale, out languageCode, out countryCode); Assert.AreEqual(languageCode, "en", "Invalid language code returned"); Assert.AreEqual(countryCode, "US", "Invalid country code returned"); }
public Content Translate(ITranslationHelper translation) { return(new Content() { Format = this.Format, Quests = this.Quests?.Select(q => q.Translate(translation)).ToList(), Offers = this.Offers?.Select(o => TranslationUtils.TranslateOffer(translation, o)).ToList(), CustomBoards = this.CustomBoards?.Select(b => TranslationUtils.Translate(translation, b)).ToList(), CustomDropBoxes = this.CustomDropBoxes?.Select(b => TranslationUtils.Translate(translation, b)).ToList(), Owner = this.Owner, }); }
public void TranslateUI() { TranslationUtils.TranslateComponents(Resources.ResourceManager, this, components); TranslationUtils.TranslateControls(Controls); mComp.Tag = null; //PrepareContextMenu(); var panelView = App.MainPages.View.ActivePanelView; if (panelView == this) { m_Presenter.UpdateItemsAndStatus(); } }
protected void TranslateItem(string itemName, object item) { ITranslation translation = Translator.GetTranslation(Settings.CurrentTranslation); if (translation == null) { return; } IEnumerable <Tuple <string, object> > itemsToTranslate = new Tuple <string, object>[] { new Tuple <string, object>(itemName, item) }; TranslationUtils.TranslateItemsFromList(Name, translation, itemsToTranslate); }
public void TestSplitLocale_ValidLocale_ShouldReturnValidLanguageCountryCode() { string inputLanguageCode = "XY"; string inputCountryCode = "ab"; string inputlocale = $"{inputLanguageCode}-{inputCountryCode}"; string languageCode; string countryCode; TranslationUtils.SplitLocale(inputlocale, out languageCode, out countryCode); Assert.AreEqual(languageCode, inputLanguageCode.ToLower(), "Invalid language code returned"); Assert.AreEqual(countryCode, inputCountryCode.ToUpper(), "Invalid country code returned"); }
private void Awake() { Log = Logger; Settings.Enabled = Config.Bind("General", "Enabled", true, $"Enable/disable {ModName}'s functionality."); Settings.EnableShoutOnDeath = Config.Bind("General", "EnableShoutOnDeath", true, "Enable/disable players shouting random phrases on death."); Settings.EnableAlertOnDeath = Config.Bind("General", "EnableAlertOnDeath", true, "Enable/disable server alerts describing a player's death."); if (Settings.Enabled.Value) { _Harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), null); TranslationUtils.InsertTranslations(ModName, ModPath); } }
public bool MouseHovering() { Vector2 Pos = Get4ButtonPos(NPCAttacker.FocusText1, NPCAttacker.FocusText3); string LocalizedText = TranslationUtils.GetTranslation("Arm"); Vector2 Size = Get4ButtonSize(LocalizedText); if (Main.mouseX > Pos.X && Main.mouseX < Pos.X + Size.X) { if (Main.mouseY > Pos.Y && Main.mouseY < Pos.Y + Size.Y) { return(true); } } return(false); }
public GetProfileResponse GetCustomerProfileforHPIDTEST(UserAuthenticationInterchange UserAuthInterchange, TokenDetails sessionTokenDetails, bool RetainOldValues, APIMethods apiRetainOldValues) { GetProfileResponse response = new GetProfileResponse(); AccessCredentials accessCredentials = new AccessCredentials(); accessCredentials.AppVersion = "1.0.0.0"; accessCredentials.CallerId = "TESTLOGIN1.0.0.0"; accessCredentials.LoginDate = DateTime.UtcNow; response.Credentials = accessCredentials; CustomerProfile customerProfile = new CustomerProfile(); CustomerData customerData = new CustomerData() { Locale = TranslationUtils.Locale(UserAuthInterchange.LanguageCode, UserAuthInterchange.CountryCode), ActiveHealth = true, Country = "US", CompanyName = "HP", DisplayName = "Ramdeo Angh", EmailAddress = "*****@*****.**", FirstName = "Ramdeo", LastName = "Angh" }; customerProfile.Country = customerData.Country; customerProfile.CompanyName = customerData.CompanyName; customerProfile.DisplayName = customerData.DisplayName; customerProfile.EmailAddress = customerData.EmailAddress; customerProfile.ActiveHealth = customerData.ActiveHealth; customerProfile.Locale = customerData.Locale; customerProfile.FirstName = customerData.FirstName; customerProfile.LastName = customerData.LastName; response.CustomerProfileObject = customerProfile; response.LoginDate = DateTime.UtcNow; sessionTokenDetails = new TokenDetails(); sessionTokenDetails.AccessToken = (Guid.NewGuid().ToString()); sessionTokenDetails.RefreshToken = (Guid.NewGuid().ToString()); sessionTokenDetails.RefreshTokenType = (int)TokenScopeType.userLogin; TokenDetails sessionToken = sessionTokenDetails; // try to get HPID profile with existing session token CustomerIds idS = new CustomerIds(); idS.HPIDid = "INNOVATIONPORTAL12345!@#$%"; return(GetCustomerProfileFromHPIDAndDatabase(response, UserAuthInterchange, sessionToken, idS, RetainOldValues, apiRetainOldValues)); }
private static void PopulateDeathShouts() { Dictionary <string, string> tokens = TranslationUtils.GetTokens(ModName); if (tokens != null) { deathShouts = new List <string>(); foreach (string token in tokens.Keys) { if (token.StartsWith("deathalert_death_msg")) { deathShouts.Add(token); } } } }
public override void OnActivate() { Vector2 Pos = Get4ButtonPos(NPCAttacker.FocusText1, NPCAttacker.FocusText3); string LocalizedText = TranslationUtils.GetTranslation("Arm"); Vector2 Size = Get4ButtonSize(LocalizedText); TextButton = new UIImageButton(Main.itemTexture[ItemID.BlackDye]); TextButton.Left.Set(Pos.X, 0f); TextButton.Top.Set(Pos.Y, 0f); TextButton.Width.Set(Size.X, 0f); TextButton.Height.Set(Size.Y, 0f); TextButton.OnClick += Chat_OnClick; Append(TextButton); base.OnActivate(); }
private static void PopulateDeathAlerts(string damageType) { Dictionary <string, string> tokens = TranslationUtils.GetTokens(ModName); if (tokens != null) { List <string> damageTypeTokens = new List <string>(); foreach (string token in tokens.Keys) { if (token.StartsWith($"deathalert_deathby_{damageType.Substring(2)}")) { damageTypeTokens.Add(token); } } deathAlerts.Add(damageType, damageTypeTokens); } }
public void TranslateUI() { // translate sub-components TranslationUtils.TranslateComponents(Resources.ResourceManager, this, components); mTrayOpen_TranslateUI(); TranslationUtils.TranslateControls(Controls); // addons context menu will refresh later popTop.Tag = null; // refresh tab names var pages = App.MainPages; var shortcutIndex = App.Presenter.FindShortcutKeysPanelIndex(); for (int index = 0; index < pages.Count; index++) { var model = pages.GetItem(index); App.MainPages.UpdateTabName(index); if (index == shortcutIndex) { model.AsyncRetrieveData(false); } } }
public EasCustomerProfile GetHPProfile(int UserID, string Token, string CallerId, string LanguageCode, string CountryCode, string SessionToken) { EasCustomerProfile profile = new EasCustomerProfile(UserID); GetProfileResponse profileResponse = new GetProfileResponse(); GetHPProfile(ref profileResponse, UserID, Token, CallerId, LanguageCode, CountryCode, SessionToken, TokenScopeType.apiProfileGetCall); if (profileResponse.ErrorList.Count == 0 && profileResponse.CustomerProfileObject != null) { profile.CallerId = CallerId; profile.TokenMD5 = SessionToken; profile.FirstName = !string.IsNullOrEmpty(profileResponse?.CustomerProfileObject?.FirstName) ? profileResponse.CustomerProfileObject.FirstName : string.Empty; profile.LastName = !string.IsNullOrEmpty(profileResponse?.CustomerProfileObject?.LastName) ? profileResponse.CustomerProfileObject.LastName : string.Empty; profile.EmailAddress = !string.IsNullOrEmpty(profileResponse?.CustomerProfileObject?.EmailAddress) ? profileResponse.CustomerProfileObject.EmailAddress : string.Empty; profile.CountryCode = !string.IsNullOrEmpty(profileResponse?.CustomerProfileObject?.Country) ? profileResponse.CustomerProfileObject.Country : SettingRepository.Get <string>("EASDeafaultPurchaseCountryCode"); profile.LanguageCode = !string.IsNullOrEmpty(profileResponse?.CustomerProfileObject?.Language) ? profileResponse.CustomerProfileObject.Language : "en"; profile.Locale = TranslationUtils.Locale(LanguageCode, CountryCode); } return(profile); }
public override void Update(GameTime gameTime) { base.Update(gameTime); Vector2 Pos = Get4ButtonPos(NPCAttacker.FocusText1, NPCAttacker.FocusText3); string LocalizedText = TranslationUtils.GetTranslation("Arm"); Vector2 Size = Get4ButtonSize(LocalizedText); TextButton.Left.Set(Pos.X, 0f); TextButton.Top.Set(Pos.Y, 0f); TextButton.Width.Set(Size.X, 0f); TextButton.Height.Set(Size.Y, 0f); Append(TextButton); if (MouseHovering() && !HasHover) { Main.PlaySound(SoundID.MenuTick, -1, -1, 1, 1f, 0f); HasHover = true; } if (!MouseHovering() && HasHover) { Main.PlaySound(SoundID.MenuTick, -1, -1, 1, 1f, 0f); HasHover = false; } }
public override void Draw(SpriteBatch spriteBatch) { Vector2 Pos = Get4ButtonPos(NPCAttacker.FocusText1, NPCAttacker.FocusText3); string LocalizedText = TranslationUtils.GetTranslation("Arm"); Vector2 Size = Get4ButtonSize(LocalizedText); Vector2 Scale = new Vector2(0.9f); if (MouseHovering()) { Scale *= 1.1f; } Vector2 Unit = new Vector2(1f); Color chatColor = Color.Red; if (Main.LocalPlayer.talkNPC != -1) { if (Main.npc[Main.LocalPlayer.talkNPC].type == NPCID.Nurse) { chatColor = CombatText.HealLife; } } ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, LocalizedText, Pos + Size * Unit * 0.5f, chatColor, 0f, Size * 0.5f, Scale * Unit, -1f, 2f); }
public virtual void TranslateItems(ITranslation translation) { TranslationUtils.TranslateItemsFromFields(GetType().Name, this, translation); }
public override void TranslateItems(ITranslation translation) { base.TranslateItems(translation); TranslationUtils.TranslateItemsFromFields(FormBrowseName, _filterRevisionsHelper, translation); TranslationUtils.TranslateItemsFromFields(FormBrowseName, _filterBranchHelper, translation); }
public virtual void TranslateItems(ITranslation translation) { TranslationUtils.TranslateItemsFromFields(TranslationCategoryName, this, translation); TranslationUtils.TranslateItemsFromList(TranslationCategoryName, translation, GetMenuCommandsForTranslationImpl()); }
public void T02_Should_read_translations() { var translations = TranslationUtils.GetTranslationsFromType(typeof(TestingTexts), true).ToArray(); Assert.Equal(2, translations.Length); }
private void Init() { _Harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), null); TranslationUtils.InsertTranslations(ModName, ModPath); }
public virtual void TranslateItems(ITranslation translation) { TranslationUtils.TranslateItemsFromList("FormBrowse", translation, GetAdditionalMainMenuItemsForTranslation()); }
private GetProfileResponse GetCustomerProfileFromHPIDAndDatabase(GetProfileResponse response, UserAuthenticationInterchange hppAuthInterchange, TokenDetails sessionToken, CustomerIds idS, bool RetainOldValues, APIMethods apiRetainOldValues) { User profile = null; List <RoleMapping> roleMappings = null; try { // check is done based on profile, customerId is also generated for a new profile bool IsNewCustomer = false; RequestFindOrInsertHPIDProfile requestFindOrInsertHPID = new RequestFindOrInsertHPIDProfile(); requestFindOrInsertHPID.Locale = string.IsNullOrEmpty(response?.CustomerProfileObject?.Locale)?TranslationUtils.Locale(hppAuthInterchange.LanguageCode, hppAuthInterchange.CountryCode):response?.CustomerProfileObject?.Locale; requestFindOrInsertHPID.HPIDprofileId = idS.HPIDid; requestFindOrInsertHPID.HPPprofileId = idS.HPPid; requestFindOrInsertHPID.tokenDetails = sessionToken; requestFindOrInsertHPID.clientId = hppAuthInterchange.ClientId; requestFindOrInsertHPID.apiRetainOldValues = apiRetainOldValues; requestFindOrInsertHPID.EmailAddrees = response?.CustomerProfileObject?.EmailAddress; requestFindOrInsertHPID.CompanyName = response?.CustomerProfileObject?.CompanyName; requestFindOrInsertHPID.ActiveHealth = response.CustomerProfileObject.ActiveHealth; requestFindOrInsertHPID.FirstName = response?.CustomerProfileObject?.FirstName; requestFindOrInsertHPID.LastName = response.CustomerProfileObject.LastName; profile = userUtils.FindOrInsertHPIDProfile(response, requestFindOrInsertHPID, out IsNewCustomer); if (response.ErrorList.Count > 0) { return(response); } if (profile.RoleMappings.Count == 0) { roleMappings = roleUtils.InsertRoleMapping(response, profile.UserId); } else { roleMappings = profile.RoleMappings.ToList(); } hppAuthInterchange.UserId = Convert.ToInt32(profile.UserId); hppAuthInterchange.Token = sessionToken.AccessToken; hppAuthInterchange.IsHPID = true; // Register profile & session token in database customerUtils.InsertOrUpdateHPPToken(response, (UserAuthentication)hppAuthInterchange, RetainOldValues); List <int> roleids = roleMappings.Select(r => r.RoleId).ToList(); List <UserRoles> userRoles = new List <UserRoles>(); RESTAPIGetRolesResponse rolesResponse = new RESTAPIGetRolesResponse(); statusUtils.GetRoles(rolesResponse); if (rolesResponse.RolesList.Count != 0) { var rolResponseList = rolesResponse.RolesList.Where(r => roleids.Contains(r.RoleId)).ToList(); foreach (var roles in rolResponseList) { userRoles.Add(new UserRoles() { Id = roles.RoleId, Name = roles.RoleName }); } } response.Credentials = new AccessCredentials() { UserID = Convert.ToInt32(profile.UserId), SessionToken = QueryUtils.GetMD5(sessionToken.AccessToken), CallerId = hppAuthInterchange.CallerId, Token = sessionToken.AccessToken, Roles = userRoles }; response = GetProfileDataFromDatabase(response, profile); response.CustomerProfileObject.IsNewCustomer = IsNewCustomer; response.LoginDate = hppAuthInterchange.LoginDate; } catch (Exception ex) { response.ErrorList.Add(new Fault("GetCustomerProfileFailed", ex.Message)); } return(response); }