Beispiel #1
0
        // Hook location : OS.launchExecutable
        public static bool onExecutableExecute(out int result,
                                               ref Computer com,
                                               ref Folder fol,
                                               ref int finde,
                                               ref string exeFileData,
                                               ref OS os,
                                               ref string[] args)
        {
            GameFilesystem.File f = null;
            if (finde >= 0)
            {
                f = os.thisComputer.GetFilesystem().Directory.FindDirectory(fol.name).GetFile(finde);
            }

            var executableExecuteEvent =
                new Event.ExecutableExecuteEvent(com, fol, finde, f, os, args);

            executableExecuteEvent.CallEvent();
            result = (int)executableExecuteEvent.Result;
            if (executableExecuteEvent.IsCancelled || result != -1)
            {
                return(true);
            }
            return(false);
        }
        public static bool onExecutableExecute(out int result,
                                               ref Computer com,
                                               ref Folder fol,
                                               ref int finde,
                                               ref string exeFileData,
                                               ref OS os,
                                               ref string[] args)
        {
            GameFilesystem.File f = null;
            if (finde >= 0)
            {
                f = os.thisComputer.GetFilesystem().Directory.FindDirectory(fol.name).GetFile(finde);
            }

            var executableExecuteEvent =
                new Event.ExecutableExecuteEvent(com, fol, finde, f, os, args);
            var exceptions = executableExecuteEvent.CallEvent();

            if (exceptions.Count > 0)
            {
                foreach (var pair in exceptions)
                {
                    os.WriteLine("Executable Listener Method '{0}' failed with: {1}", pair.Key, pair.Value);
                }
            }
            result = (int)executableExecuteEvent.Result;
            if (executableExecuteEvent.IsCancelled || result != -1)
            {
                return(true);
            }
            return(false);
        }