public int AddItem(string _txt, string _loc) { GLocalizeItem gLocalizeItem = new GLocalizeItem(); Array.Resize(ref Items, Items.Length + 1); Items[Items.Length - 1] = gLocalizeItem; int num = Unique_Key(); Items[Items.Length - 1].Id = num; Items[Items.Length - 1].Original = _txt; Items[Items.Length - 1].Translation = _txt; Items[Items.Length - 1].IdEnum = "IDT_" + num; Items[Items.Length - 1].Loc = _loc; Items[Items.Length - 1].Tipo = GLocalizeItem.Tipos.Desconocido; return(num); }
public GLocalizeCountry Localize_Base(string _file) { int num = 0; int num2 = 0; string idEnum = ""; string loc = ""; string text = ""; int id = 0; GLocalizeItem.Tipos tipo = GLocalizeItem.Tipos.Desconocido; GLocalizeCountry gLocalizeCountry = new GLocalizeCountry(); try { XmlTextReader xmlTextReader = new XmlTextReader(Path + _file); while (xmlTextReader.Read()) { if (xmlTextReader.NodeType == XmlNodeType.Text && num == 1) { text = xmlTextReader.Value.ToString(); GLocalizeItem gLocalizeItem = new GLocalizeItem(); gLocalizeItem.Translated = true; gLocalizeItem.Tipo = tipo; gLocalizeItem.Loc = loc; gLocalizeItem.Id = id; gLocalizeItem.IdEnum = idEnum; gLocalizeItem.Original = text; gLocalizeItem.Translation = text; gLocalizeCountry.CopyItem(gLocalizeItem); num = 0; } if (xmlTextReader.NodeType == XmlNodeType.Element) { if (xmlTextReader.Name.ToLower() == "localize") { num2 = 1; if (xmlTextReader.HasAttributes) { xmlTextReader.MoveToFirstAttribute(); for (int i = 0; i < xmlTextReader.AttributeCount; i++) { xmlTextReader.MoveToAttribute(i); if (xmlTextReader.Name.ToLower() == "iso") { gLocalizeCountry.BaseLoc = (gLocalizeCountry.Loc = xmlTextReader.Value.ToString()); } } } } if (xmlTextReader.Name.ToLower() == "text" && num2 == 1) { num = 1; if (xmlTextReader.HasAttributes) { xmlTextReader.MoveToFirstAttribute(); for (int i = 0; i < xmlTextReader.AttributeCount; i++) { xmlTextReader.MoveToAttribute(i); if (xmlTextReader.Name.ToLower() == "iso") { loc = xmlTextReader.Value.ToString(); } else if (xmlTextReader.Name.ToLower() == "id") { id = Convert.ToInt32(xmlTextReader.Value.ToString()); } else if (xmlTextReader.Name.ToLower() == "enum") { idEnum = xmlTextReader.Value.ToString(); } else if (xmlTextReader.Name.ToLower() == "type") { string text2 = xmlTextReader.Value.ToString(); switch (text2.ToLower()) { case "imagen": tipo = GLocalizeItem.Tipos.Imagen; break; case "link": tipo = GLocalizeItem.Tipos.Link; break; case "texto": tipo = GLocalizeItem.Tipos.Texto; break; case "video": tipo = GLocalizeItem.Tipos.Video; break; case "datos": tipo = GLocalizeItem.Tipos.Datos; break; case "audio": tipo = GLocalizeItem.Tipos.Audio; break; default: tipo = GLocalizeItem.Tipos.Desconocido; break; } } else { xmlTextReader.MoveToElement(); } } } } if (xmlTextReader.NodeType == XmlNodeType.EndElement && xmlTextReader.Name.ToLower() == "localize") { num2 = 0; } } } xmlTextReader.Close(); } catch (Exception ex) { error = ex.Message; return(null); } return(gLocalizeCountry); }
public bool Localize_Country(ref GLocalizeCountry _l, string _file) { int num = 0; int num2 = 0; string text = ""; string id = "0"; try { XmlTextReader xmlTextReader = new XmlTextReader(Path + _file); while (xmlTextReader.Read()) { if (xmlTextReader.NodeType == XmlNodeType.Text && num == 1) { text = xmlTextReader.Value.ToString(); GLocalizeItem gLocalizeItem = new GLocalizeItem(); _l.EditTranslation(id, text); num = 0; } if (xmlTextReader.NodeType == XmlNodeType.Element) { if (xmlTextReader.Name.ToLower() == "localize") { num2 = 1; if (xmlTextReader.HasAttributes) { xmlTextReader.MoveToFirstAttribute(); for (int i = 0; i < xmlTextReader.AttributeCount; i++) { xmlTextReader.MoveToAttribute(i); if (xmlTextReader.Name.ToLower() == "iso") { _l.Loc = xmlTextReader.Value.ToString(); } } } } if (xmlTextReader.Name.ToLower() == "text" && num2 == 1) { num = 1; if (xmlTextReader.HasAttributes) { xmlTextReader.MoveToFirstAttribute(); for (int i = 0; i < xmlTextReader.AttributeCount; i++) { xmlTextReader.MoveToAttribute(i); if (xmlTextReader.Name.ToLower() == "id") { id = xmlTextReader.Value.ToString(); } else { xmlTextReader.MoveToElement(); } } } } if (xmlTextReader.NodeType == XmlNodeType.EndElement && xmlTextReader.Name.ToLower() == "localize") { num2 = 0; } } } xmlTextReader.Close(); } catch (Exception ex) { error = ex.Message; return(false); } return(true); }
public int CopyItem(GLocalizeItem _i) { Array.Resize(ref Items, Items.Length + 1); Items[Items.Length - 1] = _i; return(_i.Id); }