示例#1
0
 public void CharacterCount(ScriptThread thread)
 {
     string haystack = thread.GetStringParameter(0);
     string needle = thread.GetStringParameter(1);
     int count = 0;
     for (int i = 0; i < haystack.Length; i++)
         if (haystack[i] == needle[0]) count++;
     thread.SetReturnValue(count);
 }
示例#2
0
 public void ExecuteFile(ScriptThread thread)
 {
     Process process = new Process();
     process.StartInfo.FileName = thread.GetStringParameter(0);
     process.StartInfo.Arguments = thread.GetStringParameter(1);
     process.StartInfo.Verb = "Open";
     process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
     process.Start();
     if (thread.GetBooleanParameter(2) == true) process.WaitForExit();
 }
示例#3
0
        public void Explode(ScriptThread thread)
        {
            string explodee = thread.GetStringParameter(0);
            char seperator = thread.GetStringParameter(1)[0];
            string[] exploded = explodee.Split(new char[] { seperator });

            int arrayMemoryIndex = thread.AllocateArray(DataType.String, exploded.Length);
            for (int i = 0; i < exploded.Length; i++)
                thread.SetArrayElement(arrayMemoryIndex, i, exploded[i]);

            thread.SetReturnValueArray(arrayMemoryIndex);
        }
示例#4
0
        public void CommandLineValue(ScriptThread thread)
        {
            string commandLine = thread.GetStringParameter(0);
            int valueIndex = thread.GetIntegerParameter(1);

            foreach (string arg in Engine.GlobalInstance.CommandLineArguments)
            {
                string[] value = new string[0];
                string command = arg;
                int colonIndex = arg.IndexOf(':');

                // Seperate values and command if a colon exists.
                if (colonIndex >= 0)
                {
                    value = new string[1];
                    value[0] = arg.Substring(colonIndex + 1, arg.Length - colonIndex - 1);
                    if (value[0].IndexOf(",") >= 0) value = value[0].Split(new char[1] { ',' });
                    command = arg.Substring(0, colonIndex);
                }

                if (command.ToLower() == commandLine.ToLower())
                {
                    if (valueIndex < 0 || valueIndex >= value.Length)
                    {
                        DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CommandLineValue with an invalid value index.", LogAlertLevel.Error);
                        return;
                    }
                    thread.SetReturnValue(value[valueIndex]);
                    return;
                }
            }

            DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CommandLineValue with a non-existant command line.", LogAlertLevel.Error);
        }
示例#5
0
 public void GameFlag(ScriptThread thread)
 {
     string key = thread.GetStringParameter(0).ToLower();
     if (!Fusion.GlobalInstance.GameFlags.Contains(key))
         return;
     thread.SetReturnValue((string)Fusion.GlobalInstance.GameFlags[key]);
 }
示例#6
0
        public void CommandLineExists(ScriptThread thread)
        {
            string commandLine = thread.GetStringParameter(0);

            foreach (string arg in Engine.GlobalInstance.CommandLineArguments)
            {
                string[] value = new string[0];
                string command = arg;
                int colonIndex = arg.IndexOf(':');

                // Seperate values and command if a colon exists.
                if (colonIndex >= 0)
                {
                    value = new string[1];
                    value[0] = arg.Substring(colonIndex + 1, arg.Length - colonIndex - 1);
                    if (value[0].IndexOf(",") >= 0) value = value[0].Split(new char[1] { ',' });
                    command = arg.Substring(0, colonIndex);
                }

                if (command.ToLower() == commandLine.ToLower())
                {
                    thread.SetReturnValue(true);
                    return;
                }
            }

            thread.SetReturnValue(false);
        }
示例#7
0
 public void OpenStream(ScriptThread thread)
 {
     Stream stream = StreamFactory.RequestStream(thread.GetStringParameter(0), (StreamMode)thread.GetIntegerParameter(1));
     if (stream == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called OpenStream with an unreachable url.", LogAlertLevel.Error);
         return;
     }
     thread.SetReturnValue(new StreamScriptObject(new ScriptStream(stream)));
 }
示例#8
0
 public void InvokeThreadFunction(ScriptThread thread)
 {
     ScriptThread actionThread = ((NativeObject)thread.GetObjectParameter(0)).Object as ScriptThread;
     if (actionThread == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called InvokeThreadFunction with an invalid object.", LogAlertLevel.Error);
         return;
     }
     actionThread.InvokeFunction(thread.GetStringParameter(1), thread.GetBooleanParameter(2), thread.GetBooleanParameter(3), false);
 }
示例#9
0
 public void Length(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).Length);
 }
示例#10
0
 public void Asc(ScriptThread thread)
 {
     thread.SetReturnValue((int)thread.GetStringParameter(0)[0]);
 }
示例#11
0
 public void WordWrap(ScriptThread thread)
 {
     thread.SetReturnValue(StringMethods.WordWrap(thread.GetStringParameter(0), thread.GetIntegerParameter(1)));
 }
示例#12
0
 public void TrimStart(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).TrimStart());
 }
示例#13
0
 public void BindedKeyReleased(ScriptThread thread)
 {
     thread.SetReturnValue(InputManager.BindedKeyReleased(thread.GetStringParameter(0)));
 }
示例#14
0
 public void LoadLanguagePack(ScriptThread thread)
 {
     LanguageManager.LoadLanguagePack(thread.GetStringParameter(0), thread.GetStringParameter(1));
 }
示例#15
0
 public void Contains(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).Contains(thread.GetStringParameter(1)));
 }
示例#16
0
 public void LastIndexOfB(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).LastIndexOf(thread.GetStringParameter(1), thread.GetIntegerParameter(2)));
 }
示例#17
0
 public void Insert(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).Insert(thread.GetIntegerParameter(2), thread.GetStringParameter(1)));
 }
 public void ConnectToServer(ScriptThread thread)
 {
     Networking.NetworkManager.ServerIP = thread.GetStringParameter(0);
     if (thread.GetIntegerParameter(1) != -1) Networking.NetworkManager.Port = thread.GetIntegerParameter(1);
     thread.SetReturnValue(Networking.NetworkManager.Start());
 }
示例#19
0
 public void DebugLogB(ScriptThread thread)
 {
     DebugLogger.WriteLog(thread.GetStringParameter(0));
 }
示例#20
0
 public void DebugLogA(ScriptThread thread)
 {
     DebugLogger.WriteLog(thread.GetStringParameter(0), (LogAlertLevel)thread.GetIntegerParameter(1));
 }
示例#21
0
 public void EndsWith(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).EndsWith(thread.GetStringParameter(1)));
 }
示例#22
0
 public void PadLeftA(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).PadLeft(thread.GetIntegerParameter(1)));
 }
示例#23
0
 public void IndexOfA(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).IndexOf(thread.GetStringParameter(1)));
 }
示例#24
0
 public void PadRightB(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).PadRight(thread.GetIntegerParameter(1), thread.GetStringParameter(2)[0]));
 }
示例#25
0
 public void LanguageCaptionExists(ScriptThread thread)
 {
     thread.SetReturnValue(LanguageManager.CaptionExists(thread.GetStringParameter(0)));
 }
示例#26
0
 public void Replace(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).Replace(thread.GetStringParameter(1), thread.GetStringParameter(2)));
 }
示例#27
0
 public void UnbindKey(ScriptThread thread)
 {
     InputManager.UnbindKey(thread.GetStringParameter(0));
 }
示例#28
0
 public void SubstringB(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).Substring(thread.GetIntegerParameter(1), thread.GetIntegerParameter(2)));
 }
示例#29
0
 public void BindKey(ScriptThread thread)
 {
     InputManager.BindKey(thread.GetStringParameter(0),(KeyCodes)thread.GetIntegerParameter(1));
 }
示例#30
0
 public void ToUpperCase(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).ToUpper());
 }