Example #1
0
        public void EvalMain(string fileName)
        {
            string resolvedPath;

            if (_fileResolver.ResolvePath(_fileSystem, fileName, out resolvedPath))
            {
                var source = _fileSystem.ReadAllBytes(resolvedPath);
                _mainContext.EvalMain(source, resolvedPath);
            }
        }
Example #2
0
        public void EvalMain(string fileName)
        {
            string resolvedPath;

            if (_fileResolver.ResolvePath(_fileSystem, fileName, out resolvedPath))
            {
                var source      = _fileSystem.ReadAllBytes(resolvedPath);
                var input_bytes = TextUtils.GetShebangNullTerminatedCommonJSBytes(source);
                _mainContext.EvalMain(input_bytes, resolvedPath);
            }
        }
Example #3
0
        public object EvalMain(string fileName, Type returnType)
        {
            var resolvedPath = ResolveFilePath("", fileName);

            if (resolvedPath != null)
            {
                var source = _fileSystem.ReadAllBytes(resolvedPath);
                return(_mainContext.EvalMain(source, resolvedPath, returnType));
            }
            else
            {
                throw new UnexpectedException(fileName, "can not resolve file path");
            }
        }
Example #4
0
        public object EvalMain(string fileName, Type returnType)
        {
            _mainScriptRun = true;
            if (!string.IsNullOrEmpty(fileName))
            {
                var resolvedPath = ResolveFilePath("", fileName);
                if (resolvedPath != null)
                {
                    var source   = _fileSystem.ReadAllBytes(resolvedPath);
                    var fullPath = _fileSystem.GetFullPath(resolvedPath);
                    return(_mainContext.EvalMain(source, resolvedPath, fullPath, returnType));
                }
                else
                {
                    throw new UnexpectedException(fileName, "can not resolve file path");
                }
            }

            return(null);
        }