コード例 #1
0
        public ReadingNotes BuildReadingNotes(string EditionNumber)
        {
            var notes        = StorageHelper.GetAllNotefromStorage();
            var readingNotes = new ReadingNotes();

            List <string> allTags = new List <string>();

            allTags.Add("readingnotes");

            foreach (var n in notes)
            {
                allTags    = KeepUniqueTag(allTags, n.Tags);
                n.Category = GetCategory(n.Tags);

                // little tweak because it's a pain to set the first caracter uppercase on the kindle.
                n.Comment = n.Comment.First().ToString().ToUpper() + String.Join("", n.Comment.Skip(1));

                if (readingNotes.Notes[n.Category] == null)
                {
                    readingNotes.Notes[n.Category] = new List <Note>();
                }

                ((List <Note>)readingNotes.Notes[n.Category]).Add(n);
            }

            readingNotes.Title = string.Concat("Reading Notes #", EditionNumber);
            readingNotes.Tags  = string.Join(",", allTags.OrderBy(c => c));

            StorageHelper.SaveJSonReadingNotesToStorage(readingNotes.Serialize());
            StorageHelper.SaveReadingNotesToStorage(readingNotes.ToMarkDown());

            return(readingNotes);
        }
コード例 #2
0
        public string ReProcessJSonReadingNotes(string Filename)
        {
            ReadingNotes readNotes = ReadingNotes.CreateFromString(StorageHelper.GetJSonReadingNotes(Filename));
            var          mdNotes   = readNotes.ToMarkDown();

            StorageHelper.SaveReadingNotesToStorage(mdNotes);

            return(mdNotes);
        }