Beispiel #1
0
        private static SimpleNote GetNoteFromQuery(APIResultNoteData r, ISimpleJsonRest c, string id, SimpleNoteConfig cfg, SimpleNoteConnection conn)
        {
            try
            {
                var n = new SimpleNote(id, cfg, conn.HConfig);
                using (n.SuppressDirtyChanges())
                {
                    n.Deleted          = r.deleted;
                    n.ShareURL         = r.shareURL;
                    n.PublicURL        = r.publishURL;
                    n.SystemTags       = r.systemTags;
                    n.Content          = r.content;
                    n.ModificationDate = ConvertFromEpochDate(r.modificationDate);
                    n.CreationDate     = ConvertFromEpochDate(r.creationDate);
                    n.LocalVersion     = int.Parse(c.GetResponseHeader("X-Simperium-Version"));
                    n.Tags.Synchronize(r.tags);
                };

                return(n);
            }
            catch (RestException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new SimpleNoteAPIException("SimpleNote API returned unexpected note data", e);
            }
        }