public List<BallMemento> Load(string path) { var balls = new List<BallMemento>(); using (var sr = new StreamReader(path, Encoding.Default)) { while (!sr.EndOfStream) { var ball = new BallMemento(); var readLine = sr.ReadLine(); if (readLine != null) { var values = readLine.Split(','); ball.x = int.Parse(values[0]); ball.y = int.Parse(values[1]); ball.increaseX = bool.Parse(values[2]); ball.increaseY = bool.Parse(values[3]); } balls.Add(ball); } } return balls; }
public List <BallMemento> Load(string path) { var balls = new List <BallMemento>(); using (var sr = new StreamReader(path, Encoding.Default)) { while (!sr.EndOfStream) { var ball = new BallMemento(); var readLine = sr.ReadLine(); if (readLine != null) { var values = readLine.Split(','); ball.x = int.Parse(values[0]); ball.y = int.Parse(values[1]); ball.increaseX = bool.Parse(values[2]); ball.increaseY = bool.Parse(values[3]); } balls.Add(ball); } } return(balls); }