private void saveTask(Task task) { ConfigAccessor accessor = new ConfigAccessor(); Catagory cat = new Catagory("Task"); cat.addAttribute("File", task.FileName); cat.addAttribute("Process", task.Process.ToString()); accessor.addCatagory(cat.Name, cat); accessor.writeConfigToFile(TASK_FILE); }
private Task loadTaskFromFile() { ConfigAccessor accessor = new ConfigAccessor(); if (!accessor.readConfigFromFile(TASK_FILE)) return null; Catagory cat = accessor.getCatagory("Task"); if (cat == null) return null; String file = cat.getAttribute("File", null); int process = cat.getIntAttribute("Process", -1); if (file == null || process < 0) return null; Task task = new Task(file); task.Process = process; return task; }