Beispiel #1
0
    List <CardsTerm> convertCSV(List <string[]> inputString)
    {
        List <CardsTerm> listToReturn = new List <CardsTerm> ();
        int masteryIterator           = 0;

        foreach (string[] thisLine in inputString)
        {
            if (thisLine.Length > 1)
            {
                CardsTerm termToAdd;
                if (useImages)
                {
                    if (thisLine [1] [0] == ' ')
                    {
                        thisLine [1] = thisLine [1].Substring(1, thisLine [1].Length - 1);
                    }
                    string imgPathToUse = directoryForAssignment + "/" + thisLine [1].ToLower() + ".png";
                    imgPathToUse = imgPathToUse.Replace("\"", "");
                    termToAdd    = new CardsTerm(thisLine [0], thisLine [1], imgPathToUse);                  //, newImg);
                }
                else
                {
                    termToAdd = new CardsTerm(thisLine [0], thisLine [1]);
                }
                if (currMastery > 0 && masteryIterator < 2 * ((currMastery * inputString.Count) / (inputString.Count * requiredMastery)))
                {
                    termToAdd.mastery++;
                    masteryIterator++;
                }
                listToReturn.Add(termToAdd);
            }
        }
        return(listToReturn);
    }
Beispiel #2
0
	List<CardsTerm> convertCSV (List<string[]> inputString)
	{
		List<CardsTerm> listToReturn = new List<CardsTerm> ();
    int masteryIterator = 0;
		foreach (string[] thisLine in inputString) {
			if (thisLine.Length > 1) {
				CardsTerm termToAdd;
				if (useImages) {
					if (thisLine [1] [0] == ' ') {
						thisLine [1] = thisLine [1].Substring (1, thisLine [1].Length - 1);
					}
					string imgPathToUse = directoryForAssignment + "/" + thisLine [1].ToLower () + ".png";
					imgPathToUse = imgPathToUse.Replace ("\"", "");
					termToAdd = new CardsTerm (thisLine [0], thisLine [1], imgPathToUse);//, newImg);
				} else {
					termToAdd = new CardsTerm (thisLine [0], thisLine [1]);
				}
        if(currMastery > 0 && masteryIterator < 2*((currMastery*inputString.Count)/(inputString.Count*requiredMastery))){
          termToAdd.mastery++;
          masteryIterator++;
        }
				listToReturn.Add (termToAdd);
			}
		}
		return listToReturn;
	}