public void Begin(MagicNumber tagClass, int classStringId, TagLayoutGuess layout) { if (_writer != null) throw new InvalidOperationException("Cannot begin a new tag while another is still in progress"); // Convert the class name to a pascal case string and use that as the file name var name = _stringIds.GetString(classStringId); if (string.IsNullOrEmpty(name)) throw new InvalidOperationException("Unable to look up the tag class name"); name = ConvertToPascalCase(name); var path = Path.Combine(_outDir, name + ".hpp"); _writer = new StreamWriter(File.Open(path, FileMode.Create, FileAccess.Write)); // Write the C++ header _writer.WriteLine("#pragma once"); _writer.WriteLine("#include \"Tags.hpp\""); _writer.WriteLine(); _writer.WriteLine("namespace Blam"); _writer.WriteLine("{"); _writer.WriteLine("\tnamespace Tags"); _writer.WriteLine("\t{"); _builder = new StructBuilder(_writer, 2, name); _builder.Begin(tagClass, classStringId, layout); }
public void Begin(MagicNumber tagClass, int classStringId, TagLayoutGuess layout) { if (_writer != null) { throw new InvalidOperationException("Cannot begin a new tag while another is still in progress"); } // Convert the class name to a pascal case string and use that as the file name var name = _stringIds.GetString(classStringId); if (string.IsNullOrEmpty(name)) { throw new InvalidOperationException("Unable to look up the tag class name"); } name = ConvertToPascalCase(name); var path = Path.Combine(_outDir, name + ".hpp"); _writer = new StreamWriter(File.Open(path, FileMode.Create, FileAccess.Write)); // Write the C++ header _writer.WriteLine("#pragma once"); _writer.WriteLine("#include \"Tags.hpp\""); _writer.WriteLine(); _writer.WriteLine("namespace Blam"); _writer.WriteLine("{"); _writer.WriteLine("\tnamespace Tags"); _writer.WriteLine("\t{"); _builder = new StructBuilder(_writer, 2, name); _builder.Begin(tagClass, classStringId, layout); }