protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int id; if (!int.TryParse(Request.QueryString["id"], out id)) { Response.Redirect("~/MediaCenter.aspx"); } Database db = new Database(); Lang lang = new Lang(); db.AddParameter("@lang", lang.getCurrentLang()); db.AddParameter("@id", id); DataTable dt = db.ExecuteDataTable("select top(3) * from Report where lang=@lang and (not id=@id) Order by id desc"); Repeater1.DataSource = dt; Repeater1.DataBind(); db.AddParameter("@lang", lang.getCurrentLang()); dt = db.ExecuteDataTable("select top(3) * from SocialEvent where lang=@lang Order by id desc"); Repeater2.DataSource = dt; Repeater2.DataBind(); db.AddParameter("@lang", lang.getCurrentLang()); db.AddParameter("@id", id); dt = db.ExecuteDataTable("select * from Report where lang=@lang and id=@id"); Repeater3.DataSource = dt; Repeater3.DataBind(); if (dt.Rows.Count == 0) { Response.Redirect("~/MediaCenter.aspx"); } } }
public ActionResult EditArticle(ArticleCategory category, int articleID, string title, string content, bool isTop, Lang lang) { var cmd = new EditArticle(category, articleID, title, content, isTop, lang, this.CurrentUser.UserID); this.CommandBus.Send(cmd); return Json(JsonResult.Success); }
/// <summary> /// Add a word to the dictionary /// </summary> public void AddWord(string word, Lang lang) { lock (_externalDictionary) { _externalDictionary.AddWord(word, lang); } }
private void GetData(string name,DateTime? date) { Database db = new Database(); Lang lang = new Lang(); string sqlSearch = "select * from Event where lang=@lang"; db.AddParameter("@lang", lang.getCurrentLang()); if (!string.IsNullOrWhiteSpace(name)) { sqlSearch += " and title like '%' + @name + '%'"; db.AddParameter("@name", name); } if (date.HasValue) { sqlSearch += " and (year(EventDate)=@year and month(EventDate)=@month and day(EventDate)=@day )"; db.AddParameter("@year",date.Value.Year); db.AddParameter("@month", date.Value.Month); db.AddParameter("@day", date.Value.Day); } DataTable dt = db.ExecuteDataTable(sqlSearch); ListView1.DataSource = dt; ListView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int id = -1; if (int.TryParse(Request.QueryString["id"], out id)) { Database db = new Database(); Lang lang = new Lang(); db.AddParameter("@id", id); db.AddParameter("@lang", lang.getCurrentLang()); DataTable dt = db.ExecuteDataTable("select country.name as countryname,researcher.* from Researcher inner join Country on Researcher.Country=Country.id where researcher.lang=@lang and researcher.IsAproved=1 and researcher.id=@id"); if(dt.Rows.Count==0) { Response.Redirect("Experts.aspx"); } Repeater1.DataSource = dt; Repeater1.DataBind(); LoadResearch(id,"",null,null); txtTitle.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {__doPostBack('" + btnSearch.UniqueID + "','');}} "); txtFrom.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {__doPostBack('" + btnSearch.UniqueID + "','');}} "); txtTo.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {__doPostBack('" + btnSearch.UniqueID + "','');}} "); } } }
public void Refresh_panel() { translations = GlobalVariables.translations; heading_title.GetComponent<Text> ().text= translations.getString ("activity"); _subtitle.GetComponent<Text> ().text= translations.getString ("trial_data"); _tab_trialdata.GetComponent<Button> ().GetComponentsInChildren<Text> () [0].text = translations.getString ("trial_data"); _tab_feedback.GetComponent<Button> ().GetComponentsInChildren<Text> () [0].text = translations.getString ("feedback"); _label_player_name.GetComponent<Text> ().text= translations.getString ("player"); _label_skill_name.GetComponent<Text> ().text= translations.getString ("skill"); _label_skill_date.GetComponent<Text> ().text= translations.getString ("date"); _label_skill_score.GetComponent<Text> ().text= translations.getString ("score"); int user_id = GlobalVariables.user_id; int player_id = GlobalVariables.selected_player_id; int activity_id = GlobalVariables.selected_activity_id; Activity activity = _database.getActivity (activity_id); string date = activity.datetime; int skill_id = activity.skill_id; GlobalVariables.selected_skill_id = skill_id; Skill skill = _database.getSkill (skill_id); Player player = _database.getPlayer (player_id); Statistics statistics = _database.getStatistics (activity.statistics_id); _player_name.GetComponent<Text> ().text=player.name+ " "+player.surname; _skill_name.GetComponent<Text> ().text=skill.name; _skill_date.GetComponent<Text> ().text=activity.datetime; _skill_score.GetComponent<Text> ().text = statistics.overall_score.ToString(); }
protected void btnSend_OnClick(object sender, EventArgs e) { if (ValidateData()) { string filename = DateTime.Now.Ticks + "_" + System.IO.Path.GetFileName(fileImage.PostedFile.FileName); fileImage.PostedFile.SaveAs(Server.MapPath("~/images/Researchers/")+filename); Database db = new Database(); var lang=new Lang(); db.AddParameter("@name", txtName.Text); db.AddParameter("@countrty", ddlCountry.SelectedValue); db.AddParameter("@major", txtMajor.Text); db.AddParameter("@level", ddlDegree.SelectedValue); db.AddParameter("@Organization", txtWorkPlace.Text); db.AddParameter("@Email", txtEmail.Text); db.AddParameter("@Phone", txtPhone.Text); db.AddParameter("@facebook", txtFacebook.Text); db.AddParameter("@Twitter", txtTwitter.Text); db.AddParameter("@Linkedin", txtLinkedin.Text); db.AddParameter("@Prev", txtPrev.Text); db.AddParameter("@Img", filename); db.AddParameter("@lang", new Lang().getCurrentLang()); db.ExecuteNonQuery( "insert into Researcher(name,country,major,level,Organization,Email,Phone,facebook,Twitter,Linkedin,Prev,Img,lang) values(@name,@countrty,@major,@level,@Organization,@Email,@Phone,@facebook,@Twitter,@Linkedin,@Prev,@Img,@lang)"); ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert1", "alertify.alert('" + lang.getByKey("") + "','" + lang.getByKey("ResearchSubmitSuccessfully") + "').set('onok', function(closeEvent){ location.href='/Experts.aspx';} );", true); } }
/// <summary> /// Dictionary contains the word. /// </summary> public bool ContainsWord(string word, Lang lang, out Error error) { lock (_sync) { error = null; if (_externalDictionary.ContainWord(word, lang)) return true; SpellResult result = _yandexSpeller.CheckText(word, lang, Options.ByWords, TextFormat.Plain); if (result.Errors.Count > 0) { error = result.Errors[0]; return false; } _innerUpdate = true; try { _externalDictionary.AddWord(word, lang); } finally { _innerUpdate = false; } return true; } }
private bool ValidateData() { Lang lang = new Lang(); if (string.IsNullOrWhiteSpace(txtName.Text)) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert1", "alertify.alert('" + lang.getByKey("") + "','" + lang.getByKey("NameError") + "');", true); return false; } if (ddlCountry.SelectedValue.Equals("-1")) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert1", "alertify.alert('" + lang.getByKey("") + "','" + lang.getByKey("CountryError") + "');", true); return false; } Regex reg = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(2000)); if (!reg.IsMatch(txtEmail.Text)) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert1", "alertify.alert('" + lang.getByKey("") + "','" + lang.getByKey("EmailError2") + "');", true); return false; } if (string.IsNullOrWhiteSpace(txtSubject.Text)) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert1", "alertify.alert('" + lang.getByKey("") + "','" + lang.getByKey("SubjectError") + "');", true); return false; } if (string.IsNullOrWhiteSpace(txtMessage.Text)) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert1", "alertify.alert('" + lang.getByKey("") + "','" + lang.getByKey("MessageError") + "');", true); return false; } return true; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Database db=new Database(); Lang lang=new Lang(); string albumsSql = "select top(4) * from albums where lang=@lang order by showOrder"; string aboutSql = "select * from pages where pagekey=@key and lang=@lang"; db.AddParameter("@lang", lang.getCurrentLang()); if (Request.QueryString["page"] != null) { db.AddParameter("@key", Request.QueryString["page"]); } else { db.AddParameter("@key", "HomeAbout"); } DataSet ds = db.ExecuteDataSet(aboutSql+";"+albumsSql); Repeater1.DataSource = ds.Tables[0]; Repeater1.DataBind(); Repeater2.DataSource = ds.Tables[1]; Repeater2.DataBind(); } }
/// <summary> /// method update language /// </summary> /// <param name="l">enum language</param> public static void SetLang(Lang l) { var s = String.Empty; switch (l) { case Lang.Portuguese: s = "..\\Lang\\LANG_BR.xaml"; break; case Lang.English: s = "..\\Lang\\LANG_EN.xaml"; break; //case Lang.Chinese: // s = "..\\Lang\\LANG_CH.xaml"; // break; case Lang.Korean: s = "..\\Lang\\LANG_KO.xaml"; break; } if (s == String.Empty) { return; } Elang = l; //((MainWindow)Application.Current.MainWindow).Resources.MergedDictionaries.Clear(); ResourceDictionary d = new ResourceDictionary() { Source = new Uri(s, UriKind.Relative) }; ((MainWindow)Application.Current.MainWindow).Resources.MergedDictionaries.Add(d); }
public void Refresh_panel() { Refresh_translations (); _button_english.GetComponent<Button>().onClick.AddListener(() => { Debug.Log ("change language "+GlobalVariables.locale+" to gb"); GlobalVariables.locale = "gb"; translations =new Lang (Path.Combine (Application.dataPath, "Resources/lang.xml"), GlobalVariables.locale, false); GlobalVariables.translations = translations; Refresh_translations(); _coach_leftpanel.Refresh_panel(); }); _button_basque.GetComponent<Button>().onClick.AddListener(() => { Debug.Log ("change language "+GlobalVariables.locale+" to eu"); GlobalVariables.locale = "eu"; translations =new Lang (Path.Combine (Application.dataPath, "Resources/lang.xml"), GlobalVariables.locale, false); GlobalVariables.translations = translations; Refresh_translations(); _coach_leftpanel.Refresh_panel(); }); _button_spanish.GetComponent<Button>().onClick.AddListener(() => { Debug.Log ("change language "+GlobalVariables.locale+" to es"); GlobalVariables.locale = "es"; translations =new Lang (Path.Combine (Application.dataPath, "Resources/lang.xml"), GlobalVariables.locale, false); GlobalVariables.translations = translations; Refresh_translations(); _coach_leftpanel.Refresh_panel(); }); }
private void LoadResearch(int id,string title,DateTime? from,DateTime? to) { Database db = new Database(); Lang lang = new Lang(); string sqlSearch = "select * from Research where ResearcherId=@id"; db.AddParameter("@id", id); if (!string.IsNullOrWhiteSpace(title)) { sqlSearch += " and Title like '%' + @title + '%'"; db.AddParameter("@title", title); } if (from.HasValue) { sqlSearch += " and AddDate>=@fromDate"; db.AddParameter("@fromDate", from); } if (to.HasValue) { sqlSearch += " and AddDate<=@toDate"; db.AddParameter("@toDate", to); } DataTable dt = db.ExecuteDataTable(sqlSearch); ListView1.DataSource = dt; ListView1.DataBind(); }
public CompleteResponse Complete(Lang lang, string q, int limit = 1) { RestRequest request = new RestRequest("complete"); request.AddParameter("key", _key); request.AddParameter("lang", lang.ToString().ToLowerInvariant()); request.AddParameter("q", q); request.AddParameter("limit", limit); RestResponse response = (RestResponse)_client.Execute(request); XmlAttributeDeserializer deserializer = new XmlAttributeDeserializer(); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var completeResponse = deserializer.Deserialize<CompleteResponse>(response); return completeResponse; } else { if (response.StatusCode != 0) { var error = deserializer.Deserialize<YandexError>(response); throw new YandexLinguisticsException(error); } else { throw new YandexLinguisticsException(0, response.ErrorMessage); } } }
public ActionResult EditAnnouncement(int announcementID, string title, string content, bool isTop, Lang lang) { var cmd = new EditAnnouncement(announcementID,title, content, isTop, lang, this.CurrentUser.UserID); this.CommandBus.Send(cmd); return Json(JsonResult.Success); }
/// <summary> /// Constructor for SpellDictionarySmartTagAction. /// </summary> /// <param name="span">Word to add to dictionary.</param> /// <param name="dictionary">The dictionary (used to ignore the word).</param> /// <param name="displayText">Text to show in the context menu for this action.</param> public SpellDictionarySmartTagAction(ITrackingSpan span, IYandexDictionary dictionary, string displayText, Lang lang) { _span = span; _dictionary = dictionary; _lang = lang; DisplayText = displayText; }
public void Refresh_panel() { //Elements _database = new Database_module (); translations = GlobalVariables.translations; _title.GetComponent<Text>().text = translations.getString ("skills"); _subtitle.GetComponent<Text>().text = translations.getString ("activities"); skill_id = GlobalVariables.selected_skill_id; player_id = GlobalVariables.selected_player_id; loadSkills (); // If there are skills it shows them if (skills.Count > 0) { if (skill_id == -1) { skill_id = skills [0].id; GlobalVariables.selected_skill_id = skill_id; } loadSkillActivities (skill_id); } else { } }
// Use this for initialization void Start() { _database = new Database_module (); GlobalVariables.locale = "es"; GlobalVariables.user_id = 1; translations = new Lang (Path.Combine (Application.dataPath, "Resources/lang.xml"), GlobalVariables.locale, false); GlobalVariables.translations = translations; }
public void Refresh_panel() { translations = GlobalVariables.translations; _title.GetComponent<Text> ().text = translations.getString ("mainmenu"); button_play.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text= translations.getString ("play") ; button_preferences.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text = translations.getString ("preferences") ; }
public ArticleCreated(ArticleCategory category, string title, string content, bool isTop, Lang lang, int createBy) { this.Category = category; this.Title = title; this.Content = content; this.Lang = lang; this.IsTop = isTop; this.CreateBy = createBy; }
private void LoadData() { Database db = new Database(); Lang lang = new Lang(); db.AddParameter("@lang", lang.getCurrentLang()); DataTable dt = db.ExecuteDataTable("select * from Publications where lang=@lang Order by id desc"); ListView1.DataSource = dt; ListView1.DataBind(); }
public void Refresh_panel() { translations = GlobalVariables.translations; _title.GetComponent<Text> ().text = translations.getString ("mainmenu"); button_player.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text= translations.getString ("players") ; button_activity.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text = translations.getString ("activities") ; button_feedback.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text = translations.getString ("feedbacks") ; }
public virtual bool ContainWord(string word, Lang lang) { if (_dictionary.ContainsKey(lang)) { return _dictionary[lang].Contains(word); } return false; }
private void GetData() { Database db = new Database(); Lang lang = new Lang(); db.AddParameter("@lang", lang.getCurrentLang()); DataTable dt = db.ExecuteDataTable("select * from Socialevent where lang=@lang"); ListView1.DataSource = dt; ListView1.DataBind(); }
public ArticleEdit(int articleID, ArticleCategory category, string title, string content, bool isTop, Lang lang, int editBy) { this.ArticleID = articleID; this.Category = category; this.Lang = lang; this.Title = title; this.Content = content; this.IsTop = isTop; this.EditBy = editBy; }
private void GetVedioData() { Database db = new Database(); Lang lang = new Lang(); string sqlSearch = "select * from Vedio where lang=@lang Order by id desc"; db.AddParameter("@lang", lang.getCurrentLang()); DataTable dt = db.ExecuteDataTable(sqlSearch); ListView2.DataSource = dt; ListView2.DataBind(); }
/// <summary> /// Does dictionary contain the word? /// </summary> /// <param name="word"></param> /// <param name="lang"></param> /// <returns></returns> public bool ContainWord(string word, Lang lang) { bool result = false; foreach (Lang langVariant in _supportLang) { if (lang.HasFlag(langVariant)) result = result || (_dictionary.ContainsKey(langVariant) && _dictionary[langVariant].ContainsWord(word)); } return result; }
private void addLanguages(string language, string file, XmlDocument xml) { Lang myLang = new Lang(); int count = languages.Count; myLang.name = language; myLang.xml = xml; languages.Add(count, myLang); cmbLang.Items.Add(language); if (language == Properties.Settings.Default.Language.SelectSingleNode("/Language/@name").Value) cmbLang.SelectedIndex = count; }
static void ScanDirectory(StreamWriter sw, string path, Lang lang) { string[] files = Directory.GetFiles(path, lang.Extension); foreach (string file in files) ProcessFile(sw, file, lang); string[] dirs = Directory.GetDirectories(path); foreach (string dir in dirs) ScanDirectory(sw, dir, lang); }
public void Refresh_panel() { translations = GlobalVariables.translations; _title.GetComponent<Text> ().text = translations.getString ("preferences"); _subtitle.GetComponent<Text> ().text = translations.getString ("change_password"); _tab_personaldata.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text= translations.getString ("personal_data") ; _tab_changepassword.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text= translations.getString ("change_password") ; _label_oldpassword.GetComponent<Text> ().text = translations.getString ("old_password"); _label_newpassword.GetComponent<Text> ().text = translations.getString ("new_password"); _label_retype.GetComponent<Text> ().text = translations.getString ("retype_password"); _button_save.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text = translations.getString ("save") ; user = GlobalVariables.user; _button_save.GetComponent<Button>().onClick.AddListener(() => { oldpassword = _database.HashPassword(_input_oldpassword.GetComponent<InputField> ().text); newpassword = _input_newpassword.GetComponent<InputField> ().text; retype = _input_retype.GetComponent<InputField> ().text; //If the data are not empty it saves if (oldpassword!="" && newpassword!="" && retype!="") { if (oldpassword ==user.password) { if (newpassword == retype) { user.password = _database.HashPassword(newpassword); user = _database.saveUser(GlobalVariables.user_database,user); user = _database.saveUser(GlobalVariables.users_database,user); Debug.Log ("Preferences saved"); } else { Debug.Log ("Error new password and retype are not equal"); } } else { Debug.Log ("Error old password is not the same"); } } else { Debug.Log ("Error inputs are empty"); } }); }
protected override ItemDef NewDefFromVanilla(Item item) { return(new ItemDef(Lang.itemName(item.netID, true), getTexture: () => Main.itemTexture[item.type])); }
public static void Draw() { if (!MenuFriends.show) { return; } GUIM.DrawText(new Rect((float)Screen.width / 2f + GUIM.YRES(240f), GUIM.YRES(110f) - GUIM.YRES(18f), GUIM.YRES(200f), GUIM.YRES(18f)), Lang.Get("_FRIENDS"), TextAnchor.MiddleLeft, BaseColor.White, 1, 12, false); int num = (int)GUIM.YRES(36f); int num2 = (int)GUIM.YRES(4f); int num3 = 0; int num4 = MenuFriends.currpage * 14; int num5 = (MenuFriends.currpage + 1) * 14; if (num5 > MenuFriends.friendlistorder.Count) { num5 = MenuFriends.friendlistorder.Count; } for (int i = num4; i < num5; i++) { MenuFriends.DrawFriend(new Rect((float)Screen.width / 2f + GUIM.YRES(240f), GUIM.YRES(110f) + (float)((num + num2) * num3), GUIM.YRES(200f), (float)num), MenuFriends.friendlistorder[i]); num3++; } if (GUIM.Button(new Rect((float)Screen.width / 2f + GUIM.YRES(396f), GUIM.YRES(110f) - GUIM.YRES(18f), GUIM.YRES(20f), GUIM.YRES(16f)), BaseColor.Black, "<", TextAnchor.MiddleCenter, BaseColor.Gray, 1, 16, false)) { MenuFriends.currpage--; if (MenuFriends.currpage < 0) { MenuFriends.currpage = 0; } } if (GUIM.Button(new Rect((float)Screen.width / 2f + GUIM.YRES(396f) + GUIM.YRES(24f), GUIM.YRES(110f) - GUIM.YRES(18f), GUIM.YRES(20f), GUIM.YRES(16f)), BaseColor.Black, ">", TextAnchor.MiddleCenter, BaseColor.Gray, 1, 16, false)) { MenuFriends.currpage++; if (MenuFriends.currpage > MenuFriends.friendlistorder.Count / 14) { MenuFriends.currpage = MenuFriends.friendlistorder.Count / 14; } } }
public static void Load(string folder) { if (folder == "") { folder = Directory.GetCurrentDirectory(); } DirectoryInfo di = new DirectoryInfo(folder); foreach (FileInfo fi in di.GetFiles("request.*")) { TextReader tr = new StreamReader(fi.FullName, Encoding.GetEncoding(1251)); string email = ""; string faction_name = "Faction"; string gender = "MAN"; string chosen_name = NameGenerator.Name(gender); Lang lng = Lang.En; bool body = false; while (true) { string s = tr.ReadLine(); if (s == null) { break; } if (s.Trim() == "") { body = true; } if (s.IndexOf(":") == -1) { continue; } string name = s.Substring(0, s.IndexOf(":")).ToLower(); string val = s.Substring(s.IndexOf(":") + 2); if (name == "from") { email = val; } if (!body) { continue; } if (name == "faction") { faction_name = val; } if (name == "chosen" && val.ToLower() == "woman") { gender = "WOMA"; } if (name == "name") { chosen_name = val; } if (name == "language" && val.ToLower() == "ru") { lng = Lang.Ru; } } tr.Close(); if (email != "") { // Create new faction Faction f = new Faction(); f.Email = email; f.Name = faction_name; f.Options.Lang = lng; for (int i = 0; i < 6; i++) { f.Password += (Char)('a' + Constants.Random('z' - 'a')); } // Select region with less faction players and monsters and more wanderers Region r = Map.Regions[Constants.Random(Map.Regions.Count)]; int with_faction = 0; int without_faction = 0; foreach (Person p in r.Persons) { if (!p.Faction.IsNPC || p.Man.IsMonster) { with_faction++; } else { without_faction++; } } int j = Map.Regions.IndexOf(r); int start = j; while (true) { j++; if (j >= Map.Regions.Count) { j = 0; } if (j == start) { break; } Region r2 = Map.Regions[j]; if (r2._radiation >= 90 || r2.Radiation >= 90 || !r2.Terrain.Walking) { continue; } int with_faction2 = 0; int without_faction2 = 0; foreach (Person p in r2.Persons) { if (!p.Faction.IsNPC || p.Man.IsMonster) { with_faction2++; } else { without_faction2++; } } if (with_faction2 < with_faction || (with_faction2 == with_faction && without_faction2 > without_faction)) { r = r2; with_faction = with_faction2; without_faction = without_faction2; } } if (r._radiation >= 90 || !r.Terrain.Walking) { throw new Exception("What region you picked you?"); } // Create Chosen One Person chosen = new Person(f, r); chosen.Chosen = true; chosen.Name = chosen_name; chosen.Avoiding = true; chosen.AddItems(ItemType.Get(gender), 1); foreach (Item itm in DataFile.ChosenItems) { chosen.AddItems(itm.Type, itm.Amount); } foreach (Skill sk in DataFile.ChosenSkills) { chosen.AddSkill(sk.Type).Level = sk.Level; } // Show all buildable objects foreach (Skill sk in chosen.Skills) { foreach (BuildingType bt in BuildingType.List) { if (!bt.NoBuild && bt.Materials.Count > 0 && bt.Materials[0].Type.InstallSkill.Type == sk.Type) { f.ShowBuilding(bt); } } } Console.WriteLine("..Faction created for " + email); } } }
public override void AddRecipeGroups() { // Creates a new recipe group RecipeGroup group = new RecipeGroup(() => Language.GetTextValue("LegacyMisc.37") + " " + Lang.GetItemNameValue(ItemType("ExampleItem")), new[] { ItemType("ExampleItem"), ItemType("EquipMaterial"), ItemType("BossItem") }); // Registers the new recipe group with the specified name RecipeGroup.RegisterGroup("ExampleMod:ExampleItem", group); // Modifying a vanilla recipe group. Now we can use Lava Snail to craft Snail Statue RecipeGroup snailGroup = RecipeGroup.recipeGroups[RecipeGroup.recipeGroupIDs["Snails"]]; snailGroup.ValidItems.Add(ModContent.ItemType <NPCs.ExampleCritterItem>()); }
public override void GetBlockInfo(IPlayer forPlayer, StringBuilder dsc) { if (contents != null) { int temp = (int)contents.Collectible.GetTemperature(Api.World, contents); if (temp <= 25) { dsc.AppendLine(string.Format("Contents: {0}x {1}\nTemperature: {2}", contents.StackSize, contents.GetName(), Lang.Get("Cold"))); } else { dsc.AppendLine(string.Format("Contents: {0}x {1}\nTemperature: {2}°C", contents.StackSize, contents.GetName(), temp)); } } }
public override string ToString() { return($"Need: { string.Join(", ", item.Select(x => $"{Lang.GetItemNameValue(x)} ({stack})"))}"); }
private static Dictionary <string, List <LocalizedText> > GetCommandAliasesByID() { LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("ChatCommand.", Lang.CreateDialogSubstitutionObject((NPC)null))); Dictionary <string, List <LocalizedText> > dictionary = new Dictionary <string, List <LocalizedText> >(); foreach (LocalizedText localizedText in all) { string key = localizedText.Key.Replace("ChatCommand.", ""); int length = key.IndexOf('_'); if (length != -1) { key = key.Substring(0, length); } List <LocalizedText> localizedTextList; if (!dictionary.TryGetValue(key, out localizedTextList)) { localizedTextList = new List <LocalizedText>(); dictionary[key] = localizedTextList; } localizedTextList.Add(localizedText); } return(dictionary); }
private void gluWarehouse_EditValueChanged(object sender, EventArgs e) { depError.SetError(gluWarehouse, (string.IsNullOrEmpty(gluWarehouse.EditValue + "")) ? Lang.GetMessageByLanguage("000003", Commons.Culture, Commons.ResourceMessage) : null); }
private void txtENName_EditValueChanged(object sender, EventArgs e) { depError.SetError(txtENName, (txtENName.Text.Trim().Equals("")) ? Lang.GetMessageByLanguage("000003", Commons.Culture, Commons.ResourceMessage) : null); }
private void txtStallCode_EditValueChanged(object sender, EventArgs e) { if (txtStallCode.Text.Contains(" ")) { depError.SetError(txtStallCode, Lang.GetMessageByLanguage("000004", Commons.Culture, Commons.ResourceMessage)); } else { depError.SetError(txtStallCode, (string.IsNullOrEmpty(txtStallCode.Text)) ? Lang.GetMessageByLanguage("000003", Commons.Culture, Commons.ResourceMessage) : null); } }
public string ToString(Lang lng) { return(Type.ToString(Amount, lng)); }
public static void SetLanguage(Lang newLanguage) { language = newLanguage; UpdateTextLagunage(); }
public async Task SetCnLang(MouseEventArgs eventArgs) { await Lang.SetLangAsync("zh-CN"); MarkAsRequireRender(); }
/// <summary> /// Gets the name of the output food if one exists. /// </summary> /// <param name="worldForResolve"></param> /// <param name="inputStacks"></param> /// <returns></returns> public string GetOutputName(IWorldAccessor worldForResolve, ItemStack[] inputStacks) { return(Lang.Get("unknown")); }
public override void AddRecipeGroups() { RecipeGroup group = new RecipeGroup(() => Lang.misc[37] + " Iron Bar" + Lang.GetItemNameValue(ItemType("Iron Bar")), new int[] { 22, 704 }); RecipeGroup.RegisterGroup("AnyIron", group); RecipeGroup wood = new RecipeGroup(() => Lang.misc[37] + (" Wood"), new int[] { 9, 620, 619, 911, 621, 2503, 2504, 2260, 1729 }); RecipeGroup.RegisterGroup("AnyWood", wood); RecipeGroup copper = new RecipeGroup(() => Lang.misc[37] + " Copper Bar" + Lang.GetItemNameValue(ItemType("Copper Bar")), new int[] { 20, 703 }); RecipeGroup.RegisterGroup("AnyCopper", copper); }
public override string GetHeldItemName(ItemStack itemStack) { string material = itemStack.Attributes.GetString("material"); return(Lang.GetMatching(Code?.Domain + AssetLocation.LocationSeparator + "block-" + Code?.Path + "-" + material)); }
public VideoLang(Lang l) { lang = l; }
public async Task <DataTablesPagedResults <PharmacyListViewModel> > GetDataAsync(DataTablesParameters table, Lang lng = Lang.KU) { IQueryable <Pharmacy> query = _pharmacyRepository.TableNoTracking; // Do Filters & Ordering Here var size = await query.CountAsync(); var items = await query .AsNoTracking() .Skip((table.Start / table.Length) * table.Length) .Take(table.Length) .Select(x => new PharmacyListViewModel { Id = x.Id, Name = lng == Lang.KU ? x.Name_Ku : lng == Lang.AR ? x.Name_Ar : x.Name, City = lng == Lang.KU ? x.City.Name_Ku : lng == Lang.AR ? x.City.Name_Ar : x.City.Name, Address = lng == Lang.KU ? x.Address_Ku : lng == Lang.AR ? x.Address_Ar : x.Address }) .ToListAsync(); return(new DataTablesPagedResults <PharmacyListViewModel> { Items = items, TotalSize = size }); }
public override void AddRecipeGroups() { // Creates a new recipe group RecipeGroup group = new RecipeGroup(() => Language.GetTextValue("LegacyMisc.37") + " " + Lang.GetItemNameValue(ItemType("ExampleItem")), new int[] { ItemType("ExampleItem"), ItemType("EquipMaterial"), ItemType("BossItem") }); // Registers the new recipe group with the specified name RecipeGroup.RegisterGroup("ExampleMod:ExampleItem", group); }
public async Task <(long totalCount, int totalPages, List <PharmacyItemDTO>)> GetPharmaciesListAsync(Lang lang, int page = 0, int pageSize = 12) { var query = _pharmacyRepository.Table; var totalCount = await query.LongCountAsync(); var totalPages = (int)Math.Ceiling((double)totalCount / pageSize); query = query.Skip(pageSize * page).Take(pageSize); var offers = await query.Select(x => new PharmacyItemDTO { Id = x.Id, Name = lang == Lang.KU ? x.Name_Ku : lang == Lang.AR ? x.Name_Ar : x.Name, Address = lang == Lang.KU ? x.Address_Ku : lang == Lang.AR ? x.Address_Ar : x.Address, City = lang == Lang.KU ? x.City.Name_Ku : lang == Lang.AR ? x.City.Name_Ar : x.City.Name, Avatar = x.Avatar }).ToListAsync(); return(totalCount, totalPages, offers); }
public void SetInfo(string code) { info.text = Lang.str(code); }
private static void DrawButtons(Rect rect, ref float lineEndWidth) { if (Find.Selector.NumSelected != 1) { return; } var selected = Find.Selector.SingleSelectedThing; if (selected == null) { return; } lineEndWidth += ButtonSize; Widgets.InfoCardButton(rect.width - lineEndWidth, 0f, selected); if (!(selected is Pawn pawn) || !PlayerControlled(pawn)) { return; } if (pawn.playerSettings.UsesConfigurableHostilityResponse) { lineEndWidth += ButtonSize; HostilityResponseModeUtility.DrawResponseButton(new Rect(rect.width - lineEndWidth, 0f, ButtonSize, ButtonSize), pawn, false); lineEndWidth += GUIPlus.SmallPadding; } lineEndWidth += ButtonSize; var careRect = new Rect(rect.width - lineEndWidth, 0f, ButtonSize, ButtonSize); MedicalCareUtility.MedicalCareSelectButton(careRect, pawn); GUIPlus.DrawTooltip(careRect, new TipSignal(() => Lang.Get("InspectPane.MedicalCare", pawn.KindLabel, pawn.playerSettings.medCare.GetLabel()), GUIPlus.TooltipId), true); lineEndWidth += GUIPlus.SmallPadding; if (!pawn.IsColonist) { return; } lineEndWidth += ButtonSize; var canDoctor = !pawn.WorkTypeIsDisabled(WorkTypeDefOf.Doctor); var canDoctorPriority = (pawn.workSettings == null) || (pawn.workSettings?.GetPriority(WorkTypeDefOf.Doctor) > 0); var selfTendRect = new Rect(rect.width - lineEndWidth, 0f, ButtonSize, ButtonSize); var selfTendTip = "SelfTendTip".Translate(Faction.OfPlayer.def.pawnsPlural, 0.7f.ToStringPercent()).CapitalizeFirst(); if (!canDoctor) { selfTendTip += "\n\n" + "MessageCannotSelfTendEver".Translate(pawn.LabelShort, pawn); } else if (!canDoctorPriority) { selfTendTip += "\n\n" + "MessageSelfTendUnsatisfied".Translate(pawn.LabelShort, pawn); } GUIPlus.SetFont(GameFont.Tiny); var selfTend = pawn.playerSettings.selfTend; selfTend = GUIPlus.DrawToggle(selfTendRect, selfTend, new TipSignal(() => selfTendTip, GUIPlus.TooltipId), canDoctor, Textures.SelfTendOnIcon, Textures.SelfTendOffIcon); if (selfTend != pawn.playerSettings.selfTend) { Mod_Multiplayer.SetSelfTend(pawn, selfTend); } GUIPlus.ResetFont(); lineEndWidth += GUIPlus.SmallPadding; }
public override void StartServerSide(ICoreServerAPI api) { base.StartServerSide(api); this.sapi = api; api.RegisterCommand("tpimp", ConstantsCore.ModPrefix + "Import teleport schematic", "[list|paste]", (IServerPlayer player, int groupId, CmdArgs args) => { switch (args?.PopWord()) { case "help": player.SendMessage(groupId, "/tpimp [list|paste]", EnumChatType.CommandError); break; case "list": List <IAsset> schematics = api.Assets.GetMany(Constants.TELEPORT_SCHEMATIC_PATH); if (schematics == null || schematics.Count == 0) { player.SendMessage(groupId, Lang.Get("Not found"), EnumChatType.CommandError); break; } StringBuilder list = new StringBuilder(); foreach (var sch in schematics) { list.AppendLine(sch.Name.Remove(sch.Name.Length - 5)); } player.SendMessage(groupId, list.ToString(), EnumChatType.CommandSuccess); break; case "paste": string name = args.PopWord(); if (name == null || name.Length == 0) { player.SendMessage(groupId, "/tpimp paste [name]", EnumChatType.CommandError); break; } IAsset schema = api.Assets.TryGet($"{Constants.TELEPORT_SCHEMATIC_PATH}/{name}.json"); if (schema == null) { player.SendMessage(groupId, Lang.Get("Not found"), EnumChatType.CommandError); break; } string error = null; BlockSchematic schematic = BlockSchematic.LoadFromFile( schema.Origin.OriginPath + "/" + "game" + "/" + schema.Location.Path, ref error); if (error != null) { player.SendMessage(groupId, error, EnumChatType.CommandError); break; } PasteSchematic(schematic, player.Entity.Pos.AsBlockPos.Add(0, -1, 0)); break; default: player.SendMessage(groupId, "/tpimp [list|paste]", EnumChatType.CommandError); break; } }, Privilege.controlserver ); api.RegisterCommand("rndtp", ConstantsCore.ModPrefix + "Teleport player to random location", "[range]", (IServerPlayer player, int groupId, CmdArgs args) => { RandomTeleport(player, (int)args.PopInt(-1)); }, Privilege.tp ); api.RegisterCommand("tpnetconfig", ConstantsCore.ModPrefix + "Config for TPNet", "[shared|unbreakable]", (IServerPlayer player, int groupId, CmdArgs args) => { switch (args?.PopWord()) { case "help": player.SendMessage(groupId, "/tpnetconfig [shared|unbreakable]", EnumChatType.CommandError); break; case "shared": Config.Current.SharedTeleports.Val = !Config.Current.SharedTeleports.Val; api.StoreModConfig <Config>(Config.Current, api.GetWorldId() + "/" + ConstantsCore.ModId); player.SendMessage(groupId, Lang.Get("Shared teleports now is " + (Config.Current.SharedTeleports.Val ? "on" : "off")), EnumChatType.CommandSuccess); break; case "unbreakable": Config.Current.Unbreakable.Val = !Config.Current.Unbreakable.Val; api.StoreModConfig <Config>(Config.Current, api.GetWorldId() + "/" + ConstantsCore.ModId); player.SendMessage(groupId, Lang.Get("Unbreakable teleports now is " + (Config.Current.Unbreakable.Val ? "on" : "off")), EnumChatType.CommandSuccess); break; default: player.SendMessage(groupId, "/tpnetconfig [shared|unbreakable]", EnumChatType.CommandError); break; } }, Privilege.tp ); }
private static void Main() { Log.FileDir = PathEx.Combine(PathEx.LocalDir, "..\\Documents\\.cache\\logs"); Ini.SetFile(HomePath, "Settings.ini"); Ini.SortBySections = new[] { "History", "Host", "Settings" }; Log.AllowLogging(Ini.FilePath); #if x86 string appsDownloader64; if (Environment.Is64BitOperatingSystem && File.Exists(appsDownloader64 = PathEx.Combine(PathEx.LocalDir, $"{ProcessEx.CurrentName}64.exe"))) { ProcessEx.Start(appsDownloader64, EnvironmentEx.CommandLine(false)); return; } #endif if (!RequirementsAvailable()) { var updPath = PathEx.Combine(PathEx.LocalDir, "Updater.exe"); if (File.Exists(updPath)) { ProcessEx.Start(updPath); } else { Lang.ResourcesNamespace = typeof(Program).Namespace; if (MessageBox.Show(Lang.GetText(nameof(en_US.RequirementsErrorMsg)), Resources.Title, MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes) { Process.Start(PathEx.AltCombine(Resources.GitProfileUri, Resources.GitReleasesPath)); } } return; } var instanceKey = PathEx.LocalPath.GetHashCode().ToString(); using (new Mutex(true, instanceKey, out bool newInstance)) { var allowInstance = newInstance; if (!allowInstance) { var instances = ProcessEx.GetInstances(PathEx.LocalPath); var count = 0; foreach (var instance in instances) { if (instance?.GetCommandLine()?.ContainsEx(ActionGuid.UpdateInstance) == true) { count++; } instance?.Dispose(); } allowInstance = count == 1; } if (!allowInstance) { return; } MessageBoxEx.TopMost = true; Lang.ResourcesNamespace = typeof(Program).Namespace; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm().Plus()); } }
public override string ToString() { return($"Have: {Lang.GetItemNameValue(itemid)} ({stack})"); }
public override string ToString() { return($"Buy: {Lang.GetItemNameValue(itemid)} ({stack}) from ??"); }
public static string PerishableInfoCompact(ICoreAPI Api, ItemSlot contentSlot, float ripenRate, bool withStackName = true) { StringBuilder dsc = new StringBuilder(); if (withStackName) { dsc.Append(contentSlot.Itemstack.GetName()); } TransitionState[] transitionStates = contentSlot.Itemstack?.Collectible.UpdateAndGetTransitionStates(Api.World, contentSlot); if (transitionStates != null) { for (int i = 0; i < transitionStates.Length; i++) { string comma = ", "; TransitionState state = transitionStates[i]; TransitionableProperties prop = state.Props; float perishRate = contentSlot.Itemstack.Collectible.GetTransitionRateMul(Api.World, contentSlot, prop.Type); if (perishRate <= 0) { continue; } float transitionLevel = state.TransitionLevel; float freshHoursLeft = state.FreshHoursLeft / perishRate; switch (prop.Type) { case EnumTransitionType.Perish: if (transitionLevel > 0) { dsc.Append(comma + Lang.Get("{0}% spoiled", (int)Math.Round(transitionLevel * 100))); } else { double hoursPerday = Api.World.Calendar.HoursPerDay; if (freshHoursLeft / hoursPerday >= Api.World.Calendar.DaysPerYear) { dsc.Append(comma + Lang.Get("fresh for {0} years", Math.Round(freshHoursLeft / hoursPerday / Api.World.Calendar.DaysPerYear, 1))); } else if (freshHoursLeft > hoursPerday) { dsc.Append(comma + Lang.Get("fresh for {0} days", Math.Round(freshHoursLeft / hoursPerday, 1))); } else { dsc.Append(comma + Lang.Get("fresh for {0} hours", Math.Round(freshHoursLeft, 1))); } } break; case EnumTransitionType.Ripen: if (transitionLevel > 0) { dsc.Append(comma + Lang.Get("{1:0.#} days left to ripen ({0}%)", (int)Math.Round(transitionLevel * 100), (state.TransitionHours - state.TransitionedHours) / Api.World.Calendar.HoursPerDay / ripenRate)); } else { double hoursPerday = Api.World.Calendar.HoursPerDay; if (freshHoursLeft / hoursPerday >= Api.World.Calendar.DaysPerYear) { dsc.Append(comma + Lang.Get("will ripen in {0} years", Math.Round(freshHoursLeft / hoursPerday / Api.World.Calendar.DaysPerYear, 1))); } else if (freshHoursLeft > hoursPerday) { dsc.Append(comma + Lang.Get("will ripen in {0} days", Math.Round(freshHoursLeft / hoursPerday, 1))); } else { dsc.Append(comma + Lang.Get("will ripen in {0} hours", Math.Round(freshHoursLeft, 1))); } } break; } } } return(dsc.ToString()); }
public override string ToString() { return($"Farm: {Lang.GetItemNameValue(itemid)} ({stack}) from {string.Join(", ", RecipePath.loots[itemid].Select(x => Lang.GetNPCNameValue(x)))}"); }
public override void AnglerQuestChat(ref string description, ref string catchLocation) { description = Lang.questFish("Fishmother"); catchLocation = Lang.questFish("FishmotherLocation"); }
public async Task SetEnLang(MouseEventArgs eventArgs) { await Lang.SetLangAsync("en-US"); MarkAsRequireRender(); }