diff --git a/.gitignore b/.gitignore index 748683d..1b9a752 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,42 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore # User-specific files *.suo *.user +*.userosscache *.sln.docstates +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + # Build results [Dd]ebug/ [Dd]ebugPublic/ [Rr]elease/ +[Rr]eleases/ x64/ -build/ +x86/ bld/ [Bb]in/ [Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* -#NUNIT +# NUNIT *.VisualState.xml TestResult.xml @@ -29,14 +45,28 @@ TestResult.xml [Rr]eleasePS/ dlldata.c +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio *_i.c *_p.c *_i.h *.ilk *.meta *.obj +*.iobj *.pch *.pdb +*.ipdb *.pgc *.pgd *.rsp @@ -61,14 +91,21 @@ _Chutzpah* ipch/ *.aps *.ncb +*.opendb *.opensdf *.sdf *.cachefile +*.VC.db +*.VC.VC.opendb # Visual Studio profiler *.psess *.vsp *.vspx +*.sap + +# Visual Studio Trace Files +*.e2e # TFS 2012 Local Workspace $tf/ @@ -81,7 +118,7 @@ _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user -# JustCode is a .NET coding addin-in +# JustCode is a .NET coding add-in .JustCode # TeamCity is a build add-in @@ -90,10 +127,18 @@ _TeamCity* # DotCover is a Code Coverage Tool *.dotCover +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + # NCrunch -*.ncrunch* _NCrunch_* .*crunch*.local.xml +nCrunchTemp_* # MightyMoose *.mm.* @@ -121,54 +166,164 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml - -# NuGet Packages Directory -packages/ -## TODO: If the tool you use requires repositories.config uncomment the next line -#!packages/repositories.config - -# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets -# This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented) -!packages/build/ - -# Windows Azure Build Output +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output csx/ *.build.csdef -# Windows Store app package directory +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ # Others -sql/ -*.Cache ClientBin/ -[Ss]tyle[Cc]op.* ~$* *~ *.dbmdl *.dbproj.schemaview +*.jfm *.pfx *.publishsettings -node_modules/ +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ # RIA/Silverlight projects Generated_Code/ -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak # SQL Server files *.mdf *.ldf +*.ndf # Business Intelligence projects *.rdl.data *.bim.layout *.bim_*.settings +*.rptproj.rsuser # Microsoft Fakes FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ \ No newline at end of file diff --git a/src/ArinWhois.Tests/ApiTests.cs b/src/ArinWhois.Tests/ApiTests.cs index 3281d1f..5db1082 100644 --- a/src/ArinWhois.Tests/ApiTests.cs +++ b/src/ArinWhois.Tests/ApiTests.cs @@ -1,5 +1,5 @@ -using System; -using System.Net; +using System.Net; +using System.Threading.Tasks; using ArinWhois.Client; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -9,7 +9,7 @@ namespace ArinWhois.Tests public class ApiTests { [TestMethod] - public void TestIpFound() + public async Task TestIpFound() { var arinClient = new ArinClient(); var ipResponse = arinClient.QueryIpAsync(IPAddress.Parse("69.63.176.0")).Result; @@ -27,23 +27,19 @@ public void TestIpFound() Assert.AreEqual(ipResponse.Network.OrgRef.Name, "Facebook, Inc."); var organizationHandle = ipResponse.Network.OrgRef.Handle; - var organizationResponse = arinClient.QueryResourceAsync(organizationHandle, ArinClient.ResourceType.Organization).Result; + var organizationResponse = + await arinClient.QueryResourceAsync(organizationHandle, ArinClient.ResourceType.Organization); Assert.IsNotNull(organizationResponse); Assert.AreEqual(organizationResponse.Organization.City.Value, "Menlo Park"); - } [TestMethod] - public void TestIpNotFound() + public async Task TestIpNotFound() { var arinClient = new ArinClient(); - var response = arinClient.QueryIpAsync(IPAddress.Parse("108.33.73.20")).Result; + var response = await arinClient.QueryIpAsync(IPAddress.Parse("108.33.73.20")); Assert.IsNull(response); } - - - - } -} +} \ No newline at end of file diff --git a/src/ArinWhois.Tests/ArinWhois.Tests.csproj b/src/ArinWhois.Tests/ArinWhois.Tests.csproj index f5a9799..58fade0 100644 --- a/src/ArinWhois.Tests/ArinWhois.Tests.csproj +++ b/src/ArinWhois.Tests/ArinWhois.Tests.csproj @@ -1,89 +1,19 @@ - - + + - Debug - AnyCPU - {AD145242-CAF1-4664-8884-6EBD87B4CE27} - Library - Properties - ArinWhois.Tests - ArinWhois.Tests - v4.5 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest + netcoreapp2.1;net461 + + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - + - - + + + + - - {715fb44f-ae81-406d-9ea3-224f55807e06} - ArinWhois - + - - - - - False - - - False - - - False - - - False - - - - - - - + \ No newline at end of file diff --git a/src/ArinWhois.Tests/Properties/AssemblyInfo.cs b/src/ArinWhois.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index fe77258..0000000 --- a/src/ArinWhois.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ArinWhois.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("pg")] -[assembly: AssemblyProduct("ArinWhois.Tests")] -[assembly: AssemblyCopyright("Copyright © pg 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("25d0a786-7520-4732-81e4-69f04cdb1df4")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/ArinWhois.csproj b/src/ArinWhois.csproj deleted file mode 100644 index 929cfa7..0000000 --- a/src/ArinWhois.csproj +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Debug - AnyCPU - {715FB44F-AE81-406D-9EA3-224F55807E06} - Library - Properties - ArinWhois - ArinWhois - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - packages\Jil.1.5.0\lib\net45\Jil.dll - - - packages\Sigil.4.2.1\lib\net45\Sigil.dll - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/ArinWhois.nuspec b/src/ArinWhois.nuspec deleted file mode 100644 index b2a88f1..0000000 --- a/src/ArinWhois.nuspec +++ /dev/null @@ -1,16 +0,0 @@ - - - - ArinWhois - 0.2 - ArinWhois.NET - Max Horstmann - Max Horstmann - https://github.com/MaxHorstmann/ArinWhois.NET - false - .NET client for ARIN's Whois RESTful Web Service, the API to accessing ARIN's Whois data. - Pre-Relase version - Copyright Max Horstmann, 2014 - ARIN - - \ No newline at end of file diff --git a/src/ArinWhois.sln b/src/ArinWhois.sln index 5324757..3460134 100644 --- a/src/ArinWhois.sln +++ b/src/ArinWhois.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.21126.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArinWhois", "ArinWhois.csproj", "{715FB44F-AE81-406D-9EA3-224F55807E06}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArinWhois", "ArinWhois\ArinWhois.csproj", "{715FB44F-AE81-406D-9EA3-224F55807E06}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArinWhois.Tests", "ArinWhois.Tests\ArinWhois.Tests.csproj", "{AD145242-CAF1-4664-8884-6EBD87B4CE27}" EndProject diff --git a/src/ArinWhois/ArinWhois.csproj b/src/ArinWhois/ArinWhois.csproj new file mode 100644 index 0000000..213df5a --- /dev/null +++ b/src/ArinWhois/ArinWhois.csproj @@ -0,0 +1,27 @@ + + + + netstandard2.0;netstandard1.5 + {715FB44F-AE81-406D-9EA3-224F55807E06} + ArinWhois + ArinWhois + + + + ArinWhois + 0.3 + ArinWhois.NET + MaxHorstmann + https://github.com/MaxHorstmann/ArinWhois.NET + https://github.com/MaxHorstmann/ArinWhois.NET + .NET client for ARIN's Whois RESTful Web Service, the API to accessing ARIN's Whois data. + Pre-Relase version + Copyright Max Horstmann, 2014 + ARIN + + + + + + + \ No newline at end of file diff --git a/src/ArinWhois/Client/ArinClient.cs b/src/ArinWhois/Client/ArinClient.cs new file mode 100644 index 0000000..da7121e --- /dev/null +++ b/src/ArinWhois/Client/ArinClient.cs @@ -0,0 +1,65 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +using ArinWhois.Model; +using Newtonsoft.Json; + +namespace ArinWhois.Client +{ + public class ArinClient + { + public enum ResourceType + { + Unknown = 0, + Network = 1, + Organization = 2, + PointOfContact = 3 + } + + private const string BaseUrl = "http://whois.arin.net/rest"; + + private readonly HttpClient _httpClient = new HttpClient(); + + private readonly JsonSerializerSettings _serializerSettings = + new JsonSerializerSettings {DateFormatHandling = DateFormatHandling.IsoDateFormat}; + + public async Task QueryIpAsync(IPAddress ip) + { + try + { + var query = $"ip/{ip}"; + var url = GetRequestUrl(query); + var jsonString = await _httpClient.GetStringAsync(url); + var deser = JsonConvert.DeserializeObject(jsonString, _serializerSettings); + return deser; + } + catch + { + return null; + } + } + + public async Task QueryResourceAsync(string handle, ResourceType resourceType) + { + if (resourceType != ResourceType.Organization) throw new NotImplementedException(); // coming soon + + try + { + var query = $"org/{handle}/pft"; + var jsonString = await _httpClient.GetStringAsync(GetRequestUrl(query)); + var deser = JsonConvert.DeserializeObject(jsonString, _serializerSettings); + return deser.ResponseInner; + } + catch + { + return null; + } + } + + private static Uri GetRequestUrl(string query) + { + return new Uri($"{BaseUrl}/{query}.json"); + } + } +} \ No newline at end of file diff --git a/src/Model/Common.cs b/src/ArinWhois/Model/Common.cs similarity index 74% rename from src/Model/Common.cs rename to src/ArinWhois/Model/Common.cs index 9e3c32e..4cd53d4 100644 --- a/src/Model/Common.cs +++ b/src/ArinWhois/Model/Common.cs @@ -1,10 +1,10 @@ -using System.Runtime.Serialization; +using Newtonsoft.Json; namespace ArinWhois.Model { public class ValueWrapper { - [DataMember(Name = "$")] + [JsonProperty("$")] public T Value { get; set; } public override string ToString() @@ -12,4 +12,4 @@ public override string ToString() return Value.ToString(); } } -} +} \ No newline at end of file diff --git a/src/Model/Network.cs b/src/ArinWhois/Model/Network.cs similarity index 53% rename from src/Model/Network.cs rename to src/ArinWhois/Model/Network.cs index dede74e..a7fc583 100644 --- a/src/Model/Network.cs +++ b/src/ArinWhois/Model/Network.cs @@ -1,82 +1,77 @@ using System; -using System.Runtime.Serialization; +using Newtonsoft.Json; namespace ArinWhois.Model { public class Network { - [DataMember(Name = "@termsOfUse")] + [JsonProperty("@termsOfUse")] public string TermsOfUse { get; set; } - [DataMember(Name = "registrationDate")] + [JsonProperty("registrationDate")] public ValueWrapper RegistrationDate { get; set; } - [DataMember(Name = "ref")] + [JsonProperty("ref")] public ValueWrapper Ref { get; set; } - [DataMember(Name = "handle")] + [JsonProperty("handle")] public ValueWrapper Handle { get; set; } - [DataMember(Name = "name")] + [JsonProperty("name")] public ValueWrapper Name { get; set; } - [DataMember(Name = "startAddress")] + [JsonProperty("startAddress")] public ValueWrapper StartAddress { get; set; } - [DataMember(Name = "endAddress")] + [JsonProperty("endAddress")] public ValueWrapper EndAddress { get; set; } - [DataMember(Name = "updateDate")] + [JsonProperty("updateDate")] public ValueWrapper UpdateDate { get; set; } - [DataMember(Name = "version")] + [JsonProperty("version")] public ValueWrapper Version { get; set; } - [DataMember(Name = "netBlocks")] + [JsonProperty("netBlocks")] public NetBlocks NetBlocks { get; set; } - [DataMember(Name = "orgRef")] + [JsonProperty("orgRef")] public OrgRef OrgRef { get; set; } - } public class OrgRef { - [DataMember(Name = "@name")] + [JsonProperty("@name")] public string Name { get; set; } - [DataMember(Name = "@handle")] + [JsonProperty("@handle")] public string Handle { get; set; } } public class NetBlocks { - [DataMember(Name = "netBlock")] - public NetBlock NetBlock { get; set; } // damn it, API sometimes sends an array here - } + [JsonProperty("netBlock")] + public NetBlock NetBlock { get; set; } // damn it, API sometimes sends an array here + } public class NetBlock { - [DataMember(Name = "cidrLength")] + [JsonProperty("cidrLength")] public ValueWrapper CidrLength { get; set; } - [DataMember(Name = "type")] + [JsonProperty("type")] public ValueWrapper Type { get; set; } - [DataMember(Name = "description")] + [JsonProperty("description")] public ValueWrapper Description { get; set; } - [DataMember(Name = "startAddress")] + [JsonProperty("startAddress")] public ValueWrapper StartAddress { get; set; } - [DataMember(Name = "endAddress")] + [JsonProperty("endAddress")] public ValueWrapper EndAddress { get; set; } - [IgnoreDataMember] - public string Cidr - { - get { return string.Format("{0}/{1}", StartAddress, CidrLength); } - } + [JsonIgnore] + public string Cidr => $"{StartAddress}/{CidrLength}"; } - -} +} \ No newline at end of file diff --git a/src/Model/Organization.cs b/src/ArinWhois/Model/Organization.cs similarity index 60% rename from src/Model/Organization.cs rename to src/ArinWhois/Model/Organization.cs index 16b6edc..0e5c246 100644 --- a/src/Model/Organization.cs +++ b/src/ArinWhois/Model/Organization.cs @@ -1,26 +1,26 @@ using System; -using System.Runtime.Serialization; +using Newtonsoft.Json; namespace ArinWhois.Model { public class Organization { - [DataMember(Name = "@termsOfUse")] + [JsonProperty("@termsOfUse")] public string TermsOfUse { get; set; } - [DataMember(Name = "registrationDate")] + [JsonProperty("registrationDate")] public ValueWrapper RegistrationDate { get; set; } - [DataMember(Name = "name")] + [JsonProperty("name")] public ValueWrapper Name { get; set; } - [DataMember(Name = "postalCode")] + [JsonProperty("postalCode")] public ValueWrapper PostalCode { get; set; } - [DataMember(Name = "city")] + [JsonProperty("city")] public ValueWrapper City { get; set; } - [DataMember(Name = "updateDate")] + [JsonProperty("updateDate")] public ValueWrapper UpdateDate { get; set; } } -} +} \ No newline at end of file diff --git a/src/Model/PointOfContact.cs b/src/ArinWhois/Model/PointOfContact.cs similarity index 61% rename from src/Model/PointOfContact.cs rename to src/ArinWhois/Model/PointOfContact.cs index 10af175..39616e6 100644 --- a/src/Model/PointOfContact.cs +++ b/src/ArinWhois/Model/PointOfContact.cs @@ -1,17 +1,17 @@ using System; -using System.Runtime.Serialization; +using Newtonsoft.Json; namespace ArinWhois.Model { public class PointOfContact { - [DataMember(Name = "@termsOfUse")] + [JsonProperty("@termsOfUse")] public string TermsOfUse { get; set; } - [DataMember(Name = "registrationDate")] + [JsonProperty("registrationDate")] public ValueWrapper RegistrationDate { get; set; } - [DataMember(Name = "ref")] + [JsonProperty("ref")] public ValueWrapper Ref { get; set; } } -} +} \ No newline at end of file diff --git a/src/Model/Response.cs b/src/ArinWhois/Model/Response.cs similarity index 63% rename from src/Model/Response.cs rename to src/ArinWhois/Model/Response.cs index dfd7443..b8782fb 100644 --- a/src/Model/Response.cs +++ b/src/ArinWhois/Model/Response.cs @@ -1,23 +1,22 @@ -using System.Runtime.Serialization; +using Newtonsoft.Json; namespace ArinWhois.Model { internal class ResponseOuter { - [DataMember(Name = "ns4:pft")] + [JsonProperty("ns4:pft")] public Response ResponseInner { get; set; } } public class Response { - [DataMember(Name = "net")] + [JsonProperty("net")] public Network Network { get; set; } - [DataMember(Name = "org")] + [JsonProperty("org")] public Organization Organization { get; set; } - [DataMember(Name = "poc")] + [JsonProperty("poc")] public PointOfContact PointOfContact { get; set; } } - -} +} \ No newline at end of file diff --git a/src/Client/ArinClient.cs b/src/Client/ArinClient.cs deleted file mode 100644 index c0d292f..0000000 --- a/src/Client/ArinClient.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Net; -using System.Threading.Tasks; -using ArinWhois.Model; -using Jil; - -namespace ArinWhois.Client -{ - public class ArinClient - { - private const string BaseUrl = "http://whois.arin.net/rest"; - - private static readonly Options DeserializationOptions = Options.ISO8601; - - public enum ResourceType - { - Unknown = 0, - Network = 1, - Organization = 2, - PointOfContact = 3 - } - - public async Task QueryIpAsync(IPAddress ip) - { - using (var wc = new WebClient()) - { - try - { - var query = string.Format("ip/{0}", ip); - var url = GetRequestUrl(query); - var jsonString = await wc.DownloadStringTaskAsync(url); - var deser = JSON.Deserialize(jsonString, DeserializationOptions); - return deser; - } - catch - { - return null; - } - } - } - - public async Task QueryResourceAsync(string handle, ResourceType resourceType) - { - if (resourceType != ResourceType.Organization) throw new NotImplementedException(); // coming soon - - using (var wc = new WebClient()) - { - try - { - var query = string.Format("org/{0}/pft", handle); - var jsonString = await wc.DownloadStringTaskAsync(GetRequestUrl(query)); - var deser = JSON.Deserialize(jsonString, DeserializationOptions); - return deser.ResponseInner; - } - catch - { - return null; - } - } - } - - - private static Uri GetRequestUrl(string query) - { - return new Uri(string.Format("{0}/{1}.json", BaseUrl, query)); - } - - - - } - -} diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs deleted file mode 100644 index a76338c..0000000 --- a/src/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ArinWhois")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("pg")] -[assembly: AssemblyProduct("ArinWhois")] -[assembly: AssemblyCopyright("Copyright © pg 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("6c1e8a2f-cb79-4c02-8795-80596e559fc8")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/packages.config b/src/packages.config deleted file mode 100644 index a7cf5b9..0000000 --- a/src/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file