Пример #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);
            }
        }
Пример #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);
            }
        }
Пример #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");
            }
        }
Пример #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);
        }