Ejemplo n.º 1
0
        /// <summary>
        /// 現在のバージョンの上位バージョンにアップデートします
        /// </summary>
        public void Update()
        {
            if (String.IsNullOrEmpty(this.downUrl))
            {
                throw new InvalidOperationException("ダウンロード先のURLが指定されていません。先にCheckメソッドを実行してから呼び出してください。");
            }
            var    net = new Microsoft.VisualBasic.Devices.Network();
            string c   = gs.CurrentDirectory;

            net.DownloadFile(this.downUrl, c + "\\new.zip", "", "", true, 25, true, Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing);
            net.DownloadFile(this.downUrl + ".txt", c + "\\new.txt", "", "", false, 10, true, Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing);
            string cc = c + "\\old";

            // using (File.Create(cc + "\\browser.exe")) { }
            //using (File.Create(cc + "\\library.dll")) { }
            // using (File.Create(cc + "\\plugin.dll")) { }
            File.Delete(cc + "\\browser.exe");
            File.Delete(cc + "\\library.dll");
            File.Delete(cc + "\\plugin.dll");

            File.Move(c + "\\VIPBrowser.exe", cc + "\\browser.exe");
            File.Move(c + "\\VIPBrowserLibrary.dll", cc + "\\library.dll");
            File.Move(c + "\\VIPBrowserPlugin.dll", cc + "\\plugin.dll");

            Chron.ZIPData zd = new Chron.ZIPData();
            zd.ExtractZipFile(c + "\\new.zip", c);
            Process.Start(c + "\\VIPBrowser.exe", "/up " + Process.GetCurrentProcess().Id);
            System.Windows.Forms.Application.Exit();
            File.Delete(c + "\\lock");
            return;
        }
Ejemplo n.º 2
0
        // クエストデータのダウンロード更新
        private void updateQuestData()
        {
            if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
            {
                MessageBox.Show("ネットワークに接続されていません。", StaticCode.APP_NAME);
            }
            else
            {
                string datafilename = Application.StartupPath + StaticCode.QUEST_FILE_NAME;
                string questurl     = ConfigurationManager.AppSettings[StaticCode.APP_KEY_QUEST_DATA_URL];

                Microsoft.VisualBasic.Devices.Network network =
                    new Microsoft.VisualBasic.Devices.Network();
                network.DownloadFile(
                    questurl, datafilename,
                    "", "",
                    true, 6000, true,
                    Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing);
            }

            loadData();
            showNewData(questData);
            bs.Filter = "";
            toolStripStatusLabel.Text = bs.Count + "件";
        }
Ejemplo n.º 3
0
        static async void MakeRequest()
        {

            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            //client.DefaultRequestHeaders.Add("Content-Type", "application/octet-stream");
            //client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");

            // Request parameters
            //queryString["analyzesFaceLandmarks"] = "false";
            //queryString["analyzesAge"] = "false";
            //queryString["analyzesGender"] = "false";
            //queryString["analyzesHeadPose"] = "false";
            var uri = "http://192.168.43.161:8888/poll" + queryString;
            var uriimage = "http://192.168.43.161:8888/image" + queryString;
            HttpResponseMessage response;
            // Request body
            //byte[] byteData = Encoding.UTF8.GetBytes("{body}");

            //using (var content = new ByteArrayContent(byteData))
            //{
            //    content.Headers.ContentType = new MediaTypeHeaderValue("< your content type, i.e. application/json >");
            //    response = await client.PostAsync(uri, content);
            //}
            while (true)
            {
                try
                {
                    using (var client = new HttpClient())
                    {
                        response = await client.GetAsync(uri);
                        if (response.IsSuccessStatusCode)
                        {
                            var fm = new Form1();
                            fm.textBox1.Text = await response.Content.ReadAsStringAsync();
                            using (var clienti = new HttpClient())
                            {
                                //fm.pictureBox1.Image = new Bitmap(await clienti.GetStreamAsync(uriimage));
                                var ntwk = new Microsoft.VisualBasic.Devices.Network();

                                ntwk.DownloadFile(uriimage, "temp.jpg", "", "", false, 100, true);
                                fm.pictureBox1.Image = new Bitmap("temp.jpg");
                            }
                            fm.ShowDialog();
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                await Task.Delay(2000);
            }
        }