Exemple #1
0
        public void SaveFile(Noot ourTask)
        {
            FileStream   file   = new FileStream("1.dat", FileMode.Create, FileAccess.Write);
            BinaryWriter writer = new BinaryWriter(file);

            writer.Write(ourTask.AllTask.Count());
            for (int i = 0; i < ourTask.AllTask.Count(); i++)
            {
                writer.Write(ourTask.AllTask[i].Tage);
                writer.Write(ourTask.AllTask[i].Task);
                writer.Write(ourTask.AllTask[i].priority);
                writer.Write(ourTask.AllTask[i].dateTime.ToString());
            }
            writer.Close();
            file.Close();
        }
Exemple #2
0
        public void LoadFile(ref Noot ourTask)
        {
            FileStream   file   = new FileStream("1.dat", FileMode.Open, FileAccess.Read);
            BinaryReader reader = new BinaryReader(file);
            int          count  = reader.ReadInt32();

            ourTask         = new Noot();
            ourTask.AllTask = new List <TaskList>(count);
            TaskList one;

            for (int i = 0; i < count; i++)
            {
                one.Tage     = reader.ReadString();
                one.Task     = reader.ReadString();
                one.priority = reader.ReadInt32();
                one.dateTime = DateTime.Parse(reader.ReadString());
                ourTask.AllTask.Add(one);
            }
            reader.Close();
            file.Close();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Noot obj = new Noot();

            /*TaskList first = new TaskList();
             * first.Tage = "meat";
             * first.Task = "meat freand";
             * first.dateTime = DateTime.Parse("12/11/2010 8:12:12 PM");
             *
             *
             * //Noot.CreateTask(ref first);
             * obj.AddTask(first);
             *
             *
             * TaskList second = new TaskList();
             * second.Tage = "dot";
             * second.Task = "meat girls";
             * second.dateTime = DateTime.Parse("12/11/2011 3:12:12 PM");
             * //Noot.CreateTask(ref second);
             * obj.AddTask(second);
             * // obj.Print();*/


            //obj.DeleteTask(0);
            //obj.Print();

            //Strategy search;

            //obj.ChangeTask(out search);
            //obj.Print();

            FileManager file = new FileManager();

            file.LoadFile(ref obj);
            obj.Print();
        }