public void LoadState(string pathOfFileToOpen) { if (File.Exists(pathOfFileToOpen)) { State tempState; using (Stream input = File.OpenRead(pathOfFileToOpen)) { BinaryFormatter formatter = new BinaryFormatter(); tempState = (State)formatter.Deserialize(input); } Locations = tempState.Locations; name = tempState.Name; distanceKeeper = tempState.distanceKeeper; } }
public State(string stateName) { name = stateName; distanceKeeper = new DistanceKeeper(stateName); createStateFilePaths(stateName); }