public async Task ApplyConfiguration(JToken configJson) { var config = new ConfigurationDataCookie(); config.LoadValuesFromJson(configJson); cookieHeader = config.CookieHeader; var response = await webclient.GetString(new Utils.Clients.WebRequest() { Url = SiteLink, Cookies = cookieHeader }); await ConfigureIfOK(cookieHeader, response.Content.Contains("logout.php"), () => { CQ dom = response.Content; throw new ExceptionWithConfigData("Invalid cookie header", (ConfigurationData)config); }); }
public async Task ApplyConfiguration(JToken configJson) { var config = new ConfigurationDataCookie(); config.LoadValuesFromJson(configJson); var jsonCookie = new JObject(); jsonCookie["cookie_header"] = config.CookieHeader; cookies.FillFromJson(SiteLink, jsonCookie, logger); var responseContent = await client.GetStringAsync(SiteLink); if (!responseContent.Contains("logout.php")) { CQ dom = responseContent; throw new ExceptionWithConfigData("Invalid cookie header", (ConfigurationData)config); } else { var configSaveData = new JObject(); cookies.DumpToJson(SiteLink, configSaveData); SaveConfig(configSaveData); IsConfigured = true; } }