Auto Login
New message [0] Online [0] Away [0]
[C#] Scripting System [.NET]



 
HomeLatest imagesRegisterLog in

Share
 

 [C#] Scripting System [.NET]

View previous topic View next topic Go down 
AuthorMessage
Sunder

[C#] Scripting System [.NET] Coder


Posts : 21
Age : 30
Location : Upstate New York

[C#] Scripting System [.NET] Empty
PostSubject: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptySat Dec 31, 2011 5:01 pm

Re-posting my simple scripting system for use on this forum. Same as the old, uses CodeDom and Reflection. You can make it work with any .NET for which there is a CodeDom component. Cheers everyone.
Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.CSharp;
using Microsoft.VisualBasic;
using Microsoft.JScript;
using System.Threading;
using System.Reflection;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.IO;

namespace ScriptPluginSystem
{
    class Scripting
    {
        public enum Language
        {
            CSharp, VisualBasic, JScript
        }
        class Script
        {
            private Assembly ScriptCode;//Assembly object representing the compiled script's executable code.
            public Script(string CodeToCompile, Language ProgrammingLanguage)
            {
                ScriptCode = new ScriptCompiler(ProgrammingLanguage).CompileScript(CodeToCompile);//Makes a compiler of the specified language, compiles the code passed to it as a string.
            }//Constructor.
            public object Evaluate(object[] parameters)
            {
                var ClassType = ScriptCode.GetType("Script.ScriptClass");//Gets the namespace and class from the script's assembly.
                MethodInfo MainMethod = ClassType.GetMethod("ScriptMain");//Gets the main method from the namespace and class.
                return MainMethod.Invoke(null, parameters);//Runs the script and returns the results.
            }
            public void Run()
            {//This method is the same as the above, except it takes no parameters and returns nothing.
                var ClassType = ScriptCode.GetType("Script.ScriptClass");
                MethodInfo MainMethod = ClassType.GetMethod("ScriptMain");
                MainMethod.Invoke(null, null);
            }
        }
        class ScriptCompiler
        {
            CodeDomProvider compiler;//This is our CodeDomProvider object, which compiles our code.
            CompilerParameters parameters = new CompilerParameters();//Parameters to pass to the compiler.
            public Assembly CompileScript(string Code)
            {//This method compiles code passed to it as a string and returns the compiled assembly.
                return compiler.CompileAssemblyFromSource(parameters, Code).CompiledAssembly;
            }//Returns a compiled assembly object.
            public ScriptCompiler(Language ProgrammingLanguage)
            {
                if (ProgrammingLanguage == Language.CSharp)
                {//If the language is C#, make a C# compiler.
                    compiler = new CSharpCodeProvider();
                }
                if (ProgrammingLanguage == Language.JScript)
                {//If the language is JScript/Javascript, make a JScript compiler.
                    compiler = new JScriptCodeProvider();
                }
                if (ProgrammingLanguage == Language.VisualBasic)
                {//If the language is visual basic, make a vb compiler.
                    compiler = new VBCodeProvider();
                }
                parameters.GenerateExecutable = false;//Duh.
                parameters.GenerateInMemory = true;//Makes compiler generate assembly in memory.
                parameters.IncludeDebugInformation = false;//Debug info increases script size in memory, so we disable it.
                parameters.ReferencedAssemblies.Add("System.dll");//References System.dll, so scripts can access it's namespaces.
                parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll");//WinForms and controls, for the win.
                parameters.CompilerOptions = "/o"; //Tells compiler to optimize code for speed.
            }//Constructor. Settings for code compilation are all here.
        }
        class ScriptThreading
        {
            public static Thread RunScriptAsync(Script ScriptToRun)
            {//Takes a Script object, executes it's member method "Run()" on a new thread. Returns that thread so you can control execution of the script.
                Thread ScriptThread = new Thread(new ThreadStart(ScriptToRun.Run));//Create a thread, ready to run the script's main method.
                ScriptThread.Start();//Start the thread's execution.
                return ScriptThread;//Return the thread so we can access it.
            }
            public static Thread ReadyScriptThread(Script ScriptToRun)
            {
                Thread ScriptThread = new Thread(new ThreadStart(ScriptToRun.Run));
                return ScriptThread;
            }
        }
    }
}

Example script written in C#:
Code:

namespace Script
{
    class ScriptClass
    {
        public void ScriptMain()
        {
        //Code here.
        return;
        }
    }
}

If you want an example in vb or jscript, let me know. Also, if you have any questions or requests, don't hesitate to ask me. I'd love to share what I know and try to help. 🎅
Back to top Go down
Laser

[C#] Scripting System [.NET] Smod


Posts : 116
Age : 27

[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptySat Dec 31, 2011 5:16 pm

Ok gj

cani have an example?
Back to top Go down
Sunder

[C#] Scripting System [.NET] Coder


Posts : 21
Age : 30
Location : Upstate New York

[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptySat Dec 31, 2011 7:01 pm

An example of what, exactly? A program using this scripting system, or an example of a script?
Back to top Go down
Laser

[C#] Scripting System [.NET] Smod


Posts : 116
Age : 27

[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptySat Dec 31, 2011 8:34 pm

oh yeah

what can you make with C#?
Back to top Go down
Avith

[C#] Scripting System [.NET] Founder
Avith

Posts : 115

[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptySat Dec 31, 2011 8:37 pm

Sunder wrote:
An example of what, exactly? A program using this scripting system, or an example of a script?
Sorry for his ignorance i don't have a clue either on what he is asking my best bet he was leeding into asking you to code a hack for us which is not allowed to beg, but don't worry about it :lol!:
Back to top Go down
https://acidicburn.forumotion.com
Laser

[C#] Scripting System [.NET] Smod


Posts : 116
Age : 27

[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptySat Dec 31, 2011 8:42 pm

sort of...

something that this website can use...
not xaclty a hack/hack loader but something we can use
Back to top Go down
Avith

[C#] Scripting System [.NET] Founder
Avith

Posts : 115

[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptySat Dec 31, 2011 8:49 pm

Laser wrote:
sort of...

something that this website can use...
not xaclty a hack/hack loader but something we can use
Agreed 👽
Back to top Go down
https://acidicburn.forumotion.com
Laser

[C#] Scripting System [.NET] Smod


Posts : 116
Age : 27

[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptySat Dec 31, 2011 9:08 pm

But before we make a loader... we need the hack (obvious)
👽 👽 👽 👽 👽 👽 👽 👽 👽 👽 👽 👽 👽 👽 👽 👽 👽 👽 👽 👽
Back to top Go down
Sunder

[C#] Scripting System [.NET] Coder


Posts : 21
Age : 30
Location : Upstate New York

[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptySun Jan 01, 2012 5:28 am

Well, to be honest I've never written a hack. I've written some advanced injection functions that are undetectable, though. I like to make tools that are useful to people. Another project I'm thinking of starting is something like GameBooster, but better. I'll make it so low end computers can squeeze a few more frames per second out of games, and make any process slightly faster. I've got a lot of ideas for useful programs. Just think of some ideas you guys want me to code for you, I'd be more than happy to try. I'm working on an injector at the moment, then I think I'll start my system optimizing program.
Back to top Go down
Laser

[C#] Scripting System [.NET] Smod


Posts : 116
Age : 27

[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptySun Jan 01, 2012 10:43 am

yeah anything would help
Back to top Go down
Avith

[C#] Scripting System [.NET] Founder
Avith

Posts : 115

[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptySun Jan 01, 2012 12:36 pm

Sunder wrote:
Well, to be honest I've never written a hack. I've written some advanced injection functions that are undetectable, though. I like to make tools that are useful to people. Another project I'm thinking of starting is something like GameBooster, but better. I'll make it so low end computers can squeeze a few more frames per second out of games, and make any process slightly faster. I've got a lot of ideas for useful programs. Just think of some ideas you guys want me to code for you, I'd be more than happy to try. I'm working on an injector at the moment, then I think I'll start my system optimizing program.
Very great concept ideas what ever you make i got your back
Back to top Go down
https://acidicburn.forumotion.com
8bit

[C#] Scripting System [.NET] Smod
8bit

Posts : 39
Age : 30
Location : Cyberspace

[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] EmptyTue Jan 03, 2012 9:11 am

Sunder wrote:
Well, to be honest I've never written a hack. I've written some advanced injection functions that are undetectable, though. I like to make tools that are useful to people. Another project I'm thinking of starting is something like GameBooster, but better. I'll make it so low end computers can squeeze a few more frames per second out of games, and make any process slightly faster. I've got a lot of ideas for useful programs. Just think of some ideas you guys want me to code for you, I'd be more than happy to try. I'm working on an injector at the moment, then I think I'll start my system optimizing program.
Great Ideas Sunder If You Need help You Can Ask Me Or Avith Wink
Back to top Go down
https://acidicburn.forumotion.com
Sponsored content




[C#] Scripting System [.NET] Empty
PostSubject: Re: [C#] Scripting System [.NET]   [C#] Scripting System [.NET] Empty

Back to top Go down
 

[C#] Scripting System [.NET]

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» What Operating System Do You Use?

Permissions in this forum:You cannot reply to topics in this forum
 :: Programming :: C++/C Programming/Tools Release & Downloads-
Social Media Buttons