private void btnTestTagLoaders_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.Cancel) { return; } string filename = ofd.FileName; int count = 1; ShaderTransparentGlass[] tags = new ShaderTransparentGlass[count]; for (int x = 0; x < count; x++) { BinaryReader br = new BinaryReader(new FileStream(filename, FileMode.Open)); TagHeader header = new TagHeader(); header.Read(ref br); tags[x] = new ShaderTransparentGlass(); tags[x].Read(br); tags[x].ReadChildData(br); br.Close(); } MessageBox.Show("Done!"); }
public void ComplexTest() { var h = new TagHeader(new byte[] { 0x49, 0x44, 0x33, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x76 }); Assert.AreEqual(1014, h.Length); Assert.AreEqual(3, h.Version); }
public void TestValidateHeader() { var h = new TagHeader(); Type t = typeof(TagHeader); Assert.IsTrue((bool)t.InvokeMember( name: "ValidateHeader", invokeAttr: BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, binder: null, target: h, args: new object[] { new byte[] { 0x49, 0x44, 0x33, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x76 } } )); Assert.IsFalse((bool)t.InvokeMember( name: "ValidateHeader", invokeAttr: BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, binder: null, target: h, args: new object[] { new byte[] { 0x49, 0x45, 0x33, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x76 } } )); }
public void TestParseLength() { var h = new TagHeader(); Type t = typeof(TagHeader); int result = (int)t.InvokeMember( name: "ParseLength", invokeAttr: BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, binder: null, target: h, args: new object[] { new byte[] { 0x00, 0x00, 0x07, 0x76 } } ); Assert.AreEqual(1014, result, "Length not parsed correctly"); Assert.ThrowsException <TargetInvocationException>(() => { t.InvokeMember( name: "ParseLength", invokeAttr: BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, binder: null, target: h, args: new object[] { new byte[] { 0x00, 0x00, 0x00, 0x07, 0x76 } } ); }, "Not throws ArgumentException with 5-bytes given"); }
public static IEnumerable <T> GetAllTags <T>(this string text, string startTag, string endTag, params char[] excludeBlocks) where T : TagInfo, new() { text.CheckArgument(nameof(text)); var parseIndex = 0; int startTagIndex; int endTagIndex; var result = new List <T>(); var tagHeader = new TagHeader(text); do { startTagIndex = text.IndexOf(startTag, parseIndex, StringComparison.CurrentCultureIgnoreCase); var startTagEndIndex = startTagIndex > -1 ? startTagIndex + startTag.Length : parseIndex; endTagIndex = startTagEndIndex >= 0 ? text.IndexOf(endTag, startTagEndIndex, StringComparison.CurrentCultureIgnoreCase) : -1; if (startTagIndex > -1 && endTagIndex > startTagIndex) { int idx = startTagEndIndex; int endTagSearchPosAt = startTagEndIndex; var blockCounter = new int[excludeBlocks.Length]; while (idx < endTagIndex) { for (int j = 0; j < blockCounter.Length; j++) { if (text[idx] == excludeBlocks[j]) { endTagSearchPosAt = idx; blockCounter[j] += j % 2 == 0 ? 1 : -1; } } idx++; } while (idx < text.Length && blockCounter.Sum() != 0) { for (int j = 0; j < blockCounter.Length; j++) { if (text[idx] == excludeBlocks[j]) { endTagSearchPosAt = idx; blockCounter[j] += j % 2 == 0 ? 1 : -1; } } idx++; } if (endTagSearchPosAt > endTagIndex && blockCounter.Sum() == 0) { endTagIndex = text.IndexOf(endTag, endTagSearchPosAt, StringComparison.CurrentCultureIgnoreCase); } } if (startTagIndex > -1 && endTagIndex > startTagIndex) { result.Add(new T { Header = tagHeader, StartTag = startTag, StartTagIndex = startTagIndex, EndTag = endTag, EndTagIndex = endTagIndex, }); parseIndex = startTagEndIndex; } } while (startTagIndex > -1 && endTagIndex > -1); return(result); }
private void ExtractTag(int index) { FileStream fsBitmap = OptionsManager.GetBitmapStream(m_MapVersion); FileStream fsSound = OptionsManager.GetSoundStream(m_MapVersion); //string TagClass = GetTagClass(BitConverter.GetBytes(HaloMap.IndexItems[index].Type1),0); //Loading Tag Long name and seting the map version folder //string ProcessTagFile = TagClass.Trim() + ".mag"; //string MagfilePathRoot = ""; string OutputPathRoot = ""; switch (m_MapVersion) { case MapfileVersion.HALOPC: //MagfilePathRoot = Application.StartupPath + @"\Tag Structures\PcHalo\"; OutputPathRoot = Application.StartupPath + @"\Games\Pc\Halo\"; break; case MapfileVersion.HALOCE: //MagfilePathRoot = Application.StartupPath + @"\Tag Structures\CeHalo\"; OutputPathRoot = Application.StartupPath + @"\Games\Pc\Halo\"; break; case MapfileVersion.XHALO1: //MagfilePathRoot = Application.StartupPath + @"\Tag Structures\XHalo\"; OutputPathRoot = Application.StartupPath + @"\Games\Xbox\Halo\"; break; } //Creating Directorys for extracted tags; string[] Directorys = new string[256]; string DirSep = @"\"; Directorys = HaloMap.IndexItemStringList[index].Split(DirSep.ToCharArray(), 256); uint Dircount = (uint)Directorys.Length - 1; string NewDirectoryStructure = ""; for (uint Count = 0; Count < Dircount; Count += 1) { if (Directory.Exists(OutputPathRoot + NewDirectoryStructure + Directorys[Count]) == false) { //Directory.CreateDirectory(OutputPathRoot + NewDirectoryStructure + Directorys[Count]); NewDirectoryStructure += Directorys[Count] + @"\"; } else { NewDirectoryStructure += Directorys[Count] + @"\"; } } MTSFReader mr; mr = new MTSFReader(); mr.MTSFRead("Core.Compiler.HALO_PC_SET.MTSF"); TSFReader STSF = new TSFReader(); STSF.TSF(ref mr, CompUtil.RevUInt(HaloMap.IndexItems[index].Type1)); //string ExtName = STSF.Name; //FileInfo fiout = new FileInfo(OutputPathRoot + HaloMap.IndexItemStringList[index]); MemoryStream msout = new MemoryStream(); //msout = fiout.Open(FileMode.Create,FileAccess.ReadWrite); //Grenadiac changed this to RW for archive hack TagHeader.SeekToTagDataStart(ref msout); fsin.Seek(HaloMap.IndexItems[index].MetaOffset, System.IO.SeekOrigin.Begin); byte TabByte = 0x09; string TabReplace = ""; TabReplace += (char)TabByte; Struct.StructInfo TagInfo = new Struct.StructInfo(); TagInfo.MapMagic = HaloMap.Map_Magic; TagInfo.MapVersion = HaloMap.MapHeader.Map_Version; TagInfo.SoundsFile = fsSound; TagInfo.BitmapsFile = fsBitmap; TagInfo.IndexItems = HaloMap.IndexItems; TagInfo.TagMagic = HaloMap.IndexItems[index].MetaMagic; TagInfo.IndicesOffset = HaloMap.IndexHeader.Index_Offset; TagInfo.VerticesOffset = HaloMap.IndexHeader.Verts_Offset; TagInfo.CurrentIndex = (uint)index; TagInfo.TagHeaderSize = 0x40; // Create a new struct processor Struct MainStruct = new Struct(); string[] Tags = null; MainStruct.DoProcessStruct(ref STSF, ref fsin, ref msout, 1, STSF.GetUName(), ref TagInfo, ref Tags, ref Tags); //******FIX ME ******// Structure2 MainStruct = new Structure2(); //******FIX ME ******// MainStruct.StructureCS(HaloMap.IndexItems[index].MetaOffset,(uint)MagIndex,HaloMap.IndexItems[index].MetaMagic,HaloMap.Map_Magic,MagArray,1,fsin,msout,fsBitmap,fsSound,HaloMap.IndexHeader.Verts_Offset,HaloMap.IndexHeader.Index_Offset,HaloMap.MapHeader.Map_Version); //public void StructureCS(uint MetaOffset,uint MagIndex,uint OffsetMagic,uint MapMagic,string[] StructureArray,uint ChunkCount,FileStream MapFile,FileStream TagFile,FileStream BitmapFile,FileStream SoundFile,uint VerticesOffset,uint IndicesOffset,StreamWriter ObjFile,uint MapVersion) // Initialize and write out the PROM tag header TagHeader tag_hdr = new TagHeader(); tag_hdr.TagClass0 = HaloMap.IndexItems[index].Type1; tag_hdr.TagClass1 = HaloMap.IndexItems[index].Type2; tag_hdr.TagClass2 = HaloMap.IndexItems[index].Type3; tag_hdr.GameVersion = m_MapVersion; tag_hdr.TagSize = (int)msout.Position - TagHeader.PROM_HEADER_SIZE; tag_hdr.Write(ref msout); //Write out a zero-attachment header tag_hdr.SeekToAttachStart(ref msout); AttachmentHeader attach_hdr = new AttachmentHeader(); attach_hdr.Write(ref msout); //GRENADIAC HACK to put tagfile into archive if (m_OutputArchive != null) { //m_OutputArchive.AddTagfileToArchive(HaloMap.IndexItemStringList[index], msout.GetBuffer(), (int)msout.Position); m_OutputArchive.AddFile(HaloMap.IndexItemStringList[index], GetSubArray(msout.GetBuffer(), 0, (int)msout.Position - 12)); } msout.Close(); fsBitmap.Close(); fsSound.Close(); }
private void ExtractH2Tag(int index) { //Load Shared Map streams FileStream fsShared = OptionsManager.GetHalo2SharedStream(); FileStream fsSinglePlayerShared = OptionsManager.GetHalo2SinglePlayerSharedStream(); FileStream fsMainMenu = OptionsManager.GetHalo2MainMenuStream(); //Tag Header loader start string TagClass = CompUtil.GetTagClass(BitConverter.GetBytes(Halo2Map.IndexItem[index].TagType), 0); if (TagClass == "<fx>") { TagClass = "FXFX"; } byte[] TagHeaderBuffer = new byte[64]; OptionsManager.GetGuerillaHeader(m_MapVersion, TagClass, TagHeaderBuffer); string MagfilePathRoot = Application.StartupPath + @"\Tag Structures\Halo2\"; string OutputPathRoot = Application.StartupPath + @"\Games\Xbox\Halo2\"; //Creating Directorys for extacted tag string[] Directorys = new string[256]; string DirSep = @"\"; Directorys = Halo2Map.StringTable.TagStrings[index].Split(DirSep.ToCharArray(), 256); uint Dircount = (uint)Directorys.Length - 1; string NewDirectoryStructure = ""; for (uint Count = 0; Count < Dircount; Count += 1) { if (Directory.Exists(OutputPathRoot + NewDirectoryStructure + Directorys[Count]) == false) { Directory.CreateDirectory(OutputPathRoot + NewDirectoryStructure + Directorys[Count]); NewDirectoryStructure += Directorys[Count] + @"\"; } else { NewDirectoryStructure += Directorys[Count] + @"\"; } } //Loading Tag Long name from mag file string ProcessTagFile = TagClass.Trim() + ".mag"; StreamReader MagReader = new StreamReader(MagfilePathRoot + ProcessTagFile); string InLine = MagReader.ReadLine(); //Create the Tag on disk string SplitChar = "."; string[] FixTagName = Halo2Map.StringTable.TagStrings[index].Split(SplitChar.ToCharArray(), 2); //FileInfo fiout = new FileInfo(OptionsManager.GetExtractPath(m_MapVersion) + FixTagName[0] + "." + InLine.Trim()); string FileName = FixTagName[0] + "." + InLine.Trim(); MemoryStream msout = new MemoryStream(); TagHeader.SeekToTagDataStart(ref msout); // Create a tag table for byte[] TagTable = new byte[TagCount * 16]; fsin.Seek(Halo2Map.IndexHeader.OffsetToTags, System.IO.SeekOrigin.Begin); fsin.Read(TagTable, 0, TagTable.Length); // Move File pointer to start of tag fsin.Seek(Halo2Map.IndexItem[index].TagOffset, System.IO.SeekOrigin.Begin); // Create the Tab char to provent errors byte TabByte = 0x09; string TabReplace = ""; TabReplace += (char)TabByte; // Read the Structure from the mag file string[] MagArray = new string[256]; int MagIndex = 0; do { InLine = MagReader.ReadLine(); MagArray[MagIndex] = InLine.Replace(TabReplace, "").ToLower().Trim(); MagIndex = MagIndex + 1; }while(MagReader.Peek() != -1); MagReader.Close(); // Create debug stream writer //StreamWriter DebugFile; //DebugFile = new StreamWriter(msout.Name + ".txt" ); // Start the Tags extraction Halo2Structure MainStruct = new Halo2Structure(); //if(TagClass == "sbsp") MainStruct.StructureCS((uint)MagIndex, Halo2Map.IndexItem[index].TagOffsetMagic, Halo2Map.IndexItem[index].TagMagic, MagArray, 1, fsin, msout, fsShared, 0, 0, Halo2Map.StringTable.StringBuffer, Halo2Map.StringTable.OffsetsBuffer, fsSinglePlayerShared, fsMainMenu, fsShared, Halo2Map.MapHeader.MetaStart, Halo2Map.MapHeader.FileSize, null, TagTable, Halo2Map.MapHeader.ScriptStringArray); //DebugFile.Flush(); //DebugFile.Close(); //For Refernce only //public void StructureCS(uint MagIndex,uint OffsetMagic,uint MapMagic,string[] StructureArray,uint ChunkCount,FileStream MapFile,FileStream TagFile,FileStream BitmapFile,uint VerticesOffset,uint IndicesOffset,byte[] StringTable,byte[] StringTableOffsetList,FileStream single_player_shared_map,FileStream mainmenu_map,FileStream shared_map,uint StartOfTags,uint MapSize,StreamWriter DebugFile,byte[] TagTable,string[] ScriptStringArray) // Initialize and write out the PROM tag header TagHeader tag_hdr = new TagHeader(); tag_hdr.TagClass0 = Halo2Map.IndexItem[index].TagType; tag_hdr.GameVersion = m_MapVersion; tag_hdr.TagSize = (int)msout.Position - TagHeader.PROM_HEADER_SIZE; tag_hdr.Write(ref msout); //Write out a zero-attachment header tag_hdr.SeekToAttachStart(ref msout); AttachmentHeader attach_hdr = new AttachmentHeader(); attach_hdr.Write(ref msout); if (m_OutputArchive != null) { //m_OutputArchive.AddTagfileToArchive(HaloMap.IndexItemStringList[index], msout.GetBuffer(), (int)msout.Position); m_OutputArchive.AddFile(FileName, GetSubArray(msout.GetBuffer(), 0, (int)msout.Position - 12)); } msout.Close(); fsShared.Close(); fsSinglePlayerShared.Close(); fsMainMenu.Close(); }
private void CombinedExtractTag(int index) { FileStream fsBitmap = null; FileStream fsSound = null; FileStream fsShared = null; FileStream fsSinglePlayerShared = null; FileStream fsMainMenu = null; switch (m_MapVersion) { case MapfileVersion.HALOPC: case MapfileVersion.HALOCE: fsBitmap = OptionsManager.GetBitmapStream(m_MapVersion); fsSound = OptionsManager.GetSoundStream(m_MapVersion); break; case MapfileVersion.XHALO2: fsShared = OptionsManager.GetHalo2SharedStream(); fsSinglePlayerShared = OptionsManager.GetHalo2SinglePlayerSharedStream(); fsMainMenu = OptionsManager.GetHalo2MainMenuStream(); break; } string TagClass; if (m_MapVersion == MapfileVersion.XHALO2) { TagClass = GetTagClass(BitConverter.GetBytes(Halo2Map.IndexItem[index].TagType), 0); } else { TagClass = GetTagClass(BitConverter.GetBytes(HaloMap.IndexItems[index].Type1), 0); } if (TagClass == "<fx>") { TagClass = "FXFX"; } //byte[] TagHeaderBuffer = new byte[64]; //OptionsManager.GetGuerillaHeader(m_MapVersion, TagClass, TagHeaderBuffer); //Loading Tag Long name and seting the map version folder string MagfilePathRoot = OptionsManager.GetMagfilePath(m_MapVersion); string OutputPathRoot = OptionsManager.GetExtractPath(m_MapVersion); //Creating Directorys for extracted tags; string[] Directorys = new string[256]; string DirSep = @"\"; if (m_MapVersion == MapfileVersion.XHALO2) { Directorys = Halo2Map.StringTable.TagStrings[index].Split(DirSep.ToCharArray(), 256); } else { Directorys = HaloMap.IndexItemStringList[index].Split(DirSep.ToCharArray(), 256); } //Create tag directory if it doesn't exist uint Dircount = (uint)Directorys.Length - 1; string NewDirectoryStructure = ""; for (uint Count = 0; Count < Dircount; Count += 1) { if (Directory.Exists(OutputPathRoot + NewDirectoryStructure + Directorys[Count]) == false) { Directory.CreateDirectory(OutputPathRoot + NewDirectoryStructure + Directorys[Count]); NewDirectoryStructure += Directorys[Count] + @"\"; } else { NewDirectoryStructure += Directorys[Count] + @"\"; } } //Parse mag file string ProcessTagFile = TagClass.Trim() + ".mag"; StreamReader MagReader = new StreamReader(MagfilePathRoot + ProcessTagFile); string InLine = MagReader.ReadLine(); string TagExtension = InLine; byte TabByte = 0x09; string TabReplace = ""; TabReplace += (char)TabByte; string[] MagArray = new string[256]; int MagIndex = 0; do { InLine = MagReader.ReadLine(); MagArray[MagIndex] = InLine.Replace(TabReplace, "").ToLower().Trim(); MagIndex++; }while(MagReader.Peek() != -1); MagReader.Close(); //Create output tag stream/file FileInfo fiout; if (m_MapVersion == MapfileVersion.XHALO2) { string SplitChar = "."; string[] FixTagName = Halo2Map.StringTable.TagStrings[index].Split(SplitChar.ToCharArray(), 2); fiout = new FileInfo(OutputPathRoot + FixTagName[0] + "." + TagExtension.Trim()); } else { fiout = new FileInfo(OutputPathRoot + HaloMap.IndexItemStringList[index]); } MemoryStream msout = new MemoryStream(); //msout = fiout.Open(FileMode.Create,FileAccess.ReadWrite); //Grenadiac changed this to RW for archive hack //msout.Seek(0,System.IO.SeekOrigin.Begin); TagHeader.SeekToTagDataStart(ref msout); //msout.Write(TagHeaderBuffer,0,64); //Parse the meta and reformat output tag according to Magfile rules if (m_MapVersion == MapfileVersion.XHALO2) { // Create debug stream writer StreamWriter DebugFile; DebugFile = null;//new StreamWriter(Application.StartupPath + @"\TagDebug.txt"); byte[] TagTable = new byte[TagCount * 16]; fsin.Seek(Halo2Map.IndexHeader.OffsetToTags, System.IO.SeekOrigin.Begin); fsin.Read(TagTable, 0, TagTable.Length); Halo2Structure MainStruct = new Halo2Structure(); if (TagClass == "sbsp") { MainStruct.StructureCS((uint)MagIndex, Halo2Map.IndexItem[index].TagOffsetMagic, Halo2Map.IndexItem[index].TagMagic, MagArray, 1, fsin, msout, fsShared, 0, 0, Halo2Map.StringTable.StringBuffer, Halo2Map.StringTable.OffsetsBuffer, fsSinglePlayerShared, fsMainMenu, fsShared, Halo2Map.MapHeader.MetaStart, Halo2Map.MapHeader.FileSize, DebugFile, TagTable, Halo2Map.MapHeader.ScriptStringArray); } fsShared.Close(); fsSinglePlayerShared.Close(); fsMainMenu.Close(); } else { fsin.Seek(HaloMap.IndexItems[index].MetaOffset, System.IO.SeekOrigin.Begin); Structure2 MainStruct = new Structure2(); MainStruct.StructureCS(HaloMap.IndexItems[index].MetaOffset, (uint)MagIndex, HaloMap.IndexItems[index].MetaMagic, HaloMap.Map_Magic, MagArray, 1, fsin, msout, fsBitmap, fsSound, HaloMap.IndexHeader.Verts_Offset, HaloMap.IndexHeader.Index_Offset, HaloMap.MapHeader.Map_Version); fsBitmap.Close(); fsSound.Close(); } // Initialize and write out the PROM tag header TagHeader tag_hdr = new TagHeader(); tag_hdr.TagClass0 = TagClass; tag_hdr.GameVersion = (MapfileVersion)m_MapVersion; tag_hdr.TagSize = (int)msout.Position - TagHeader.PROM_HEADER_SIZE; tag_hdr.Write(ref msout); //Write out a zero-attachment header AttachmentHeader attach_hdr = new AttachmentHeader(); attach_hdr.Write(ref msout); if (m_OutputArchive != null) { m_OutputArchive.AddTagfileToArchive(HaloMap.IndexItemStringList[index], msout.GetBuffer(), (int)msout.Position); } msout.Close(); }
private void ExtractTag(int index) { FileStream fsBitmap = OptionsManager.GetBitmapStream(m_MapVersion); FileStream fsSound = OptionsManager.GetSoundStream(m_MapVersion); string TagClass = GetTagClass(BitConverter.GetBytes(HaloMap.IndexItems[index].Type1), 0); //Loading Tag Long name and seting the map version folder string ProcessTagFile = TagClass.Trim() + ".mag"; string MagfilePathRoot = ""; string OutputPathRoot = ""; switch (m_MapVersion) { case MapfileVersion.HALOPC: MagfilePathRoot = Application.StartupPath + @"\Tag Structures\PcHalo\"; OutputPathRoot = Application.StartupPath + @"\Games\Pc\Halo\"; break; case MapfileVersion.HALOCE: MagfilePathRoot = Application.StartupPath + @"\Tag Structures\CeHalo\"; OutputPathRoot = Application.StartupPath + @"\Games\Pc\Halo\"; break; case MapfileVersion.XHALO1: MagfilePathRoot = Application.StartupPath + @"\Tag Structures\XHalo\"; OutputPathRoot = Application.StartupPath + @"\Games\Xbox\Halo\"; break; } //Creating Directorys for extracted tags; string[] Directorys = new string[256]; string DirSep = @"\"; Directorys = HaloMap.IndexItemStringList[index].Split(DirSep.ToCharArray(), 256); uint Dircount = (uint)Directorys.Length - 1; string NewDirectoryStructure = ""; for (uint Count = 0; Count < Dircount; Count += 1) { if (Directory.Exists(OutputPathRoot + NewDirectoryStructure + Directorys[Count]) == false) { Directory.CreateDirectory(OutputPathRoot + NewDirectoryStructure + Directorys[Count]); NewDirectoryStructure += Directorys[Count] + @"\"; } else { NewDirectoryStructure += Directorys[Count] + @"\"; } } StreamReader MagReader = new StreamReader(MagfilePathRoot + ProcessTagFile); string InLine = MagReader.ReadLine(); FileInfo fiout = new FileInfo(OutputPathRoot + HaloMap.IndexItemStringList[index]); MemoryStream msout = new MemoryStream(); //msout = fiout.Open(FileMode.Create,FileAccess.ReadWrite); //Grenadiac changed this to RW for archive hack TagHeader.SeekToTagDataStart(ref msout); fsin.Seek(HaloMap.IndexItems[index].MetaOffset, System.IO.SeekOrigin.Begin); byte TabByte = 0x09; string TabReplace = ""; TabReplace += (char)TabByte; string[] MagArray = new string[256]; int MagIndex = 0; do { InLine = MagReader.ReadLine(); //MagArray[Count] = InLine.Split(new char[]{' '},256); MagArray[MagIndex] = InLine.Replace(TabReplace, "").ToLower().Trim(); MagIndex = MagIndex + 1; }while (MagReader.Peek() != -1); MagReader.Close(); Structure2 MainStruct = new Structure2(); MainStruct.StructureCS(HaloMap.IndexItems[index].MetaOffset, (uint)MagIndex, HaloMap.IndexItems[index].MetaMagic, HaloMap.Map_Magic, MagArray, 1, fsin, msout, fsBitmap, fsSound, HaloMap.IndexHeader.Verts_Offset, HaloMap.IndexHeader.Index_Offset, HaloMap.MapHeader.Map_Version); //public void StructureCS(uint MetaOffset,uint MagIndex,uint OffsetMagic,uint MapMagic,string[] StructureArray,uint ChunkCount,FileStream MapFile,FileStream TagFile,FileStream BitmapFile,FileStream SoundFile,uint VerticesOffset,uint IndicesOffset,StreamWriter ObjFile,uint MapVersion) // Initialize and write out the PROM tag header TagHeader tag_hdr = new TagHeader(); tag_hdr.TagClass0 = TagClass; tag_hdr.GameVersion = (MapfileVersion)m_MapVersion; tag_hdr.TagSize = (int)msout.Position - TagHeader.PROM_HEADER_SIZE; tag_hdr.Write(ref msout); //Write out a zero-attachment header tag_hdr.SeekToAttachStart(ref msout); AttachmentHeader attach_hdr = new AttachmentHeader(); attach_hdr.Write(ref msout); //GRENADIAC HACK to put tagfile into archive if (m_OutputArchive != null) { m_OutputArchive.AddTagfileToArchive(HaloMap.IndexItemStringList[index], msout.GetBuffer(), (int)msout.Position); } msout.Close(); fsBitmap.Close(); fsSound.Close(); }
public Tag(byte[] headerBytes) { Header = new TagHeader(headerBytes); }