예제 #1
0
    public static bool GetDataFromFile(out List <string[]> platformInput, out List <string[]> hazardInput, out List <string[]> checkpointInput)
    {
        platformInput   = new List <string[]>();
        hazardInput     = new List <string[]>();
        checkpointInput = new List <string[]>();

        string filePath = FileEditor.GetFile();

        if (filePath != null)
        {
            StreamReader reader = new StreamReader(filePath);

            string line = "";

            while (!(line = reader.ReadLine()).Contains("|"))
            {
                platformInput.Add(line.Split(' '));
            }

            while (!(line = reader.ReadLine()).Contains("|"))
            {
                hazardInput.Add(line.Split(' '));
            }

            while ((line = reader.ReadLine()) != null)
            {
                checkpointInput.Add(line.Split(' '));
            }

            return(true);
        }

        return(false);
    }