public NetProvider(VMExecutionEngine engine) { instance = this; _engine = engine; if(!File.Exists("OpenNetDB")) { File.Create("OpenNetDB").Dispose(); try { File.Encrypt("OpenNetDB"); }catch(Exception) { Console.WriteLine("WARN: File system encryption is not supported on your computer. the private key will remain in un-encrypted format"); } } db = new PubKeyDatabase("default",File.Open("OpenNetDB",FileMode.Open)); if(db.Length == 0) { db.AddPublicKey(db.GenPublicPrivateKey(2048)); db.GetPublicKeyOnly(db[0]); } }
public ConfigManager(VMExecutionEngine _engine) { engine = _engine; MemoryStream mstream = new MemoryStream(); StreamWriter mwriter= new StreamWriter(mstream); mwriter.WriteLine("<html>"); mwriter.WriteLine("<head>"); mwriter.WriteLine("<title>Page not found</title>"); mwriter.WriteLine("</head>"); mwriter.WriteLine("<body>"); mwriter.WriteLine("The requested URL could not be located in the server administration console."); mwriter.WriteLine("</body>"); mwriter.WriteLine("</html>"); mwriter.Flush(); mstream.Position = 0; notfoundpage = new byte[mstream.Length]; mstream.Read(notfoundpage,0,notfoundpage.Length); }
public void StartApplication(byte[] asm, VMExecutionEngine engine) { Assembly mbly = Assembly.Load(asm); dirname = mbly.GetName().Name; foreach(Type et in mbly.GetExportedTypes()) { //VM = mbly.GetExportedTypes()[0].GetConstructor(new Type[] {typeof(VMExecutionEngine)}).Invoke(new object[] {engine}); if(et.GetConstructor(new Type[] {typeof(VMExecutionEngine)}) !=null) { VM = et.GetConstructor(new Type[] {typeof(VMExecutionEngine)}).Invoke(new object[] {engine}); return; } } throw new Exception("Entry point not found!"); }
static void Main(string[] args) { engine = new VMExecutionEngine(); HttpListener mlist = new HttpListener(80); mlist.onClientConnect += new HttpListener.ConnectEventDgate(mlist_onClientConnect); mimemappings.Add(".htm", "text/html"); mimemappings.Add(".jpg", "image/jpeg"); mimemappings.Add(".html", "text/html"); mimemappings.Add(".png", "image/png"); mimemappings.Add(".js", "text/javascript"); mimemappings.Add(".mp4", "video/mp4"); mimemappings.Add(".ogg", "audio/ogg"); mimemappings.Add(".ogv", "video/ogg"); mimemappings.Add(".swf","application/x-shockwave-flash"); }