Beispiel #1
0
 public void SaveFolder(TagFolder tagsFolder)
 {
     StreamWriter writer = new StreamWriter(@"TagFolder.xml");
     XmlSerializer xs = new XmlSerializer(typeof(TagFolder));
     xs.Serialize(writer, tagsFolder);
     writer.Close();
 }
Beispiel #2
0
 public void LoadFolder(ref TagFolder tagsFolder)
 {
     StreamReader reader = new StreamReader(@"TagFolder.xml");
     XmlSerializer xs = new XmlSerializer(typeof(TagFolder));
     tagsFolder = (TagFolder)xs.Deserialize(reader);
     reader.Close();
 }
Beispiel #3
0
 public static void Main(string[] args)
 {
     try
     {
         var commands = new string[] { "add", "done", "remove", "--help", "list", "filter", "change", "due", "tag", "untag", "delete", "filterTag", "folder", "filterFolder" };
         var arguments = new ArgumentList(args, commands);
         var taskList = new TaskList();
         var tagList = new TagList();
         var tagFolder = new TagFolder();
         var loader = new FileIO();
         loader.LoadTasks(taskList);
         loader.LoadTags(ref tagList);
         loader.LoadFolder(ref tagFolder);
         var dictionary = new Dictionary<string, ICommand>();
         dictionary.Add(commands[0], new AddCommand());
         dictionary.Add(commands[1], new DoneCommand());
         dictionary.Add(commands[2], new RemoveCommand());
         dictionary.Add(commands[3], new HelpCommand());
         dictionary.Add(commands[4], new ListCommand());
         dictionary.Add(commands[5], new FilterCommand());
         dictionary.Add(commands[6], new ChangeCommand());
         dictionary.Add(commands[7], new DueCommand());
         dictionary.Add(commands[8], new TagCommand());
         dictionary.Add(commands[9], new UntagCommand());
         dictionary.Add(commands[10], new DeleteCommand());
         dictionary.Add(commands[11], new FilterTagCommand());
         dictionary.Add(commands[12], new FolderCommand());
         dictionary.Add(commands[13], new FilterFolderCommand());
         var invoker = new Invoker(dictionary);
             ICommand command = invoker.GetCommand(arguments.GetCommand());
             command.Execute(arguments, taskList, tagList, tagFolder);
     }
     catch (ArgumentException)
     {
         Console.WriteLine("Invalid Command");
     }
     catch (IndexOutOfRangeException)
     {
         DisplayHelp();
     }
     catch (FormatException)
     {
         Console.WriteLine("Invalid date entered");
     }
 }
Beispiel #4
0
 public void AddSubfolder(TagFolder subfolder)
 {
     if (GetSubfolder(subfolder.FolderName) == null)
     Subfolders.Add(subfolder);
 }
Beispiel #5
0
 public void ReplaceSubFolder(TagFolder oldsubfolder, TagFolder newsubfolder)
 {
     if (Subfolders.IndexOf(oldsubfolder) >= 0)
     Subfolders[Subfolders.IndexOf(oldsubfolder)] = newsubfolder;
        else foreach (TagFolder tg in Subfolders)
         tg.ReplaceSubFolder(oldsubfolder, newsubfolder);
 }