Esempio n. 1
0
        public void InitInterpreter(BioTlkFileSet editorTalkset = null)
        {
            DynamicByteProvider db = new DynamicByteProvider(pcc.Exports[Index].Data);

            hb1.ByteProvider = db;
            memory           = pcc.Exports[Index].Data;
            memsize          = memory.Length;

            // attempt to find a TlkFileSet associated with the object, else just pick the first one and hope it's correct
            if (editorTalkset == null)
            {
                PropertyReader.Property tlkSetRef = PropertyReader.getPropList(pcc, pcc.Exports[Index].Data).FirstOrDefault(x => pcc.getNameEntry(x.Name) == "m_oTlkFileSet");
                if (tlkSetRef != null)
                {
                    tlkset = new BioTlkFileSet(pcc, tlkSetRef.Value.IntValue - 1);
                }
                else
                {
                    tlkset = new BioTlkFileSet(pcc);
                }
            }
            else
            {
                tlkset = editorTalkset;
            }
        }
Esempio n. 2
0
        public void InitTlkManager(PCCObject pcc, BioTlkFileSet tlkSet, TalkFiles tlks = null)
        {
            packages     = new List <PCCObject>();
            tlkFileSets  = new List <BioTlkFileSet>();
            selectedTlks = tlks ?? new TalkFiles();

            packages.Add(pcc);
            refreshFileBox();
            fileBox.SelectedIndex = 0;
            Application.DoEvents();
            for (int i = 0; i < tlkFileSets.Count; i++)
            {
                if (tlkFileSets[i].index == tlkSet.index)
                {
                    bioTlkSetBox.SelectedIndex = i;
                    Application.DoEvents();
                    tlkFileBox.SelectedIndex = tlkSet.selectedTLK;
                    break;
                }
            }
            TalkFile tlk = tlkSet.talkFiles[tlkSet.selectedTLK];

            if (!selectedTlks.tlkList.Contains(tlk))
            {
                selectedTlks.tlkList.Add(tlk);
            }
            foreach (TalkFile tlkFile in selectedTlks.tlkList)
            {
                selectedTlkFilesBox.Items.Add(Path.GetFileName(pcc.fullname) + " -> " + tlkFile.BioTlkSetName + tlkFile.Name);
            }
        }
Esempio n. 3
0
        private void bioTlkSetBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            int n = bioTlkSetBox.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            tlkFileBox.BeginUpdate();
            tlkFileBox.Items.Clear();
            BioTlkFileSet tlkSet = tlkFileSets[n];

            foreach (TalkFile tlk in tlkSet.talkFiles)
            {
                tlkFileBox.Items.Add(tlk.Name);
            }
            tlkFileBox.EndUpdate();
        }
Esempio n. 4
0
        private void fileBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            bioTlkSetBox.Items.Clear();
            tlkFileBox.Items.Clear();
            int n = fileBox.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            ME1Package pcc = packages[n];

            tlkFileSets.Clear();
            IReadOnlyList <IExportEntry> Exports = pcc.Exports;

            for (int i = 0; i < Exports.Count; i++)
            {
                if (Exports[i].ClassName == "BioTlkFileSet")
                {
                    BioTlkFileSet b = new BioTlkFileSet(pcc, i);
                    tlkFileSets.Add(b);
                    bioTlkSetBox.Items.Add(b.Name);
                }
            }
            //No BioTlkSets, look for loose BioTlkFiles
            if (tlkFileSets.Count == 0)
            {
                BioTlkFileSet tlkSet = new BioTlkFileSet(pcc);
                for (int i = 0; i < Exports.Count; i++)
                {
                    if (Exports[i].ClassName == "BioTlkFile")
                    {
                        TalkFile tlk = new TalkFile(pcc, i);
                        tlkSet.talkFiles.Add(tlk);
                    }
                }
                if (tlkSet.talkFiles.Count != 0)
                {
                    tlkFileSets.Add(tlkSet);
                    bioTlkSetBox.Items.Add("Misc TlkFiles");
                }
            }
        }
Esempio n. 5
0
 public void InitBioTlkFileSet()
 {
     tlkFileSet = new BioTlkFileSet(pcc);
     tlkFiles   = new TalkFiles();
     tlkFile    = tlkFileSet;
 }
Esempio n. 6
0
 public void InitBioTlkFileSet()
 {
     tlkFileSet = new BioTlkFileSet(Pcc as ME1Package);
     //tlkFiles = new TalkFiles();
     tlkFile = tlkFileSet;
 }