コード例 #1
0
        /// <summary>
        /// Fix the links to self.
        /// </summary>
        /// <param name="entry"></param>
        /// <param name="originalId"></param>
        private void FixMainEntry(BINEntry entry, int originalId)
        {
            DefinitionType def =
                ContentManager.Instance.Definitions.GetDefinition(
                    entry.Definition);

            def.ReadIn(entry);

            def.FixLinks(
                LinkDestination.GameBINEntryID, originalId, entry.ID);

            def.Write(entry);
        }
コード例 #2
0
        private void addEntryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormNewGameBINEntry form = new FormNewGameBINEntry(myBIN);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                byte[] data = null;

                BINEntry defEntry = myBIN.GetEntryByName(
                    form.Template);

                if (defEntry == null)
                {
                    form.Dispose();
                    form = null;
                    MessageBox.Show(this, "Default entry not found.");
                    return;
                }

                data = defEntry.Data;

                BINEntry entry = myBIN.AddEntry(
                    form.SymbolName, form.Definition, data);

                DefinitionType defType =
                    ContentManager.Instance.Definitions.GetDefinition(
                        form.Definition);

                defType.ReadIn(entry);

                defType.FixLinks(
                    LinkDestination.GameBINEntryID,
                    defEntry.ID,
                    entry.ID);

                defType.Write(entry);

                treeView.SelectedNode = AddEntry(entry);

                data = null;
            }

            form.Dispose();
            form = null;
        }