예제 #1
0
파일: BconForm.cs 프로젝트: FranklinDM/PJSE
        private void common_Popup(pjse.FileTable.Entry item, SimPe.ExpansionItem exp, bool noOverride)
        {
            if (item == null)
            {
                return;               // this should never happen
            }
            Bcon bcon = new Bcon();

            bcon.ProcessData(item.PFD, item.Package);

            BconForm ui  = (BconForm)bcon.UIHandler;
            string   tag = "Popup"; // tells the SetReadOnly function it's in a popup - so everything locked down

            if (noOverride)
            {
                tag += ";noOverride";             //
            }
            if (exp != null)
            {
                tag += ";expName=+" + exp.NameShort + "+";
            }
            ui.Tag = tag;

            bcon.RefreshUI();
            ui.Show();
        }
예제 #2
0
        public void Append(pjse.FileTable.Entry item)
        {
            if (item == null || !(item.Wrapper is Bhav))
            {
                return;
            }

            Bhav b = (Bhav)item.Wrapper;

            if (b == null)
            {
                return;
            }

            bool savedstate = internalchg;

            internalchg = true;

            this.Parent.Cursor = Cursors.WaitCursor;
            try
            {
                ushort offset = (ushort)wrapper.Count;
                foreach (Instruction bi in b)
                {
                    try
                    {
                        wrapper.Add(bi);
                        int i = wrapper.Count - 1;
                        if (wrapper[i].Target1 < 0xFFFC)
                        {
                            wrapper[i].Target1 += offset;
                        }
                        if (wrapper[i].Target2 < 0xFFFC)
                        {
                            wrapper[i].Target2 += offset;
                        }
                    }
                    catch { break; }
                }
            }
            finally
            {
                this.Parent.Cursor = Cursors.Default;
            }

            internalchg = savedstate;
            myrepaint();
            if (csel >= 0)
            {
                flowitems[csel].Focus();
            }
        }
예제 #3
0
        private void llEvent_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            pjse.FileTable.Entry item = inst.Parent.ResourceByInstance(SimPe.Data.MetaData.BHAV_FILE, doidEvent.Value);
            Bhav b = new Bhav();

            b.ProcessData(item.PFD, item.Package);

            SimPe.PackedFiles.UserInterface.BhavForm ui = (SimPe.PackedFiles.UserInterface.BhavForm)b.UIHandler;
            ui.Tag  = "Popup"; // tells the SetReadOnly function it's in a popup - so everything locked down
            ui.Text = pjse.Localization.GetString("viewbhav")
                      + ": " + b.FileName + " [" + b.Package.SaveFileName + "]";
            b.RefreshUI();
            ui.Show();
        }
예제 #4
0
        private void llBhav_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            pjse.FileTable.Entry item = wrapper.ResourceByInstance(SimPe.Data.MetaData.BHAV_FILE, (sender == llAction) ? currentItem.Action : currentItem.Guardian);
            Bhav b = new Bhav();

            b.ProcessData(item.PFD, item.Package);

            BhavForm ui = (BhavForm)b.UIHandler;

            ui.Tag = "Popup" // tells the SetReadOnly function it's in a popup - so everything locked down
                     + ";callerID=+" + wrapper.FileDescriptor.ExportFileName + "+";
            ui.Text = pjse.Localization.GetString("viewbhav") + ": " + b.FileName + " [" + b.Package.SaveFileName + "]";
            b.RefreshUI();
            ui.Show();
        }
예제 #5
0
파일: BconForm.cs 프로젝트: FranklinDM/PJSE
        private void doUpdateBCON()
        {
            if (!isOverride)
            {
                return;              // this should never happen
            }
            pjse.FileTable.Entry item = (pjse.FileTable.Entry)llIsOverride.Tag;
            Bcon bcon = new Bcon();

            bcon.ProcessData(item.PFD, item.Package);
            internalchg = true;
            while (wrapper.Count < bcon.Count)
            {
                wrapper.Add(new BconItem(bcon[wrapper.Count]));
            }
            internalchg = false;
            updateLists();
        }
예제 #6
0
        private void tsmi_Click(object sender, EventArgs e)
        {
            pjse.FileTable.Entry fe;
            SimPe.ExpansionItem  exp;
            int i = cmenuCompare.Items.IndexOf((ToolStripItem)sender);

            if (i < 0)
            {
                throw new ArgumentOutOfRangeException("menuItem", "Unrecognised object triggered event");
            }
            else if (i == 0)
            {
                pjse.FileTable.Entry[] items =
                    pjse.FileTable.GFT[wrapper.FileDescriptor.Type, wrapper.FileDescriptor.Group, wrapper.FileDescriptor.Instance, pjse.FileTable.Source.Maxis];
                if (items == null || items.Length == 0)
                {
                    MessageBox.Show(pjse.Localization.GetString("cmpNFCurrent", wrapperName),
                                    this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
                fe  = items[0];
                exp = null;
            }
            else
            {
                exp = (SimPe.ExpansionItem)cmenuCompare.Items[i].Tag;
                SimPe.Packages.GeneratableFile op = SimPe.Packages.GeneratableFile.LoadFromFile(
                    System.IO.Path.Combine(System.IO.Path.Combine(exp.InstallFolder, exp.ObjectsSubFolder), "objects.package"));
                if (op == null)
                {
                    throw new Exception("Could not read " + exp.Name + " objects.package");
                }
                IPackedFileDescriptor pfd = op.FindFile(wrapper.FileDescriptor);
                if (pfd == null)
                {
                    MessageBox.Show(pjse.Localization.GetString("cmpNFExp", wrapperName, exp.Name),
                                    this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
                fe = new pjse.FileTable.Entry(op, pfd, true, false);
            }

            OnCompareWith(this, new CompareWithEventArgs(fe, exp));
        }
예제 #7
0
        private void btnViewBHAV_Click(object sender, EventArgs e)
        {
            ListView lv = getListView();

            if (lv == null)
            {
                return;
            }

            pjse.FileTable.Entry item = (pjse.FileTable.Entry)lv.SelectedItems[0].Tag;
            Bhav b = new Bhav();

            b.ProcessData(item.PFD, item.Package);

            SimPe.PackedFiles.UserInterface.BhavForm ui = (SimPe.PackedFiles.UserInterface.BhavForm)b.UIHandler;
            ui.Tag  = "Popup"; // tells the SetReadOnly function it's in a popup - so everything locked down
            ui.Text = pjse.Localization.GetString("viewbhav") + ": " + b.FileName + " [" + b.Package.SaveFileName + "]";
            b.RefreshUI();
            ui.Show();
        }
예제 #8
0
        private void OK_Click(object sender, EventArgs ev)
        {
            ListView lv = getListView();

            if (lv != null && lv != lvPrim)
            {
                pjse.FileTable.Entry e = (pjse.FileTable.Entry)lv.SelectedItems[0].Tag;

                if (CanDoEA && e.Group != 0xffffff && !e.IsFixed)
                {
                    foreach (pjse.FileTable.Entry f in pjse.FileTable.GFT[e.Type, e.Group, e.Instance, FileTable.Source.Fixed])
                    {
                        if (f.IsFixed)
                        {
                            DialogResult dr = MessageBox.Show(
                                Localization.GetString("rc_override", e.Package.FileName),
                                Localization.GetString("rc_overridesEA"),
                                MessageBoxButtons.YesNoCancel,
                                MessageBoxIcon.Question,
                                MessageBoxDefaultButton.Button3
                                );

                            if (dr == DialogResult.Yes)
                            {
                            }
                            else if (dr == DialogResult.No)
                            {
                                lv.SelectedItems[0].Tag = f;
                            }
                            else
                            {
                                this.DialogResult = DialogResult.Retry;
                            }
                            break;
                        }
                    }
                }
            }
        }
예제 #9
0
 void GFT_FiletableRefresh(object sender, EventArgs e)
 {
     FileTable.GFT.FiletableRefresh -= new EventHandler(GFT_FiletableRefresh);
     ftEntry = null;
     wrapper = null;
 }
예제 #10
0
 public CompareWithEventArgs(pjse.FileTable.Entry item, SimPe.ExpansionItem exp) : base()
 {
     this.item = item; this.exp = exp;
 }
예제 #11
0
        public void Execute(Instruction inst)
        {
            internalchg = true;

            ckbDecimal.Checked           = pjse.Settings.PJSE.DecimalDOValue;
            ckbUseInstancePicker.Checked = pjse.Settings.PJSE.InstancePickerAsText;

            this.inst = inst;
            foreach (LabelledDataOwner ldoc in aldoc)
            {
                ldoc.Instruction = inst;
            }

            nodeVersion = inst.NodeVersion;

            pjse.FileTable.Entry ftEntry = inst.Parent.ResourceByInstance(SimPe.Data.MetaData.BHAV_FILE, inst.OpCode);
            TPRP tprp = null;

            if (ftEntry != null)
            {
                Bhav wrapper = (Bhav)ftEntry.Wrapper;
                tprp   = (TPRP)wrapper.SiblingResource(TPRP.TPRPtype);
                nrArgs = wrapper.Header.ArgumentCount;

                this.lbBhavName.Text = "0x" + SimPe.Helper.HexString(inst.OpCode) + ": " + wrapper.FileName;
                this.lbArgC.Text     = "0x" + SimPe.Helper.HexString(nrArgs);
            }
            else
            {
                this.lbBhavName.Text = "0x" + SimPe.Helper.HexString(inst.OpCode) + ": [" + pjse.Localization.GetString("bhavnotfound") + "]";
                this.lbArgC.Text     = "(???)";
            }

            operands = new byte[16];
            ((byte[])inst.Operands).CopyTo(operands, 0);
            ((byte[])inst.Reserved1).CopyTo(operands, 8);

            for (int i = 0; i < nrArgs; i++)
            {
                if (tprp != null && !tprp.TextOnly && i < tprp.ParamCount)
                {
                    albArg[i].Text = tprp[false, i].Label;
                }
                else
                {
                    albArg[i].Text = pjse.Localization.GetString("unk");
                }
            }
            for (int i = nrArgs; i < albArg.Length; i++)
            {
                albArg[i].Text = pjse.Localization.GetString("bwb_unused");
            }


            format = pjse.BhavNameWizards.BhavWizBhav.opFormat(inst.NodeVersion, operands);

            rbTemps.Checked   = format == BhavWizBhav.dataFormat.useTemps;
            rbOld.Checked     = format == BhavWizBhav.dataFormat.oldFormat;
            rbNew.Checked     = format == BhavWizBhav.dataFormat.newFormat;
            rbCallers.Enabled = nodeVersion > 0;
            rbCallers.Checked = format == BhavWizBhav.dataFormat.useParams;

            doFormat();

            internalchg = false;

            return;
        }