File size: 2,416 Bytes
e26fba6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Web;
using System.IO;
using System.Threading;
namespace MovieFinder.Test.Forms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
// this.webBrowser1.DocumentText = "<embed type=\"application/x-shockwave-flash\" src=\"http://neovid.me/1.swf\" flashvars=\"file=317707bbc69fd6f171970a2e4dee290a.mp4&plugins=hd-2&bufferlength=5\">";
}
private void button1_Click(object sender, EventArgs e)
{
try
{
this.textBox1.Text = HttpUtility.UrlDecode(this.textBox1.Text.Trim());
}
catch (Exception ex)
{ MessageBox.Show(ex.Message); }
}
private void buttonPlay_Click(object sender, EventArgs e)
{
this.axWindowsMediaPlayer1.URL = this.textBoxUrl.Text;
}
private void button2_Click(object sender, EventArgs e)
{
//FileStream source = new FileStream("unpacker.html", FileMode.Open, FileAccess.Read);
//webBrowser1.DocumentStream = source;
//Application.DoEvents();
//var input = webBrowser1.Document.GetElementById("result").GetAttribute("value");
runBrowserThread(new FileStream("unpacker.html", FileMode.Open, FileAccess.Read));
}
private void runBrowserThread(FileStream stream)
{
var th = new Thread(() =>
{
var br = new WebBrowser();
br.DocumentCompleted += browser_DocumentCompleted;
br.DocumentStream = stream;
Application.Run();
});
th.SetApartmentState(ApartmentState.STA);
th.Start();
}
void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
var br = sender as WebBrowser;
if (br.Url == e.Url)
{
var input = br.Document.GetElementById("result").GetAttribute("value");
Application.ExitThread(); // Stops the thread
}
}
}
}
|