Esempio n. 1
0
        public TaskList.SerializedForm LoadTasks()
        {
            if (!File.Exists(this.taskFile))
            {
                return(null);
            }
            StreamReader sr = new StreamReader(this.taskFile);

            TaskList.SerializedForm serializedForm = JsonMapper.ToObject <TaskList.SerializedForm>(sr.ReadToEnd());
            sr.Close();
            return(serializedForm);
        }
Esempio n. 2
0
        public void SaveTasks(TaskList.SerializedForm serializedForm)
        {
            JsonWriter writer = new JsonWriter();

            writer.PrettyPrint = true;
            JsonMapper.ToJson(serializedForm, writer);
            string       json = writer.ToString();
            StreamWriter sr   = new StreamWriter(this.taskFile);

            sr.Write(json);
            sr.Close();
        }