public HttpThread(int port, ProgramThread programThread) { _port = port; _programthread = programThread; Assembly a = Assembly.GetExecutingAssembly(); using (StreamReader sr1 = new StreamReader(a.GetManifestResourceStream("HTTPconsole.Resources.main.js"))) { pageJS = sr1.ReadToEnd(); } using (StreamReader sr2 = new StreamReader(a.GetManifestResourceStream("HTTPconsole.Resources.index.html"))) { pageHtml = sr2.ReadToEnd(); } using (StreamReader sr3 = new StreamReader(a.GetManifestResourceStream("HTTPconsole.Resources.style.css"))) { pageStyle = sr3.ReadToEnd(); } using (StreamReader sr4 = new StreamReader(a.GetManifestResourceStream("HTTPconsole.Resources.jquery.js"))) { jquery = sr4.ReadToEnd(); } }
public UIForm(string command, string args) { _args = args; Instance = this; if (command == "") { using (PathDialogForm pdf = new PathDialogForm()) { if (pdf.ShowDialog() == DialogResult.Cancel) { Environment.Exit(0); } } } else { _command = command; } Text = _command + " " + _args; Size = new Size(800, 600); SizeGripStyle = SizeGripStyle.Hide; FormBorderStyle = FormBorderStyle.Fixed3D; MaximizeBox = false; Label titleLabel = new Label(); titleLabel.Text = "HTTPconsole"; titleLabel.Width = this.Width; titleLabel.Height = 60; titleLabel.Location = new Point(0, 0); titleLabel.BackColor = Color.FromArgb(0x4c, 0x07, 0x62); titleLabel.ForeColor = Color.FromArgb(0xf2, 0xf2, 0xf2); titleLabel.Font = new Font("Segoe UI", 32.0f); titleLabel.TextAlign = ContentAlignment.MiddleCenter; titleLabel.Parent = this; consoleBox = new TextBox(); consoleBox.BackColor = Color.FromArgb(0x5f, 0x5f, 0x5f); consoleBox.ForeColor = Color.FromArgb(0x73, 0xad, 0x21); consoleBox.Multiline = true; consoleBox.ReadOnly = true; consoleBox.Font = new Font(FontFamily.GenericMonospace, 11.0f); consoleBox.Width = 728; consoleBox.Height = 408; consoleBox.Location = new Point(32, 70); consoleBox.BorderStyle = BorderStyle.None; consoleBox.Parent = this; Label inputBoxLabel = new Label(); inputBoxLabel.Text = "Input:"; inputBoxLabel.Width = 40; inputBoxLabel.Height = 20; inputBoxLabel.Location = new Point(33, 491); inputBoxLabel.Font = new Font(inputBoxLabel.Font.FontFamily, 11.0f); inputBoxLabel.Parent = this; inputBox = new TextBox(); inputBox.Width = 600; inputBox.Font = new Font(FontFamily.GenericMonospace, 10.0f); inputBox.Location = new Point(80, 490); inputBox.Parent = this; Button inputButton = new Button(); inputButton.Text = "Send"; inputButton.Height = inputBox.Height + 2; inputButton.Width = 70; inputButton.Location = new Point(688, 489); inputButton.Font = new Font(inputButton.Font.FontFamily, 11.0f); inputButton.Click += InputButton_Click; AcceptButton = inputButton; inputButton.Parent = this; StatusBar sb = new StatusBar(); sb.Text = "HTTP server running on port 49900, Operating system: " + Environment.OSVersion.VersionString; sb.Parent = this; sb.SizingGrip = false; pt = new ProgramThread(_command, _args); Thread program = new Thread(new ThreadStart(pt.ThreadRun)); program.IsBackground = true; program.Start(); HttpThread ht = new HttpThread(49900, pt); Thread http = new Thread(new ThreadStart(ht.ThreadRun)); http.IsBackground = true; http.Start(); }