private EvernoteNote APIDownloadNote(Guid id)
        {
            var remote = nsClient.getNote(_token, id.ToString("D"), true, false, false, false);

            var note = new EvernoteNote(Guid.Parse(remote.Guid), _config, HConfig);

            if (remote.__isset.tagGuids)
            {
                note.Tags.Synchronize(ConvertTagsFromUUID(remote.TagGuids));
            }
            if (remote.__isset.updateSequenceNum)
            {
                note.UpdateSequenceNumber = remote.UpdateSequenceNum;
            }
            if (remote.__isset.content)
            {
                note.SetTextFromENML(remote.Content);
            }
            if (remote.__isset.title)
            {
                note.InternalTitle = remote.Title;
            }
            if (remote.__isset.updated)
            {
                note.ModificationDate = ConvertFromEpochDate(remote.Updated);
            }
            if (remote.__isset.created)
            {
                note.CreationDate = ConvertFromEpochDate(remote.Created);
            }

            return(note);
        }
Esempio n. 2
0
        protected override BasicNoteImpl CreateClone()
        {
            var n = new EvernoteNote(_id, _config, _hConfig);

            using (n.SuppressDirtyChanges())
            {
                n._internalTitle        = _internalTitle;
                n._text                 = _text;
                n._creationDate         = _creationDate;
                n._modificationDate     = _modificationDate;
                n._updateSequenceNumber = _updateSequenceNumber;
                return(n);
            }
        }
        private EvernoteNote APICreateNewNote(EvernoteNote note)
        {
            remoteDirty = true;

            var remoteNote = new Note();

            remoteNote.Guid     = note.ID.ToString("D");
            remoteNote.Title    = note.InternalTitle;
            remoteNote.Content  = note.CreateENML();
            remoteNote.TagNames = note.Tags.ToList();
            remoteNote.Created  = ConvertToEpochDate(note.CreationDate);
            remoteNote.Updated  = ConvertToEpochDate(note.ModificationDate);

            var createdNote = nsClient.createNote(_token, remoteNote);

            if (createdNote.__isset.tagGuids)
            {
                note.Tags.Synchronize(ConvertTagsFromUUID(createdNote.TagGuids));
            }
            if (createdNote.__isset.updateSequenceNum)
            {
                note.UpdateSequenceNumber = createdNote.UpdateSequenceNum;
            }
            if (createdNote.__isset.content)
            {
                note.SetTextFromENML(createdNote.Content);
            }
            if (createdNote.__isset.title)
            {
                note.InternalTitle = createdNote.Title;
            }
            if (createdNote.__isset.updated)
            {
                note.ModificationDate = ConvertFromEpochDate(createdNote.Updated);
            }
            if (createdNote.__isset.created)
            {
                note.CreationDate = ConvertFromEpochDate(createdNote.Created);
            }

            return(note);
        }