Пример #1
0
    public int ParseString()
    {
        var result = 0;

        foreach (var line in Lines)
        {
            result += CSVString.Parse(line);
        }
        return(result);
    }
Пример #2
0
        public ItemList CSVToProg()
        {
            ItemList ret = new ItemList();
            //this	{todo_list.CSVPresent}	todo_list.CSVPresent

            CSVString header = CSVData[0];//TODO case for wrong header
            //Parse header
            OrderCSV order   = new OrderCSV();
            int      counter = 0;

            foreach (String i in header)
            {
                switch (i)
                {
                case "title": order.title = counter; break;

                case "desc": order.desc = counter; break;

                case "deadline": order.deadline = counter; break;

                case "tags": order.tags = counter; break;
                }
                counter++;
            }
            counter = 0;
            foreach (CSVString i in CSVData)
            {
                if (counter == 0)
                {
                    counter++;
                    continue;
                }

                DateTime deadline = DateTime.Parse(i[order.deadline]);
                ret.Add(new Item(i[order.title], i[order.desc], deadline, i[order.tags].Split(',').ToList()));
            }
            return(ret);
        }