Exemple #1
0
        public void LoadData()
        {
            positions = new PositionStorage();

            if (!File.Exists(filename))
            {
                //Nothing to load if file does not exist
                return;
            }
            try
            {
                string[] lines = File.ReadAllLines(filename);
                for (int i = 0; i < lines.Length; i++)
                {
                    string[] linesplit = lines[i].Split(';');
                    try
                    {
                        int[] pos = positions.StringToPos(linesplit[1]);
                        positions.Store(linesplit[0], pos[0], pos[1], pos[2]);
                    }
                    catch
                    {
                        //Skip line when read fails
                        Console.WriteLine("[WARNING] Skipping invalid entry on line {0}.", i + 1);
                    }
                }
            }
            catch
            {
                Console.WriteLine("[ERROR] StoredPositions.txt could not be read!");
            }
        }
        public void LoadData()
        {
            positions = new PositionStorage();

            if (!File.Exists(filename))
            {
                //Nothing to load if file does not exist
                return;
            }
            try
            {
                string[] lines = File.ReadAllLines(filename);
                for (int i = 0; i < lines.Length; i++)
                {
                    string[] linesplit = lines[i].Split(';');
                    try
                    {
                        int[] pos = positions.StringToPos(linesplit[1]);
                        positions.Store(linesplit[0], pos[0], pos[1], pos[2]);
                    }
                    catch
                    {
                        //Skip line when read fails
                        Console.WriteLine("[WARNING] Skipping invalid entry on line {0}.", i + 1);
                    }
                }
            }
            catch
            {
                Console.WriteLine("[ERROR] StoredPositions.txt could not be read!");
            }
        }