Skip to content
Snippets Groups Projects
Commit 8c88415c authored by Kevin Prudente's avatar Kevin Prudente Committed by GitHub
Browse files

Merge pull request #9 from quamotion/features/dotnetcore

Add support for .NET Core
parents 2ced8a4d 34143d9f
Branches
No related tags found
No related merge requests found
......@@ -62,6 +62,8 @@ nuget:
project_feed: true
before_build:
- nuget restore source\MasterDevs.ChromeDevTools.sln
- dotnet restore source\ChromeDevTools\project.json
- dotnet pack source\ChromeDevTools\project.json --version-suffix r%APPVEYOR_BUILD_NUMBER%
build:
project: source\MasterDevs.ChromeDevTools.sln
publish_nuget: true
......@@ -69,6 +71,7 @@ build:
verbosity: minimal
artifacts:
- path: '*.nupkg'
- path: 'source\ChromeDevTools\bin\Debug\*.nupkg'
deploy:
- provider: GitHub
auth_token:
......
......@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
......@@ -35,10 +36,10 @@ namespace MasterDevs.ChromeDevTools
public async Task<string[]> GetSessions()
{
var remoteSessionUrls = new List<string>();
var webClient = new WebClient();
var webClient = new HttpClient();
var uriBuilder = new UriBuilder(RemoteDebuggingUri);
uriBuilder.Path = "/json";
var remoteSessions = await webClient.DownloadStringTaskAsync(uriBuilder.Uri);
var remoteSessions = await webClient.GetStringAsync(uriBuilder.Uri);
using (var stringReader = new StringReader(remoteSessions))
using (var jsonReader = new JsonTextReader(stringReader))
{
......
using MasterDevs.ChromeDevTools.Serialization;
#if !NETSTANDARD1_5
using MasterDevs.ChromeDevTools.Serialization;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
......@@ -251,3 +252,4 @@ namespace MasterDevs.ChromeDevTools
}
}
}
#endif
namespace MasterDevs.ChromeDevTools
#if !NETSTANDARD1_5
namespace MasterDevs.ChromeDevTools
{
public class ChromeSessionFactory : IChromeSessionFactory
{
......@@ -15,3 +16,4 @@
}
}
}
#endif
using System;
using System.Linq;
using System.Reflection;
namespace MasterDevs.ChromeDevTools
{
......@@ -14,18 +15,18 @@ namespace MasterDevs.ChromeDevTools
public static string GetMethod(this Type type)
{
if (null == type) return null;
var eventAttribute = type.GetCustomAttributes(typeof(EventAttribute), true)
var eventAttribute = type.GetTypeInfo().GetCustomAttributes(typeof(EventAttribute), true)
.FirstOrDefault() as EventAttribute;
if (null != eventAttribute) return eventAttribute.MethodName;
var commandAttribute = type.GetCustomAttributes(typeof(CommandAttribute), true)
var commandAttribute = type.GetTypeInfo().GetCustomAttributes(typeof(CommandAttribute), true)
.FirstOrDefault() as CommandAttribute;
if (null != commandAttribute) return commandAttribute.MethodName;
var commandResponseAttribute = type.GetCustomAttributes(typeof(CommandResponseAttribute), true)
var commandResponseAttribute = type.GetTypeInfo().GetCustomAttributes(typeof(CommandResponseAttribute), true)
.FirstOrDefault() as CommandResponseAttribute;
if (null != commandResponseAttribute) return commandResponseAttribute.MethodName;
// maybe it's generic parameter has a method
if (type.IsGenericType)
if (type.GetTypeInfo().IsGenericType)
{
return type.GenericTypeArguments
.FirstOrDefault()
......
......@@ -43,6 +43,9 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
......
{
"frameworks": {
"net45": {}
},
"runtimes": {
"win": {}
}
}
\ No newline at end of file
......@@ -23,11 +23,11 @@ namespace MasterDevs.ChromeDevTools
private void LoadMethodTypeMap(string alias)
{
var assembly = Assembly.GetExecutingAssembly();
var assembly = typeof(MethodTypeMap).GetTypeInfo().Assembly;
var assemblyTypes = assembly.GetTypes();
foreach (var type in assemblyTypes)
{
if (!type.IsClass) continue;
if (!type.GetTypeInfo().IsClass) continue;
if (!type.Namespace.StartsWith($"MasterDevs.ChromeDevTools.Protocol.{alias}")) continue;
......@@ -54,7 +54,7 @@ namespace MasterDevs.ChromeDevTools
private string GetMethodName<T>(Type type) where T : IMethodNameAttribute
{
var attribute = type.GetCustomAttributes(typeof(T))
var attribute = type.GetTypeInfo().GetCustomAttributes(typeof(T))
.FirstOrDefault();
if (null == attribute) return null;
var methodNameAttribute = attribute as IMethodNameAttribute;
......
{
"version": "1.0.3-*",
"description": "Contains the classes and utilities used to interact with the Chrome Developer Tools",
"authors": [ "MasterDevs" ],
"packOptions": {
"projectUrl": "https://github.com/MasterDevs/ChromeDevTools",
"licenseUrl": "https://github.com/MasterDevs/ChromeDevTools/blob/master/LICENSE",
"iconUrl": "http://masterdevs.com/images/FavIcon_144.png"
},
"buildOptions": {},
"dependencies": {
"Newtonsoft.Json": "9.0.1"
},
"frameworks": {
"netstandard15": {
"dependencies": {
"System.Reflection": "4.1.0",
"System.Runtime": "4.1.0",
"System.Collections.Concurrent": "4.0.12",
"System.IO.FileSystem": "4.0.1",
"System.Diagnostics.Process": "4.1.0",
"System.Runtime.InteropServices": "4.1.0",
"System.Net.Http": "4.1.0",
"System.Threading.Thread": "4.0.0"
}
},
"net45": {
"dependencies": {
"WebSocket4Net": "0.14.1"
},
"frameworkAssemblies": {
"System.Net.Http": "4.0.0.0"
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment