Exemple #1
0
            public override void Execute()
            {
                string filePath = Path.Combine(Settings.Folder_GameGenieCodes,
                                               Path.GetFileNameWithoutExtension(Program.CurrentGameFile) + ".ggc");

                if (File.Exists(filePath))
                {
                    string[] lines = File.ReadAllLines(filePath);
                    // Clear all
                    if (lines.Length > 0)
                    {
                        page.Items[3].Options.Clear();
                        page.Items[4].Options.Clear();
                        page.Items[5].Options.Clear();
                        page.Items[6].Options.Clear();
                        page.Items[7].Options.Clear();
                        // Add code by code
                        for (int i = 0; i < lines.Length; i++)
                        {
                            GameGenieCode newcode = new GameGenieCode();
                            newcode.Enabled = true;
                            newcode.Name    = lines[i];
                            if (lines[i].Length == 6)
                            {
                                newcode.Address   = gameGenie.GetGGAddress(gameGenie.GetCodeAsHEX(lines[i]), 6);
                                newcode.Value     = gameGenie.GetGGValue(gameGenie.GetCodeAsHEX(lines[i]), 6);
                                newcode.IsCompare = false;
                            }
                            else
                            {
                                newcode.Address   = gameGenie.GetGGAddress(gameGenie.GetCodeAsHEX(lines[i]), 8);
                                newcode.Value     = gameGenie.GetGGValue(gameGenie.GetCodeAsHEX(lines[i]), 8);
                                newcode.Compare   = gameGenie.GetGGCompareValue(gameGenie.GetCodeAsHEX(lines[i]));
                                newcode.IsCompare = true;
                            }
                            page.Items[3].Options.Add(i.ToString());
                            page.Items[4].Options.Add(lines[i]);
                            page.Items[5].Options.Add(newcode.Address.ToString("X4"));
                            page.Items[6].Options.Add(newcode.Value.ToString("X2"));
                            page.Items[7].Options.Add(newcode.Compare.ToString("X2"));
                        }

                        page.SelectLastCode();

                        Program.VIDEO.WriteNotification("Game Genie File Loaded !!", 200, System.Drawing.Color.Lime);
                    }
                    else
                    {
                        Program.VIDEO.WriteNotification("Game Genie file is empty.", 200, System.Drawing.Color.Red);
                    }
                }
                else
                {
                    Program.VIDEO.WriteNotification("Game Genie file is not found.", 200, System.Drawing.Color.Red);
                }
            }
Exemple #2
0
            public override void Execute()
            {
                if (page.Items[3].Options[0] == "N/A")
                {
                    return;
                }

                int index = 0;

                int.TryParse(page.Items[3].Options[page.Items[3].SelectedOptionIndex], out index);
                page._gameGenieCodes.RemoveAt(index);

                page.Items[3].Options.RemoveAt(index);
                page.Items[4].Options.RemoveAt(index);
                page.Items[5].Options.RemoveAt(index);
                page.Items[6].Options.RemoveAt(index);
                page.Items[7].Options.RemoveAt(index);
                // Fix indexes
                for (int i = 0; i < page.Items[3].Options.Count; i++)
                {
                    page.Items[3].Options[i] = i.ToString();
                }
                if (page.Items[3].Options.Count == 0)
                {
                    page.Items[3].Options.Clear();
                    page.Items[3].Options.Add("N/A");
                    page.Items[3].SelectedOptionIndex = 0;
                    page.Items[4].Options.Clear();
                    page.Items[4].Options.Add("N/A");
                    page.Items[4].SelectedOptionIndex = 0;
                    page.Items[5].Options.Clear();
                    page.Items[5].Options.Add("N/A");
                    page.Items[5].SelectedOptionIndex = 0;
                    page.Items[6].Options.Clear();
                    page.Items[6].Options.Add("N/A");
                    page.Items[6].SelectedOptionIndex = 0;
                    page.Items[7].Options.Clear();
                    page.Items[7].Options.Add("N/A");
                    page.Items[7].SelectedOptionIndex = 0;
                }
                page.SelectLastCode();
            }