Exemplo n.º 1
0
        public string ShowAllLinkInProgress()
        {
            var query    = ConfigValueGetterHelper.GetValueByKeyFromConfiguration(_keySetOrGetLinkInProgress);
            var getQuery = $"{query}?{nameof(token)}={token}";
            var task     = Task.Run(() => client.GetStringAsync(getQuery));

            task.Wait();
            var response = task.Result;

            return(response);
        }
Exemplo n.º 2
0
        public string GetJsonByLink(string link)
        {
            var query    = ConfigValueGetterHelper.GetValueByKeyFromConfiguration(_keyAddOrGetLinkInfo);
            var getQuery = $"{query}?{nameof(token)}={token}&{nameof(link)}{link}";
            var task     = Task.Run(() => client.GetStringAsync(getQuery));

            task.Wait();
            var response = task.Result;

            return(response);
        }
Exemplo n.º 3
0
 public async void SetStatusInProgressToLink(string link)
 {
     var tokenDecode = HttpUtility.UrlDecode(token);
     var postValues  = new Dictionary <string, string>()
     {
         { nameof(token), tokenDecode },
         { nameof(link), link },
     };
     var query    = ConfigValueGetterHelper.GetValueByKeyFromConfiguration(_keySetOrGetLinkInProgress);
     var content  = new FormUrlEncodedContent(postValues);
     var response = await client.PostAsync(query, content);
 }
Exemplo n.º 4
0
        public string GetNewLink(string net)
        {
            var query    = ConfigValueGetterHelper.GetValueByKeyFromConfiguration(_keyGetNewLink);
            var getQuery = $"{query}?{nameof(token)}={token}&{nameof(net)}={net}";
            var task     = Task.Run(() => client.GetStringAsync(getQuery));

            task.Wait();
            var response = task.Result;

            CurrentLink = response;
            SetStatusInProgressToLink(response);
            return(response);
        }
Exemplo n.º 5
0
 public async void AddLinkInfo(string link, string json)
 {
     var tokenDecode = HttpUtility.UrlDecode(token);
     var postValues  = new Dictionary <string, string>()
     {
         { nameof(token), tokenDecode },
         { nameof(link), link },
         { nameof(json), json }
     };
     var query    = ConfigValueGetterHelper.GetValueByKeyFromConfiguration(_keyAddOrGetLinkInfo);
     var content  = new FormUrlEncodedContent(postValues);
     var response = await client.PostAsync(query, content);
 }
        public AssemblyProfileService(IFactoryNetwork factoryNetwork)
        {
            var startIntervalValue = ConfigValueGetterHelper.GetValueByKeyFromConfiguration(_keyStartInterval);

            if (int.TryParse(startIntervalValue, out int startInterval))
            {
                var interval = new TimeSpan(0, startInterval, 0);
                _timer = new Timer {
                    Enabled = true, AutoReset = true, Interval = interval.TotalMilliseconds
                };
            }
            else
            {
                throw new ArgumentException("Неккорректное значение интервала из файла конфигурации");
            }
            _factoryNetwork = factoryNetwork;
            InitServices();
        }
Exemplo n.º 7
0
        protected BaseSeleniumService(IApiService apiService, string net)
        {
            _net = net;
            var pathToBrowser = ConfigValueGetterHelper.GetValueByKeyFromConfiguration(_keyPathToBrowser);
            var pathToProfile = ConfigValueGetterHelper.GetValueByKeyFromConfiguration(_keyPathToProfile);

            _apiService = apiService;
            ChromeDriverService service = ChromeDriverService.CreateDefaultService();

            _chromeOptions = new ChromeOptions();
            _chromeOptions.BinaryLocation = pathToBrowser;
            _chromeOptions.AddArgument($"--user-data-dir={pathToProfile}");
            _chromeOptions.AddArgument("--allow-file-access-from-files");
            _chromeOptions.AddArgument("--enable-file-cookies");
            _chromeOptions.AddArgument("--disable-web-security");
            _chromeOptions.AddArgument("--headless");
            _chromeOptions.AddArguments("--ignore-ssl-errors=true");
            _chromeOptions.AddArguments("--ssl-protocol=any");
            _chromeOptions.AddArguments("--disable-gpu");
            _chromeOptions.AddArguments("--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36");
            _chromeDriver  = new ChromeDriver(service, _chromeOptions);
            _webDriverWait = new WebDriverWait(_chromeDriver, TimeSpan.FromSeconds(2));
        }
Exemplo n.º 8
0
 public LinkedInFactory(IApiService apiService)
 {
     _apiService = apiService;
     _net        = ConfigValueGetterHelper.GetValueByKeyFromConfiguration(_netKey);
 }
Exemplo n.º 9
0
 public ApiService()
 {
     token  = ConfigValueGetterHelper.GetValueByKeyFromConfiguration(_keyToken);
     client = new HttpClient();
 }