public static void LookForOutdatedPosts() { WriteLine("Give me the sitemap, please."); var sitemapFilePath = ReadLine(); try { var sitemap = new Sitemap(sitemapFilePath); var client = new SimpleWebClient(); var pageChecker = new PageChecker(client) { ProblemTerms = new List <string>() { "master", "slave", "blacklist", "whitelist", "lame", "retard", "crazy", "derp", "ocd", "gyp", "jip", "ghetto", "hysterical", "dumb", "cripple" } }; var auditResult = pageChecker.AuditSiteFromSiteMap(sitemap).Result; File.WriteAllText(@"C:\users\erik\desktop\problems.csv", auditResult.ProblemsToCsv(), Encoding.UTF8); } catch { WriteLine("Oops, try again."); } }
public static void AnalyzeAPage() { WriteLine("Url, please."); var url = System.Console.ReadLine(); var client = new SimpleWebClient(); var pageChecker = new PageChecker(); var rawHtml = client.GetRawResultOfBasicGetRequest(url); pageChecker.GetLinksFrom(rawHtml).ToList().ForEach(l => WriteLine(l)); }
private void Connect() { var tcpConfig = new TcpConfig(true, 5000, 5000); client = SimpleWebClient.Create(32000, 500, tcpConfig); client.onConnect += () => Debug.Log($"Connected to Server"); client.onDisconnect += () => Debug.Log($"Disconnected from Server"); client.onData += OnData; client.onError += (exception) => Debug.Log($"Error because of Server, Error:{exception}"); client.Connect(new Uri("ws://localhost:7776")); }
private void Awake() { _moveableReferencer = GetComponent <MoveableReferencer>(); _timerTextController = GetComponent <TimerTextController>(); _scoreboardController = GetComponent <ScoreboardController>(); _audioSource = GetComponent <AudioSource>(); _musicController = GetComponentInChildren <MusicController>(); TcpConfig tcpConfig = new TcpConfig(true, 5000, 45000); _webClient = SimpleWebClient.Create(16 * 1024, 1000, tcpConfig); _webClient.onConnect += WebClientOnonConnect; _webClient.onData += WebClientOnonData; _webClient.onDisconnect += WebClientOnonDisconnect; Builder.ObjectMoved += BuilderOnObjectMoved; Interacter.WrongGuessMade += InteracterOnWrongGuessMade; }
public static void ScrapeSearch() { WriteLine("Enter search term"); var searchTerm = ReadLine(); var webClient = new SimpleWebClient(); var retriever = new SearchResultRetriever(webClient, new CredentialStore(File.ReadAllText(@"CredFiles\cse.cred"))); const int serpPagesToCrawl = 5; var results = retriever.SearchFor(searchTerm, serpPagesToCrawl).ToList(); var csvRows = results.Select(res => $"{res.DisplayLink},{res.Link}").ToList(); csvRows.Insert(0, "Base Site,Resut Link"); File.WriteAllLines(@"C:\users\erik\desktop\results.csv", csvRows); }
public static void RecordMetrics() { var webClient = new SimpleWebClient(); var feedlyInquisitor = new FeedlyInquisitor(webClient); var alexaInquisitor = new AlexaDataInquisitor(webClient); var mozInquisitor = new MozInquisitor(new CredentialStore(File.ReadAllText(@"CredFiles\moz.cred")), webClient) { Timeout = 10 }; var metricsRecorder = new BlogMetricsRecorder(feedlyInquisitor, alexaInquisitor, mozInquisitor); using (var context = new BlogContext()) { var blogs = context.Blogs.ToList(); var blogMetrics = metricsRecorder.GenerateMetrics(blogs); context.BlogMetrics.AddRange(blogMetrics); context.SaveChanges(); } }
void Start() { _timeSinceLastSend = Time.time; _ghostCars = new Dictionary <ushort, GhostCarBehavior>(); TcpConfig tcpConfig = new TcpConfig(true, 5000, 20000); _ws = SimpleWebClient.Create(16 * 1024, 1000, tcpConfig); _ws.onConnect += delegate { Debug.Log("Client connected"); }; _ws.onData += WsOnonData; _ws.onError += delegate(Exception exception) { Debug.Log("Error: " + exception.Message); }; Connect(true); }
private async Task StartClient() { try { var client = SimpleWebClient.Create(32000, 1000, default); client.Connect(new UriBuilder() { Host = "localhost", Port = 7777, Scheme = "ws" }.Uri); client.onConnect += () => Debug.Log($"Connected to Server"); client.onDisconnect += () => Debug.Log($"Disconnected from Server"); client.onData += (data) => Debug.Log($"Data from Server, {BitConverter.ToString(data.Array, data.Offset, data.Count)}"); client.onError += (exception) => Debug.Log($"Error because of Server, Error:{exception}"); while (true) { client.ProcessMessageQueue(); // ping client.Send(new ArraySegment <byte>(new byte[1] { (byte)(counter++) })); await Task.Yield(); if (token.stop) { break; } } token = null; } catch (Exception e) { Debug.LogException(e); } }
public AlexaDataInquisitor(SimpleWebClient client) { _client = client; }
public WordpressService(SimpleWebClient client) { _client = client; }
public SearchResultRetriever(SimpleWebClient simpleWebClient, CredentialStore store) { _client = simpleWebClient; BaseSearchQuery = $"https://www.googleapis.com/customsearch/v1?key={store["ApiKey"]}&cx={store["CseId"]}&q="; }
/// <summary> /// Lookup SMP (service-metadata) for given participant. /// Constructs SMP-url and extracts metadata from SMP (endpointaddress for given participant and receiving-capabilities for that endpoint) /// SMP = Service Metadata Provider, See also http://www.peppol.eu/pilot-reporting/infrastructure/post-award-infrastructure-1/smp-providers /// </summary> /// <param name="participantIdentifier">participant-id, f.eks. 9908:974763907 where 9908 means norway no tax, and 974763907 is org.nr</param> /// <returns>Information about the accesspoint for given participant. throws <see cref="SmpLookupException"/> if participant is not found</returns> public virtual SmpInformation LookupSMP(string participantIdentifier) { try { Log.Info("Start LookupSMP"); if (string.IsNullOrEmpty(participantIdentifier)) { throw new ArgumentNullException("participantIdentifier", "cannot be null"); } var helper = new Helper(); const string businessIdScheme = "iso6523-actorid-upis"; //når vi spør SMP om info MÅ vi bruke denne verdien. Denne betyr at vi bruker en eller annen internasjonal ISO-standard for å definere participant-iden. POLICY 7 XML attributes for Participant Identifiers in BusDox: The “scheme” attribute must be populated with the value "iso6523-actorid-upis" (see POLICY 5) in all instances of the “ParticipantIdentifier” element const string documentIdScheme = "busdox-docid-qns"; //denne er alltid fast.. POLICY 10: The PEPPOL document type identifier scheme to be used is: busdox-docid-qns. Applies to: all document type identifiers in all components //fungerer: (men då spør vi bare om aksesspunkt som støtter generell type?) Men satser på at det går greit, siden oxalis i hverty fall bare har ett endpoint for alle dokument? trur denne spør om AP godtar fra versjon 1 til 2 og.. const string documentIdValue = "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:www.cenbii.eu:transaction:biicoretrdm010:ver1.0:#urn:www.peppol.eu:bis:peppol4a:ver1.0::2.0"; //Participant identifiers – consisting of scheme and value – are encoded as follows into a DNS name: 292 B-<hash-of-value>.<scheme>.<SML-zone-name> var smpUrl = helper.BuildSmpUrl(participantIdentifier, businessIdScheme, DefaultSmlDomain); try { Log.InfoFormat("Contacting SMP URL: {0}", smpUrl); using (var client = new SimpleWebClient()) { client.HeadOnly = true; var s1 = client.DownloadString(smpUrl); } Log.Info("SMP OK"); } catch (Exception exception) { Log.Error(exception); throw new SmpLookupException(string.Format("Error contacting smpUrl ({0})", smpUrl), smpUrl, exception); } string endpointAddress; try { Log.Info("Getting endpointaddres from service metadata.."); endpointAddress = helper.GetEndPointAddress(participantIdentifier, businessIdScheme, DefaultSmlDomain, documentIdScheme, documentIdValue); Log.InfoFormat("Endpoint found OK: {0}", endpointAddress); } catch (Exception exception) { Log.Error(exception); throw new SmpLookupException("Error getting endpointaddress from smp: " + exception.Message, smpUrl, exception); } ServiceGroup serviceGroupElements; try { Log.Info("Parsing servicegroup-info from smp..."); serviceGroupElements = new ServiceGroupParser().GetServiceGroup(smpUrl); Log.Info("Parse OK"); } catch (Exception exception) { Log.Error(exception); throw new SmpLookupException("Error getting servicegroups from smp: " + exception.Message, smpUrl, exception); } var temp = new SmpInformation { Address = endpointAddress, FromSmpUrl = smpUrl, ServiceGroupElements = serviceGroupElements }; Log.Info("Returning SmpInfo"); return(temp); } catch (Exception exception) { Log.Error(exception); throw; } }
public FeedlyInquisitor(SimpleWebClient client) { _client = client; }
public PageChecker(SimpleWebClient client = null) { _client = client ?? new SimpleWebClient(); }
public MozInquisitor(CredentialStore credentials, SimpleWebClient simpleWebClient) { _simpleWebClient = simpleWebClient; _credentials = credentials; }
public AuditService(SimpleWebClient client) { _client = client; }