Пример #1
0
        void UpdateView()
        {
            CodeFormat format = CodeFormat.Disassemble;

            if (radioCFDecompile.Checked)
            {
                format = CodeFormat.ScruffDecompile;
            }
            else if (radioFullDecompile.Checked)
            {
                format = CodeFormat.FullDecompile;
            }

            string code = _scriptFile.GetCode(format);

            if (_browser != null)
            {
                Controls.Remove(_browser);
            }

            _browser = new WebBrowser();
            _browser.Dock = DockStyle.Fill;
            _browser.AllowNavigation = false;
            _browser.AllowWebBrowserDrop = false;
            //_browser.WebBrowserShortcutsEnabled = false;
            _browser.IsWebBrowserContextMenuEnabled = false;

            if (radioFullDecompile.Checked & code.Length < 0x10000)
            {
                var codeFormat = new ScruffFormat();
                string text = codeFormat.FormatCode(new MemoryStream(Encoding.ASCII.GetBytes(code)));
                text = "<style>" +
                            ".csharpcode, .csharpcode pre" + 
                            "{" + 
                            "  font-size: 10pt;" + 
                            "  color: black;" + 
                            "  font-family: Consolas, Courier New, Courier, Monospace;" + 
                            "  background-color: #ffffff;" + 
                            "}" + 
                            ".csharpcode pre { margin: 0em; }" + 
                            ".csharpcode .rem { color: #008000; }" + 
                            ".csharpcode .kwrd { color: #0000ff; }" + 
                            ".csharpcode .str { color: #006080; }" + 
                            ".csharpcode .op { color: #0000c0; }" + 
                            ".csharpcode .preproc { color: #cc6633; }" + 
                            ".csharpcode .asp { background-color: #ffff00; }" + 
                            ".csharpcode .html { color: #800000; }" + 
                            ".csharpcode .attr { color: #ff0000; }" + 
                            ".csharpcode .alt " + 
                            "{" + 
                            "  background-color: #f4f4f4;" + 
                            "  width: 100%;" + 
                            "  margin: 0em;" + 
                            "}" + 
                            ".csharpcode .lnum { color: #606060; }" + 
                        "</style>" +
                        text;
                _browser.DocumentText = text;
            }
            else
            {
                string text = "<pre>" + code.Replace("\n", "<br/>") + "</pre>";
                _browser.DocumentText = text;
            }

            Controls.Add(_browser);
            _browser.BringToFront();
        }
Пример #2
0
        void UpdateView()
        {
            CodeFormat format = CodeFormat.Disassemble;

            if (radioCFDecompile.Checked)
            {
                format = CodeFormat.ScruffDecompile;
            }
            else if (radioFullDecompile.Checked)
            {
                format = CodeFormat.FullDecompile;
            }

            string code = _scriptFile.GetCode(format);

            if (_browser != null)
            {
                Controls.Remove(_browser);
            }

            _browser                     = new WebBrowser();
            _browser.Dock                = DockStyle.Fill;
            _browser.AllowNavigation     = false;
            _browser.AllowWebBrowserDrop = false;
            //_browser.WebBrowserShortcutsEnabled = false;
            _browser.IsWebBrowserContextMenuEnabled = false;

            if (radioFullDecompile.Checked & code.Length < 0x10000)
            {
                var    codeFormat = new ScruffFormat();
                string text       = codeFormat.FormatCode(new MemoryStream(Encoding.ASCII.GetBytes(code)));
                text = "<style>" +
                       ".csharpcode, .csharpcode pre" +
                       "{" +
                       "  font-size: 10pt;" +
                       "  color: black;" +
                       "  font-family: Consolas, Courier New, Courier, Monospace;" +
                       "  background-color: #ffffff;" +
                       "}" +
                       ".csharpcode pre { margin: 0em; }" +
                       ".csharpcode .rem { color: #008000; }" +
                       ".csharpcode .kwrd { color: #0000ff; }" +
                       ".csharpcode .str { color: #006080; }" +
                       ".csharpcode .op { color: #0000c0; }" +
                       ".csharpcode .preproc { color: #cc6633; }" +
                       ".csharpcode .asp { background-color: #ffff00; }" +
                       ".csharpcode .html { color: #800000; }" +
                       ".csharpcode .attr { color: #ff0000; }" +
                       ".csharpcode .alt " +
                       "{" +
                       "  background-color: #f4f4f4;" +
                       "  width: 100%;" +
                       "  margin: 0em;" +
                       "}" +
                       ".csharpcode .lnum { color: #606060; }" +
                       "</style>" +
                       text;
                _browser.DocumentText = text;
            }
            else
            {
                string text = "<pre>" + code.Replace("\n", "<br/>") + "</pre>";
                _browser.DocumentText = text;
            }

            Controls.Add(_browser);
            _browser.BringToFront();
        }