change project to .net core
This commit is contained in:
parent
1b5a93c765
commit
e5d71c1014
|
@ -1,94 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D7453B88-2266-4805-B39B-2B5A2A33E1BA}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Mono.Nat</RootNamespace>
|
||||
<AssemblyName>Mono.Nat</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\SharedVersion.cs">
|
||||
<Link>Properties\SharedVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="AbstractNatDevice.cs" />
|
||||
<Compile Include="AsyncResults\AsyncResult.cs" />
|
||||
<Compile Include="Enums\MapState.cs" />
|
||||
<Compile Include="Enums\ProtocolType.cs" />
|
||||
<Compile Include="EventArgs\DeviceEventArgs.cs" />
|
||||
<Compile Include="Exceptions\MappingException.cs" />
|
||||
<Compile Include="INatDevice.cs" />
|
||||
<Compile Include="ISearcher.cs" />
|
||||
<Compile Include="Mapping.cs" />
|
||||
<Compile Include="NatProtocol.cs" />
|
||||
<Compile Include="NatUtility.cs" />
|
||||
<Compile Include="Pmp\AsyncResults\PortMapAsyncResult.cs" />
|
||||
<Compile Include="Pmp\PmpConstants.cs" />
|
||||
<Compile Include="Pmp\PmpNatDevice.cs" />
|
||||
<Compile Include="Pmp\Searchers\PmpSearcher.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Upnp\Messages\DiscoverDeviceMessage.cs" />
|
||||
<Compile Include="Upnp\Messages\ErrorMessage.cs" />
|
||||
<Compile Include="Upnp\Messages\GetServicesMessage.cs" />
|
||||
<Compile Include="Upnp\Messages\Requests\CreatePortMappingMessage.cs" />
|
||||
<Compile Include="Upnp\Messages\Responses\CreatePortMappingResponseMessage.cs" />
|
||||
<Compile Include="Upnp\Messages\UpnpMessage.cs" />
|
||||
<Compile Include="Upnp\Searchers\UpnpSearcher.cs" />
|
||||
<Compile Include="Upnp\Upnp.cs" />
|
||||
<Compile Include="Upnp\UpnpNatDevice.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
|
||||
<Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project>
|
||||
<Name>MediaBrowser.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj">
|
||||
<Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project>
|
||||
<Name>MediaBrowser.Controller</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
|
||||
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
|
||||
<Name>MediaBrowser.Model</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Upnp\AsyncResults\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
23
Mono.Nat/Mono.Nat.xproj
Normal file
23
Mono.Nat/Mono.Nat.xproj
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>0a82260b-4c22-4fd2-869a-e510044e3502</ProjectGuid>
|
||||
<RootNamespace>Mono.Nat</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -36,7 +36,7 @@ using System.IO;
|
|||
using System.Net.NetworkInformation;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace Mono.Nat
|
||||
|
@ -109,7 +109,7 @@ namespace Mono.Nat
|
|||
|
||||
if (enabledProtocols.Contains(PmpSearcher.Instance.Protocol))
|
||||
{
|
||||
Receive(PmpSearcher.Instance, PmpSearcher.sockets);
|
||||
await Receive(PmpSearcher.Instance, PmpSearcher.sockets).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
foreach (ISearcher s in controllers)
|
||||
|
@ -129,15 +129,16 @@ namespace Mono.Nat
|
|||
}
|
||||
}
|
||||
|
||||
static void Receive (ISearcher searcher, List<UdpClient> clients)
|
||||
static async Task Receive (ISearcher searcher, List<UdpClient> clients)
|
||||
{
|
||||
IPEndPoint received = new IPEndPoint(IPAddress.Parse("192.168.0.1"), 5351);
|
||||
foreach (UdpClient client in clients)
|
||||
{
|
||||
if (client.Available > 0)
|
||||
{
|
||||
IPAddress localAddress = ((IPEndPoint)client.Client.LocalEndPoint).Address;
|
||||
byte[] data = client.Receive(ref received);
|
||||
var result = await client.ReceiveAsync().ConfigureAwait(false);
|
||||
var data = result.Buffer;
|
||||
var received = result.RemoteEndPoint;
|
||||
searcher.Handle(localAddress, data, received);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,7 +172,10 @@ namespace Mono.Nat.Pmp
|
|||
"Out of resources (NAT box cannot create any more mappings at this time)",
|
||||
"Unsupported opcode"
|
||||
};
|
||||
throw new MappingException(resultCode, errors[resultCode]);
|
||||
|
||||
var errorMsg = errors[resultCode];
|
||||
NatUtility.Log("Error in CreatePortMapListen: " + errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (lifetime == 0) return; //mapping was deleted
|
||||
|
|
|
@ -37,6 +37,7 @@ using Mono.Nat.Pmp;
|
|||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Mono.Nat
|
||||
{
|
||||
|
@ -142,13 +143,13 @@ namespace Mono.Nat
|
|||
timeout = 250;
|
||||
}
|
||||
|
||||
public void Search()
|
||||
public async void Search()
|
||||
{
|
||||
foreach (UdpClient s in sockets)
|
||||
{
|
||||
try
|
||||
{
|
||||
Search(s);
|
||||
await Search(s).ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -157,7 +158,7 @@ namespace Mono.Nat
|
|||
}
|
||||
}
|
||||
|
||||
void Search (UdpClient client)
|
||||
async Task Search (UdpClient client)
|
||||
{
|
||||
// Sort out the time for the next search first. The spec says the
|
||||
// timeout should double after each attempt. Once it reaches 64 seconds
|
||||
|
@ -175,8 +176,10 @@ namespace Mono.Nat
|
|||
|
||||
// The nat-pmp search message. Must be sent to GatewayIP:53531
|
||||
byte[] buffer = new byte[] { PmpConstants.Version, PmpConstants.OperationCode };
|
||||
foreach (IPEndPoint gatewayEndpoint in gatewayLists[client])
|
||||
client.Send(buffer, buffer.Length, gatewayEndpoint);
|
||||
foreach (IPEndPoint gatewayEndpoint in gatewayLists[client])
|
||||
{
|
||||
await client.SendAsync(buffer, buffer.Length, gatewayEndpoint).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool IsSearchAddress(IPAddress address)
|
||||
|
|
|
@ -2,30 +2,18 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// 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("Mono.Nat")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Mono.Nat")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[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
|
||||
// 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("d7453b88-2266-4805-b39b-2b5a2a33e1ba")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: Guid("0a82260b-4c22-4fd2-869a-e510044e3502")]
|
||||
|
|
|
@ -37,8 +37,8 @@ using System.Diagnostics;
|
|||
using System.Net.Sockets;
|
||||
using System.Net.NetworkInformation;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace Mono.Nat
|
||||
{
|
||||
|
|
|
@ -34,8 +34,8 @@ using System.Text;
|
|||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace Mono.Nat.Upnp
|
||||
{
|
||||
|
|
39
Mono.Nat/project.fragment.lock.json
Normal file
39
Mono.Nat/project.fragment.lock.json
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"version": 2,
|
||||
"exports": {
|
||||
"MediaBrowser.Common/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETPortable,Version=v4.5,Profile=Profile7",
|
||||
"compile": {
|
||||
"bin/Debug/MediaBrowser.Common.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/MediaBrowser.Common.dll": {}
|
||||
},
|
||||
"contentFiles": {
|
||||
"bin/Debug/MediaBrowser.Common.pdb": {
|
||||
"buildAction": "None",
|
||||
"codeLanguage": "any",
|
||||
"copyToOutput": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"MediaBrowser.Model/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETPortable,Version=v4.5,Profile=Profile7",
|
||||
"compile": {
|
||||
"bin/Debug/MediaBrowser.Model.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/MediaBrowser.Model.dll": {}
|
||||
},
|
||||
"contentFiles": {
|
||||
"bin/Debug/MediaBrowser.Model.pdb": {
|
||||
"buildAction": "None",
|
||||
"codeLanguage": "any",
|
||||
"copyToOutput": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
41
Mono.Nat/project.json
Normal file
41
Mono.Nat/project.json
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"net46": {
|
||||
"frameworkAssemblies": {
|
||||
"System.Collections": "4.0.0.0",
|
||||
"System.Net": "4.0.0.0",
|
||||
"System.Runtime": "4.0.0.0",
|
||||
"System.Threading": "4.0.0.0",
|
||||
"System.Threading.Tasks": "4.0.0.0",
|
||||
"System.Xml": "4.0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"MediaBrowser.Common": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.Model": {
|
||||
"target": "project"
|
||||
}
|
||||
}
|
||||
},
|
||||
"netstandard1.6": {
|
||||
"imports": "dnxcore50",
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.6.0",
|
||||
"MediaBrowser.Common": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.Model": {
|
||||
"target": "project"
|
||||
},
|
||||
"System.Net.NetworkInformation": "4.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
4529
Mono.Nat/project.lock.json
Normal file
4529
Mono.Nat/project.lock.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user