private void button1_Click(object sender, EventArgs e) { NicoVideoAPI nvapi = new NicoVideoAPI(); if(!nvapi.Login(textBox1.Text, textBox2.Text)) { MessageBox.Show("Invaild ID or Password. Please try again."); return; } id = textBox1.Text; pw = textBox2.Text; this.Close(); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Length < 16) return; if (textBox1.Text.Substring(7, 16) == "www.nicovideo.jp") { //not logged in try login if (Properties.Settings.Default.NICOVIDEO_ID == string.Empty) { Login nicolg = new Login(); nicolg.ShowDialog(); if (nicolg.id == null || nicolg.pw == null) return; Properties.Settings.Default.NICOVIDEO_ID = nicolg.id; Properties.Settings.Default.NICOVIDEO_PW_ENCRYPT = EnDecryptor.EncryptString(EnDecryptor.ToSecureString(nicolg.id)); Properties.Settings.Default.Save(); } //logged IN! string id = Properties.Settings.Default.NICOVIDEO_ID; string pass = EnDecryptor.ToInsecureString(EnDecryptor.DecryptString(Properties.Settings.Default.NICOVIDEO_PW_ENCRYPT)); Uri u = new Uri(textBox1.Text); string videoid = u.Segments.Last(); NicoVideoAPI nvapi = new NicoVideoAPI(); nvapi.Login(id, pass); DownloadDialog dd = new DownloadDialog(); dd.DOWNLOAD_URL = textBox1.Text; dd.cookie = nvapi.getCookie(); dd.VIDEO_ID = videoid; dd.ShowDialog(); dd.Dispose(); } }