예제 #1
0
        private void nicoSearch()
        {
            //宣言
            List<string> nicoVideoIdList = new List<string>();
            string nicoVideoId;
            string word = txtNicoSearchWord.Text;

            //デリゲート
            LpsDelegate.dlgS2ToVoid d = new LpsDelegate.dlgS2ToVoid(addNicoDgv);
            LpsDelegate.dlgVoidToVoid c = new LpsDelegate.dlgVoidToVoid(clearNicoDgv);

            //クリア
            Invoke(c);

            //ダウンロード
            NicoSearch nico = new NicoSearch(os.nicoId, os.nicoPass);

            //ログインチェック
            if (!nico._isLogin)
            {
                //ログインし直す
                nico = new NicoSearch(LiplisDefine.NICO_DEFAULT_ID, LiplisDefine.NICO_DEFAULT_PASS);
                //ログインチェック
                if (!nico._isLogin)
                {
                    //検索失敗
                    MessageBox.Show("ニコニコ動画へのログインに失敗しました。", "Liplis");
                    return;
                }
            }

            //ページ
            for (int page = 1; page <= 50; page++)
            {
                List<string> urlList = nico.getUrlList(word, opt, sortSelectedIdx, page);

                foreach (string url in urlList)
                {
                    nicoVideoId = LpsRegularEx.getNicoId(url);

                    if (nicoVideoIdList.IndexOf(nicoVideoId) < 0)
                    {
                        nicoVideoIdList.Add(nicoVideoId);
                        objNicoInfo o = new objNicoInfo(nicoVideoId);
                        Invoke(d, nicoVideoId, o.title);
                        Application.DoEvents();
                        Thread.Sleep(5);
                    }
                }
            }
        }
예제 #2
0
 private void fileDonwload(int code)
 {
     string url = "";
     if (LpsLiplisUtil.domainCheck(txtNicoUrl.Text, LpsDefineMost.URL_NICO_DOMAIN))
     {
         string[] splitStr = txtNicoUrl.Text.Split('/');
         url = LpsDefineMost.URL_NICO_VIDEO + splitStr[splitStr.Length - 1]; ;
     }
     else if (LpsRegularEx.chekcNicoVideoId(txtNicoUrl.Text))
     {
         url = LpsDefineMost.URL_NICO_VIDEO + txtNicoUrl.Text;
     }
     else
     {
         //どちらにも該当しない場合はエラー
         lblNicoMessage.Text = "URLが不正か、動画が見つかりません。";
         return;
     }
     objNicoInfo n = new objNicoInfo(LpsRegularEx.getNicoId(url));
     string downPath = LpsPathController.getSaveFileName(LpsDefineMost.LPS_EXTENSION_FLV, os.downPath, n.title, os.downNotice);
     lips.addDownload(new ObjDownloadFile(url, n.title, downPath, 0.0, code, 0, 0));
 }