// Evernote has a bunch of junk in it's xml tomboy doesn't care about, and tomboy // also requires some specific tags. So strip out evernote's and add tomboys // TODO - Really, Really need to convert the html-like tags, not just strip them // TODO - so that we can keep things like bulleted lists, font sizes, etc public string CreateTomboyNoteContent(Evernote.EDAM.Type.Note note) { string evernoteContent; try { evernoteContent = _noteStore.getNoteContent(_authToken, note.Guid); } catch (Exception e) { evernoteContent = "Could not retrieve Evernote Content"; } ExportManager exportManager = new ExportManager(EvernoteToTomboyXSLTResourceName); string tomboyContent; try { tomboyContent = exportManager.ApplyXSL(evernoteContent, note.Title, null, ValidationType.DTD); } catch (Exception e) { tomboyContent = "Evernote Export failed." + " Please report a bug at http://bugzilla.gnome.org with the following: (strip out confidential information)" + e + "\n" + note; } string content = TomboyHeader + "\n" + "<title>" + note.Title + "</title>" + "<text xml:space=\"preserve\"><note-content version=\"0.1\">" + "\n"; content += tomboyContent; content += "</note-content></text>\n"; DateTime date; if (note.Updated > DateTime.MinValue.Ticks && note.Updated < DateTime.MaxValue.Ticks) { date = Epoch.Add(TimeSpan.FromTicks(note.Updated * 10000)); } else { date = DateTime.Now; } content += "<last-change-date>" + date + "</last-change-date>\n"; content += "<last-metadata-change-date>" + date + "</last-metadata-change-date>\n"; if (note.Created > DateTime.MinValue.Ticks && note.Created < DateTime.MaxValue.Ticks) { date = Epoch.Add(TimeSpan.FromTicks(note.Created * 10000)); } content += "<create-date>" + date + "</create-date>\n"; content += "</note>"; return(content); }
private Evernote.EDAM.Type.Note FillEvernote(Note tomboynote, Evernote.EDAM.Type.Note evernote) { Logger.Debug("[Evernote] Creating new Evernote from tomboy:" + tomboynote.Id.ToString()); if (evernote.Attributes == null) { evernote.Attributes = new NoteAttributes(); } evernote.Attributes.SourceApplication = "tomboy"; //this note came from tomboy. This is read later to match guids evernote.Attributes.Source = tomboynote.Id; ExportManager exportManager = new ExportManager(TomboyToEvernoteXSLTResourceName); string mycontent = exportManager.ApplyXSL(tomboynote); string content = mycontent; evernote.Content += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml.dtd\">"; evernote.Content += content; try { ValidateXML(evernote.Content); } catch (Exception e) { Logger.Error("[Evernote] Could not validate XML: " + evernote.Content); } evernote.Title = tomboynote.Title; if (tomboynote.Tags.Count > 0) { evernote.TagNames = new List <string>(); foreach (Tag tag in tomboynote.Tags) { evernote.TagNames.Add(tag.Name); } } evernote.NotebookGuid = _tomboyNotebook.Guid; evernote.Created = (long)tomboynote.CreateDate.Subtract(Epoch).TotalMilliseconds; evernote.Updated = (long)tomboynote.ChangeDate.Subtract(Epoch).TotalMilliseconds; return(evernote); }
private Evernote.EDAM.Type.Note FillEvernote(Note tomboynote, Evernote.EDAM.Type.Note evernote) { Logger.Debug("[Evernote] Creating new Evernote from tomboy:" + tomboynote.Id.ToString()); if (evernote.Attributes == null) { evernote.Attributes = new NoteAttributes(); } evernote.Attributes.SourceApplication = "tomboy"; //this note came from tomboy. This is read later to match guids evernote.Attributes.Source = tomboynote.Id; ExportManager exportManager = new ExportManager(TomboyToEvernoteXSLTResourceName); string mycontent = exportManager.ApplyXSL(tomboynote); string content = mycontent; evernote.Content += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml.dtd\">"; evernote.Content += content; try { ValidateXML(evernote.Content); } catch (Exception e) { Logger.Error("[Evernote] Could not validate XML: " + evernote.Content); } evernote.Title = tomboynote.Title; if (tomboynote.Tags.Count > 0) { evernote.TagNames = new List<string>(); foreach (Tag tag in tomboynote.Tags) { evernote.TagNames.Add(tag.Name); } } evernote.NotebookGuid = _tomboyNotebook.Guid; evernote.Created = (long)tomboynote.CreateDate.Subtract(Epoch).TotalMilliseconds; evernote.Updated = (long)tomboynote.ChangeDate.Subtract(Epoch).TotalMilliseconds; return evernote; }
// Evernote has a bunch of junk in it's xml tomboy doesn't care about, and tomboy // also requires some specific tags. So strip out evernote's and add tomboys // TODO - Really, Really need to convert the html-like tags, not just strip them // TODO - so that we can keep things like bulleted lists, font sizes, etc public string CreateTomboyNoteContent(Evernote.EDAM.Type.Note note) { string evernoteContent; try { evernoteContent = _noteStore.getNoteContent(_authToken, note.Guid); } catch (Exception e) { evernoteContent = "Could not retrieve Evernote Content"; } ExportManager exportManager = new ExportManager(EvernoteToTomboyXSLTResourceName); string tomboyContent; try { tomboyContent = exportManager.ApplyXSL(evernoteContent, note.Title, null, ValidationType.DTD); } catch (Exception e) { tomboyContent = "Evernote Export failed." + " Please report a bug at http://bugzilla.gnome.org with the following: (strip out confidential information)" + e + "\n" + note; } string content = TomboyHeader + "\n" + "<title>" + note.Title + "</title>" + "<text xml:space=\"preserve\"><note-content version=\"0.1\">" + "\n"; content += tomboyContent; content += "</note-content></text>\n"; DateTime date; if (note.Updated > DateTime.MinValue.Ticks && note.Updated < DateTime.MaxValue.Ticks) { date = Epoch.Add(TimeSpan.FromTicks(note.Updated*10000)); } else { date = DateTime.Now; } content += "<last-change-date>" + date + "</last-change-date>\n"; content += "<last-metadata-change-date>" + date + "</last-metadata-change-date>\n"; if (note.Created > DateTime.MinValue.Ticks && note.Created < DateTime.MaxValue.Ticks) { date = Epoch.Add(TimeSpan.FromTicks(note.Created * 10000)); } content += "<create-date>" + date + "</create-date>\n"; content += "</note>"; return content; }