Dunno
This commit is contained in:
parent
97c4f62677
commit
8a4824a5d3
8
cashew/MainForm.Designer.cs
generated
8
cashew/MainForm.Designer.cs
generated
|
@ -275,9 +275,7 @@
|
||||||
this.cseditCode.Size = new System.Drawing.Size(780, 291);
|
this.cseditCode.Size = new System.Drawing.Size(780, 291);
|
||||||
this.cseditCode.TabIndex = 9;
|
this.cseditCode.TabIndex = 9;
|
||||||
this.cseditCode.TabStop = false;
|
this.cseditCode.TabStop = false;
|
||||||
this.cseditCode.Text = "using System;\r\n\r\nnamespace Project\r\n{\r\n public class Program\r\n {\r\n p" +
|
this.cseditCode.Text = resources.GetString("cseditCode.Text");
|
||||||
"ublic static void Main()\r\n {\r\n Console.WriteLine(\"Hello, world" +
|
|
||||||
"!\");\r\n }\r\n }\r\n}\r\n";
|
|
||||||
//
|
//
|
||||||
// htmltab
|
// htmltab
|
||||||
//
|
//
|
||||||
|
@ -578,12 +576,12 @@
|
||||||
//
|
//
|
||||||
this.csSaveFileDialog.DefaultExt = "dat";
|
this.csSaveFileDialog.DefaultExt = "dat";
|
||||||
this.csSaveFileDialog.FileName = "Project.dat";
|
this.csSaveFileDialog.FileName = "Project.dat";
|
||||||
this.csSaveFileDialog.Filter = "Data File|*.dat|Binary|*.exe";
|
this.csSaveFileDialog.Filter = "Data File|*.dat|Library|*.dll|Binary|*.exe";
|
||||||
//
|
//
|
||||||
// csOpenFileDialog
|
// csOpenFileDialog
|
||||||
//
|
//
|
||||||
this.csOpenFileDialog.DefaultExt = "dat";
|
this.csOpenFileDialog.DefaultExt = "dat";
|
||||||
this.csOpenFileDialog.Filter = "Data File|*.dat|Binary|*.exe";
|
this.csOpenFileDialog.Filter = "Data File|*.dat|Library|*.dll|Binary|*.exe";
|
||||||
//
|
//
|
||||||
// htmlOptionsMenu
|
// htmlOptionsMenu
|
||||||
//
|
//
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace cashew
|
||||||
private readonly Control[] normalControls;
|
private readonly Control[] normalControls;
|
||||||
private readonly ToolStripMenuItem[] menuItems;
|
private readonly ToolStripMenuItem[] menuItems;
|
||||||
private string[] cseditcodel = new string[0];
|
private string[] cseditcodel = new string[0];
|
||||||
private string[] cseditrefl = new string[0];
|
private string[] cseditrefl = new string[] { "Microsoft.CSharp.dll", "System.dll", "System.Core.dll", "System.Data.dll", "System.Data.DataSetExtensions.dll", "System.Net.Http.dll", "System.Xml.dll", "System.Xml.Linq.dll" };
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,8 @@ namespace cashew
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
File.Copy(compileCS(false).PathToAssembly, csSaveFileDialog.FileName);
|
compileCS(false, csSaveFileDialog.FilterIndex == 2, csSaveFileDialog.FileName);
|
||||||
|
//File.Copy(compileCS(false, csSaveFileDialog.FilterIndex == 2).PathToAssembly, csSaveFileDialog.FileName, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e1)
|
catch (Exception e1)
|
||||||
|
@ -184,6 +185,12 @@ namespace cashew
|
||||||
{
|
{
|
||||||
_ = results.CompiledAssembly.EntryPoint.Invoke(null, null);
|
_ = results.CompiledAssembly.EntryPoint.Invoke(null, null);
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_ = results.CompiledAssembly.EntryPoint.Invoke(null, new object[] { new string[0] });
|
||||||
|
}
|
||||||
catch (Exception e1)
|
catch (Exception e1)
|
||||||
{
|
{
|
||||||
if (!e1.tryCast(out ThreadAbortException ex))
|
if (!e1.tryCast(out ThreadAbortException ex))
|
||||||
|
@ -192,6 +199,7 @@ namespace cashew
|
||||||
MetroMessageBox.Show(this, e1.Message, "Execution Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MetroMessageBox.Show(this, e1.Message, "Execution Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
csScript.Start();
|
csScript.Start();
|
||||||
csediterrors.Text = "Ready";
|
csediterrors.Text = "Ready";
|
||||||
|
@ -203,7 +211,7 @@ namespace cashew
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompilerResults compileCS(bool memory = true)
|
private CompilerResults compileCS(bool memory = true, bool library = false, string OF = "")
|
||||||
{
|
{
|
||||||
csediterrors.Text = "";
|
csediterrors.Text = "";
|
||||||
if (cseditref.Text == "Code")
|
if (cseditref.Text == "Code")
|
||||||
|
@ -217,8 +225,9 @@ namespace cashew
|
||||||
CompilerParameters parameters = new CompilerParameters
|
CompilerParameters parameters = new CompilerParameters
|
||||||
{
|
{
|
||||||
GenerateInMemory = memory,
|
GenerateInMemory = memory,
|
||||||
GenerateExecutable = true,
|
GenerateExecutable = !library
|
||||||
};
|
};
|
||||||
|
parameters.OutputAssembly = memory ? parameters.OutputAssembly : OF;
|
||||||
parameters.ReferencedAssemblies.AddRange(cseditrefl);
|
parameters.ReferencedAssemblies.AddRange(cseditrefl);
|
||||||
CompilerResults results;
|
CompilerResults results;
|
||||||
using (CSharpCodeProvider provider = new CSharpCodeProvider())
|
using (CSharpCodeProvider provider = new CSharpCodeProvider())
|
||||||
|
@ -262,8 +271,7 @@ namespace cashew
|
||||||
{
|
{
|
||||||
CSharpDecompiler decompiler = new CSharpDecompiler(csOpenFileDialog.FileName, new DecompilerSettings());
|
CSharpDecompiler decompiler = new CSharpDecompiler(csOpenFileDialog.FileName, new DecompilerSettings());
|
||||||
cseditcodel = decompiler.DecompileWholeModuleAsString().Split(new string[] { "\r\n" }, StringSplitOptions.None);
|
cseditcodel = decompiler.DecompileWholeModuleAsString().Split(new string[] { "\r\n" }, StringSplitOptions.None);
|
||||||
cseditrefl = Assembly.LoadFrom(csOpenFileDialog.FileName)
|
cseditrefl = Assembly.LoadFrom(csOpenFileDialog.FileName).GetReferencedAssemblies().Where(s => !new string[] { "mscorlib" }.Contains(s.Name))
|
||||||
.GetReferencedAssemblies().Where(s => !new string[] { "mscorlib" }.Contains(s.Name))
|
|
||||||
.Select(s => string.IsNullOrWhiteSpace(s.CodeBase) ? (s.Name + ".dll") : s.CodeBase).ToArray();
|
.Select(s => string.IsNullOrWhiteSpace(s.CodeBase) ? (s.Name + ".dll") : s.CodeBase).ToArray();
|
||||||
if (cseditref.Text == "References")
|
if (cseditref.Text == "References")
|
||||||
cseditCode.Text = string.Join("\r\n", cseditcodel);
|
cseditCode.Text = string.Join("\r\n", cseditcodel);
|
||||||
|
@ -273,6 +281,7 @@ namespace cashew
|
||||||
}
|
}
|
||||||
catch (Exception e1)
|
catch (Exception e1)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(e1.ToString());
|
||||||
MetroMessageBox.Show(this, e1.ToString(), "Failed to Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MetroMessageBox.Show(this, e1.ToString(), "Failed to Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,24 @@
|
||||||
NOTE: The output of programs written in Cashew will be printed to the native console, no new window will open up.
|
NOTE: The output of programs written in Cashew will be printed to the native console, no new window will open up.
|
||||||
This Program uses:
|
This Program uses:
|
||||||
[PACKAGELIST]</value>
|
[PACKAGELIST]</value>
|
||||||
|
</data>
|
||||||
|
<data name="cseditCode.Text" xml:space="preserve">
|
||||||
|
<value>using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Program
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Hello, world");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}</value>
|
||||||
</data>
|
</data>
|
||||||
<metadata name="csSaveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="csSaveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
|
|
Reference in New Issue
Block a user