static void CacheRebuildUnicTagsMethod(object param) { var args = param as CacheFileOutputInfoArgs; using (var handler = new CacheHandler <Blam.HaloReach.CacheFile>(args.Game, args.MapPath)) { handler.Read(); var cache = handler.CacheInterface; string header_name = cache.Header.Name; if (MapNeedsUniqueName(header_name)) { header_name = cache.GetUniqueName(); } Blam.Cache.CacheItemGen3 game_globals = null; foreach (var tag in cache.IndexHaloReach.Tags) { if (tag.GroupTag == GameTagGroups.matg) { game_globals = tag as Blam.Cache.CacheItemGen3; break; } } Assert.IsNotNull(game_globals); cache.InputStream.Seek(game_globals.Offset + Blam.Cache.CacheFileLanguagePackResourceGen3.kGlobalsOffsetHaloReach); var lang_pack_english = new Blam.Cache.CacheFileLanguagePackResourceGen3(null); lang_pack_english.Read(cache.InputStream); lang_pack_english.ReadFromCache(cache); lang_pack_english.ToString(); var xml_settings = new System.Xml.XmlWriterSettings(); xml_settings.Indent = true; xml_settings.IndentChars = "\t"; string results_path = BuildResultPath(kTagDumpPath, args.Game, header_name, "unic", "txt"); #region StreamWriter Unic if (false) { using (var s = new System.IO.StreamWriter(results_path, false, System.Text.Encoding.UTF8)) { foreach (var tag in cache.IndexHaloReach.Tags) { if (tag.GroupTag != GameTagGroups.unic) { continue; } var index = cache.TagIndexManager.Open(tag.Datum); var man = cache.TagIndexManager[index]; var def = man.TagDefinition; var unic = def as GameTags.multilingual_unicode_string_list_group; if (unic != null) { s.WriteLine("{0}\t{1}", man.GroupTag.TagToString(), man.Name); unic.ReconstructHack(cache, lang_pack_english); unic.ToStream(s, man, null); } cache.TagIndexManager.Unload(index); } } } #endregion #region XmlWriter Unic results_path = BuildResultPath(kTagDumpPath, args.Game, header_name, "unic", "xml"); xml_settings.Encoding = System.Text.Encoding.UTF8; xml_settings.CheckCharacters = false; if (false) { using (var s = System.Xml.XmlTextWriter.Create(results_path, xml_settings)) { s.WriteStartDocument(true); s.WriteStartElement("localizationDefinitions"); s.WriteAttributeString("game", "HaloReach_Xbox"); foreach (var tag in cache.IndexHaloReach.Tags) { if (tag.GroupTag != GameTagGroups.unic) { continue; } var index = cache.TagIndexManager.Open(tag.Datum); var man = cache.TagIndexManager[index]; var def = man.TagDefinition; var unic = def as GameTags.multilingual_unicode_string_list_group; unic.ReconstructHack(cache, lang_pack_english); unic.ToStream(s, man, null); cache.TagIndexManager.Unload(index); } s.WriteEndElement(); s.WriteEndDocument(); } } xml_settings.CheckCharacters = true; #endregion #region StreamWriter Interface results_path = BuildResultPath(kTagDumpPath, args.Game, header_name, "interface", "txt"); if (false) { using (var s = new System.IO.StreamWriter(results_path)) { foreach (var tag in cache.IndexHaloReach.Tags) { if (!kInterfaceGroupTags.Contains(tag.GroupTag)) { continue; } var index = cache.TagIndexManager.Open(tag.Datum); var man = cache.TagIndexManager[index]; var def = man.TagDefinition; var to_stream = def as GameTags.ITempToStreamInterface; s.WriteLine("{0}\t{1}", man.GroupTag.TagToString(), man.Name); to_stream.ToStream(s, man, null); cache.TagIndexManager.Unload(index); } } } #endregion #region XmlWriter Interface results_path = BuildResultPath(kTagDumpPath, args.Game, header_name, "interface", "xml"); xml_settings.Encoding = System.Text.Encoding.ASCII; using (var s = System.Xml.XmlTextWriter.Create(results_path, xml_settings)) { s.WriteStartDocument(true); s.WriteStartElement("interfaceDefinitions"); s.WriteAttributeString("game", "HaloReach_Xbox"); foreach (var tag in cache.IndexHaloReach.Tags) { if (!kInterfaceGroupTags.Contains(tag.GroupTag)) { continue; } var index = cache.TagIndexManager.Open(tag.Datum); var man = cache.TagIndexManager[index]; var def = man.TagDefinition; var to_stream = def as GameTags.ITempToXmlStreamInterface; to_stream.ToStream(s, man, null); cache.TagIndexManager.Unload(index); } s.WriteEndElement(); s.WriteEndDocument(); } #endregion } }
static void CacheOutputMegaloInformationMethod(object param) { var args = param as CacheFileOutputInfoArgs; using (var handler = new CacheHandler <Blam.HaloReach.CacheFile>(args.Game, args.MapPath)) { handler.Read(); var cache = handler.CacheInterface; string header_name = cache.Header.Name; if (MapNeedsUniqueName(header_name)) { header_name = cache.GetUniqueName(); } var xml_settings = new System.Xml.XmlWriterSettings(); xml_settings.Indent = true; xml_settings.IndentChars = "\t"; string results_path = BuildResultPath(kTagDumpPath, args.Game, header_name, "megalo", "txt"); #region StreamWriter if (false) { using (var s = new System.IO.StreamWriter(results_path)) { foreach (var tag in cache.IndexHaloReach.Tags) { if (!kMegaloGroupTags.Contains(tag.GroupTag)) { continue; } var index = cache.TagIndexManager.Open(tag.Datum); var man = cache.TagIndexManager[index]; var def = man.TagDefinition; var to_stream = def as GameTags.ITempToStreamInterface; if (to_stream != null) { s.WriteLine("{0}\t{1}", man.GroupTag.TagToString(), man.Name); to_stream.ToStream(s, man, null); } cache.TagIndexManager.Unload(index); } } } #endregion #region XmlWriter results_path = BuildResultPath(kTagDumpPath, args.Game, header_name, "megalo", "xml"); using (var s = System.Xml.XmlTextWriter.Create(results_path, xml_settings)) { s.WriteStartDocument(true); s.WriteStartElement("megaloDefinitions"); s.WriteAttributeString("game", "HaloReach_Xbox"); foreach (var tag in cache.IndexHaloReach.Tags) { if (!kMegaloGroupTags.Contains(tag.GroupTag)) { continue; } var index = cache.TagIndexManager.Open(tag.Datum); var man = cache.TagIndexManager[index]; var def = man.TagDefinition; var to_stream = def as GameTags.ITempToXmlStreamInterface; to_stream.ToStream(s, man, null); cache.TagIndexManager.Unload(index); } s.WriteEndElement(); s.WriteEndDocument(); } #endregion } args.SignalFinished(); }