예제 #1
0
        public object ExecuteFile(string path, ScriptScope scope, bool throwIfNotExist)
        {
            path.EnsureArgumentNotNull("path");
            scope.EnsureArgumentNotNull("scope");

            if (throwIfNotExist && !PathProvider.FileExists(path))
            {
                throw new FileNotFoundException("Can't find the file", path);
            }

            if (!PathProvider.FileExists(path))
            {
                return(null);
            }

            var source = Engine.CreateScriptSourceFromFile(path);

            return(source.Execute(scope));
        }