What I am trying to do is invoke text as code. Here is an example:
Public Uri As [String] = New Net.WebClient().DownloadString("https://www.website.com/Method.txt") Public T As Type Public M As Reflection.MethodInfo Public O As New Object Sub Main() T.GetMethod("Login.CS").Invoke(Uri, Nothing) End Sub End Module
Inside the Uri String will be:
Namespace Login Class CS Public Sub MyMethod() Windows.Forms.MessageBox.Show("This is showing an executing snippet of code!") Console.WriteLine("This is working perfectly!") IO.File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\Updated.exe", "Null") Console.ReadLine() End Sub End Class End Namespace
I tried messing around with the reflection namespace and couldn't find anything that actually works. I need to invoke it directly into memory, so I cannot use CodeDOM because it generates another file. If I write Console.WriteLine("text") it should execute it.
I been trying to look for a method for days now that can actually do this. Reflection was my best bet but I did not find anything or probably didn't use it correctly to achieve this. Can anyone point me in the right direction?