コード例 #1
0
        public SAV_BlockDump8(SaveFile sav)
        {
            InitializeComponent();
            WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
            SAV = (SAV8SWSH)sav;

            PG_BlockView.Size = RTB_Hex.Size;

            Metadata = new SCBlockMetadata(SAV.Blocks);

            CB_Key.InitializeBinding();
            CB_Key.DataSource = Metadata.GetSortedBlockKeyList().ToArray();

            ComboItem[] boolToggle =
            {
                new(nameof(SCTypeCode.Bool1), (int)SCTypeCode.Bool1),
                new(nameof(SCTypeCode.Bool2), (int)SCTypeCode.Bool2),
                new(nameof(SCTypeCode.Bool3), (int)SCTypeCode.Bool3),
            };
コード例 #2
0
ファイル: SAV_BlockDump8.cs プロジェクト: wowjinxy/PKHeX
        private void UpdateBlockSummaryControls()
        {
            var block = CurrentBlock;

            L_Detail_R.Text = GetBlockSummary(block);
            RTB_Hex.Text    = string.Join(" ", block.Data.Select(z => $"{z:X2}"));

            var blockName = Metadata.GetBlockName(block, out var obj);

            if (blockName != null)
            {
                L_BlockName.Visible = true;
                L_BlockName.Text    = blockName;
            }
            else
            {
                L_BlockName.Visible = false;
            }

            if (ModifierKeys != Keys.Control)
            {
                // Show a PropertyGrid to edit
                if (obj != null)
                {
                    var props = ReflectUtil.GetPropertiesCanWritePublicDeclared(obj.GetType());
                    if (props.Count() > 1)
                    {
                        PG_BlockView.Visible        = true;
                        PG_BlockView.SelectedObject = obj;
                        return;
                    }
                }

                var o = SCBlockMetadata.GetEditableBlockObject(block);
                if (o != null)
                {
                    PG_BlockView.Visible        = true;
                    PG_BlockView.SelectedObject = o;
                    return;
                }
            }
            PG_BlockView.Visible = false;
        }