Jump to content

RunCode class


Marsbar
 Share

Recommended Posts

Does anyone know how the RunCode class works?

I want to be able to let a user enter some C# similar to the quester runcode step. The RunCode class has some Compile methods but none for running that I could decifer.

Any help would be appreciated ❤️

Link to comment
Share on other sites

Hi, like that:

var CodeToRun = "var r = 1 + 1;";

                string _sourceCodeIQuesterCondition =
                    @"using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Threading;
using robotManager;
using robotManager.FiniteStateMachine;
using robotManager.Helpful;
using wManager.Wow.Class;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
using Timer = robotManager.Helpful.Timer;
using wManager.Wow.Enums;

public class Main
{
    public static void Pulse()
    {
        [RUNCODE];
    }
}";

string error;
if (!robotManager.Helpful.RunCode.CompileAndInvokeStaticMethod(RunCode.CodeType.CSharp, _sourceCodeIQuesterCondition.Replace("[RUNCODE]", CodeToRun), "Main", "Pulse", out error))
    Logging.WriteError(error);

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...