Exemplo n.º 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fd = new FolderBrowserDialog();

            fd.Description = "Папка для загрузки файлов";

            if (fd.ShowDialog() == DialogResult.OK)
            {
                OpenFileDialog opg = new OpenFileDialog();
                opg.Filter = "DB File|*.db";

                if (opg.ShowDialog() == DialogResult.OK)
                {
                    var db = DBFile.Read(opg.FileName);
                    progressBar1.Maximum = 0;
                    progressBar1.Value   = 0;
                    progressBar1.Style   = ProgressBarStyle.Blocks;
                    Sizefiles.Clear();

                    foreach (var item in db)
                    {
                        //MessageBox.Show(DownloadingPaths.ToPath(setting.URLToHTTPPort) + DownloadingPaths.SD + item.HTTPPath);
                        progressBar1.Maximum += 100;
                        BtnDownload(DownloadingPaths.ToPath(setting.URLToHTTPPort) + DownloadingPaths.SD + item.HTTPPath, fd.SelectedPath + "\\" + item.HTTPPath.Split('/').Where(x => x.Contains(".")).ToArray()[0]);
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void просмотрToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (selected.typeNode == FileTreeNode.TypeNode.File && selected.URL.EndsWith(".jpg"))
     {
         var         url = DownloadingPaths.ToPath(setting.URLToHTTPPort) + DownloadingPaths.SD + selected.URL;
         var         img = Downloading.GetImageWitchAutorized(url, setting.Login, setting.Password);
         ImagePlayer ip  = new ImagePlayer(img, url);
         ip.Show();
     }
     else if (selected.typeNode == FileTreeNode.TypeNode.File && !selected.URL.EndsWith(".jpg"))
     {
         new Thread(() => ld.ShowDialog()).Start();
         var url  = DownloadingPaths.ToPath(setting.URLToHTTPPort) + DownloadingPaths.SD + selected.URL;
         var path = Downloading.DownloadFile(url, setting.Name, setting.Password, Environment.GetFolderPath(Environment.SpecialFolder.MyVideos, Environment.SpecialFolderOption.Create) + "\\IPCamera\\");
         if (File.Exists(path + ".h264"))
         {
             File.Delete(path + ".h264");
         }
         File.Move(path, path + ".h264");
         Convert cnv = new Convert(new string[] { path + ".h264" }, true);
         cnv.Show();
         cnv.IsPlay = true;
         ld.Invoke(new Action(() => ld.Close()));
     }
 }
Exemplo n.º 3
0
        FileTreeNode[] GetServer(string startpath = "", bool showdownload = false)
        {
            Log = "Идет загрузка...";
            if (showdownload)
            {
                new Thread(() => ld.ShowDialog()).Start();
            }

            var web = (Downloading.GetHTML(DownloadingPaths.ToPath(setting.URLToHTTPPort) + DownloadingPaths.SD + startpath, setting.Name, setting.Password));

            var list = new List <FileTreeNode>();

            HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument();
            html.LoadHtml(web);

            var table   = html.DocumentNode.SelectSingleNode("/html/body/pre/table");
            var tabletr = table.ChildNodes.Where(x => x.Name == "tr").ToList();

            tabletr.RemoveRange(0, 3);

            foreach (var item in tabletr)
            {
                if (item.ChildNodes.Count > 2)
                {
                    var path = item.ChildNodes[0].ChildNodes[0].InnerHtml.Replace("&nbsp;", "");
                    var date = item.ChildNodes[1].ChildNodes[0].InnerHtml.Replace("&nbsp;", "");
                    var size = item.ChildNodes[2].ChildNodes[0].InnerHtml.Replace("&nbsp;", "");

                    //Console.WriteLine(path);
                    //Console.WriteLine(date);
                    //Console.WriteLine(type);
                    //Console.WriteLine("----------");

                    FileTreeNode tr;

                    if (size == "[DIRECTORY]")
                    {
                        tr = new FileTreeNode(path, /*GetServer(startpath + "" + path),*/ FileTreeNode.TypeNode.Directory, startpath + "" + path);
                        tr.SelectedImageKey = "f";
                        tr.ImageKey         = "f";
                        tr.Nodes.Add("");
                    }
                    else
                    {
                        tr = new FileTreeNode(path, FileTreeNode.TypeNode.File, startpath + "" + path);
                        tr.SelectedImageKey = "v";
                        tr.ImageKey         = "v";
                    }
                    tr.ContextMenuStrip = contextMenuStrip1;
                    tr.ToolTipText      = date + " (" + (size) + ")";
                    list.Add(tr);
                }
            }
            if (showdownload)
            {
                ld.Invoke(new Action(() => ld.Close())); Log = "Загрузка завершена";
            }
            return(list.ToArray());
        }
Exemplo n.º 4
0
        void UpdateServer(string startpath = "")
        {
            Log = "Идет загрузка...";
            treeView1.Nodes.Clear();
            new Thread(() => ld.ShowDialog()).Start();

            var DeviceInfo = Downloading.GetDeviceParams(setting.URLToHTTPPort, setting.Name, setting.Password);

            label1.Text          = "Свободно места на SD (" + formatFileSize(int.Parse(DeviceInfo["sdfreespace"])) + ") из " + formatFileSize(int.Parse(DeviceInfo["sdtotalspace"]));
            progressBar2.Maximum = int.Parse(DeviceInfo["sdtotalspace"]);
            progressBar2.Value   = int.Parse(DeviceInfo["sdtotalspace"]) - int.Parse(DeviceInfo["sdfreespace"]);
            label2.Text          = (DeviceInfo["sdstatus"].Contains("Ready")) ? "SD карта работает исправно" : "Ошибка SD карты";
            label3.Text          = "Камера запущенна: " + DeviceInfo["startdate"];
            label6.Text          = "Камера работает: " + (DateTime.Now - DateTime.Parse(DeviceInfo["startdate"])).ToString().Split('.')[0];

            checkBox1.Checked       = DeviceInfo["planrec_enable"].Contains("1");
            numericUpDown1.Value    = int.Parse(DeviceInfo["planrec_time"]);
            comboBox1.SelectedIndex = DeviceInfo["planrec_chn"] == "11" ? 1 : 0;

            var web = (Downloading.GetHTML(DownloadingPaths.ToPath(setting.URLToHTTPPort) + DownloadingPaths.SD + startpath, setting.Name, setting.Password));

            HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument();
            html.LoadHtml(web);

            var table   = html.DocumentNode.SelectSingleNode("/html/body/pre/table");
            var tabletr = table.ChildNodes.Where(x => x.Name == "tr").ToList();

            tabletr.RemoveRange(0, 3);

            foreach (var item in tabletr)
            {
                if (item.ChildNodes.Count > 2)
                {
                    var path = item.ChildNodes[0].ChildNodes[0].InnerHtml.Replace("&nbsp;", "");
                    var date = item.ChildNodes[1].ChildNodes[0].InnerHtml.Replace("&nbsp;", "");
                    var size = item.ChildNodes[2].ChildNodes[0].InnerHtml.Replace("&nbsp;", "");

                    //Console.WriteLine(path);
                    //Console.WriteLine(date);
                    //Console.WriteLine(type);
                    //Console.WriteLine("----------");

                    FileTreeNode tr = new FileTreeNode(path, GetServer(startpath + "" + path), FileTreeNode.TypeNode.Directory, startpath + "" + path);
                    tr.ToolTipText      = date + " (" + size + ")";
                    tr.ContextMenuStrip = contextMenuStrip1;
                    treeView1.Nodes.Add(tr);
                }
            }
            if (backgroundWorker1.IsBusy)
            {
                backgroundWorker1.CancelAsync();
            }
            if (!backgroundWorker1.IsBusy)
            {
                backgroundWorker1.RunWorkerAsync(DateTime.Now - DateTime.Parse(DeviceInfo["startdate"]));
            }
            ld.Invoke(new Action(() => ld.Close()));
            Log = "Загрузка завершена";
        }
Exemplo n.º 5
0
        private void Save()
        {
            SortedList <string, string> sending = new SortedList <string, string>();

            sending.Add("cmd", "setinfrared");
            sending.Add("cururl", "http://" + structures.URLToHTTPPort + "web/display.html");
            sending.Add("-infraredstat", IRStat);
            var resp = (Downloading.SendRequest(DownloadingPaths.ToPath(structures.IP) + DownloadingPaths.DeviceParam, structures.Name, structures.Password, sending));

            sending.Clear();
            sending.Add("cmd", "setircutattr");
            sending.Add("-saradc_switch_value", numericUpDown1.Value.ToString());
            resp = (Downloading.SendRequest(DownloadingPaths.ToPath(structures.IP) + DownloadingPaths.DeviceParam, structures.Name, structures.Password, sending));
            sending.Clear();
            sending.Add("cmd", "setlampattrex");
            sending.Add("-lamp_mode", LampMode);
            resp = (Downloading.SendRequest(DownloadingPaths.ToPath(structures.IP) + DownloadingPaths.DeviceParam, structures.Name, structures.Password, sending));
            sending.Clear();
            sending.Add("cmd", "setimageattr");
            sending.Add("-brightness", Brightness);
            sending.Add("-contrast", Contrast);
            sending.Add("-saturation", Saturation);
            sending.Add("-sharpness", Sharpness);
            sending.Add("-mirror", Mirror);
            sending.Add("-flip", Flip);
            sending.Add("-shutter", "65535");
            sending.Add("-night", Night);
            sending.Add("-wdr", WDR);
            sending.Add("-noise", "on");
            sending.Add("-gc", gc);
            sending.Add("-ae", ae);
            sending.Add("-targety", "64");
            sending.Add("-aemode", AEMode);
            sending.Add("-image_type", dm);
            sending.Add("-imgmode", "0");
            resp = (Downloading.SendRequest(DownloadingPaths.ToPath(structures.IP) + DownloadingPaths.DeviceParam, structures.Name, structures.Password, sending));
            //MessageBox.Show(resp);
            sending.Clear();
            sending.Add("cmd", "setaudioinvolume");
            sending.Add("-volume", InputVolume);
            sending.Add("-volin_type", violin);
            resp = (Downloading.SendRequest(DownloadingPaths.ToPath(structures.IP) + DownloadingPaths.DeviceParam, structures.Name, structures.Password, sending));
            sending.Clear();
            sending.Add("cmd", "setaudiooutvolume");
            sending.Add("-volume", OutputVolume);
            resp = (Downloading.SendRequest(DownloadingPaths.ToPath(structures.IP) + DownloadingPaths.DeviceParam, structures.Name, structures.Password, sending));
            UpdateParams();
        }
Exemplo n.º 6
0
        //bool IsPlay = false;
        private void смотретьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var path = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) + "\\" + "VideoFile.264";

            if (selected == null)
            {
                return;
            }
            progressBar1.Maximum = 0;
            progressBar1.Value   = 0;
            progressBar1.Style   = ProgressBarStyle.Blocks;
            Sizefiles.Clear();

            progressBar1.Maximum += 100;
            BtnDownload(DownloadingPaths.ToPath(setting.URLToHTTPPort) + DownloadingPaths.SD + selected.URL, path);
        }
Exemplo n.º 7
0
 private void ParseChild(FileTreeNode fs, string pathdown)
 {
     if (fs.typeNode == FileTreeNode.TypeNode.File & fs.Checked)
     {
         progressBar1.Maximum += 100;
         //Directory.CreateDirectory(pathdown + fs.URL);
         BtnDownload(DownloadingPaths.ToPath(setting.URLToHTTPPort) + DownloadingPaths.SD + fs.URL, pathdown + "\\" + fs.URL.Split('/').Where(x => x.Contains(".")).ToArray()[0]);
     }
     else if (fs.typeNode == FileTreeNode.TypeNode.Directory)
     {
         foreach (var item in fs.Nodes)
         {
             var nods = item as FileTreeNode;
             ParseChild(nods, pathdown);
         }
     }
 }
Exemplo n.º 8
0
        private void Save()
        {
            SortedList <string, string> sending = new SortedList <string, string>();

            sending.Add("cmd", "setsmtpattr");
            sending.Add("cururl", "http://" + structures.URLToHTTPPort + "web/email.html");
            sending.Add("-ma_server", Server);
            sending.Add("-ma_from", From);
            sending.Add("-ma_to", To);
            sending.Add("-ma_subject", Theme);
            sending.Add("-ma_text", Message);
            sending.Add("-ma_logintype", Authenication);
            sending.Add("-ma_username", Login);
            sending.Add("-ma_password", Password);
            sending.Add("-ma_port", Port);
            sending.Add("-ma_ssl", SaveLink);
            var resp = (Downloading.SendRequest(DownloadingPaths.ToPath(structures.IP) + DownloadingPaths.DeviceParam, structures.Name, structures.Password, sending));

            UpdateSettings();
        }
Exemplo n.º 9
0
        private void Save()
        {
            SortedList <string, string> sending = new SortedList <string, string>();

            sending.Add("cmd", "setoverlayattr");
            sending.Add("cururl", "http://" + structures.URLToHTTPPort + "web/osd.html");
            sending.Add("-region", "0");
            sending.Add("-show", PrintTime);
            sending.Add("-place", "0");
            var resp = (Downloading.SendRequest(DownloadingPaths.ToPath(structures.IP) + DownloadingPaths.DeviceParam, structures.Name, structures.Password, sending));

            sending.Clear();
            sending.Add("cmd", "setoverlayattr");
            sending.Add("-region", "1");
            sending.Add("-show", PrintName);
            sending.Add("-name", CName);
            sending.Add("-place", "0");
            resp = (Downloading.SendRequest(DownloadingPaths.ToPath(structures.IP) + DownloadingPaths.DeviceParam, structures.Name, structures.Password, sending));

            UpdateSettings();
        }
Exemplo n.º 10
0
        private void скачатьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (selected == null)
            {
                return;
            }
            progressBar1.Maximum = 0;
            progressBar1.Value   = 0;
            progressBar1.Style   = ProgressBarStyle.Blocks;
            Sizefiles.Clear();

            FolderBrowserDialog fd = new FolderBrowserDialog();

            fd.Description = "Папка для загрузки файлов";

            if (fd.ShowDialog() == DialogResult.OK)
            {
                progressBar1.Maximum += 100;
                BtnDownload(DownloadingPaths.ToPath(setting.URLToHTTPPort) + DownloadingPaths.SD + selected.URL, fd.SelectedPath + "\\" + selected.URL.Split('/').Where(x => x.Contains(".")).ToArray()[0]);
                //MessageBox.Show(DownloadingPaths.ToPath(setting.URLToHTTPPort) + DownloadingPaths.SD + selected.URL);
            }
        }
Exemplo n.º 11
0
        private void button3_Click(object sender, EventArgs e)
        {
            SortedList <string, string> sending = new SortedList <string, string>();

            sending.Add("cmd", "setplanrecattr");
            sending.Add("cururl", "http://" + setting.URLToHTTPPort + "web/record.html");
            sending.Add("-planrec_enable", checkBox1.Checked ? "1" : "0");
            sending.Add("-planrec_chn", comboBox1.SelectedIndex == 0 ? "11" : "12");
            sending.Add("-planrec_time", numericUpDown1.Value.ToString());
            sending.Add("-planrec_type", "1");

            var resp = (Downloading.SendRequest(DownloadingPaths.ToPath(setting.IP) + DownloadingPaths.DeviceParam, setting.Name, setting.Password, sending));

            if (resp.Contains("[Succeed]set ok. system reboot."))
            {
                MessageBox.Show("Настройки успешно изменены. Камера будет автоматически перезагружена");
            }
            else
            {
                MessageBox.Show("Настройки успешно изменены.");
            }
        }
Exemplo n.º 12
0
 private void скопироватьСсылкуToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Clipboard.SetText(DownloadingPaths.ToPath(setting.URLToHTTPPort) + DownloadingPaths.SD + selected.URL);
 }