Esempio n. 1
0
    public void _1_2_FindFirstLineWhichContainsString()
    {
        string[] stringLines    = { "(1,2 2,1, 1,1) is GamePlaneBounds", " ", "(10,0, 10,0) is IntagerNumberOfElementsOnXAndY", "0,0, 0,0  is maze wall element" };
        int      lineWithString = TextHandler.FindFirstLineWhichContainsString("IntagerNumberOfElementsOnXAndY", stringLines);

        Assert.AreEqual(lineWithString, 2);
    }
Esempio n. 2
0
    public Vector2 GetVector2FromTextLineThatContainsString(string stringOccuredInVector2TextLine, string[] textLines)
    {
        int numberOfLineThatContainsString = TextHandler.FindFirstLineWhichContainsString(stringOccuredInVector2TextLine, textLines);

        string vector2FoundInTextLineInStringType = TextHandler.RemoveAllNonVectorPartsOfString(textLines[numberOfLineThatContainsString]);

        Vector2 foundVector2 = StringToVector2Parser.Parse(vector2FoundInTextLineInStringType);

        return foundVector2;
    }
Esempio n. 3
0
 private static int GetLineTextWithGamePlaneBounds(string[] saveTexLines)// Bounds format: "Center: (0,0, 0,0, 0,0), Extents: (5,0, 5,0, 5,0)"
 {
     int lineWithCenterWord = TextHandler.FindFirstLineWhichContainsString("Center:", saveTexLines);
     int lineWithExtentsWord = TextHandler.FindFirstLineWhichContainsString("Extents:", saveTexLines);
     if (lineWithCenterWord == lineWithExtentsWord)
     {
         return lineWithExtentsWord;
     }
     else
     {
         throw new System.NullReferenceException();
     }
 }
Esempio n. 4
0
    public List<Vector2> GetVectorsFromTextLinesThatContainsString(string[] _textLines, string _stringOccuredInEveryVector2TextLine)
    {
        textLines = _textLines;
        stringOccuredInEveryVector2TextLine = _stringOccuredInEveryVector2TextLine;
        foundListOfVectors = new List<Vector2>();

        int numberOfFirstVector2TextLine = TextHandler.FindFirstLineWhichContainsString(stringOccuredInEveryVector2TextLine, textLines);

        int numberOfLastVector2TextLine = GetNumberOfLastTextLineWhichContainsString(numberOfFirstVector2TextLine);

        for (int i = numberOfFirstVector2TextLine; i < numberOfLastVector2TextLine; i++)
        {
            string foundVector2String = TextHandler.RemoveAllNonVectorPartsOfString(textLines[i]);
            Vector2 foundVector2 = StringToVector2Parser.Parse(foundVector2String);
            foundListOfVectors.Add(foundVector2);
        }

        return foundListOfVectors;
    }