Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

[C#] Builder with no stub.

Name: Vengeance 2009-07-20 22:44


using System;
using System.Windows.Forms;
using System.Text;
using System.Reflection;
using Microsoft.CSharp;
using System.CodeDom.Compiler;

namespace Builder
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            StringBuilder strb = new StringBuilder();      
            strb.Append("using System;");                  
            strb.Append("using System.Windows.Forms;");
            strb.Append("public class main");
            strb.Append("{");
            strb.Append("public static void Main()");
            strb.Append("{");
            strb.Append("MessageBox.Show(\"");
            strb.Append(textBox1.Text);                    
            strb.Append("\");");
            strb.Append("}");
            strb.Append("}");
            string source = strb.ToString();               

            ICodeCompiler compiler = new CSharpCodeProvider().CreateCompiler();    
            CompilerParameters args = new CompilerParameters();
           
            args.CompilerOptions = "/target:winexe";
            args.OutputAssembly = "gay.exe";         //Name
            args.GenerateExecutable = true;
           
            foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
            {
                args.ReferencedAssemblies.Add(asm.Location);
            }
           
            CompilerResults build = compiler.CompileAssemblyFromSource(args, source);
           
            foreach (CompilerError ce in build.Errors)                               
            {
                MessageBox.Show(ce.ErrorNumber + " " + ce.ErrorText);
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
       
    }
   
}


This is a very ghetto way of doing it, this was my attempt. D:

Name: Anonymous 2009-07-20 23:52

aw, i'm sorry :(

Name: Anonymous 2009-07-21 0:08

It wasn't bad when the framework was 500MB, so what do they do? Keep adding more. I think what Micro$oft doesn't understand is more is not always better. Having every function imaginable duplicated three times throughout the library, and them some more, is not how you make it easier for developers to use. The entire Java installer is smaller than a handful or UPDATES to .NET

Name: Anonymous 2009-07-21 0:12

>>3
No one asked.

Name: Anonymous 2009-07-21 0:18

>>3
latest beta:
dotNetFx40_Full_x86.exe    76.7 MB

Name: Vengeance 2009-07-21 1:39

This only uses stuff in 1.1 I believe, so your computer should already have it installed.

Name: Vengeance 2009-07-21 3:34

"aw, i'm sorry :("
What are you sorry for? o.o

Name: Anonymous 2009-07-22 6:56

Why the hell is this a windows forms application?
Seriously. Why?

Name: Anonymous 2009-07-22 7:25

>>8
Because it's one of the only two sane ways to make a GUI.

Name: Anonymous 2009-07-22 7:38

>>9
Tcl/Tk wants a word with you.

Name: Anonymous 2009-07-22 7:56

>>10
one of the only two

Name: Anonymous 2009-07-22 8:06

>>11
And WYSIWYG editors aren't sane?

Name: Anonymous 2009-07-22 9:12

>>12
have you seen the steaming piles those things shit out? of course they aren't sane.

Name: Anonymous 2009-07-22 9:20

>>13
Ohh, we're talking Windows here. Okay, never mind.

Name: Anonymous 2009-07-22 10:50

Just use F# ...

Name: Anonymous 2009-07-22 11:33

I edit my webpages with HoTMetaL Pro because I am 1337

Name: Vengeance 2009-07-23 7:40

I code in brainfuck.

Name: Anonymous 2011-02-03 0:45


Don't change these.
Name: Email:
Entire Thread Thread List