コード例 #1
0
        public static List <string> GetLatestIssuesNumbers(int amount)
        {
            List <string> list = new List <string>();

            List <Task> tasks = new List <Task>();

            string[] files = Directory.GetFiles(Program.DataPath + "\\TaskData\\");
            foreach (String s in files)
            {
                tasks.AddRange(TaskTracker.LoadDay(s).Tasks);
            }
            tasks = tasks.OrderBy(d => d.TaskID).ToList();
            for (int i = tasks.Count - 1; i >= 0; i--)
            {
                bool dup = false;
                foreach (string s in list)
                {
                    if (s.ToLower() == tasks[i].IssueNumber.ToLower())
                    {
                        dup = true;
                    }
                }
                if (!dup)
                {
                    list.Add(tasks[i].IssueNumber);
                }
                if (list.Count == amount)
                {
                    break;
                }
            }

            return(list);
        }
コード例 #2
0
        public static List <string> GetAllIssues()
        {
            string[]      files    = Directory.GetFiles(Program.DataPath + "\\TaskData\\");
            List <string> issues   = new List <string>();
            List <bool>   toRemove = new List <bool>();

            foreach (String s in files)
            {
                issues.AddRange(TaskTracker.LoadDay(s).Tasks.Select(task => task.IssueNumber));
            }

            foreach (string s in issues)
            {
                toRemove.Add(false);
            }

            for (int i = 0; i < issues.Count; i++)
            {
                if (i < issues.Count)
                {
                    for (int j = i + 1; j < issues.Count; j++)
                    {
                        if (issues[i] == issues[j] && i != j)
                        {
                            toRemove[i] = true;
                        }
                    }
                }
            }

            //Console.WriteLine(string.Join("\n", issues));
            for (int i = issues.Count - 1; i >= 0; i--)
            {
                if (toRemove[i])
                {
                    issues.RemoveAt(i);
                }
            }
            //Console.WriteLine(string.Join("\n", issues));
            return(issues);
        }