public Timeline GetNotesFromDay(Date date)
        {
            Timeline returnTimeline = new Timeline();

            foreach (Note note in _timelineList)
            {
                if (date.Year == note.Date.Year &&
                    date.Month == note.Date.Month &&
                    date.Day == note.Date.Day)
                {
                    returnTimeline.Add(note);
                }
            }
            return(returnTimeline);
        }
Exemple #2
0
        public bool LoadTimeline(out Timeline timeline)
        {
            CreateBaseFileIfMissing();

            timeline = new Timeline();

            XmlReader         reader;
            XmlReaderSettings settings = new XmlReaderSettings();
            XmlDocument       doc      = new XmlDocument();

            //XmlSchema schema = getSchema();

            //settings.Schemas.Add(schema);

            //reader = XmlReader.Create(FilePath, settings);

            reader = XmlReader.Create(FilePath);

            doc.Load(reader);

            //doc.Validate

            XmlNode root = doc.FirstChild;

            root = root.NextSibling;

            List <Note> noteList = new List <Note>();

            foreach (XmlNode noteNode in root.ChildNodes)
            {
                noteList.Add(ParseXmlNodeToNote(noteNode));
            }

            for (int i = noteList.Count - 1; i >= 0; i--)
            {
                timeline.Add(noteList[i]);
            }

            reader.Close();
            return(true);
        }