public string GetStrophe(int StropheNumber) { if (StropheNumber == -1) { StropheNumber = this.strophe; } string temp = GetText(1); int x = 0; int intSLength = 0; //(height)length of the biggest strophe int intSWidth = 0; LongestStrophe = GetText(1); //Text of the Biggest_Strophe WidestStrophe = GetText(1); string strCurrentStrophe = temp; int strophes; //get strophe and search for the longest one strophes = CountStrophes(); if (StropheNumber >= strophes) { StropheNumber = strophes - 1; } for (x = 0; x < strophes; x++) { // find all strophes, exept the last one if (x < (strophes - 1)) { // if selected strophe, then copy this into the Textfield if (x == StropheNumber) { strCurrentStrophe = temp.Substring(0, temp.IndexOf(strSeperator)); } //check if this is the longest strophe int tmp = DreamTools.Count(temp.Substring(0, temp.IndexOf(strSeperator)), "\n"); if (tmp > intSLength) { intSLength = tmp; LongestStrophe = temp.Substring(0, temp.IndexOf(strSeperator)); } //check if this is the widest strophe tmp = GetLongestLine(temp.Substring(0, temp.IndexOf(strSeperator))); if (tmp > intSWidth) { intSWidth = tmp; WidestStrophe = temp.Substring(0, temp.IndexOf(strSeperator)); } // cut the first strophe out of the list temp = temp.Substring(temp.IndexOf(strSeperator) + strSeperator.Length); } else { // get the last strophe // if selected strophe, then copy this into the Textfield if (x == StropheNumber) { strCurrentStrophe = temp; } //check if this is the longest strophe int tmp = DreamTools.Count(temp, "\n"); if (tmp > intSLength) { intSLength = tmp; LongestStrophe = temp; } //check if this is the widest strophe tmp = GetLongestLine(temp); if (tmp > intSWidth) { intSWidth = tmp; WidestStrophe = temp; } } } this.TextChanged = false; return(strCurrentStrophe); }
public int CountStrophes() { return(DreamTools.Count(Text[1], strSeperator)); }