Ejemplo n.º 1
0
        public ActionResult Index(string note, string content)
        {
            var noteStore = Evernote.GetNoteStore(User.Identity.Name);

            var n = noteStore.getNote(User.Identity.Name, note, true, false, false, false);

            content = content.Replace("\r", "").Replace("\n", "<br />");

            n.Content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\"><en-note><pre>" + content.Trim() + "</pre></en-note>";
            noteStore.updateNote(User.Identity.Name, n);

            return(RedirectToAction("Index", new { note }));
        }
Ejemplo n.º 2
0
        public ActionResult Index(bool loadNotes = false)
        {
            if (User.Identity.IsAuthenticated)
            {
                try
                {
                    var noteStore = Evernote.GetNoteStore(User.Identity.Name);
                    noteStore.listNotebooks(User.Identity.Name);

                    return(RedirectToAction("Index", "Notes"));
                }
                catch
                {
                    return(RedirectToAction("Logoff"));
                }
            }

            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult Index(string notebook)
        {
            var viewModel = new IndexViewModel();

            var noteStore = Evernote.GetNoteStore(User.Identity.Name);

            foreach (var n in noteStore.listNotebooks(User.Identity.Name))
            {
                var notesCount = noteStore.findNoteCounts(User.Identity.Name, new NoteFilter {
                    NotebookGuid = n.Guid
                }, false).NotebookCounts.First().Value;
                var notebookViewModel = new IndexViewModel.Notebook
                {
                    Id         = n.Guid,
                    Name       = n.Name,
                    NotesCount = notesCount
                };

                if (n.Guid == notebook)
                {
                    foreach (var note in noteStore.findNotes(User.Identity.Name, new NoteFilter {
                        NotebookGuid = n.Guid
                    }, 0, 1000).Notes)
                    {
                        notebookViewModel.Notes.Add(new IndexViewModel.Note
                        {
                            Id         = note.Guid,
                            Name       = note.Title,
                            UpdateDate = new DateTime(1970, 1, 1).AddMilliseconds(note.Updated)
                        });
                    }
                }

                viewModel.Notebooks.Add(notebookViewModel);
            }

            return(View(viewModel));
        }
Ejemplo n.º 4
0
        private IndexViewModel BuildViewModel(string noteId)
        {
            var viewModel = new IndexViewModel();
            var noteStore = Evernote.GetNoteStore(User.Identity.Name);

            var note     = noteStore.getNote(User.Identity.Name, noteId, true, false, false, false);
            var notebook = noteStore.getNotebook(User.Identity.Name, note.NotebookGuid);

            viewModel.Title            = note.Title;
            viewModel.NotebookAndTitle = notebook.Name + "\\" + note.Title;
            viewModel.NoteId           = noteId;

            var xmlContent = XDocument.Parse(note.Content);

            if (xmlContent.Root != null)
            {
                var content = xmlContent.Root.ToString();

                //replace the <en-note> tag
                content = content.Substring(9);
                content = content.Substring(0, content.Length - 10);
                content = content.Replace("<br />", "\r\n").Trim();

                if (content.StartsWith("<pre>"))
                {
                    content = content.Substring(5);
                }
                if (content.EndsWith("</pre>"))
                {
                    content = content.Substring(0, content.Length - 6);
                }

                viewModel.Content = content.Trim();
            }

            return(viewModel);
        }
Ejemplo n.º 5
0
 public IAsyncResult Begin_createSearch(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.SavedSearch search)
 {
   return send_createSearch(callback, state, authenticationToken, search);
 }
Ejemplo n.º 6
0
 public IAsyncResult send_getLinkedNotebookSyncChunk(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.LinkedNotebook linkedNotebook, int afterUSN, int maxEntries, bool fullSyncOnly)
Ejemplo n.º 7
0
 public void send_getLinkedNotebookSyncState(string authenticationToken, Evernote.EDAM.Type.LinkedNotebook linkedNotebook)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("getLinkedNotebookSyncState", TMessageType.Call, seqid_));
   getLinkedNotebookSyncState_args args = new getLinkedNotebookSyncState_args();
   args.AuthenticationToken = authenticationToken;
   args.LinkedNotebook = linkedNotebook;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT || NETFX_CORE
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Ejemplo n.º 8
0
      public SyncState getLinkedNotebookSyncState(string authenticationToken, Evernote.EDAM.Type.LinkedNotebook linkedNotebook)
      {
        #if !SILVERLIGHT && !NETFX_CORE
        send_getLinkedNotebookSyncState(authenticationToken, linkedNotebook);
        return recv_getLinkedNotebookSyncState();

        #else
        var asyncResult = Begin_getLinkedNotebookSyncState(null, null, authenticationToken, linkedNotebook);
        return End_getLinkedNotebookSyncState(asyncResult);

        #endif
      }
Ejemplo n.º 9
0
 public IAsyncResult Begin_updateLinkedNotebook(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.LinkedNotebook linkedNotebook)
 {
   return send_updateLinkedNotebook(callback, state, authenticationToken, linkedNotebook);
 }
Ejemplo n.º 10
0
 public IAsyncResult send_setSharedNotebookRecipientSettings(AsyncCallback callback, object state, string authenticationToken, long sharedNotebookId, Evernote.EDAM.Type.SharedNotebookRecipientSettings recipientSettings)
Ejemplo n.º 11
0
 public void send_updateSharedNotebook(string authenticationToken, Evernote.EDAM.Type.SharedNotebook sharedNotebook)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("updateSharedNotebook", TMessageType.Call, seqid_));
   updateSharedNotebook_args args = new updateSharedNotebook_args();
   args.AuthenticationToken = authenticationToken;
   args.SharedNotebook = sharedNotebook;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT || NETFX_CORE
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Ejemplo n.º 12
0
      public Evernote.EDAM.Type.SharedNotebook createSharedNotebook(string authenticationToken, Evernote.EDAM.Type.SharedNotebook sharedNotebook)
      {
        #if !SILVERLIGHT && !NETFX_CORE
        send_createSharedNotebook(authenticationToken, sharedNotebook);
        return recv_createSharedNotebook();

        #else
        var asyncResult = Begin_createSharedNotebook(null, null, authenticationToken, sharedNotebook);
        return End_createSharedNotebook(asyncResult);

        #endif
      }
Ejemplo n.º 13
0
 public void send_updateResource(string authenticationToken, Evernote.EDAM.Type.Resource resource)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("updateResource", TMessageType.Call, seqid_));
   updateResource_args args = new updateResource_args();
   args.AuthenticationToken = authenticationToken;
   args.Resource = resource;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT || NETFX_CORE
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Ejemplo n.º 14
0
 public IAsyncResult send_updateTag(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.Tag tag)
Ejemplo n.º 15
0
      public int updateTag(string authenticationToken, Evernote.EDAM.Type.Tag tag)
      {
        #if !SILVERLIGHT && !NETFX_CORE
        send_updateTag(authenticationToken, tag);
        return recv_updateTag();

        #else
        var asyncResult = Begin_updateTag(null, null, authenticationToken, tag);
        return End_updateTag(asyncResult);

        #endif
      }
Ejemplo n.º 16
0
 public IAsyncResult Begin_updateTag(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.Tag tag)
 {
   return send_updateTag(callback, state, authenticationToken, tag);
 }
Ejemplo n.º 17
0
 public Evernote.EDAM.Type.Tag createTag(string authenticationToken, Evernote.EDAM.Type.Tag tag)
 {
     send_createTag(authenticationToken, tag);
     return recv_createTag();
 }
Ejemplo n.º 18
0
 public Evernote.EDAM.Type.SharedNotebook createSharedNotebook(string authenticationToken, Evernote.EDAM.Type.SharedNotebook sharedNotebook)
 {
     send_createSharedNotebook(authenticationToken, sharedNotebook);
     return recv_createSharedNotebook();
 }
Ejemplo n.º 19
0
 public IAsyncResult Begin_createSharedNotebook(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.SharedNotebook sharedNotebook)
 {
   return send_createSharedNotebook(callback, state, authenticationToken, sharedNotebook);
 }
Ejemplo n.º 20
0
      public int updateSearch(string authenticationToken, Evernote.EDAM.Type.SavedSearch search)
      {
        #if !SILVERLIGHT && !NETFX_CORE
        send_updateSearch(authenticationToken, search);
        return recv_updateSearch();

        #else
        var asyncResult = Begin_updateSearch(null, null, authenticationToken, search);
        return End_updateSearch(asyncResult);

        #endif
      }
Ejemplo n.º 21
0
 public IAsyncResult send_updateSharedNotebook(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.SharedNotebook sharedNotebook)
Ejemplo n.º 22
0
 public IAsyncResult send_updateSearch(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.SavedSearch search)
Ejemplo n.º 23
0
      public int setSharedNotebookRecipientSettings(string authenticationToken, long sharedNotebookId, Evernote.EDAM.Type.SharedNotebookRecipientSettings recipientSettings)
      {
        #if !SILVERLIGHT && !NETFX_CORE
        send_setSharedNotebookRecipientSettings(authenticationToken, sharedNotebookId, recipientSettings);
        return recv_setSharedNotebookRecipientSettings();

        #else
        var asyncResult = Begin_setSharedNotebookRecipientSettings(null, null, authenticationToken, sharedNotebookId, recipientSettings);
        return End_setSharedNotebookRecipientSettings(asyncResult);

        #endif
      }
Ejemplo n.º 24
0
      public Evernote.EDAM.Type.Note createNote(string authenticationToken, Evernote.EDAM.Type.Note note)
      {
        #if !SILVERLIGHT && !NETFX_CORE
        send_createNote(authenticationToken, note);
        return recv_createNote();

        #else
        var asyncResult = Begin_createNote(null, null, authenticationToken, note);
        return End_createNote(asyncResult);

        #endif
      }
Ejemplo n.º 25
0
 public void send_setSharedNotebookRecipientSettings(string authenticationToken, long sharedNotebookId, Evernote.EDAM.Type.SharedNotebookRecipientSettings recipientSettings)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("setSharedNotebookRecipientSettings", TMessageType.Call, seqid_));
   setSharedNotebookRecipientSettings_args args = new setSharedNotebookRecipientSettings_args();
   args.AuthenticationToken = authenticationToken;
   args.SharedNotebookId = sharedNotebookId;
   args.RecipientSettings = recipientSettings;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT || NETFX_CORE
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Ejemplo n.º 26
0
 public IAsyncResult send_createNote(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.Note note)
Ejemplo n.º 27
0
      public int updateLinkedNotebook(string authenticationToken, Evernote.EDAM.Type.LinkedNotebook linkedNotebook)
      {
        #if !SILVERLIGHT && !NETFX_CORE
        send_updateLinkedNotebook(authenticationToken, linkedNotebook);
        return recv_updateLinkedNotebook();

        #else
        var asyncResult = Begin_updateLinkedNotebook(null, null, authenticationToken, linkedNotebook);
        return End_updateLinkedNotebook(asyncResult);

        #endif
      }
Ejemplo n.º 28
0
 public void send_createNote(string authenticationToken, Evernote.EDAM.Type.Note note)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("createNote", TMessageType.Call, seqid_));
   createNote_args args = new createNote_args();
   args.AuthenticationToken = authenticationToken;
   args.Note = note;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT || NETFX_CORE
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Ejemplo n.º 29
0
 public IAsyncResult send_getLinkedNotebookSyncState(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.LinkedNotebook linkedNotebook)
Ejemplo n.º 30
0
 public IAsyncResult Begin_updateNote(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.Note note)
 {
   return send_updateNote(callback, state, authenticationToken, note);
 }
Ejemplo n.º 31
0
      public SyncChunk getLinkedNotebookSyncChunk(string authenticationToken, Evernote.EDAM.Type.LinkedNotebook linkedNotebook, int afterUSN, int maxEntries, bool fullSyncOnly)
      {
        #if !SILVERLIGHT && !NETFX_CORE
        send_getLinkedNotebookSyncChunk(authenticationToken, linkedNotebook, afterUSN, maxEntries, fullSyncOnly);
        return recv_getLinkedNotebookSyncChunk();

        #else
        var asyncResult = Begin_getLinkedNotebookSyncChunk(null, null, authenticationToken, linkedNotebook, afterUSN, maxEntries, fullSyncOnly);
        return End_getLinkedNotebookSyncChunk(asyncResult);

        #endif
      }
Ejemplo n.º 32
0
      public int updateResource(string authenticationToken, Evernote.EDAM.Type.Resource resource)
      {
        #if !SILVERLIGHT && !NETFX_CORE
        send_updateResource(authenticationToken, resource);
        return recv_updateResource();

        #else
        var asyncResult = Begin_updateResource(null, null, authenticationToken, resource);
        return End_updateResource(asyncResult);

        #endif
      }
Ejemplo n.º 33
0
 public void send_getLinkedNotebookSyncChunk(string authenticationToken, Evernote.EDAM.Type.LinkedNotebook linkedNotebook, int afterUSN, int maxEntries, bool fullSyncOnly)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("getLinkedNotebookSyncChunk", TMessageType.Call, seqid_));
   getLinkedNotebookSyncChunk_args args = new getLinkedNotebookSyncChunk_args();
   args.AuthenticationToken = authenticationToken;
   args.LinkedNotebook = linkedNotebook;
   args.AfterUSN = afterUSN;
   args.MaxEntries = maxEntries;
   args.FullSyncOnly = fullSyncOnly;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT || NETFX_CORE
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Ejemplo n.º 34
0
 public IAsyncResult send_updateResource(AsyncCallback callback, object state, string authenticationToken, Evernote.EDAM.Type.Resource resource)