public void AddCodes(GameGenie[] gameGenieCodes, int codeCount) { for (int i = 0; i < codeCount; i++) { this.codeCount++; if(gameGenieCodes[i].code != "DUMMY") lstCodes.Items.Add(gameGenieCodes[i].code); else lstCodes.Items.Add("(" + gameGenieCodes[i].address.ToString("X4") + " : " + gameGenieCodes[i].value.ToString("X2") + ")"); } }
public GameGenie[] GetCodes() { GameGenie[] gameGeneieCodes = new GameGenie[this.codeCount]; for (int i = 0; i < this.codeCount; i++) { if (((string)lstCodes.Items[i]).IndexOf("(") == 0) { byte value = byte.Parse(((string)lstCodes.Items[i]).Substring(8,2), System.Globalization.NumberStyles.HexNumber, null); ushort address = ushort.Parse(((string)lstCodes.Items[i]).Substring(1,4), System.Globalization.NumberStyles.HexNumber, null); gameGeneieCodes[i] = new GameGenie(address, value); } else { gameGeneieCodes[i] = new GameGenie((string)lstCodes.Items[i]); } } return gameGeneieCodes; }