Exemplo n.º 1
0
        public static void VerifyEnvironment()
        {
            if ((string)AppDomain.CurrentDomain.GetData(VerificationCacheKey) == "1")
            {
                return;
            }

            var executables = new List <string>
            {
                "python.exe",
                "phantomjs.exe",
                "casperjs.exe"
            };

            foreach (var file in executables)
            {
                var path = ScraperExtensions.GetExecutableFullPath(file);

                if (string.IsNullOrEmpty(path))
                {
                    throw new FileNotFoundException("Environment can not found executable file: " + file);
                }
            }

            AppDomain.CurrentDomain.SetData(VerificationCacheKey, "1");
        }
Exemplo n.º 2
0
        private static string GetCasperjsExePath()
        {
            var element = ScraperExtensions.Configuration.AppSettings.Settings["DScraper.CasperjsExePath"];

            if (element != null)
            {
                return(element.Value);
            }
            else
            {
                return(ScraperExtensions.GetExecutableFullPath("casperjs.exe"));
            }
        }