/// <summary> /// Builds a note that can be displayed within Viq. /// </summary> /// <param name="note"></param> /// <param name="resolver"></param> /// <returns></returns> private NoteModel BuildNote(Note note, TextResolver resolver) { // we have a note so we need to get the full content - we will extract the text for now and maybe images string content = _Instance.getNoteContent(_authToken, note.Guid); // we have a new note - etl the data NoteModel newnote = new NoteModel(); newnote.ExternalId = new Guid(note.Guid); newnote.Title = note.Title; newnote.Timestamp = note.Updated; newnote.Text = ParseContent(note, content, resolver); newnote.DateCreated = DateTime.Now; newnote.DateModified = DateTime.Now; newnote.Notebook = new Guid(note.NotebookGuid); return(newnote); }
/// <summary> /// Takes the raw evernote output and transforms to something we can consume. /// </summary> /// <param name="content"></param> /// <param name="resolver"></param> /// <returns></returns> private string ParseContent(Note note, string content, TextResolver resolver) { switch (resolver) { case TextResolver.basic: { return(BasicContent(note, content)); } case TextResolver.strip: { return(StripContent(content)); } default: { return(content); } } }
/// <summary> /// Retrieves the note with the specified Guid and its content. /// </summary> /// <param name="id"></param> /// <returns></returns> public NoteModel Get(Guid id, TextResolver resolver) { Note note = _Instance.getNote(_authToken, id.ToString(), true, false, false, false); return(BuildNote(note, resolver)); }
/// <summary> /// This will read a set of annotated notes from the specified notebook. That is, this method will attempt to get the note, its attributes, the content and resolve images in the content. /// Using this call you'd likely have stored the version against each notebookid in your local data store. /// </summary> /// <param name="authToken">Your auth token to authenticate against the api.</param> /// <param name="notebookid">The Id of the notebook to filter on.</param> /// <param name="version">This is compared with the UpdateCount which is a value Evernote store at the account level to say if ANY of the notebooks have been updated. /// You can get this from the UserService.GetVersion() method. The first call will always get the latest.</param> /// <param name="version">This is the timestamp of the last note you retrieved. The first call will get the latest notes.</param> /// <param name="raw">Html returns the full XML with much of the content resolved. Strip will return pure text. Basic will strip most of the XML but resolve images etc and leave basic HTML elements in there - useful is writing to a webpage.</param> /// <param name="timestamp"></param> /// <returns></returns> public IList <NoteModel> GetNotes(Guid notebookid, long?timestamp, out long newtimestamp, TextResolver resolver = TextResolver.basic) { // initialize newtimestamp = 0; if (!timestamp.HasValue) { timestamp = 0; } // add in a filter int pageSize = 10; int pageNumber = 0; NoteFilter filter = new NoteFilter(); filter.Order = (int)Evernote.EDAM.Type.NoteSortOrder.UPDATED; filter.Ascending = false; filter.NotebookGuid = notebookid.ToString(); // set the notebook to filter on // what do we want back from the query? //NotesMetadataResultSpec resultSpec = new NotesMetadataResultSpec() { IncludeTitle = true, IncludeUpdated = true }; // execute the query for the notes NoteList newNotes = _Instance.findNotes(_authToken, filter, pageNumber * pageSize, pageSize);//, resultSpec); // initialize response collection IList <NoteModel> notes = new List <NoteModel>(); // store the latest timestamp if (newNotes.Notes != null && newNotes.Notes.Count > 0) { newtimestamp = newNotes.Notes.FirstOrDefault().Updated; } // enumerate and build response foreach (Note note in newNotes.Notes) { // if the db timestamp is the same or later than the note then ignore it // is the timestamp which is the last time this project was checked if (timestamp >= note.Updated) { continue; } notes.Add(BuildNote(note, resolver)); } return(notes); }
public SimplifyKroneckerDeltas2(XMLImporter xmlImporter, TextResolver textResolver, LayoutConverter layoutConverter) : base(xmlImporter, textResolver, layoutConverter) { }
public DefineThePoissonEquation(XMLImporter xmlImporter, TextResolver textResolver, LayoutConverter layoutConverter) : base(xmlImporter, textResolver, layoutConverter) { }
public EvaluateTheKroneckerDelta(XMLImporter xmlImporter, TextResolver textResolver, LayoutConverter layoutConverter) : base(xmlImporter, textResolver, layoutConverter) { }
public TextResolverTests() { _textResolver = new TextResolver(); }
public CalculateTheBeatFrequency1(XMLImporter xmlImporter, TextResolver textResolver, LayoutConverter layoutConverter) : base(xmlImporter, textResolver, layoutConverter) { }