Exemplo n.º 1
0
 /// <summary>
 /// Adds a named script to the library
 /// </summary>
 /// <param name="name">The script's name</param>
 /// <param name="str">The script to add</param>
 /// <returns>Returns true if the script was successfully added, false otherwise. This method returns false if there's already a script with the specified name in the library</returns>
 public bool AddNamedScript(string name, ref GTXScriptData script)
 {
     if (namedScripts.ContainsKey(name))
     {
         return(false);
     }
     else
     {
         namedScripts.Add(name, script);
         return(true);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Adds a script to the library
 /// </summary>
 /// <param name="id">The script's id</param>
 /// <param name="str">The script to add</param>
 /// <returns>Returns true if the script was successfully added, false otherwise. This method returns false if there's already a script with the specified id in the library</returns>
 public bool AddScript(uint id, ref GTXScriptData script)
 {
     if (scripts.ContainsKey(id))
     {
         return(false);
     }
     else
     {
         scripts.Add(id, script);
         return(true);
     }
 }
Exemplo n.º 3
0
        public uint StartNamedScript(string name, byte [] args)
        {
            if (!namedScripts.ContainsKey(name))
            {
                throw new ArgumentException("The specified script name does not exist");
            }

            GTXScriptData scData = namedScripts [name];
            GTXScript     script = new GTXScript(this, scData.MemorySize, scData.StackSize);

            Support.Stack <byte> stk = new Support.Stack <byte> (scData.StackSize);
            script.Stack = stk;

            uint pID = (uint)script.GetHashCode();

            script.PID = pID;
            runningScripts.Add(pID, script);
            return(pID);
        }