Last active
December 15, 2015 20:59
-
-
Save itsff/5322559 to your computer and use it in GitHub Desktop.
Drop your pants!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void doMagic() | |
{ | |
var form = new System.Windows.Forms.Form(); | |
form.Text = "Drop your pants!"; | |
form.Width = 800; | |
form.Height = 500; | |
var browser = new System.Windows.Forms.WebBrowser(); | |
browser.Anchor = AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top; | |
browser.Size = form.Size; | |
browser.Navigate("http://www.youtube.com/embed/uIN48CE6L_I?autoplay=1"); | |
form.Controls.Add(browser); | |
form.Show(); | |
} | |
// The "dynamic" keyword requires reference to Microsoft.CSharp.dll | |
static void downloadAssemblyToMemoryAndRun() | |
{ | |
string url = "http://update.debesys.net/stuff/AdlJukeBox.dll"; | |
var wc = new System.Net.WebClient(); | |
byte[] bytes = wc.DownloadData(url); | |
var asm = System.Reflection.Assembly.Load(bytes); | |
dynamic obj = asm.CreateInstance("AdlJukeBox.JukeBox"); | |
obj.Run(); // or whatever method | |
} | |
static void downloadExecToDiskAndRun () | |
{ | |
string url = "some interweb address of an executable"; | |
string destination = "."; | |
var wc = new System.Net.WebClient(); | |
wc.DownloadFile(url, destination); | |
var psi = new System.Diagnostics.ProcessStartInfo(); | |
psi.FileName = destination; | |
System.Diagnostics.Process.Start(psi); | |
// or: System.Diagnostics.Process.Start(destination) if you don't need any extra options | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment