Skip to content

Commit

Permalink
Remove test code
Browse files Browse the repository at this point in the history
  • Loading branch information
flipbit committed Oct 13, 2019
1 parent 528cbdc commit ea49ac3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 52 deletions.
51 changes: 0 additions & 51 deletions Whois/Parsers/WhoisParser.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using Newtonsoft.Json;
using Tokens;
using Tokens.Transformers;
using Tokens.Validators;
Expand Down Expand Up @@ -93,8 +90,6 @@ public WhoisResponse Parse(string whoisServer, string content)

value.Status = status;

if (status == WhoisStatus.Found) Write(value, whoisServer);

return value;
}

Expand All @@ -111,35 +106,6 @@ private class Server
public string WhoisServerUrl { get; set; }
}

private void Write(WhoisResponse value, string url)
{
const string fileName = "foo.json";
var contents = string.Empty;
var servers = new List<Server>();

if (File.Exists(fileName))
{
contents = File.ReadAllText(fileName);
servers = JsonConvert.DeserializeObject<List<Server>>(contents);
}

if (servers.Any(x => x.DomainName == value.DomainName)) return;

servers.Add(new Server
{
DomainName = value.DomainName,
WhoisServerUrl = url
});

servers = servers.OrderBy(s => s.DomainName).ToList();

var json = JsonConvert.SerializeObject(servers, Formatting.Indented);

File.WriteAllText(fileName, json);

Thread.Sleep(50);
}

public void AddTemplate(string content, string name)
{
matcher.RegisterTemplate(content, name);
Expand All @@ -160,23 +126,6 @@ public void RegisterTransformer<T>() where T : ITokenTransformer
matcher.RegisterTransformer<T>();
}

private void LoadServerTemplates(string whoisServer, string tld)
{
// Check templates for this server/tld not already loaded
var loaded = Templates.ContainsAllTags(whoisServer, tld);

if (loaded) return;

var templateNames = reader.GetNames(whoisServer, tld);

foreach (var templateName in templateNames)
{
var content = reader.GetContent(templateName);

matcher.RegisterTemplate(content);
}
}

private void LoadServerTemplates(string whoisServer)
{
// Check templates for this server/tld not already loaded
Expand Down
1 change: 0 additions & 1 deletion Whois/Whois.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CSharp" Version="4.6.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Tokenizer" Version="2.2.0" />
</ItemGroup>

Expand Down

0 comments on commit ea49ac3

Please sign in to comment.