void writeDataToFile() { string updatedGameData = ""; //Compile the array back to a single string foreach (string gd in gameData) { updatedGameData = updatedGameData + gd + ","; } //Chop off the last comma int index = updatedGameData.LastIndexOf(','); updatedGameData = updatedGameData.Substring(0, index); //Then update the data file dm.writeToDataFile(updatedGameData); //refresh the game data array getGameData(); }
public void updateGameDataPort() { string updatedGameData = ""; //Save the last port chosen into the game Data array gameData[5] = lastPortChosen.portName; //Compile the array back to a single string foreach (string gd in gameData) { updatedGameData = updatedGameData + gd + ","; } //Chop off the last comma int index = updatedGameData.LastIndexOf(','); updatedGameData = updatedGameData.Substring(0, index); //Then update the data file dm.writeToDataFile(updatedGameData); }