public MoonfishTagGroup(GuerillaTagGroup guerillaTag) { Name = guerillaTag.Name; Class = guerillaTag.Class; ParentClass = guerillaTag.ParentClass; Definition = new MoonfishTagDefinition(guerillaTag.Definition); }
private void ProcessTag(IEnumerable <GuerillaTagGroup> h2Tags, string folder, BinaryReader reader, XmlWriter writer, GuerillaTagGroup tag) { const int @null = -1; List <tag_field> fields = null; if (tag.parentGroupTag != @null) { fields = new List <tag_field>(); var parent = h2Tags.Single(x => x.groupTag == tag.parentGroupTag); if (parent.parentGroupTag != @null) { var @base = h2Tags.Single(x => x.groupTag == parent.parentGroupTag); fields.AddRange(ExtractFields(h2Tags, reader, @base)); } fields.AddRange(ExtractFields(h2Tags, reader, parent)); fields.AddRange(ExtractFields(h2Tags, reader, tag)); } // Process the tag_group definition. var fieldOffset = 0; ProcessTagBlockDefinition(tag.Definition, writer, tag.definitionAddress, ref fieldOffset, tag.Class.ToString(), "", root, false, fields); root = root ? false : false; writer.Flush(); //File.WriteAllText(string.Format("{0}\\{1}.cs", folder, readTag.Name), writer.ToString()); return; }
private static IList <tag_field> ExtractFields(IEnumerable <GuerillaTagGroup> h2Tags, BinaryReader reader, GuerillaTagGroup tag) { var definition = (TagBlockDefinition)tag.Definition; return(definition.LatestFieldSet.Fields); }
private static string GetEntityCompatibleName(GuerillaTagGroup tag) { var outputName = tag.Class.ToString().Trim(); Regex r = new Regex("[^a-zA-Z0-9!+++<> -]"); outputName = r.Replace(outputName, ""); outputName = outputName.Replace('<', '_'); outputName = outputName.Replace('>', '_'); outputName.Trim(); return(outputName); }
public void DumpTagLayout(GuerillaTagGroup tag, string folder) { Dictionary <string, string> definitionDictitonary = new Dictionary <string, string>(); XmlWriterSettings xmlWriterSettings = new XmlWriterSettings(); xmlWriterSettings.Indent = true; var outputName = GetEntityCompatibleName(tag); XmlWriter writer = XmlWriter.Create( new FileStream(string.Format("{0}\\{1}.ent", folder, outputName), FileMode.Create, FileAccess.Write, FileShare.Read), xmlWriterSettings); root = true; ProcessTag(h2Tags, folder, null, writer, tag); // Close the tag layout writer. writer.Close(); }
public static void LoadGuerillaExecutable(string guerillaExecutablePath) { // Open the guerilla executable. using (var reader = new BinaryReader(new VirtualMemoryStream(guerillaExecutablePath, BaseAddress))) { h2Tags = new List <GuerillaTagGroup>(NumberOfTagLayouts); // Loop through all the tag layouts and extract each one. for (var i = 0; i < NumberOfTagLayouts; i++) { // Go to the tag layout table. reader.BaseStream.Position = TagLayoutTableAddress + (i * 4); // Read the tag layout pointer. var layoutAddress = reader.ReadInt32(); // Go to the tag layout and read it. reader.BaseStream.Position = layoutAddress; var tag = new GuerillaTagGroup(reader); h2Tags.Add(tag); } } }