Esempio n. 1
0
        /*-------------------------------------------------------------------------
         * 更新確認
         * ---------------------------------------------------------------------------*/
        private void button4_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            // バージョンを確認する
            downloadfile dlf    = new downloadfile();
            bool         result = dlf.Download(def.VERSION_URL, def.VERSION_FNAME);

            Cursor = Cursors.Default;

            if (!result)
            {
                // 更新しない
                MessageBox.Show(this, "更新情報が取得できませんでした。\nインターネットの接続を確認してください。", "更新確認エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            dlf = null;

            // 更新されたデータがあるかどうか確認する
            string        line    = "";
            List <string> data    = new List <string>();
            int           version = 0;

            try{
                using (StreamReader sr = new StreamReader(
                           def.VERSION_FNAME, Encoding.GetEncoding("Shift_JIS"))){
                    // バージョン
                    line    = sr.ReadLine();
                    version = Convert.ToInt32(line);

                    // 残り
                    while ((line = sr.ReadLine()) != null)
                    {
                        data.Add(line);
                    }
                }
            }catch {
                MessageBox.Show(this, "バージョン情報が確認できません。\n更新確認に失敗しました。", "更新確認エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (version > def.VERSION)
            {
                // 更新されている
                check_update_result dlg = new check_update_result(data.ToArray());
                dlg.ShowDialog(this);
                dlg.Dispose();
            }
            else
            {
                // 更新されていない
                MessageBox.Show(this, "更新されたソフトウェアは見つかりませんでした。\nお使いのバージョンが最新です。", "更新確認結果", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        /*-------------------------------------------------------------------------
         * 최신버전チェック
         * ---------------------------------------------------------------------------*/
        private void button4_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            // 버전を확인する
            bool result = HttpDownload.Download(def.VERSION_URL, def.VERSION_FNAME);

            Cursor = Cursors.Default;

            if (!result)
            {
                // 업데이트しない
                MessageBox.Show(this, "업데이트정보が取得できませんでした. \nインターネットの연결を확인してください. ", "업데이트확인오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // 업데이트された데이터があるかどうか확인する
            string        line    = "";
            List <string> data    = new List <string>();
            int           version = 0;

            try {
                using (StreamReader sr = new StreamReader(
                           def.VERSION_FNAME, Encoding.GetEncoding("UTF-8"))) {
                    // 버전
                    line    = sr.ReadLine();
                    version = Convert.ToInt32(line);

                    // 残り
                    while ((line = sr.ReadLine()) != null)
                    {
                        data.Add(line);
                    }
                }
            } catch {
                MessageBox.Show(this, "버전정보が확인できません. \n업데이트확인に실패하였습니다. ", "업데이트확인오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (version > def.VERSION)
            {
                // 업데이트されている
                check_update_result dlg = new check_update_result(data.ToArray());
                dlg.ShowDialog(this);
                dlg.Dispose();
            }
            else
            {
                // 업데이트されていない
                MessageBox.Show(this, "업데이트されたソフトウェアは見つかりませんでした. \nお使いの버전が최신です. ", "업데이트확인결과", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }