public RenamedItem(NanoXmlElement el, RenamedClass owner) { try { this.owner = owner; entityType = (EntityType)Enum.Parse(typeof (EntityType), el.Name.Substring(7)); string str = el.GetAttribute("oldName"); int i; if ((i = str.IndexOf(' ')) != -1) { string s = str.Substring(0, i); int k = s.IndexOf('/'); if (k != -1) resultType = new Renamed(s.Substring(0, k) + "." + s.Substring(k + 1)); else resultType = new Renamed(s); str = str.Substring(i + 1); } if ((i = str.IndexOf("::")) != -1) str = str.Substring(i + 2); if ((i = str.IndexOf('(')) != -1) { methodParams = new List<Renamed>(); foreach (string s in EntityName.ParseList(str, i + 1, ')')) { int k = s.IndexOf('/'); if (k != -1) methodParams.Add(new Renamed(s.Substring(0, k) + "." + s.Substring(k + 1))); else methodParams.Add(new Renamed(s)); } str = str.Substring(0, i); i = str.IndexOf('['); if (i != -1 && str[i + 2] == ']') str = str.Substring(0, i); } string strNew = el.GetAttribute("newName"); if (strNew != "dropped") name = new Renamed(str, strNew); else name = new Renamed(str); } catch (Exception e) { throw new ObfuscarParserException("Failed to process item element", e, el.Path); } }
public XmlMappingEntity(NanoXmlElement el) { this.el = el; Name = el.GetAttribute("oldName"); if (Name == null) { Name = el.GetAttribute("name"); } if (Name == null) { throw new ObfuscarParserException("Unable to get name", el.Path); } NewName = el.GetAttribute("newName"); if (NewName == null) { SkipReason = el.GetAttribute("reason"); if (SkipReason == null) { throw new ObfuscarParserException("Neither new name, nor skip reason not found", el.Path); } } string typeValue; if (el.Name.StartsWith(PREFIX_RENAMED)) { typeValue = el.Name.Substring(PREFIX_RENAMED.Length); } else if (el.Name.StartsWith(PREFIX_SKIPPED)) { typeValue = el.Name.Substring(PREFIX_SKIPPED.Length); } else { throw new ObfuscarParserException($"Invalid or unsupported tag: {el.Name}", el.Path); } Type = (EntityType)Enum.Parse(typeof(EntityType), typeValue); }
private void ParseClass(NanoXmlElement el, Mapping owner) { try { string newName = el.GetAttribute("newName"); int j = newName.IndexOf('/'); if (j != -1) { newName = newName.Substring(j + 1); } string str = el.GetAttribute("oldName"); j = str.IndexOf('/'); if (j != -1) { ownerClassName = str.Substring(0, j); name = new Renamed(str.Substring(j + 1), newName); } else { name = new Renamed(str, newName); } } catch (Exception e) { throw new ObfuscarParserException("Failed to process class element: ", e, el.Path); } foreach (NanoXmlElement element in el.ChildElements) { if (!element.Name.StartsWith("renamed")) { continue; } items.Add(new RenamedItem(element, this)); } }
private void ParseSkipped(NanoXmlElement el) { try { string str = el.GetAttribute("name"); int j = str.IndexOf('/'); if (j != -1) { ownerClassName = str.Substring(0, j); name = new Renamed(str.Substring(j + 1)); } else { name = new Renamed(str); } skipReason = el.GetAttribute("reason"); } catch (Exception e) { throw new ObfuscarParserException("Failed to process element", e, el.Path); } }
public RecentItem(NanoXmlElement el) { filename = el.GetAttribute("filename"); foreach (NanoXmlAttribute attribute in el.Attributes) { if (attribute.Name != "filename") { properties.Add(attribute.Name, attribute.Value); } } foreach (NanoXmlElement element in el.ChildElements) { List <string> list; if (!additionalItems.TryGetValue(element.Name, out list)) { list = new List <string>(); additionalItems.Add(element.Name, list); } list.Add(element.Value); } }
public RenamedItem(NanoXmlElement el, RenamedClass owner) { try { this.owner = owner; entityType = (EntityType)Enum.Parse(typeof(EntityType), el.Name.Substring(7)); string str = el.GetAttribute("oldName"); int i; if ((i = str.IndexOf(' ')) != -1) { string s = str.Substring(0, i); int k = s.IndexOf('/'); if (k != -1) { resultType = new RenamedParam(s.Substring(0, k) + "." + s.Substring(k + 1)); } else { resultType = new RenamedParam(s); } str = str.Substring(i + 1); } if ((i = str.IndexOf("::")) != -1) { str = str.Substring(i + 2); } if ((i = str.IndexOf('(')) != -1) { methodParams = new List <RenamedParam>(); foreach (string s in EntityName.ParseList(str, i + 1, ')')) { int k = s.IndexOf('/'); if (k != -1) { methodParams.Add(new RenamedParam(s.Substring(0, k) + "." + s.Substring(k + 1))); } else { methodParams.Add(new RenamedParam(s)); } } str = str.Substring(0, i); i = str.IndexOf('['); if (i != -1 && str[i + 2] == ']') { str = str.Substring(0, i); } } string strNew = el.GetAttribute("newName"); if (strNew != "dropped") { name = new Renamed(str, strNew); } else { name = new Renamed(str); } } catch (Exception e) { throw new ObfuscarParserException("Failed to process item element", e, el.Path); } }
public RecentItem(NanoXmlElement el) { filename = el.GetAttribute("filename"); foreach (NanoXmlAttribute attribute in el.Attributes) if (attribute.Name != "filename") properties.Add(attribute.Name, attribute.Value); foreach (NanoXmlElement element in el.ChildElements) { List<string> list; if (!additionalItems.TryGetValue(element.Name, out list)) { list = new List<string>(); additionalItems.Add(element.Name, list); } list.Add(element.Value); } }