public void _1_1_Parse()
    {
        string stringToParse = "  1,0, 1,0 ";

        Vector2 parsedString = StringToVector2Parser.Parse(stringToParse);

        Assert.AreEqual(new Vector2(1, 1), parsedString);
    }
    public void _1_4_Parse()
    {
        string stringToParse = "  1        ,3333      ,                                1,1 ";

        Vector2 parsedString = StringToVector2Parser.Parse(stringToParse);

        Assert.AreEqual(new Vector2(1.3333f, 1.1f), parsedString);
    }
Esempio n. 3
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. 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;
    }