コード例 #1
0
        /// <summary>
        /// 上传图片
        /// </summary>
        /// <param name="id"></param>
        /// <param name="json"></param>
        /// <returns></returns>
        public static async Task <bool> SaveImageAsync(int id, string json)
        {
            string  url = Url + $"/video/{id}/snapshots";
            JObject obj = await WebClinetHepler.PostAsync(url, json).ConfigureAwait(false);

            return(obj != null);
        }
コード例 #2
0
ファイル: LabelData.cs プロジェクト: kora3306/VideoRecordings
        public static bool DeleteLabel(int id)
        {
            string  url = Url + $"/label/{id}";
            JObject obj = WebClinetHepler.Delete_New(url);

            return(obj != null);
        }
コード例 #3
0
        /// <summary>
        ///// 本机屏幕截图
        ///// </summary>
        //public void CaptureTheScreen()
        //{
        //    Point point = new Point(po.X, po.Y + 50);
        //    Bitmap bit = new Bitmap(videoPlayer1.Width, videoPlayer1.Height - 150);
        //    Graphics g = Graphics.FromImage(bit);
        //    g.CopyFromScreen(point, new Point(0, 0), bit.Size);
        //    string photoname = DateTime.Now.Ticks.ToString();
        //    bit.Save(Program.ImageSavePath + "\\" + photoname + ".jpg", ImageFormat.Jpeg);
        //    g.Dispose();
        //}

        /// <summary>
        /// 删除图片 本地..网络
        /// </summary>
        public void DelImage()
        {
            string url = AppSettings.Urlpath + "/video/snapshot/";

            if (imageListView1.SelectedItems.Count == 0)
            {
                return;
            }
            foreach (var item in imageListView1.SelectedItems)
            {
                if (imageurl.Contains(item.FileName))
                {
                    JObject obj = WebClinetHepler.Delete_New(url + item.Text.Split('/').Last());
                    if (obj == null)
                    {
                        MessageBox.Show(url + item.Text.Split('/').Last() + "删除失败");

                        return;
                    }
                    imageListView1.Items.Remove(item);
                    imageurl.Remove(url + item.Text.Split('/').Last());
                }
                else
                {
                    File.Delete(item.FileName);
                    paths.Remove(item.FileName);
                    imageListView1.Items.Remove(item);
                }
            }
            SetTheListView();
            ImageAdd();
            Program.log.Info($"删除图片{string.Join(",",imageListView1.SelectedItems.Select(t=>t.Name).ToList())}");
        }
コード例 #4
0
        public static int GetImageId(int id)
        {
            string  url = Url + $"/video/equipment/{id}/snapshot";
            JObject obj = WebClinetHepler.GetJObject(url);

            return(obj["result"] != null?int.Parse(obj["result"].ToString()) : 0);
        }
コード例 #5
0
        public static bool DeleteEquipmengt(List <int> ids)
        {
            string  url = Url + $"/video/equipments";
            JObject obj = WebClinetHepler.Delete_New(url, JsonConvert.SerializeObject(ids));

            return(obj != null);
        }
コード例 #6
0
        public static EquipmentInfo GetEquipmentById(int id)
        {
            string  url = Url + $"/video/equipments?id={id}";
            JObject obj = WebClinetHepler.GetJObject(url);

            return(JsonConvert.DeserializeObject <EquipmentInfo>(obj["result"]["equipments"][0].ToString()));
        }
コード例 #7
0
        public static JObject GetAllVideoInfo(string projectName)
        {
            string  geturl = Url + $"/videos?project_name={projectName}";
            JObject obj    = WebClinetHepler.GetJObject(geturl);

            return(obj);
        }
コード例 #8
0
ファイル: LabelData.cs プロジェクト: kora3306/VideoRecordings
        /// <summary>
        /// 视频打标签
        /// </summary>
        /// <param name="id"></param>
        /// <param name="labels"></param>
        /// <returns></returns>
        public static async Task <bool> AddLabelToVideoAsync(int id, List <int> labels)
        {
            string  url = Url + $"/video/{id}/labels";
            JObject obj = await WebClinetHepler.PostAsync(url, JsonConvert.SerializeObject(labels)).ConfigureAwait(false);

            return(obj != null);
        }
コード例 #9
0
ファイル: GroupData.cs プロジェクト: kora3306/VideoRecordings
        /// <summary>
        /// 获取条件通道
        /// </summary>
        /// <param name="city"></param>
        /// <param name="street"></param>
        /// <param name="site"></param>
        /// <param name="uid"></param>
        /// <returns></returns>
        public static MyGroup GetGroupShows(string city = null, string street = null, string site = null, string uid = null)
        {
            string url = Url + "/video/equipments";

            if (!string.IsNullOrEmpty(city))
            {
                url += $"?city={city}";
            }
            if (!string.IsNullOrEmpty(street))
            {
                url += $"&street={street}";
            }
            if (!string.IsNullOrEmpty(site))
            {
                url += $"&site={site}";
            }
            if (!string.IsNullOrEmpty(uid))
            {
                url += $"&uid={uid}";
            }
            JObject obj = WebClinetHepler.GetJObject(url);

            if (obj == null)
            {
                return(null);
            }
            MyGroup show = JsonConvert.DeserializeObject <MyGroup>(obj["result"].ToString());

            return(show);
        }
コード例 #10
0
ファイル: LabelData.cs プロジェクト: kora3306/VideoRecordings
        /// <summary>
        /// 标签添加到通道
        /// </summary>
        /// <param name="id"></param>
        /// <param name="labels"></param>
        /// <returns></returns>
        public static bool AddLabelToEquipment(int id, List <int> labels)
        {
            string  url = Url + $"/video/equipment/{id}/add/labels";
            JObject obj = WebClinetHepler.Post_New(url, JsonConvert.SerializeObject(labels));

            return(obj != null);
        }
コード例 #11
0
ファイル: GroupData.cs プロジェクト: kora3306/VideoRecordings
        /// <summary>
        /// 删除分组
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static bool DeleteGroup(int id)
        {
            string  url = Url + $"/video/equipment/group/{id}";
            JObject obj = WebClinetHepler.Delete_New(url);

            return(obj != null);
        }
コード例 #12
0
ファイル: Login.cs プロジェクト: kora3306/VideoRecordings
        /// <summary>
        /// 获取cookies并返回当前用户名
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            string url      = "http://192.168.1.225:19886/api/my/info";
            string name     = textBox_name.Text == string.Empty ? string.Empty : textBox_name.Text.Trim();
            string passWord = textBox_passward.Text == string.Empty ? string.Empty : textBox_passward.Text.Trim();

            if (name == string.Empty || passWord == string.Empty)
            {
                MessageBox.Show("账号或者密码不能为空");
                textBox_passward.Focus();
                return;
            }
            WebClinetHepler.Cookies = Logining(name, passWord);
            if (WebClinetHepler.Cookies == string.Empty)
            {
                MessageBox.Show("账号或者密码错误");
                Program.log.Error("账号登录", new Exception($"{textBox_name.Text}登录失败,账号密码错误"));
                textBox_passward.Focus();
                return;
            }
            LogSucceed = true;
            JObject obj = WebClinetHepler.GetJObject(url);

            AppSettings.User = JsonConvert.DeserializeObject <User>(obj["result"].ToString());
            AppSettings.UpdataLongName();
            UpdataLongPassWord(passWord, checkBox1.Checked);
            this.Close();
        }
コード例 #13
0
ファイル: LabelData.cs プロジェクト: kora3306/VideoRecordings
        public static TypeLabels GetLabelToEquipment(int id)
        {
            string  url = Url + $"/video/equipment/{id}/labels";
            JObject obj = WebClinetHepler.GetJObject(url);

            return(JsonConvert.DeserializeObject <TypeLabels>(obj["result"].ToString()));
        }
コード例 #14
0
        /// <summary>
        /// 清除扫描文件夹
        /// </summary>
        /// <param name="focusedfolder"></param>
        /// <returns></returns>
        public static bool DeleteScanFolder(int id)
        {
            string  url = Url + "/clear/video/project/" + id;
            JObject obj = WebClinetHepler.Post_New(url);

            return(obj != null);
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: kora3306/VideoRecordings
        /// <summary>
        /// 检查更新版本,有的话选择更新
        /// </summary>
        /// <returns></returns>
        private static bool CheckUpdate()
        {
            CheckUpdaterUpdate();
            if (WebClinetHepler.Get($"{AppSettings.UpdateApi}/api/VideoRecordings/verson") == AppSettings.Version ||
                !File.Exists("Updater.exe"))
            {
                return(false);
            }
            if (MessageBox.Show("有新版本需要更新?", @"提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return(true);
            }
            //ImageListViewCacheThumbnail.DiskCache.Clear();
            var p = new Process
            {
                StartInfo =
                {
                    FileName  = Path.Combine(Application.StartupPath, "Updater.exe"),
                    Arguments =
                        "\"VideoRecordings\" " +
                        "\"VideoRecordings.exe\" " +
                        "\"http://192.168.1.222:18820\" " +
                        "*.bat|LabelConfig.json|update server/|Log/|cache/|config.json|*.txt",
                    UseShellExecute = true
                }
            };

            p.Start();
            Environment.Exit(0);
            return(true);
        }
コード例 #16
0
        /// <summary>
        /// 扫描文件夹
        /// </summary>
        /// <param name="focusedfolder"></param>
        /// <returns></returns>
        public static bool ScanFolder(VideoProject focusedfolder)
        {
            string  posturl    = Url + "/scan/video/project/" + focusedfolder.Id.ToString();
            string  conditions = "project_name=" + focusedfolder.Name;
            JObject obj        = WebClinetHepler.Post_New(posturl);

            return(obj != null);
        }
コード例 #17
0
        /// <summary>
        /// 添加查重
        /// </summary>
        /// <param name="name"></param>
        /// <param name="info"></param>
        /// <param name="ids"></param>
        /// <returns></returns>
        public static bool VideoRepetition(string name, string info, int id, List <int> ids)
        {
            string     url        = Url + $"/video/check";
            Repetition repetition = new Repetition(name, info, id, ids);
            JObject    obj        = WebClinetHepler.Post_New(url, JsonConvert.SerializeObject(repetition));

            return(obj != null);
        }
コード例 #18
0
        public static bool AddFolder(VideoProject folder)
        {
            string  posturl = Url + "/video/project";
            string  json    = JsonHelper.SerializeDataContractJson(folder);
            JObject obj     = WebClinetHepler.Post_New(posturl, json);

            return(obj != null);
        }
コード例 #19
0
        public static int GetQueryVideoCount(string json)
        {
            string  url   = Url + $"/videos/count?{json}";
            JObject obj   = WebClinetHepler.GetJObject(url);
            int?    count = obj?["count"]?.ToObject <int>();

            return(count ?? 0);
        }
コード例 #20
0
        public static MyGroup GetAlEquipment()
        {
            string  url        = Url + $"/video/equipments";
            JObject obj        = WebClinetHepler.GetJObject(url);
            MyGroup equipments = JsonConvert.DeserializeObject <MyGroup>(obj["result"].ToString());

            return(equipments);
        }
コード例 #21
0
ファイル: LabelData.cs プロジェクト: kora3306/VideoRecordings
        public static AllTypeLabel GetAllLabel(int id)
        {
            string       url      = Url + $"/labels?video={id}";
            JObject      obj      = WebClinetHepler.GetJObject(url);
            AllTypeLabel AllLabel = JsonConvert.DeserializeObject <AllTypeLabel>(obj["result"].ToString());

            return(AllLabel);
        }
コード例 #22
0
        /// <summary>
        /// 删除解帧信息
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public static bool DeleteSolution(List <int> ids)
        {
            string url = Url + $"/deframe";
            //string url = "http://192.168.1.224:16087/deframe";
            string  json = JsonConvert.SerializeObject(ids);
            JObject obj  = WebClinetHepler.Delete_New(url, json);

            return(obj != null);
        }
コード例 #23
0
        public static bool QueueSolution(List <BackSolution> ids)
        {
            string url = Url + $"/topping/deframe";
            //string url = "http://192.168.1.224:16087/topping/deframe";
            string  json = JsonConvert.SerializeObject(ids.Select(t => t.VideoId));
            JObject obj  = WebClinetHepler.Post_New(url, json);

            return(obj != null);
        }
コード例 #24
0
        public static bool SolutionOfTheFrame(Solution solu)
        {
            //string url = "http://192.168.1.224:16087/deframe/task";
            string  url  = Url + $"/deframe/task";
            string  json = JsonConvert.SerializeObject(solu);
            JObject obj  = WebClinetHepler.Post_New(url, json);

            return(obj != null);
        }
コード例 #25
0
ファイル: LabelData.cs プロジェクト: kora3306/VideoRecordings
        public static bool UpdateLabelName(int id, string name)
        {
            string url = Url + $"/label/{id}";
            var    up  = new
            {
                name
            };
            JObject obj = WebClinetHepler.Patch_New(url, JsonConvert.SerializeObject(up));

            return(obj != null);
        }
コード例 #26
0
ファイル: GroupData.cs プロジェクト: kora3306/VideoRecordings
        public static bool DeleteEquipmentToGroup(int id, List <int> ids)
        {
            string url = Url + $"/video/equipment/group/{id}/remove/equipments";
            Dictionary <string, List <int> > jsondic = new Dictionary <string, List <int> >();

            jsondic.Add("equip_ids", ids);
            string  json = JsonConvert.SerializeObject(jsondic);
            JObject obj  = WebClinetHepler.Post_New(url, json);

            return(obj != null);
        }
コード例 #27
0
        public static List <ReturnRepetition> GetOutResult(int id)
        {
            string  url = Url + $"/video/check/result?id={id}";
            JObject obj = WebClinetHepler.GetJObject(url);

            if (obj == null)
            {
                return(null);
            }
            return(JsonConvert.DeserializeObject <List <ReturnRepetition> >(obj["data"]["result"].ToString()));
        }
コード例 #28
0
        public static bool DeleteRepetition(int id)
        {
            string url  = Url + $"/video/check/result";
            string json = JsonConvert.SerializeObject(new Dictionary <string, int>()
            {
                { "id", id }
            });
            JObject obj = WebClinetHepler.Delete_New(url, json);

            return(obj != null);
        }
コード例 #29
0
        public static bool DeleteRepetitionVideo(List <int> ids)
        {
            string url  = Url + $"/video/check";
            string json = JsonConvert.SerializeObject(new Dictionary <string, List <int> >()
            {
                { "video_ids", ids }
            });
            JObject obj = WebClinetHepler.Delete_New(url, json);

            return(obj != null);
        }
コード例 #30
0
        /// <summary>
        /// 重新扫描
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static bool RefreshFolder(int id)
        {
            string  url = Url + $"/rescan/video/project/{id}";
            JObject obj = WebClinetHepler.Post_New(url);

            if (obj?["message"].ToString() == "not scaned")
            {
                return(false);
            }
            return(obj != null);
        }