Ejemplo n.º 1
0
 public static int GetHeaderCount(Compiler compiler)
 {
     int i = 0;
     foreach (IScriptApi api in compiler.ScriptEngine.GetAPIs())
         foreach (string nameSpace in api.NamespaceAdditions)
             i++;
     return 13 + i;
 }
Ejemplo n.º 2
0
        public static string CreateCompilerScript(Compiler compiler,
                                                  List<string> MethodsToAdd, string ScriptClass)
        {
            StringBuilder sb = new StringBuilder();
            foreach (IScriptApi api in compiler.ScriptEngine.GetAPIs())
                foreach (string nameSpace in api.NamespaceAdditions)
                    sb.AppendFormat("using {0};\n", nameSpace);
            sb.AppendLine(
@"using Aurora.ScriptEngine.AuroraDotNetEngine.APIs.Interfaces;
using LSL_Types = Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types;
using System;
namespace Script
{
[Serializable]
public class ScriptClass : Aurora.ScriptEngine.AuroraDotNetEngine.Runtime.ScriptBaseClass
{");

            sb.AppendLine(ScriptClass);
            sb.AppendLine(string.Join("\n", MethodsToAdd));

            sb.AppendLine("}}");

            return sb.ToString();
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Creates an 'empty' CSCodeGenerator instance.
        /// </summary>
        public CSCodeGenerator(Compiler compiler)
        {
            #region DTFunctions

            // api funtions that can return a time delay only
            // must be type DateTime in stub files and implementation
            DTFunctions.Add("llAddToLandBanList");
            DTFunctions.Add("llAddToLandPassList");
            DTFunctions.Add("llAdjustSoundVolume");
            DTFunctions.Add("llCloseRemoteDataChannel");
            DTFunctions.Add("llCreateLink");
            DTFunctions.Add("llDialog");
            DTFunctions.Add("llEjectFromLand");
            DTFunctions.Add("llEmail");
            DTFunctions.Add("llGiveInventory");
            DTFunctions.Add("llInstantMessage");
            DTFunctions.Add("llLoadURL");
            DTFunctions.Add("llMakeExplosion");
            DTFunctions.Add("llMakeFire");
            DTFunctions.Add("llMakeFountain");
            DTFunctions.Add("llMakeSmoke");
            DTFunctions.Add("llMapDestination");
            DTFunctions.Add("llOffsetTexture");
            DTFunctions.Add("llOpenRemoteDataChannel");
            DTFunctions.Add("llParcelMediaCommandList");
            DTFunctions.Add("llPreloadSound");
            DTFunctions.Add("llRefreshPrimURL");
            DTFunctions.Add("llRemoteDataReply");
            DTFunctions.Add("llRemoteLoadScript");
            DTFunctions.Add("llRemoteLoadScriptPin");
            DTFunctions.Add("llRemoveFromLandBanList");
            DTFunctions.Add("llRemoveFromLandPassList");
            DTFunctions.Add("llResetLandBanList");
            DTFunctions.Add("llResetLandPassList");
            DTFunctions.Add("llRezAtRoot");
            DTFunctions.Add("llRezObject");
            DTFunctions.Add("llRotateTexture");
            DTFunctions.Add("llScaleTexture");
            DTFunctions.Add("llSetLinkTexture");
            DTFunctions.Add("llSetLocalRot");
            DTFunctions.Add("llSetParcelMusicURL");
            DTFunctions.Add("llSetPos");
            DTFunctions.Add("llSetPrimURL");
            DTFunctions.Add("llSetRot");
            DTFunctions.Add("llSetTexture");
            DTFunctions.Add("llSleep");
            DTFunctions.Add("llTeleportAgentHome");
            DTFunctions.Add("llTextBox");
            DTFunctions.Add("osTeleportAgent");
            DTFunctions.Add("osTeleportOwner");


            /* suspended:  some API functions are not compatible with IEnum
                        // Api functions that can return a delay, a value or breakable in timeslices
                        // must be IEnumerator in stub, interface and implementation files           
 
                        IenFunctions.Add("llRequestAgentData", "LSL_Types.LSLString");
                        IenFunctions.Add("llRequestInventoryData", "LSL_Types.LSLString");
                        IenFunctions.Add("llSendRemoteData", "LSL_Types.LSLString");
                        IenFunctions.Add("llXorBase64Strings", "LSL_Types.LSLString");
                        IenFunctions.Add("llRequestSimulatorData", "LSL_Types.LSLString");
                        IenFunctions.Add("llParcelMediaQuery", "LSL_Types.list");
                        IenFunctions.Add("llGetPrimMediaParams", "LSL_Types.list");
                        IenFunctions.Add("llSetPrimMediaParams", "LSL_Types.LSLInteger");
                        IenFunctions.Add("llClearPrimMedia", "LSL_Types.LSLInteger");
                        IenFunctions.Add("llModPow", "LSL_Types.LSLInteger");
                        IenFunctions.Add("llGetNumberOfNotecardLines", "LSL_Types.LSLString");
                        IenFunctions.Add("llGetParcelPrimOwners", "LSL_Types.list");
                        IenFunctions.Add("llGetNotecardLine", "LSL_Types.LSLString");
            */


            // the rest will be directly called

            #endregion

            ResetCounters();
            m_compiler = compiler;

            if(m_apiFunctions == null)
                m_apiFunctions = compiler.ScriptEngine.GetAllFunctionNamesAPIs();
        }
Ejemplo n.º 4
0
        public void AddRegion(Scene scene)
        {
            if (!m_enabled)
                return;

            //Register the console commands
            if (FirstStartup)
            {
                scene.AddCommand(this, "ADNE", "ADNE", "Subcommands for Aurora DotNet Engine", AuroraDotNetConsoleCommands);
                scene.AddCommand(this, "help ADNE", "help ADNE", "Brings up the help for ADNE", AuroraDotNetConsoleHelp);

                //Fire this once to make sure that the APIs are found later...
                GetAPIs();

                // Create all objects we'll be using
                ScriptProtection = new ScriptProtectionModule(Config);

                EventManager = new EventManager(this);

                Compiler = new Compiler(this);

                AppDomainManager = new AppDomainManager(this);

                ScriptErrorReporter = new ScriptErrorReporter(Config);

                AssemblyResolver = new AssemblyResolver(ScriptEnginesPath);
            }
            
            FirstStartup = false;

        	m_Scenes.Add(scene);

            scene.StackModuleInterface<IScriptModule>(this);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates an 'empty' CSCodeGenerator instance.
        /// </summary>
        public CSCodeGenerator(Compiler compiler)
        {
            ResetCounters();
            m_compiler = compiler;

            IScriptApi[] apis = compiler.ScriptEngine.GetAPIs();

            foreach (IScriptApi api in apis)
            {
                List<string> FunctionNames = compiler.ScriptEngine.GetFunctionNames(api);
                foreach (string functionName in FunctionNames)
                {
                    if (!m_apiFunctions.ContainsKey(functionName))
                        m_apiFunctions.Add(functionName, api);
                }
            }
        }
Ejemplo n.º 6
0
        public static string CreateCompilerScript(Compiler compiler, 
            List<string> MethodsToAdd, string ScriptClass)
        {
            string compiledScript = "";
            foreach (IScriptApi api in compiler.ScriptEngine.GetAPIs())
                foreach (string nameSpace in api.NamespaceAdditions)
                    compiledScript += "using " + nameSpace + ";\n";
            compiledScript += "using Aurora.ScriptEngine.AuroraDotNetEngine.Runtime;\n";
            compiledScript += "using Aurora.ScriptEngine.AuroraDotNetEngine;\n";
            compiledScript += "using Aurora.ScriptEngine.AuroraDotNetEngine.APIs.Interfaces;\n";
            compiledScript += "using System;\n";
            compiledScript += "using System.Collections.Generic;\n";
            compiledScript += "using System.Collections;\n";
            compiledScript += "using System.Reflection;\n";
            compiledScript += "using System.Timers;\n";

            compiledScript += "namespace Script\n";
            compiledScript += "{\n";

            compiledScript += "[Serializable]\n";
            compiledScript +=
                "public class ScriptClass : Aurora.ScriptEngine.AuroraDotNetEngine.Runtime.ScriptBaseClass\n";
            compiledScript += "{\n";

            compiledScript += ScriptClass;
            foreach (string method in MethodsToAdd)
            {
                compiledScript += method;
            }

            compiledScript += "}\n"; // Close Class

            compiledScript += "}\n"; // Close Namespace

            return compiledScript;
        }
Ejemplo n.º 7
0
 public void Initialise(Compiler compiler)
 {
 }