void changeDoYouOwnPort(string own) { for (int i = 0; i < ports.Length - 1; i++) { if (ports[i].StartsWith(travelManager.currentPort.portName)) { //split it out string[] port = ports[i].Split(','); //upate the array value with the own string port[1] = own; //reconstitute then add it back to ports string updatedPort = ""; //Compile the port array back to a single string foreach (string po in port) { updatedPort = updatedPort + po + ","; } int index = updatedPort.LastIndexOf(','); updatedPort = updatedPort.Substring(0, index); //Add it back to the ports array ports[i] = updatedPort; string updatedPorts = ""; //Compile the array back to a single string foreach (string pos in ports) { updatedPorts = updatedPorts + pos + "_"; } //Chop off the last underscore int index2 = updatedPorts.LastIndexOf('_'); updatedPorts = updatedPorts.Substring(0, index2); //Then update the data file dm.writeToPortFile(updatedPorts); //refresh the game data array getPortData(); } } }