Esempio n. 1
0
        private void ButtonX3_Click(object sender, EventArgs e)
        {
            string txt = TextBoxX_ReferenceName.Text.Trim();

            AddReference(txt);
            ItemListBox1.Refresh();
        }
Esempio n. 2
0
        private void ButtonX4_Click(object sender, EventArgs e)
        {
            int selIndex = ItemListBox1.SelectedIndex;

            RemoveReference(selIndex);
            ItemListBox1.Refresh();
        }
Esempio n. 3
0
        private void AddNewPatch(string name, string description, Version version, Version minAppVersion, Version maxAppVersion, string firstScriptName)
        {
            var patch = new PatchProfile()
            {
                Name        = name,
                Description = description,
                Version     = version,
                MinVersion  = minAppVersion,
                MaxVersion  = maxAppVersion
            };

            patch.ID.Generate();
            var script = new PatchScript()
            {
                Name = firstScriptName
            };

            script.ID.Generate();
            patch.Scripts.Add(script);
            var btnItem = GetButtonItemFromPatch(patch);

            ItemListBox1.Items.Add(btnItem);
            SaveSinglePatch(patch);
            ItemListBox1.SelectedItem = btnItem;
            ItemListBox1.Refresh();
            ItemListBox1.EnsureVisible(btnItem);
        }
Esempio n. 4
0
        private void RemoveSelectedArrayItemInfo()
        {
            var item = ItemListBox1.SelectedItem;

            if (item?.Tag is object)
            {
                RemoveArrayItemInfo(item);
                ItemListBox1.Refresh();
            }
        }
        // F e a t u r e s

        private void LoadList()
        {
            ItemListBox1.SuspendLayout();
            ItemListBox1.Items.Clear();
            foreach (CustomModel obj in objBank.Models)
            {
                AddItemToList(obj);
            }
            ItemListBox1.ResumeLayout();
            ItemListBox1.Refresh();
        }
Esempio n. 6
0
        private void UpdateSelectedArrayItemInfoListItem()
        {
            var baseItem = ItemListBox1.SelectedItem;
            TextArrayItemInfo arrayItem = (TextArrayItemInfo)baseItem?.Tag;

            if (arrayItem is object)
            {
                baseItem.Text = Conversions.ToString(arrayItem.RomAddress);
                ItemListBox1.Refresh();
            }
        }
Esempio n. 7
0
        private void AddArrayItemInfo()
        {
            var item = new TextArrayItemInfo();
            TextArrayGroupInfo group = (TextArrayGroupInfo)GetSelectedGroupInfo();

            group.Texts.Add(item);
            var btn = AddArrayItemListItem(item);

            ItemListBox1.Items.Add(btn);
            ItemListBox1.Refresh();
        }
Esempio n. 8
0
        private void LoadReferences()
        {
            foreach (string @ref in tempScript.References)
            {
                ItemListBox1.Items.Add(new ButtonItem()
                {
                    Text = @ref
                });
                ntsReferences = true;
            }

            ItemListBox1.Refresh();
        }
Esempio n. 9
0
        private void ButtonX5_Click(object sender, EventArgs e)
        {
            ButtonItem   btnItem = (ButtonItem)ItemListBox1.SelectedItem;
            PatchProfile patch   = (PatchProfile)btnItem?.Tag;

            if (patch is object && MessageBoxEx.Show(this, "Are you sure to remove this tweak? You will not be able to recover it.", "Remove Tweak", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                Flyout1.Close();
                ItemListBox1.Items.Remove(btnItem);
                ItemListBox1.Refresh();
                myPatchs.Remove(patch);
                File.Delete(patch.FileName);
            }
        }
Esempio n. 10
0
        private void RemoveAllArrayItemInfos()
        {
            var items = new BaseItem[ItemListBox1.Items.Count + 1];

            ItemListBox1.Items.CopyTo(items, 0);
            ItemListBox1.SuspendLayout();
            foreach (BaseItem baseItem in items)
            {
                if (baseItem?.Tag is object)
                {
                    RemoveArrayItemInfo(baseItem);
                }
            }

            ItemListBox1.ResumeLayout();
            ItemListBox1.Refresh();
        }
Esempio n. 11
0
        private void LoadTextArrayItems(TextGroupInfo table)
        {
            ItemListBox1.SuspendLayout();
            ItemListBox1.Items.Clear();
            if (table is TextArrayGroupInfo)
            {
                foreach (TextArrayItemInfo item in ((TextArrayGroupInfo)table).Texts)
                {
                    AddArrayItemListItem(item);
                }
                AdvPropertyGrid1.Dock = DockStyle.Top;
                Panel3.Visible        = true;
            }
            else
            {
                Panel3.Visible        = false;
                AdvPropertyGrid1.Dock = DockStyle.Fill;
            }

            ItemListBox1.ResumeLayout();
            ItemListBox1.Refresh();
        }
Esempio n. 12
0
        private void LoadTweakList(string Filter = "")
        {
            bool enableFilter = !string.IsNullOrEmpty(Filter.Trim());

            Filter = $"*{Filter}*";
            ItemListBox1.Items.Clear();

            foreach (PatchProfile patch in myPatchs)
            {
                if (!enableFilter || LikeString(patch.Name, Filter, CompareMethod.Text) || patch.Scripts.Where(n => LikeString(n.Name, Filter, CompareMethod.Text)).Any())
                {
                    var btnItem = GetButtonItemFromPatch(patch);
                    ItemListBox1.Items.Add(btnItem);
                }
            }

            if (ItemListBox1.Items.Count > 0)
            {
                ItemListBox1.SelectedItem = ItemListBox1.Items[0];
            }

            ItemListBox1.Refresh();
        }
Esempio n. 13
0
        private void EditPatch(PatchProfile patch)
        {
            var editor = new TweakProfileEditor()
            {
                Titel         = patch.Name,
                Description   = patch.Description,
                Version       = patch.Version,
                MinAppVersion = patch.MinVersion,
                MaxAppVersion = patch.MaxVersion
            };

            if (editor.ShowDialog(this) == DialogResult.OK)
            {
                string oldName        = patch.Name;
                string oldDescription = patch.Description;

                patch.Name        = editor.Titel.Trim();
                patch.Description = editor.Description.Trim();
                patch.Version     = editor.Version;
                patch.MinVersion  = editor.MinAppVersion;
                patch.MaxVersion  = editor.MaxAppVersion;

                if ((oldName ?? "") != (patch.Name ?? ""))
                {
                    //// Rename File
                    //string newFileName = Path.Combine(Path.GetDirectoryName(patch.FileName), editor.Titel + Path.GetExtension(patch.FileName));
                    //newFileName = EnsureFileNameIsNotUsed(newFileName);
                    //File.Move(patch.FileName, newFileName);
                    //patch.FileName = newFileName;

                    // Update Title in ListBox
                    ItemListBox1.SelectedItem.Text = patch.Name;
                    ItemListBox1.Refresh();
                }
            }
        }