add Compiler
This commit is contained in:
parent
d024a7e587
commit
94dc2d8e4d
|
@ -59,6 +59,9 @@
|
||||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="FastColoredTextBox, Version=2.16.24.0, Culture=neutral, PublicKeyToken=fb8aa12b994ef61b, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\FCTB.2.16.24\lib\FastColoredTextBox.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Microsoft.VisualBasic" />
|
<Reference Include="Microsoft.VisualBasic" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
@ -78,6 +81,12 @@
|
||||||
<Compile Include="Form1.Designer.cs">
|
<Compile Include="Form1.Designer.cs">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="FormCompiler.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="FormCompiler.designer.cs">
|
||||||
|
<DependentUpon>FormCompiler.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="FormDoc.cs">
|
<Compile Include="FormDoc.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -99,6 +108,10 @@
|
||||||
<EmbeddedResource Include="FormAbout.resx">
|
<EmbeddedResource Include="FormAbout.resx">
|
||||||
<DependentUpon>FormAbout.cs</DependentUpon>
|
<DependentUpon>FormAbout.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="FormCompiler.resx">
|
||||||
|
<DependentUpon>FormCompiler.cs</DependentUpon>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="FormDoc.resx">
|
<EmbeddedResource Include="FormDoc.resx">
|
||||||
<DependentUpon>FormDoc.cs</DependentUpon>
|
<DependentUpon>FormDoc.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
this.button18 = new System.Windows.Forms.Button();
|
this.button18 = new System.Windows.Forms.Button();
|
||||||
this.button17 = new System.Windows.Forms.Button();
|
this.button17 = new System.Windows.Forms.Button();
|
||||||
this.button19 = new System.Windows.Forms.Button();
|
this.button19 = new System.Windows.Forms.Button();
|
||||||
|
this.打开编译器ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.contextMenuStrip1.SuspendLayout();
|
this.contextMenuStrip1.SuspendLayout();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
|
@ -247,6 +248,7 @@
|
||||||
//
|
//
|
||||||
this.文件ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.文件ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.打开文件ToolStripMenuItem,
|
this.打开文件ToolStripMenuItem,
|
||||||
|
this.打开编译器ToolStripMenuItem,
|
||||||
this.退出ToolStripMenuItem});
|
this.退出ToolStripMenuItem});
|
||||||
this.文件ToolStripMenuItem.Name = "文件ToolStripMenuItem";
|
this.文件ToolStripMenuItem.Name = "文件ToolStripMenuItem";
|
||||||
this.文件ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
|
this.文件ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
|
||||||
|
@ -255,14 +257,14 @@
|
||||||
// 打开文件ToolStripMenuItem
|
// 打开文件ToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.打开文件ToolStripMenuItem.Name = "打开文件ToolStripMenuItem";
|
this.打开文件ToolStripMenuItem.Name = "打开文件ToolStripMenuItem";
|
||||||
this.打开文件ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
|
this.打开文件ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.打开文件ToolStripMenuItem.Text = "打开文件";
|
this.打开文件ToolStripMenuItem.Text = "打开文件";
|
||||||
this.打开文件ToolStripMenuItem.Click += new System.EventHandler(this.打开文件ToolStripMenuItem_Click);
|
this.打开文件ToolStripMenuItem.Click += new System.EventHandler(this.打开文件ToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// 退出ToolStripMenuItem
|
// 退出ToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
|
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
|
||||||
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
|
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.退出ToolStripMenuItem.Text = "退出";
|
this.退出ToolStripMenuItem.Text = "退出";
|
||||||
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click);
|
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
@ -278,14 +280,14 @@
|
||||||
// 文档ToolStripMenuItem
|
// 文档ToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.文档ToolStripMenuItem.Name = "文档ToolStripMenuItem";
|
this.文档ToolStripMenuItem.Name = "文档ToolStripMenuItem";
|
||||||
this.文档ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
|
this.文档ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.文档ToolStripMenuItem.Text = "文档";
|
this.文档ToolStripMenuItem.Text = "文档";
|
||||||
this.文档ToolStripMenuItem.Click += new System.EventHandler(this.文档ToolStripMenuItem_Click);
|
this.文档ToolStripMenuItem.Click += new System.EventHandler(this.文档ToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// 关于ToolStripMenuItem
|
// 关于ToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
|
this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
|
||||||
this.关于ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
|
this.关于ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.关于ToolStripMenuItem.Text = "关于";
|
this.关于ToolStripMenuItem.Text = "关于";
|
||||||
this.关于ToolStripMenuItem.Click += new System.EventHandler(this.关于ToolStripMenuItem_Click);
|
this.关于ToolStripMenuItem.Click += new System.EventHandler(this.关于ToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
@ -448,6 +450,13 @@
|
||||||
this.button19.UseVisualStyleBackColor = true;
|
this.button19.UseVisualStyleBackColor = true;
|
||||||
this.button19.Click += new System.EventHandler(this.button19_Click);
|
this.button19.Click += new System.EventHandler(this.button19_Click);
|
||||||
//
|
//
|
||||||
|
// 打开编译器ToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.打开编译器ToolStripMenuItem.Name = "打开编译器ToolStripMenuItem";
|
||||||
|
this.打开编译器ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.打开编译器ToolStripMenuItem.Text = "打开编译器";
|
||||||
|
this.打开编译器ToolStripMenuItem.Click += new System.EventHandler(this.打开编译器ToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||||
|
@ -540,6 +549,7 @@
|
||||||
private System.Windows.Forms.Button button18;
|
private System.Windows.Forms.Button button18;
|
||||||
private System.Windows.Forms.Button button17;
|
private System.Windows.Forms.Button button17;
|
||||||
private System.Windows.Forms.Button button19;
|
private System.Windows.Forms.Button button19;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem 打开编译器ToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ using System.Drawing;
|
||||||
using System.CodeDom.Compiler;
|
using System.CodeDom.Compiler;
|
||||||
using Microsoft.CSharp;
|
using Microsoft.CSharp;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Compiler;
|
||||||
|
|
||||||
namespace CrypterExample
|
namespace CrypterExample
|
||||||
{
|
{
|
||||||
|
@ -650,5 +651,13 @@ namespace CrypterExample
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void 打开编译器ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (FormCompiler formCompiler = new FormCompiler())
|
||||||
|
{
|
||||||
|
formCompiler.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,365 @@
|
||||||
|
namespace Compiler
|
||||||
|
{
|
||||||
|
partial class FormCompiler
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormCompiler));
|
||||||
|
this.panel2 = new System.Windows.Forms.Panel();
|
||||||
|
this.txtBox = new FastColoredTextBoxNS.FastColoredTextBox();
|
||||||
|
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||||
|
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.runToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.wordWraoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.panel1 = new System.Windows.Forms.Panel();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.comboFrame = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.comboType = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.listBoxReferences = new System.Windows.Forms.ListBox();
|
||||||
|
this.menuReferences = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.comboLang = new System.Windows.Forms.ComboBox();
|
||||||
|
this.panel2.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.txtBox)).BeginInit();
|
||||||
|
this.menuStrip1.SuspendLayout();
|
||||||
|
this.panel1.SuspendLayout();
|
||||||
|
this.menuReferences.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel2
|
||||||
|
//
|
||||||
|
this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.panel2.Controls.Add(this.txtBox);
|
||||||
|
this.panel2.Location = new System.Drawing.Point(8, 22);
|
||||||
|
this.panel2.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.panel2.Name = "panel2";
|
||||||
|
this.panel2.Size = new System.Drawing.Size(579, 319);
|
||||||
|
this.panel2.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// txtBox
|
||||||
|
//
|
||||||
|
this.txtBox.AutoCompleteBracketsList = new char[] {
|
||||||
|
'(',
|
||||||
|
')',
|
||||||
|
'{',
|
||||||
|
'}',
|
||||||
|
'[',
|
||||||
|
']',
|
||||||
|
'\"',
|
||||||
|
'\"',
|
||||||
|
'\'',
|
||||||
|
'\''};
|
||||||
|
this.txtBox.AutoIndentCharsPatterns = "\r\n^\\s*[\\w\\.]+(\\s\\w+)?\\s*(?<range>=)\\s*(?<range>[^;]+);\r\n^\\s*(case|default)\\s*[^:]" +
|
||||||
|
"*(?<range>:)\\s*(?<range>[^;]+);\r\n";
|
||||||
|
this.txtBox.AutoScrollMinSize = new System.Drawing.Size(27, 14);
|
||||||
|
this.txtBox.BackBrush = null;
|
||||||
|
this.txtBox.BracketsHighlightStrategy = FastColoredTextBoxNS.BracketsHighlightStrategy.Strategy2;
|
||||||
|
this.txtBox.CharHeight = 14;
|
||||||
|
this.txtBox.CharWidth = 8;
|
||||||
|
this.txtBox.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||||
|
this.txtBox.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
|
||||||
|
this.txtBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.txtBox.Font = new System.Drawing.Font("Courier New", 9.75F);
|
||||||
|
this.txtBox.IsReplaceMode = false;
|
||||||
|
this.txtBox.Language = FastColoredTextBoxNS.Language.CSharp;
|
||||||
|
this.txtBox.LeftBracket = '(';
|
||||||
|
this.txtBox.LeftBracket2 = '{';
|
||||||
|
this.txtBox.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.txtBox.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.txtBox.Name = "txtBox";
|
||||||
|
this.txtBox.Paddings = new System.Windows.Forms.Padding(0);
|
||||||
|
this.txtBox.RightBracket = ')';
|
||||||
|
this.txtBox.RightBracket2 = '}';
|
||||||
|
this.txtBox.SelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
|
||||||
|
this.txtBox.Size = new System.Drawing.Size(579, 319);
|
||||||
|
this.txtBox.TabIndex = 3;
|
||||||
|
this.txtBox.Zoom = 100;
|
||||||
|
//
|
||||||
|
// menuStrip1
|
||||||
|
//
|
||||||
|
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
|
||||||
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.optionsToolStripMenuItem,
|
||||||
|
this.editToolStripMenuItem});
|
||||||
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
|
this.menuStrip1.Padding = new System.Windows.Forms.Padding(4, 1, 0, 1);
|
||||||
|
this.menuStrip1.Size = new System.Drawing.Size(741, 24);
|
||||||
|
this.menuStrip1.TabIndex = 2;
|
||||||
|
this.menuStrip1.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// optionsToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.runToolStripMenuItem});
|
||||||
|
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
||||||
|
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(66, 22);
|
||||||
|
this.optionsToolStripMenuItem.Text = "Options";
|
||||||
|
//
|
||||||
|
// runToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.runToolStripMenuItem.Name = "runToolStripMenuItem";
|
||||||
|
this.runToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F5;
|
||||||
|
this.runToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||||
|
this.runToolStripMenuItem.Text = "Compile";
|
||||||
|
this.runToolStripMenuItem.Click += new System.EventHandler(this.RunToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// editToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.wordWraoToolStripMenuItem});
|
||||||
|
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||||
|
this.editToolStripMenuItem.Size = new System.Drawing.Size(42, 22);
|
||||||
|
this.editToolStripMenuItem.Text = "Edit";
|
||||||
|
//
|
||||||
|
// wordWraoToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.wordWraoToolStripMenuItem.Name = "wordWraoToolStripMenuItem";
|
||||||
|
this.wordWraoToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.wordWraoToolStripMenuItem.Text = "Word Wrap";
|
||||||
|
this.wordWraoToolStripMenuItem.Click += new System.EventHandler(this.WordWraoToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
this.panel1.Controls.Add(this.label4);
|
||||||
|
this.panel1.Controls.Add(this.comboFrame);
|
||||||
|
this.panel1.Controls.Add(this.label3);
|
||||||
|
this.panel1.Controls.Add(this.comboType);
|
||||||
|
this.panel1.Controls.Add(this.label2);
|
||||||
|
this.panel1.Controls.Add(this.listBoxReferences);
|
||||||
|
this.panel1.Controls.Add(this.label1);
|
||||||
|
this.panel1.Controls.Add(this.comboLang);
|
||||||
|
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
|
this.panel1.Location = new System.Drawing.Point(591, 24);
|
||||||
|
this.panel1.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.panel1.Name = "panel1";
|
||||||
|
this.panel1.Size = new System.Drawing.Size(150, 324);
|
||||||
|
this.panel1.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.label4.AutoSize = true;
|
||||||
|
this.label4.Location = new System.Drawing.Point(3, 136);
|
||||||
|
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
this.label4.Size = new System.Drawing.Size(59, 12);
|
||||||
|
this.label4.TabIndex = 7;
|
||||||
|
this.label4.Text = "Framework";
|
||||||
|
//
|
||||||
|
// comboFrame
|
||||||
|
//
|
||||||
|
this.comboFrame.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.comboFrame.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboFrame.FormattingEnabled = true;
|
||||||
|
this.comboFrame.Items.AddRange(new object[] {
|
||||||
|
"v2.0",
|
||||||
|
"v4.0"});
|
||||||
|
this.comboFrame.Location = new System.Drawing.Point(5, 157);
|
||||||
|
this.comboFrame.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.comboFrame.Name = "comboFrame";
|
||||||
|
this.comboFrame.Size = new System.Drawing.Size(138, 20);
|
||||||
|
this.comboFrame.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(3, 77);
|
||||||
|
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(35, 12);
|
||||||
|
this.label3.TabIndex = 5;
|
||||||
|
this.label3.Text = "Type:";
|
||||||
|
//
|
||||||
|
// comboType
|
||||||
|
//
|
||||||
|
this.comboType.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.comboType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboType.FormattingEnabled = true;
|
||||||
|
this.comboType.Items.AddRange(new object[] {
|
||||||
|
"winexe",
|
||||||
|
"library"});
|
||||||
|
this.comboType.Location = new System.Drawing.Point(5, 98);
|
||||||
|
this.comboType.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.comboType.Name = "comboType";
|
||||||
|
this.comboType.Size = new System.Drawing.Size(138, 20);
|
||||||
|
this.comboType.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(3, 201);
|
||||||
|
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(71, 12);
|
||||||
|
this.label2.TabIndex = 3;
|
||||||
|
this.label2.Text = "References:";
|
||||||
|
//
|
||||||
|
// listBoxReferences
|
||||||
|
//
|
||||||
|
this.listBoxReferences.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.listBoxReferences.ContextMenuStrip = this.menuReferences;
|
||||||
|
this.listBoxReferences.FormattingEnabled = true;
|
||||||
|
this.listBoxReferences.ItemHeight = 12;
|
||||||
|
this.listBoxReferences.Items.AddRange(new object[] {
|
||||||
|
"System.dll",
|
||||||
|
"System.Windows.Forms.dll",
|
||||||
|
"Microsoft.VisualBasic.dll",
|
||||||
|
"System.Management.dll",
|
||||||
|
"System.Drawing.dll"});
|
||||||
|
this.listBoxReferences.Location = new System.Drawing.Point(5, 223);
|
||||||
|
this.listBoxReferences.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.listBoxReferences.Name = "listBoxReferences";
|
||||||
|
this.listBoxReferences.Size = new System.Drawing.Size(138, 88);
|
||||||
|
this.listBoxReferences.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// menuReferences
|
||||||
|
//
|
||||||
|
this.menuReferences.ImageScalingSize = new System.Drawing.Size(24, 24);
|
||||||
|
this.menuReferences.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.addToolStripMenuItem,
|
||||||
|
this.removeToolStripMenuItem});
|
||||||
|
this.menuReferences.Name = "menuReferences";
|
||||||
|
this.menuReferences.ShowImageMargin = false;
|
||||||
|
this.menuReferences.Size = new System.Drawing.Size(99, 48);
|
||||||
|
//
|
||||||
|
// addToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.addToolStripMenuItem.Name = "addToolStripMenuItem";
|
||||||
|
this.addToolStripMenuItem.Size = new System.Drawing.Size(98, 22);
|
||||||
|
this.addToolStripMenuItem.Text = "Add";
|
||||||
|
this.addToolStripMenuItem.Click += new System.EventHandler(this.AddToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// removeToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
|
||||||
|
this.removeToolStripMenuItem.Size = new System.Drawing.Size(98, 22);
|
||||||
|
this.removeToolStripMenuItem.Text = "Remove";
|
||||||
|
this.removeToolStripMenuItem.Click += new System.EventHandler(this.RemoveToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(3, 7);
|
||||||
|
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(59, 12);
|
||||||
|
this.label1.TabIndex = 1;
|
||||||
|
this.label1.Text = "Language:";
|
||||||
|
//
|
||||||
|
// comboLang
|
||||||
|
//
|
||||||
|
this.comboLang.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.comboLang.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboLang.FormattingEnabled = true;
|
||||||
|
this.comboLang.Items.AddRange(new object[] {
|
||||||
|
"C#",
|
||||||
|
"VB.NET"});
|
||||||
|
this.comboLang.Location = new System.Drawing.Point(5, 28);
|
||||||
|
this.comboLang.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.comboLang.Name = "comboLang";
|
||||||
|
this.comboLang.Size = new System.Drawing.Size(138, 20);
|
||||||
|
this.comboLang.TabIndex = 0;
|
||||||
|
this.comboLang.SelectedIndexChanged += new System.EventHandler(this.ComboLang_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(741, 348);
|
||||||
|
this.Controls.Add(this.panel1);
|
||||||
|
this.Controls.Add(this.menuStrip1);
|
||||||
|
this.Controls.Add(this.panel2);
|
||||||
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
|
this.MainMenuStrip = this.menuStrip1;
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.Name = "Form1";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
this.Text = "Compiler";
|
||||||
|
this.Load += new System.EventHandler(this.Form1_Load);
|
||||||
|
this.panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.txtBox)).EndInit();
|
||||||
|
this.menuStrip1.ResumeLayout(false);
|
||||||
|
this.menuStrip1.PerformLayout();
|
||||||
|
this.panel1.ResumeLayout(false);
|
||||||
|
this.panel1.PerformLayout();
|
||||||
|
this.menuReferences.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private System.Windows.Forms.Panel panel2;
|
||||||
|
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem runToolStripMenuItem;
|
||||||
|
private FastColoredTextBoxNS.FastColoredTextBox txtBox;
|
||||||
|
private System.Windows.Forms.Panel panel1;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.ListBox listBoxReferences;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.ComboBox comboLang;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.ComboBox comboType;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
private System.Windows.Forms.ComboBox comboFrame;
|
||||||
|
private System.Windows.Forms.ContextMenuStrip menuReferences;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem wordWraoToolStripMenuItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,216 @@
|
||||||
|
using FastColoredTextBoxNS;
|
||||||
|
using Microsoft.CSharp;
|
||||||
|
using Microsoft.VisualBasic;
|
||||||
|
using System;
|
||||||
|
using System.CodeDom.Compiler;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Compiler
|
||||||
|
{
|
||||||
|
public partial class FormCompiler : Form
|
||||||
|
{
|
||||||
|
public FormCompiler()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
comboLang.SelectedIndex = 0;
|
||||||
|
comboType.SelectedIndex = 0;
|
||||||
|
comboFrame.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RunToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (listBoxReferences.Items.Count == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("No references!", "Compiler", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(txtBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Empty code!", "Compiler", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (SaveFileDialog saveFile = new SaveFileDialog())
|
||||||
|
{
|
||||||
|
if (comboType.SelectedIndex == 0)
|
||||||
|
saveFile.Filter = "Executable (*.exe)|*.exe";
|
||||||
|
else
|
||||||
|
saveFile.Filter = "Library (*.dll)|*.dll";
|
||||||
|
|
||||||
|
if (saveFile.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
switch (comboLang.Text)
|
||||||
|
{
|
||||||
|
case "C#":
|
||||||
|
{
|
||||||
|
Compiler(new CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", comboFrame.Text } }),
|
||||||
|
txtBox.Text, GetReference(),
|
||||||
|
saveFile.FileName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case "VB.NET":
|
||||||
|
{
|
||||||
|
Compiler(new VBCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", comboFrame.Text } }),
|
||||||
|
txtBox.Text, GetReference(),
|
||||||
|
saveFile.FileName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Compiler", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
GC.Collect();
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
|
GC.Collect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string[] GetReference()
|
||||||
|
{
|
||||||
|
List<string> reference = new List<string>();
|
||||||
|
foreach (string r in listBoxReferences.Items)
|
||||||
|
{
|
||||||
|
reference.Add(r);
|
||||||
|
}
|
||||||
|
return reference.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Compiler(CodeDomProvider codeDomProvider, string source, string[] referencedAssemblies, string output)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var compilerOptions = $"/target:{comboType.Text} /platform:anycpu /optimize+";
|
||||||
|
|
||||||
|
var compilerParameters = new CompilerParameters(referencedAssemblies)
|
||||||
|
{
|
||||||
|
GenerateExecutable = true,
|
||||||
|
GenerateInMemory = false,
|
||||||
|
CompilerOptions = compilerOptions,
|
||||||
|
TreatWarningsAsErrors = false,
|
||||||
|
IncludeDebugInformation = false,
|
||||||
|
OutputAssembly = output,
|
||||||
|
};
|
||||||
|
var compilerResults = codeDomProvider.CompileAssemblyFromSource(compilerParameters, source);
|
||||||
|
|
||||||
|
if (compilerResults.Errors.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (CompilerError compilerError in compilerResults.Errors)
|
||||||
|
{
|
||||||
|
throw new Exception(string.Format("{0}\nLine: {1}", compilerError.ErrorText, compilerError.Line));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Done!", "Compiler", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Exception(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string reference = Interaction.InputBox("Add Reference", "References", "");
|
||||||
|
if (string.IsNullOrEmpty(reference))
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (string item in listBoxReferences.Items)
|
||||||
|
{
|
||||||
|
if (item == reference)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
listBoxReferences.Items.Add(reference);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxReferences.SelectedItems.Count == 1)
|
||||||
|
{
|
||||||
|
listBoxReferences.Items.Remove(listBoxReferences.SelectedItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ComboLang_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (comboLang.SelectedIndex == 0)
|
||||||
|
{
|
||||||
|
txtBox.Language = Language.CSharp;
|
||||||
|
txtBox.Text = txtBox.Text = @"// c#
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Compiler
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
MessageBox.Show(""Hello World"");
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
txtBox.Language = Language.VB;
|
||||||
|
txtBox.Text = @"' VB
|
||||||
|
|
||||||
|
Imports System
|
||||||
|
Imports System.Windows.Forms
|
||||||
|
|
||||||
|
Public Class Program
|
||||||
|
Public Shared Sub Main()
|
||||||
|
Try
|
||||||
|
MessageBox.Show(""Hello World"")
|
||||||
|
Catch
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
|
|
||||||
|
";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WordWraoToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (txtBox.WordWrap)
|
||||||
|
{
|
||||||
|
txtBox.WordWrap = false;
|
||||||
|
wordWraoToolStripMenuItem.Checked = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
txtBox.WordWrap = true;
|
||||||
|
wordWraoToolStripMenuItem.Checked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,2 +1,3 @@
|
||||||
Crypter.exe
|
Crypter.exe
|
||||||
DotNetZip.dll
|
DotNetZip.dll
|
||||||
|
FastColoredTextBox.dll
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="DotNetZip" version="1.13.7" targetFramework="net45" />
|
<package id="DotNetZip" version="1.13.7" targetFramework="net45" />
|
||||||
|
<package id="FCTB" version="2.16.24" targetFramework="net45" />
|
||||||
<package id="ILMerge" version="3.0.29" targetFramework="net45" />
|
<package id="ILMerge" version="3.0.29" targetFramework="net45" />
|
||||||
<package id="MSBuild.ILMerge.Task" version="1.1.3" targetFramework="net45" />
|
<package id="MSBuild.ILMerge.Task" version="1.1.3" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue