Exemple #1
0
        private void importToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tagTreeView.SelectedNode?.Tag is CachedTag tag)
            {
                using (var ofd = new OpenFileDialog())
                {
                    var groupName = Cache.StringTable.GetString(tag.Group.Name);

                    ofd.Filter = $"{groupName} files (*.{groupName})|*.{groupName}";

                    if (ofd.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    byte[] data;

                    using (var stream = File.OpenRead(ofd.FileName))
                    {
                        data = new byte[stream.Length];
                        stream.Read(data, 0, data.Length);
                    }

                    GameCacheHaloOnline cacheHaloOnline = Cache as GameCacheHaloOnline;

                    using (var stream = Cache.OpenCacheReadWrite())
                        cacheHaloOnline.TagCacheGenHO.SetTagDataRaw(stream, (CachedTagHaloOnline)tag, data);

                    MessageBox.Show($"Imported {ofd.FileName} successfully.", "Import Tag", MessageBoxButtons.OK);
                }
            }
        }
Exemple #2
0
        private void saveTagNamesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GameCacheHaloOnline cacheHaloOnline = Cache as GameCacheHaloOnline;

            cacheHaloOnline.SaveTagNames();
            MessageBox.Show("Saved tag names successfully.", "Save Tag Names", MessageBoxButtons.OK);
        }
Exemple #3
0
        private void extractToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tagTreeView.SelectedNode?.Tag is CachedTag tag)
            {
                using (var sfd = new SaveFileDialog())
                {
                    var groupName = Cache.StringTable.GetString(tag.Group.Name);

                    sfd.Filter = $"{groupName} files (*.{groupName})|*.{groupName}";

                    if (sfd.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    // needs to be updated for gen3

                    GameCacheHaloOnline cacheHaloOnline = Cache as GameCacheHaloOnline;

                    byte[] data;

                    using (var stream = Cache.OpenCacheRead())
                        data = cacheHaloOnline.TagCacheGenHO.ExtractTagRaw(stream, (CachedTagHaloOnline)tag);

                    using (var stream = File.Open(sfd.FileName, FileMode.Create, FileAccess.Write))
                        stream.Write(data, 0, data.Length);

                    MessageBox.Show($"Extracted {sfd.FileName} successfully.", "Extract Tag", MessageBoxButtons.OK);
                }
            }
        }