Exemplo n.º 1
0
        private static void RegisterCrawlersConfig()
        {
            string tmdbApiKey  = EnvironmentVariablesParser.GetValue("TmdbApiKey");
            string omdbApiKey  = EnvironmentVariablesParser.GetValue("OmdbApiKey");
            string steamApiKey = EnvironmentVariablesParser.GetValue("SteamApiKey");

            _serviceConfigRegistry.RegisterCrawler("Tmdb",
                                                   new XElement("TmdbCrawler",
                                                                new XAttribute("TmdbApiKey", tmdbApiKey),
                                                                new XAttribute("TmdbMaxRetryCount", "10")
                                                                )
                                                   );

            _serviceConfigRegistry.RegisterCrawler("Omdb",
                                                   new XElement("OmdbCrawler",
                                                                new XAttribute("OmdbApiKey", omdbApiKey)
                                                                )
                                                   );

            _serviceConfigRegistry.RegisterCrawler("Steam",
                                                   new XElement("SteamCrawler",
                                                                new XAttribute("SteamApiKey", steamApiKey)
                                                                )
                                                   );
        }
Exemplo n.º 2
0
        public void Test1()
        {
            IDictionary environmentVariables = new Dictionary <string, string>();

            environmentVariables.Add("var1", "value1");
            environmentVariables.Add("var2", "value2");
            var parser = new EnvironmentVariablesParser("Host=$var1$;Port=$var2$;Other", environmentVariables);

            Assert.Equal("Host=value1;Port=value2;Other", parser.Parse());
        }
Exemplo n.º 3
0
        public bool Gestured(PointInfo pointInfo)
        {
            if (_settings == null)
            {
                return(false);
            }

            using (Process process = new Process())
            {
                var parser = new EnvironmentVariablesParser(pointInfo);
                process.StartInfo.FileName        = parser.ExpandEnvironmentVariables(_settings.Path);
                process.StartInfo.Arguments       = parser.ExpandEnvironmentVariables(_settings.Variables);
                process.StartInfo.UseShellExecute = true;
                process.Start();
            }

            return(true);
        }
Exemplo n.º 4
0
        public bool Gestured(PointInfo pointInfo)
        {
            if (_Settings == null)
            {
                return(false);
            }

            string clipboardString = string.Empty;
            var    parser          = new EnvironmentVariablesParser(pointInfo);
            string command         = parser.ExpandEnvironmentVariables(_Settings.Command);

            using (Process process = new Process())
            {
                process.StartInfo.FileName        = "cmd.exe";
                process.StartInfo.Arguments       = $"{(_Settings.ShowCmd ? "/K " : "/C ")}\"{string.Join(" & ", command.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))}\"";
                process.StartInfo.WindowStyle     = _Settings.ShowCmd ? ProcessWindowStyle.Normal : ProcessWindowStyle.Hidden;
                process.StartInfo.CreateNoWindow  = !_Settings.ShowCmd;
                process.StartInfo.UseShellExecute = false;
                process.Start();
            }

            return(true);
        }
Exemplo n.º 5
0
 public IDictionary <string, string> GetEnvironmentVariablesForExecution(string executable, string testDirectory, int threadId)
 => EnvironmentVariablesParser.ParseEnvironmentVariablesString(
     _placeholderReplacer.ReplaceEnvironmentVariablesPlaceholdersForExecution(EnvironmentVariables, executable, testDirectory, threadId));
Exemplo n.º 6
0
 public IDictionary <string, string> GetEnvironmentVariablesForDiscovery(string executable)
 => EnvironmentVariablesParser.ParseEnvironmentVariablesString(
     _placeholderReplacer.ReplaceEnvironmentVariablesPlaceholdersForDiscovery(EnvironmentVariables, executable));