public void DumpTagLayout(MoonfishTagGroup tag, string folder) { _definitionsDictionary.Clear(); var info = BeginProcessTagBlockDefinition(tag.Definition); using (var stream = new FileStream(Path.Combine(folder, info.Name + ".cs"), FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) { var size = tag.Definition.CalculateSizeOfFieldSet(); var hasParent = h2Tags.Any(x => x.Class == tag.ParentClass); if (hasParent) { var parentTag = new MoonfishTagGroup(h2Tags.First(x => x.Class == tag.ParentClass)); info.BaseClass = new ClassInfo(TokenDictionary.GenerateValidIdentifier( ToTypeName(parentTag.Definition.Name))); // loop through all the parents summing up thier sizes while (hasParent) { size += parentTag.Definition.CalculateSizeOfFieldSet(); hasParent = h2Tags.Any(x => x.Class == parentTag.ParentClass); if (hasParent) { parentTag = new MoonfishTagGroup(h2Tags.First(x => x.Class == parentTag.ParentClass)); } } } else { info.BaseClass = new ClassInfo("GuerillaBlock"); } var alignment = tag.Definition.Alignment; var property = info.Properties.Single(x => x.Name == "SerializedSize"); property.GetBody = string.Format("return {0};", size); info.Attributes.Add(new AttributeInfo(typeof(TagClassAttribute)) { Parameters = { "\"" + tag.Class + "\"" } }); var streamWriter = new StreamWriter(stream); info.Generate(); GenerateOutputForClass(info, streamWriter); } var localDefinitions = _definitionsDictionary.Select(x => x.Value); foreach (var item in localDefinitions) { using (var stream = new FileStream(Path.Combine(folder, item.Name + ".cs"), FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) { item.Generate(); GenerateOutputForClass(item, new StreamWriter(stream)); } } }