public TagRefData(string name, uint offset, uint address, TagHierarchy allTags, Visibility showJumpTo, bool withClass, uint pluginLine) : base(name, offset, address, pluginLine) { _allTags = allTags; _withClass = withClass; _showJumpTo = showJumpTo; }
public MetaEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie) { InitializeComponent(); _parentMetaContainer = parentContainer; _tag = tag; _tags = tags; _buildInfo = buildInfo; _cache = cache; _fileManager = streamManager; _rteProvider = rteProvider; _searchTimer = new Timer(SearchTimer); _stringIdTrie = stringIDTrie; // Load Plugin Path string className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(tag.RawTag.Class.Magic)).Trim(); _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins", _buildInfo.Settings.GetSetting <string>("plugins"), className); // Set Option boxes cbShowInvisibles.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles; cbShowComments.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowComments; cbShowEnumIndex.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowEnumIndex; cbShowInformation.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInformation; // Load Meta RefreshEditor(MetaReader.LoadType.File); // Set init finished hasInitFinished = true; }
public MetaContainer(BuildInformation buildInfo, TagEntry tag, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie) { InitializeComponent(); _tag = tag; _tags = tags; _buildInfo = buildInfo; _cache = cache; _streamManager = streamManager; _rteProvider = rteProvider; _stringIDTrie = stringIDTrie; tbMetaEditors.SelectedIndex = (int)Settings.halomapLastSelectedMetaEditor; // Create Meta Information Tab _metaInformation = new MetaInformation(_buildInfo, _tag, _cache); tabTagInfo.Content = _metaInformation; // Create Meta Editor Tab _metaEditor = new MetaEditor(_buildInfo, _tag, this, _tags, _cache, _streamManager, _rteProvider, _stringIDTrie) { Padding = new Thickness(0) }; tabMetaEditor.Content = _metaEditor; // Create Plugin Editor Tab _pluginEditor = new PluginEditor(_buildInfo, _tag, this, _metaEditor); tabPluginEditor.Content = _pluginEditor; }
public InjectSettings(TagHierarchy tags, TagContainer container) { InitializeComponent(); Container = container; _allTags = tags; List <int> blah = new List <int>(); foreach (ExtractedTag t in Container.Tags) { blah.Add(t.Group); } UsedGroups.Add(new ExtractedGroup(0x2D2D2D2D)); foreach (int t in blah.Distinct()) { UsedGroups.Add(new ExtractedGroup(t)); } UsedGroups = UsedGroups.OrderBy(c => c.MagicString).ToList(); tagGroups.ItemsSource = UsedGroups; tagGroups.SelectedIndex = 0; }
public MetaEditor(BuildInformation buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie) { InitializeComponent(); _parentMetaContainer = parentContainer; _tag = tag; _tags = tags; _buildInfo = buildInfo; _cache = cache; _streamManager = streamManager; _rteProvider = rteProvider; _searchTimer = new Timer(SearchTimer); _stringIDTrie = stringIDTrie; // Load Plugin Path string className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(tag.RawTag.Class.Magic)).Trim(); _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins", _buildInfo.PluginFolder, className); // Set Invisibility box cbShowInvisibles.IsChecked = Settings.pluginsShowInvisibles; // Load Meta RefreshEditor(); // Set init finished hasInitFinished = true; }
public MetaEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie) { InitializeComponent(); _parentMetaContainer = parentContainer; _tag = tag; _tags = tags; _buildInfo = buildInfo; _cache = cache; _fileManager = streamManager; _rteProvider = rteProvider; _searchTimer = new Timer(SearchTimer); _stringIdTrie = stringIDTrie; // Load Plugin Path string className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(tag.RawTag.Class.Magic)).Trim(); _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins", _buildInfo.Settings.GetSetting<string>("plugins"), className); // Set Option boxes cbShowInvisibles.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles; cbShowComments.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowComments; cbShowEnumIndex.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowEnumIndex; cbShowInformation.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInformation; // Load Meta RefreshEditor(MetaReader.LoadType.File); // Set init finished hasInitFinished = true; }
public TagRefData(string name, uint offset, long address, TagHierarchy allTags, Visibility showTagOptions, bool withClass, uint pluginLine) : base(name, offset, address, pluginLine) { _allTags = allTags; _withClass = withClass; _showTagOptions = showTagOptions; }
public TagRefData(string name, uint offset, long address, TagHierarchy allTags, Visibility showTagOptions, bool withGroup, uint pluginLine, string tooltip) : base(name, offset, address, pluginLine, tooltip) { _allTags = allTags; _withGroup = withGroup; _showTagOptions = showTagOptions; }
public TagRefData(string name, uint offset, uint address, TagHierarchy allTags, Visibility showJumpTo, bool withClass, uint pluginLine) : base(name, offset, address, pluginLine) { _allTags = allTags; _withClass = withClass; _showJumpTo = showJumpTo; }
/// <summary> /// Initializes a new <see cref="IndexEntry"/> using the supplied object entry, file name, and tag hierarchy. /// </summary> /// <param name="objectEntry">The object entry for this index entry.</param> /// <param name="filename">The file path of this index entry.</param> /// <param name="tagHierarchy">The tag hierarchy for this index entry.</param> public IndexEntry(ObjectEntry objectEntry, string filename, TagHierarchy tagHierarchy) { //Setup this.tagHierarchy = tagHierarchy; this.objectEntry = objectEntry; Filename = filename; Raws = new RawContainer(); Strings = new StringContainer(); }
public ThirdGenPluginVisitor(TagHierarchy tags, Trie stringIDTrie, FileSegmentGroup metaArea, bool showInvisibles) { _tags = tags; _stringIDTrie = stringIDTrie; _metaArea = metaArea; Values = new ObservableCollection <MetaField>(); Reflexives = new ObservableCollection <ReflexiveData>(); _showInvisibles = showInvisibles; }
public AssemblyPluginVisitor(TagHierarchy tags, Trie stringIDTrie, FileSegmentGroup metaArea, bool showInvisibles, bool viewValueAs = false) { _tags = tags; _stringIDTrie = stringIDTrie; _metaArea = metaArea; Values = new ObservableCollection <MetaField>(); TagBlocks = new ObservableCollection <TagBlockData>(); _showInvisibles = showInvisibles; _viewValueAs = viewValueAs; }
public static TagHierarchy CreateTagHierarchy(int iTagHierarchyId, int iTitleId, int iTitleTagId, int iTitleTagTitleId, int iTitleTagTitleTagId, int iTitleTagTitleTagTitleId, int iTitleTagTitleTagTitleTagId) { TagHierarchy objTagHierarchy = new TagHierarchy(); objTagHierarchy.ID = iTagHierarchyId; //Level 0 objTagHierarchy.TitleID = iTitleId; objTagHierarchy.TitleTagID = iTitleTagId; objTagHierarchy.TitleTagTitleID = iTitleTagTitleId; objTagHierarchy.TitleTagTitleTagID = iTitleTagTitleTagId; objTagHierarchy.TitleTagTitleTagTitleID = iTitleTagTitleTagTitleId; objTagHierarchy.TitleTagTitleTagTitleTagID = iTitleTagTitleTagTitleTagId; //Level 6 return(objTagHierarchy); }
public MetaEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie) { InitializeComponent(); _parentMetaContainer = parentContainer; _tag = tag; _tags = tags; _buildInfo = buildInfo; _cache = cache; _fileManager = streamManager; _rteProvider = rteProvider; _searchTimer = new Timer(SearchTimer); _stringIdTrie = stringIDTrie; // Load Plugin Path string groupName = VariousFunctions.SterilizeTagGroupName(CharConstant.ToString(tag.RawTag.Group.Magic)).Trim(); _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins", _buildInfo.Settings.GetSetting <string>("plugins"), groupName); if (_buildInfo.Settings.PathExists("fallbackPlugins")) { _fallbackPluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins", _buildInfo.Settings.GetSetting <string>("fallbackPlugins"), groupName); } // Set Option boxes cbShowInvisibles.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles; cbShowComments.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowComments; cbShowInformation.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInformation; cbEnumPrefix.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.PluginsEnumPrefix; // Load Meta RefreshEditor(MetaReader.LoadType.File); // Load Info lblTagName.Text = tag.TagFileName != null ? tag.TagFileName + "." + tag.GroupName : "0x" + tag.RawTag.Index.Value.ToString("X"); lblDatum.Text = string.Format("{0}", tag.RawTag.Index); lblAddress.Text = string.Format("0x{0:X8}", tag.RawTag.MetaLocation.AsPointer()); lblOffset.Text = string.Format("0x{0:X}", tag.RawTag.MetaLocation.AsOffset()); // Set init finished hasInitFinished = true; }
public MetaEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie) { InitializeComponent(); _parentMetaContainer = parentContainer; _tags = tags; _buildInfo = buildInfo; _cache = cache; _fileManager = streamManager; _rteProvider = rteProvider; _searchTimer = new Timer(SearchTimer); _stringIdTrie = stringIDTrie; LoadNewTagEntry(tag); // Set init finished hasInitFinished = true; }
public MetaContainer(BuildInformation buildInfo, TagEntry tag, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager) { InitializeComponent(); _tag = tag; _buildInfo = buildInfo; _cache = cache; tbMetaEditors.SelectedIndex = (int)Settings.halomapLastSelectedMetaEditor; // Create Meta Information Tab MetaInformation metaInformation = new MetaInformation(_buildInfo, _tag, _cache); tabTagInfo.Content = metaInformation; // Create Meta Editor Tab MetaEditor metaEditor = new MetaEditor(_buildInfo, _tag, tags, _cache, streamManager); tabMetaEditor.Content = metaEditor; // Create Plugin Editor Tab PluginEditor pluginEditor = new PluginEditor(_buildInfo, _tag, this, metaEditor); tabPluginEditor.Content = pluginEditor; }
public static List <TagHierarchy> PopulateTagHierarchy(JObject jo) { int iTagHierarchyId = -1, iTitleId = -1, iTitleTagId = -1, iTitleTagTitleId = -1, iTitleTagTitleTagId = -1, iTitleTagTitleTagTitleId = -1, iTitleTagTitleTagTitleTagId = -1; List <TagHierarchy> lstTagsHierarchy = new List <TagHierarchy> (); foreach (JToken token0 in jo.SelectToken("tagHierarchy")) { if (token0.HasValues) { // Console.WriteLine (token.ToString ()); //Converts string to JSON object JObject obj = JObject.Parse("{" + token0.ToString() + "}"); foreach (var pair in obj) { //Level 0 if (pair.Key == "id") { iTagHierarchyId = (int)obj[pair.Key]; //objTagHierarchy.ID = iTagHierarchyId; } //Console.WriteLine(pair.Key + "," + pair.Value); if (pair.Key == "titles") { foreach (JToken token1 in pair.Value) { // Console.WriteLine (token1.ToString ()); //Converts string to JSON object if (token1.HasValues) { JObject obj1 = JObject.Parse(token1.ToString()); foreach (var pair1 in obj1) { //Level 1 if (pair1.Key == "id") { iTitleId = (int)obj1[pair1.Key]; //objTagHierarchy.TitleID = iTitleId; } //Console.WriteLine(pair2.Key + "," + pair2.Value); if (pair1.Key == "tags") { foreach (JToken token2 in pair1.Value) { // Console.WriteLine (token2.ToString ()); if (token2.HasValues) { JObject obj2 = JObject.Parse(token2.ToString()); foreach (var pair2 in obj2) { //Level 2 if (pair2.Key == "id") { iTitleTagId = (int)obj2[pair2.Key]; //objTagHierarchy.TitleTagID = iTitleTagId; } if (pair2.Key == "titles") { foreach (JToken token3 in pair2.Value) { // Console.WriteLine (token3.ToString ()); if (token3.HasValues) { JObject obj3 = JObject.Parse(token3.ToString()); foreach (var pair3 in obj3) { //Level 3 if (pair3.Key == "id") { iTitleTagTitleId = (int)obj3[pair3.Key]; //objTagHierarchy.TitleTagTitleID = iTitleTagTitleId; } if (pair3.Key == "tags") { foreach (JToken token4 in pair3.Value) { // Console.WriteLine (token4.ToString ()); if (token4.HasValues) { JObject obj4 = JObject.Parse(token4.ToString()); foreach (var pair4 in obj4) { //Level 4 if (pair4.Key == "id") { iTitleTagTitleTagId = (int)obj4[pair4.Key]; //objTagHierarchy.TitleTagTitleTagID = iTitleTagTitleTagId; } if (pair4.Key == "titles") { foreach (JToken token5 in pair4.Value) { //Console.WriteLine (token5.ToString ()); if (token5.HasValues) { JObject obj5 = JObject.Parse(token5.ToString()); foreach (var pair5 in obj5) { //Level 5 if (pair5.Key == "id") { iTitleTagTitleTagTitleId = (int)obj5[pair5.Key]; //objTagHierarchy.TitleTagTitleTagTitleID = iTitleTagTitleTagTitleId; } if (pair5.Key == "tags") { foreach (JToken token6 in pair5.Value) { if (token6.HasValues) //over { } else { //Level 6 //Console.WriteLine ("LEVEL6 " + token6.ToString ()); iTitleTagTitleTagTitleTagId = Convert.ToInt32(token6.ToString()); //objTagHierarchy.TitleTagTitleTagTitleTagID = iTitleTagTitleTagTitleTagId; TagHierarchy obFinalObject = CreateTagHierarchy(iTagHierarchyId, iTitleId, iTitleTagId, iTitleTagTitleId, iTitleTagTitleTagId, iTitleTagTitleTagTitleId, iTitleTagTitleTagTitleTagId); lstTagsHierarchy.Add(obFinalObject); } } } } } else //Level 5 { if (token5.HasValues) //over { } else { //Level 5 //Console.WriteLine ("LEVEL5 " + token5.ToString ()); iTitleTagTitleTagTitleId = Convert.ToInt32(token5.ToString()); //objTagHierarchy.TitleTagTitleTagTitleID = iTitleTagTitleTagTitleId; TagHierarchy obFinalObject = CreateTagHierarchy(iTagHierarchyId, iTitleId, iTitleTagId, iTitleTagTitleId, iTitleTagTitleTagId, iTitleTagTitleTagTitleId, -1); lstTagsHierarchy.Add(obFinalObject); } } } } } } //token4 if else { //Level 4 //Console.WriteLine ("LEVEL4 " + token4.ToString ()); iTitleTagTitleTagId = Convert.ToInt32(token4.ToString()); //objTagHierarchy.TitleTagTitleTagTitleID = iTitleTagTitleTagTitleId; TagHierarchy obFinalObject = CreateTagHierarchy(iTagHierarchyId, iTitleId, iTitleTagId, iTitleTagTitleId, iTitleTagTitleTagId, -1, -1); lstTagsHierarchy.Add(obFinalObject); } } } } } //token3 if else { //Level 3 //Console.WriteLine ("LEVEL3 " + token3.ToString ()); iTitleTagTitleId = Convert.ToInt32(token3.ToString()); //objTagHierarchy.TitleTagTitleTagTitleID = iTitleTagTitleTagTitleId; TagHierarchy obFinalObject = CreateTagHierarchy(iTagHierarchyId, iTitleId, iTitleTagId, iTitleTagTitleId, -1, -1, -1); lstTagsHierarchy.Add(obFinalObject); } } } } } //token2 if else { //Level 2 //Console.WriteLine ("LEVEL2 " + token2.ToString ()); iTitleTagId = Convert.ToInt32(token2.ToString()); //objTagHierarchy.TitleTagTitleTagTitleID = iTitleTagTitleTagTitleId; TagHierarchy obFinalObject = CreateTagHierarchy(iTagHierarchyId, iTitleId, iTitleTagId, -1, -1, -1, -1); lstTagsHierarchy.Add(obFinalObject); } } //lstTagNames.Add( new TagName{ ID = Convert.ToInt32(pair.Key), Description = pair.Value.ToString() }); } } } //token1 if else { //Level 1 //Console.WriteLine ("LEVEL1 " + token1.ToString ()); iTitleId = Convert.ToInt32(token1.ToString()); //objTagHierarchy.TitleTagTitleTagTitleID = iTitleTagTitleTagTitleId; TagHierarchy obFinalObject = CreateTagHierarchy(iTagHierarchyId, iTitleId, -1, -1, -1, -1, -1); lstTagsHierarchy.Add(obFinalObject); } } //lstTagNames.Add( new TagName{ ID = Convert.ToInt32(pair.Key), Description = pair.Value.ToString() }); } } } //token0 if else { //Level 0 //Console.WriteLine ("LEVEL0 " + token0.ToString ()); iTagHierarchyId = Convert.ToInt32(token0.ToString()); //objTagHierarchy.TitleTagTitleTagTitleID = iTitleTagTitleTagTitleId; TagHierarchy obFinalObject = CreateTagHierarchy(iTagHierarchyId, -1, -1, -1, -1, -1, -1); lstTagsHierarchy.Add(obFinalObject); } //int iCount = lstTagsHierarchy.Count; // JObject obj = JObject.Parse(jsonString); // List<Object> lstTransactionBatches = new List<Object>(); // foreach (var pair in obj) { // Console.WriteLine (pair.Key); // Console.WriteLine (pair.Value); // foreach (JToken result in pair.Value) // { // Object objTransactionBatch = result.ToObject<Object>(); // lstTransactionBatches.Add(objTransactionBatch); // } // } // // JObject jo = JObject.Parse(jsonString); // foreach (JToken token in jo.SelectToken("tagHierarchy")) // { // Console.WriteLine(token.Path + ": " + token.ToString()); // } // return null; // Object objRoot = JsonConvert.DeserializeObject<Object> (jsonString); // JArray objResult = ((dynamic) objRoot) ["ChildrenTokens"]; // foreach (JToken result in objResult) { // Object objTransactionBatch = result.ToObject<Object> (); // //lstTransactionBatches.Add(objTransactionBatch); // } // DataTable dtTable = jsonStringToTable(objResult.ToString()); // return dtTable; // if (callService.TruncateTable ()) { // string strInsertCalls = callService.InsertCalls (lstCalls) ? $"Inserted {lstCalls.Count} in STG_Call table" : "Failed to insert calls in STG_Call table"; // Console.WriteLine (strInsertCalls); // } else { // Console.WriteLine ("STG_Call table was not truncated"); // } } return(lstTagsHierarchy); }
public MetaContainer(EngineDescription buildInfo, string cacheLocation, TagEntry tag, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie) { InitializeComponent(); _cacheLocation = cacheLocation; _tag = tag; _tags = tags; _buildInfo = buildInfo; _cache = cache; _streamManager = streamManager; _rteProvider = rteProvider; _stringIDTrie = stringIDTrie; tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor; // Create Meta Information Tab //_metaInformation = new MetaInformation(_buildInfo, _tag, _cache); //tabTagInfo.Content = _metaInformation; if (App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor == Settings.LastMetaEditorType.Info) { tbMetaEditors.SelectedIndex = (int)Settings.LastMetaEditorType.MetaEditor; } // Create Meta Editor Tab _metaEditor = new MetaEditor(_buildInfo, _tag, this, _tags, _cache, _streamManager, _rteProvider, _stringIDTrie); tabMetaEditor.Content = _metaEditor; // Create Plugin Editor Tab _pluginEditor = new PluginEditor(_buildInfo, _tag, this, _metaEditor); tabPluginEditor.Content = _pluginEditor; // Create Raw Tabs #region Models //if (_cache.ResourceMetaLoader.SupportsRenderModels && _tag.RawTag.Group.Magic == CharConstant.FromString("mode")) //{ // tabSound.Visibility = Visibility.Visible; // tabSound.Content = new SoundEditor(_tag, _cache, _streamManager); //} //else //{ // tabSound.Visibility = Visibility.Collapsed; // if (App.AssemblyStorage.AssemblySettings.halomapLastSelectedMetaEditor == App.AssemblyStorage.AssemblySettings.LastMetaEditorType.Model) // tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.LastMetaEditorType.MetaEditor; //} #endregion #region Sound //if (_cache.ResourceMetaLoader.SupportsSounds && _tag.RawTag.Group.Magic == CharConstant.FromString("snd!")) //{ // tabSoundEditor.Visibility = Visibility.Visible; // tabSoundEditor.Content = new SoundEditor(_buildInfo, _cacheLocation, _tag, _cache, _streamManager); //} //else { tabSoundEditor.Visibility = Visibility.Collapsed; if (App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor == Settings.LastMetaEditorType.Sound) { tbMetaEditors.SelectedIndex = (int)Settings.LastMetaEditorType.MetaEditor; } } #endregion }
public MetaContainer(EngineDescription buildInfo, TagEntry tag, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie) { InitializeComponent(); _tag = tag; _tags = tags; _buildInfo = buildInfo; _cache = cache; _streamManager = streamManager; _rteProvider = rteProvider; _stringIDTrie = stringIDTrie; tbMetaEditors.SelectedIndex = (int) App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor; // Create Meta Information Tab _metaInformation = new MetaInformation(_buildInfo, _tag, _cache); tabTagInfo.Content = _metaInformation; // Create Meta Editor Tab _metaEditor = new MetaEditor(_buildInfo, _tag, this, _tags, _cache, _streamManager, _rteProvider, _stringIDTrie) { Padding = new Thickness(0) }; tabMetaEditor.Content = _metaEditor; // Create Plugin Editor Tab _pluginEditor = new PluginEditor(_buildInfo, _tag, this, _metaEditor); tabPluginEditor.Content = _pluginEditor; // Create Raw Tabs #region Models //if (_cache.ResourceMetaLoader.SupportsRenderModels && _tag.RawTag.Class.Magic == CharConstant.FromString("mode")) //{ // tabSound.Visibility = Visibility.Visible; // tabSound.Content = new SoundEditor(_tag, _cache, _streamManager); //} //else //{ // tabSound.Visibility = Visibility.Collapsed; // if (App.AssemblyStorage.AssemblySettings.halomapLastSelectedMetaEditor == App.AssemblyStorage.AssemblySettings.LastMetaEditorType.Model) // tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.LastMetaEditorType.MetaEditor; //} #endregion #region BSP /*if (true && _tag.RawTag.Class.Magic == CharConstant.FromString("sbsp")) // add some manual check here akarias, since you code isn't in blamite { tabBspEditor.Visibility = Visibility.Visible; tabBspEditor.Content = new BspEditor(_tag, _cache, _streamManager); } else*/ { tabBspEditor.Visibility = Visibility.Collapsed; if (App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor == Settings.LastMetaEditorType.Bsp) tbMetaEditors.SelectedIndex = (int) Settings.LastMetaEditorType.MetaEditor; } #endregion #region Sound //if (_cache.ResourceMetaLoader.SupportsSounds && _tag.RawTag.Class.Magic == CharConstant.FromString("snd!")) //{ // tabSound.Visibility = Visibility.Visible; // tabSound.Content = new SoundEditor(_tag, _cache, _streamManager); //} //else //{ // tabSound.Visibility = Visibility.Collapsed; // if (App.AssemblyStorage.AssemblySettings.halomapLastSelectedMetaEditor == App.AssemblyStorage.AssemblySettings.LastMetaEditorType.Sound) // tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.LastMetaEditorType.MetaEditor; //} #endregion }
/// <summary> /// Attempts to create a new tag using the supplied map file, tag four-character code, filename, and length. /// </summary> /// <param name="map">The map file to create a tag.</param> /// <param name="tagFourCc">The tag four-character code.</param> /// <param name="filename">The tag file name.</param> /// <param name="pad">The amount to pad the offset of the new tag to.</param> /// <param name="length">The length of the tag data.</param> /// <param name="tagId">If the function returns true, the new tag ID; otherwise null.</param> /// <returns>true if a new tag was successfully created; otherwise false.</returns> public static bool CreateTag(this MapFile map, string tagFourCc, string filename, uint pad, uint length, out TagId tagId) { //Prepare bool success = false; tagId = TagId.Null; //Check if (map == null) { throw new ArgumentNullException(nameof(map)); } if (tagFourCc == null) { throw new ArgumentNullException(nameof(tagFourCc)); } if (filename == null) { throw new ArgumentNullException(nameof(filename)); } if (string.IsNullOrEmpty(tagFourCc)) { throw new ArgumentException("Tag string cannot be blank.", nameof(tagFourCc)); } if (string.IsNullOrEmpty(filename)) { throw new ArgumentException("Tag file name cannot be blank.", nameof(tagFourCc)); } if (!map.Tags.ContainsTag(tagFourCc)) { throw new ArgumentException($"Map does not contain any tags matching {tagFourCc}"); } if (tagFourCc == HaloTags.sbsp) { throw new ArgumentException($"Cannot add new tag of type {HaloTags.sbsp}."); } if (tagFourCc == HaloTags.ltmp) { throw new ArgumentException($"Cannot add new tag of type {HaloTags.ltmp}."); } if (map.IndexEntries.Count < 2) { throw new InvalidOperationException("Invalid map file."); } //Get Last Tag IndexEntry last = map.IndexEntries.Last; //Get Tag TagHierarchy tag = map.Tags[tagFourCc]; TagId id = GetNextId(map.IndexEntries.Last.Id); //Get Offsets uint newOffset = last.Offset.PadTo(pad); uint coconutsOffset = (newOffset + length).PadTo(4); uint totalShift = coconutsOffset - last.Offset; //Shift raw addresses foreach (RawSection rawSection in Enum.GetValues(typeof(RawSection))) { foreach (var container in last.Raws[rawSection]) { for (int i = 0; i < container.OffsetAddresses.Count; i++) { container.OffsetAddresses[i] = container.OffsetAddresses[i] + totalShift; } for (int i = 0; i < container.LengthAddresses.Count; i++) { container.LengthAddresses[i] = container.LengthAddresses[i] + totalShift; } } } //Shift Coconuts ShiftCoconuts(last, totalShift); //Return return(success); }
public MetaContainer(EngineDescription buildInfo, string cacheLocation, TagEntry tag, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie) { InitializeComponent(); _cacheLocation = cacheLocation; _tag = tag; _tags = tags; _buildInfo = buildInfo; _cache = cache; _streamManager = streamManager; _rteProvider = rteProvider; _stringIDTrie = stringIDTrie; tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor; // Create Meta Information Tab //_metaInformation = new MetaInformation(_buildInfo, _tag, _cache); //tabTagInfo.Content = _metaInformation; if (App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor == Settings.LastMetaEditorType.Info) { tbMetaEditors.SelectedIndex = (int)Settings.LastMetaEditorType.MetaEditor; } // Create Meta Editor Tab _metaEditor = new MetaEditor(_buildInfo, _tag, this, _tags, _cache, _streamManager, _rteProvider, _stringIDTrie) { Padding = new Thickness(0) }; tabMetaEditor.Content = _metaEditor; // Create Plugin Editor Tab _pluginEditor = new PluginEditor(_buildInfo, _tag, this, _metaEditor); tabPluginEditor.Content = _pluginEditor; // Create Raw Tabs #region Models //if (_cache.ResourceMetaLoader.SupportsRenderModels && _tag.RawTag.Class.Magic == CharConstant.FromString("mode")) //{ // tabSound.Visibility = Visibility.Visible; // tabSound.Content = new SoundEditor(_tag, _cache, _streamManager); //} //else //{ // tabSound.Visibility = Visibility.Collapsed; // if (App.AssemblyStorage.AssemblySettings.halomapLastSelectedMetaEditor == App.AssemblyStorage.AssemblySettings.LastMetaEditorType.Model) // tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.LastMetaEditorType.MetaEditor; //} #endregion #region Sound if (_cache.ResourceMetaLoader.SupportsSounds && _tag.RawTag.Class.Magic == CharConstant.FromString("snd!")) { tabSoundEditor.Visibility = Visibility.Visible; tabSoundEditor.Content = new SoundEditor(_buildInfo, _cacheLocation, _tag, _cache, _streamManager); } else { tabSoundEditor.Visibility = Visibility.Collapsed; if (App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor == Settings.LastMetaEditorType.Sound) { tbMetaEditors.SelectedIndex = (int)Settings.LastMetaEditorType.MetaEditor; } } #endregion // Load Info lblTagName.Text = tag.TagFileName != null ? tag.TagFileName + "." + tag.ClassName : "0x" + tag.RawTag.Index.Value.ToString("X"); lblDatum.Text = string.Format("Datum Index: {0}", tag.RawTag.Index); lblAddress.Text = string.Format("Memory Address: 0x{0:X8}", tag.RawTag.MetaLocation.AsPointer()); lblOffset.Text = string.Format("File Offset: 0x{0:X}", tag.RawTag.MetaLocation.AsOffset()); }
/// <summary> /// Sets the index entry's internal tag hierarchy. /// </summary> /// <param name="tagHierarchy">The tag hierarchy value.</param> public void SetTagHeirarchy(TagHierarchy tagHierarchy) { this.tagHierarchy = tagHierarchy; }
public MetaContainer(EngineDescription buildInfo, TagEntry tag, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie) { InitializeComponent(); _tag = tag; _tags = tags; _buildInfo = buildInfo; _cache = cache; _streamManager = streamManager; _rteProvider = rteProvider; _stringIDTrie = stringIDTrie; tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor; // Create Meta Information Tab _metaInformation = new MetaInformation(_buildInfo, _tag, _cache); tabTagInfo.Content = _metaInformation; // Create Meta Editor Tab _metaEditor = new MetaEditor(_buildInfo, _tag, this, _tags, _cache, _streamManager, _rteProvider, _stringIDTrie) { Padding = new Thickness(0) }; tabMetaEditor.Content = _metaEditor; // Create Plugin Editor Tab _pluginEditor = new PluginEditor(_buildInfo, _tag, this, _metaEditor); tabPluginEditor.Content = _pluginEditor; // Create Raw Tabs #region Models //if (_cache.ResourceMetaLoader.SupportsRenderModels && _tag.RawTag.Class.Magic == CharConstant.FromString("mode")) //{ // tabSound.Visibility = Visibility.Visible; // tabSound.Content = new SoundEditor(_tag, _cache, _streamManager); //} //else //{ // tabSound.Visibility = Visibility.Collapsed; // if (App.AssemblyStorage.AssemblySettings.halomapLastSelectedMetaEditor == App.AssemblyStorage.AssemblySettings.LastMetaEditorType.Model) // tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.LastMetaEditorType.MetaEditor; //} #endregion #region BSP /*if (true && _tag.RawTag.Class.Magic == CharConstant.FromString("sbsp")) // add some manual check here akarias, since you code isn't in blamite * { * tabBspEditor.Visibility = Visibility.Visible; * tabBspEditor.Content = new BspEditor(_tag, _cache, _streamManager); * } * else*/ { tabBspEditor.Visibility = Visibility.Collapsed; if (App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor == Settings.LastMetaEditorType.Bsp) { tbMetaEditors.SelectedIndex = (int)Settings.LastMetaEditorType.MetaEditor; } } #endregion #region Sound //if (_cache.ResourceMetaLoader.SupportsSounds && _tag.RawTag.Class.Magic == CharConstant.FromString("snd!")) //{ // tabSound.Visibility = Visibility.Visible; // tabSound.Content = new SoundEditor(_tag, _cache, _streamManager); //} //else //{ // tabSound.Visibility = Visibility.Collapsed; // if (App.AssemblyStorage.AssemblySettings.halomapLastSelectedMetaEditor == App.AssemblyStorage.AssemblySettings.LastMetaEditorType.Sound) // tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.LastMetaEditorType.MetaEditor; //} #endregion }