Exemplo n.º 1
0
        private void DefTypeLink(
            BINEntry entryDst, BINEntry entrySrc, string cdef)
        {
            DefinitionType def =
                FileDatabase.Instance.Definitions.GetDefinition(
                    entryDst.Definition);

            def.ReadIn(entryDst);

            if (def.CDefs == null)
            {
                return;
            }

            CDefLink link = def.get_CDefLinks(cdef);

            if (link != null)
            {
                link.DataID = entrySrc.ID.ToString();

                def.Write(entryDst);

                return;
            }

            def = null;
        }
Exemplo n.º 2
0
        private void btnApplyChanges_Click(object sender, EventArgs e)
        {
            m_Entry.Definition = txtDefinitionType.Text;
            m_Entry.Name       = txtSymbolName.Text;

            if (m_DefDisplay != null)
            {
                m_DefDisplay.ApplyChanges();
                m_DefType.Write(m_Entry);
            }
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        private void ApplyChanges()
        {
            if (!myModified)
            {
                return;
            }

            ApplyScript(myMode1, textBox1.Text);
            ApplyScript(myMode2, textBox2.Text);
            ApplyScript(myMode3, textBox3.Text);

            myDefType.Write(myCutscene);

            myModified = false;
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
0
        private void AssetLink(
            BINEntry entryDst,
            AssetTemplate assetItem, UInt32 assetId)
        {
            DefinitionType def =
                ContentManager.Instance.Definitions.GetDefinition(
                    entryDst.Definition);

            def.ReadIn(entryDst);

            FableMod.ContentManagement.Control c =
                def.FindControl(assetItem.ControlID);

            if (c != null)
            {
                ((Member)c.Members[assetItem.Element]).Value =
                    assetId.ToString();

                def.Write(entryDst);
            }

            def = null;
        }