private INote getDeterminedNoteObject(string data, string header, string content)
        {
            INote note;

            switch (data)
            {
            case "check":
                note = new CheckListNote();
                break;

            case "info":
                note = new InfoNote();
                break;

            case "list":
                note = new ListNote();
                break;

            case "remind":
                note = new RemindNote();
                break;

            case "warn":
                note = new WarnNote();
                break;

            default:
                Logger.PrintError($"Unkonwn note {data}");
                throw new Exception($"Unknown note {data}");
            }

            note.BuildFromInput(header, content);
            return(note);
        }
Beispiel #2
0
        private INote getNoteFromId(string line)
        {
            INote note;

            if (line.StartsWith(CheckListNote.NAME_ID))
            {
                note = new CheckListNote();
            }
            else if (line.StartsWith(InfoNote.NAME_ID))
            {
                note = new InfoNote();
            }
            else if (line.StartsWith(ListNote.NAME_ID))
            {
                note = new ListNote();
            }
            else if (line.StartsWith(RemindNote.NAME_ID))
            {
                note = new RemindNote();
            }
            else if (line.StartsWith(WarnNote.NAME_ID))
            {
                note = new WarnNote();
            }
            else
            {
                handleUnrecognizedNoteError(line);
                throw new Exception($"Unrecognized note type in line {line}");
            }

            new NoteBuilder().BuildFromLine(line, note);
            return(note);
        }