Esempio n. 1
0
        public void NameAddress(uint address, string name = null)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                NamingDialog dlg = new NamingDialog
                {
                    Text = $"Label RAM:{address:X4}..."
                };
                if (Project.Namer.Names.ContainsKey(address))
                {
                    dlg.NameString = Project.Namer.Names[address];
                }

                if (dlg.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }

                name = dlg.NameString;
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                Project.Namer.Names.Remove(address);
            }
            else
            {
                Project.Namer.Names[address] = name;
            }

            ChangeMade?.Invoke(this, null);
        }
Esempio n. 2
0
        public void CommentOffset(uint offset, string label = null)
        {
            if (string.IsNullOrWhiteSpace(label))
            {
                NamingDialog dlg = new NamingDialog
                {
                    Text = $"Comment ROM{new BankedAddress(offset).ToString()}..."
                };
                if (Project.Comments.ContainsKey(offset))
                {
                    dlg.NameString = Project.Comments[offset];
                }

                if (dlg.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }

                label = dlg.NameString;
            }

            if (string.IsNullOrWhiteSpace(label))
            {
                Project.Comments.Remove(offset);
            }
            else
            {
                Project.Comments[offset] = label;
            }

            ChangeMade?.Invoke(this, null);
        }