コード例 #1
0
        private String QuizletListToString(QuizletList quizletList, ExportProperties exportProperties)
        {
            if (!(exportProperties.ShowTerm) && !(exportProperties.ShowDefination))
            {
                return("ERROR - Show Term 和 Show Defination 全被取消了! 那样的话什么都不会输出!");
            }
            if (exportProperties.Sort)
            {
                quizletList.Terms.Sort();
                quizletList.Definations.Sort();
                if (!(exportProperties.SortAz))
                {
                    quizletList.Terms       = reverse(quizletList.Terms);
                    quizletList.Definations = reverse(quizletList.Definations);
                }
            }
            String output = "";

            for (int i = 0; i < quizletList.Terms.Count; i++)
            {
                if (exportProperties.ShowTerm)
                {
                    output += quizletList.Terms[i];
                }
                if (exportProperties.ShowTerm && exportProperties.ShowDefination)
                {
                    if (!exportProperties.AutoSpace)
                    {
                        output += exportProperties.TermAndDefinationSeparator;
                    }
                    else
                    {
                        output += exportProperties.Spaces - quizletList.Terms[i].Length < 1 ? " " : spaceGen(i != 0 ? exportProperties.Spaces - quizletList.Terms[i].Length : (exportProperties.Spaces - quizletList.Terms[i].Length) * 2 + 1);
                    }
                }

                if (exportProperties.ShowDefination)
                {
                    output += quizletList.Definations[i];
                }
                output += exportProperties.RowSeparator;
            }
            if (exportProperties.ChangeCase)
            {
                if (exportProperties.AllUpperCase)
                {
                    output = output.ToUpper();
                }
                else
                {
                    output = output.ToLower();
                }
            }
            return(output);
        }
コード例 #2
0
        public void refresh()
        {
            QuizletList list = convertToQuizletList(splitTwo(input.Text, importProperties.TermAndDefinationSeparator, importProperties.RowSeparator));

            output.Text = QuizletListToString(list, exportProperties);
        }