示例#1
0
        private string GetCDefDataID(
            string defName, string cdef)
        {
            BINEntry entry = myGameBin.GetEntryByName(defName);

            if (entry != null)
            {
                DefinitionType def =
                    FileDatabase.Instance.Definitions.GetDefinition(
                        entry.Definition);

                def.ReadIn(entry);

                if (def.CDefs != null)
                {
                    CDefLink link = def.get_CDefLinks(cdef);

                    if (link != null)
                    {
                        return(link.DataID.ToString());
                    }
                }
            }

            return(null);
        }
示例#2
0
        private void buttonCreate_Click(object sender, EventArgs e)
        {
            if (SymbolName == "" || Definition == "" || Template == "")
            {
                FormMain.Instance.ErrorMessage("Missing information.");
                return;
            }

            if (myBIN.GetEntryByName(SymbolName) != null)
            {
                FormMain.Instance.ErrorMessage("Entry already exists.");
            }
            else
            {
                DialogResult = DialogResult.OK;
            }
        }
示例#3
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;
        }