示例#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);
            }
        }
示例#2
0
        protected override BasicNoteImpl CreateClone()
        {
            var n = new SimpleNote(_id, _config, _hConfig);

            using (n.SuppressDirtyChanges())
            {
                n._tags.Synchronize(_tags.ToList());
                n._content          = _content;
                n._deleted          = _deleted;
                n._shareURL         = _shareURL;
                n._publicURL        = _publicURL;
                n._systemTags       = _systemTags.ToList();
                n._creationDate     = _creationDate;
                n._modificationDate = _modificationDate;
                n._localVersion     = _localVersion;

                return(n);
            }
        }