示例#1
0
        /// <summary>
        /// push tag order info
        /// </summary>
        internal static TagMeta pushTag(TagItem i)
        {
            var js   = new JavaScriptSerializer();
            var node = new TagMeta();

            node.index   = i.Index;
            node.name    = i.Name;
            node.version = i.Version;
            var data = js.Serialize(node);
            var url  = (i.Version == 0) ? "/api2/tags" : "/api2/tags/" + i.Name;
            var s    = RequestRetry(url, "POST", data);

            return(js.Deserialize <TagMeta>(s));
        }
示例#2
0
        // update tag order/ver
        private void UpdateTag(TagItem tag, TagMeta raw, TaskScheduler ui)
        {
            tag.Index = raw.index;
              tag.Version = raw.version;
              //save to db
              var conn = new SQLiteConnection(ConnString);
              conn.Open();
              using (SQLiteTransaction tr = conn.BeginTransaction()) {
            using (SQLiteCommand cmd = new SQLiteCommand(conn)) {
              cmd.CommandText = "UPDATE tags SET `index`=?, version=? WHERE id=?"; // don't update name
              cmd.Parameters.AddWithValue(null, tag.Index);
              cmd.Parameters.AddWithValue(null, tag.Version);
              cmd.Parameters.AddWithValue(null, tag.Id);
              cmd.ExecuteNonQuery();
            }
            tr.Commit();
              }
              conn.Close();

              // sync with ui
              Task t1 = new Task(() => {
            tree.RefreshObject(tag);
            tree.Sort();
              });
              t1.Start(ui);
        }
示例#3
0
 /// <summary>
 /// push tag order info
 /// </summary>
 internal static TagMeta pushTag(TagItem i)
 {
     var js = new JavaScriptSerializer();
       var node = new TagMeta();
       node.index = i.Index;
       node.name = i.Name;
       node.version = i.Version;
       var data = js.Serialize(node);
       var url = (i.Version == 0) ? "/api2/tags" : "/api2/tags/"+i.Name;
       var s = RequestRetry(url, "POST", data);
       return js.Deserialize<TagMeta>(s);
 }