initial
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C# Express 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpnpEnumSupport", "UpnpEnumSupport\UpnpEnumSupport.csproj", "{8061AF63-B392-4737-9887-060EA205092E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8061AF63-B392-4737-9887-060EA205092E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8061AF63-B392-4737-9887-060EA205092E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8061AF63-B392-4737-9887-060EA205092E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8061AF63-B392-4737-9887-060EA205092E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
Boyi Airleak (LV2015 64bits)/UpnpEnumSupport/UpnpEnumSupport.suo
Normal file
BIN
Boyi Airleak (LV2015 64bits)/UpnpEnumSupport/UpnpEnumSupport.suo
Normal file
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
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("UpnpEnumSupport")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("UpnpEnumSupport")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[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("bb011c75-61a8-48b2-ae1c-ad91eb9e4a81")]
|
||||
|
||||
// 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")]
|
||||
@@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net.Sockets;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace UpnpEnumSupport
|
||||
{
|
||||
|
||||
public class SimpleHTTPServer
|
||||
{
|
||||
private readonly string[] _indexFiles = {
|
||||
"index.html",
|
||||
"index.htm",
|
||||
"default.html",
|
||||
"default.htm"
|
||||
};
|
||||
|
||||
private static IDictionary<string, string> _mimeTypeMappings = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase) {
|
||||
#region extension to MIME type list
|
||||
{".asf", "video/x-ms-asf"},
|
||||
{".asx", "video/x-ms-asf"},
|
||||
{".avi", "video/x-msvideo"},
|
||||
{".bin", "application/octet-stream"},
|
||||
{".cco", "application/x-cocoa"},
|
||||
{".crt", "application/x-x509-ca-cert"},
|
||||
{".css", "text/css"},
|
||||
{".deb", "application/octet-stream"},
|
||||
{".der", "application/x-x509-ca-cert"},
|
||||
{".dll", "application/octet-stream"},
|
||||
{".dmg", "application/octet-stream"},
|
||||
{".ear", "application/java-archive"},
|
||||
{".eot", "application/octet-stream"},
|
||||
{".exe", "application/octet-stream"},
|
||||
{".flv", "video/x-flv"},
|
||||
{".gif", "image/gif"},
|
||||
{".hqx", "application/mac-binhex40"},
|
||||
{".htc", "text/x-component"},
|
||||
{".htm", "text/html"},
|
||||
{".html", "text/html"},
|
||||
{".ico", "image/x-icon"},
|
||||
{".img", "application/octet-stream"},
|
||||
{".iso", "application/octet-stream"},
|
||||
{".jar", "application/java-archive"},
|
||||
{".jardiff", "application/x-java-archive-diff"},
|
||||
{".jng", "image/x-jng"},
|
||||
{".jnlp", "application/x-java-jnlp-file"},
|
||||
{".jpeg", "image/jpeg"},
|
||||
{".jpg", "image/jpeg"},
|
||||
{".js", "application/x-javascript"},
|
||||
{".mml", "text/mathml"},
|
||||
{".mng", "video/x-mng"},
|
||||
{".mov", "video/quicktime"},
|
||||
{".mp3", "audio/mpeg"},
|
||||
{".mpeg", "video/mpeg"},
|
||||
{".mpg", "video/mpeg"},
|
||||
{".msi", "application/octet-stream"},
|
||||
{".msm", "application/octet-stream"},
|
||||
{".msp", "application/octet-stream"},
|
||||
{".pdb", "application/x-pilot"},
|
||||
{".pdf", "application/pdf"},
|
||||
{".pem", "application/x-x509-ca-cert"},
|
||||
{".pl", "application/x-perl"},
|
||||
{".pm", "application/x-perl"},
|
||||
{".png", "image/png"},
|
||||
{".prc", "application/x-pilot"},
|
||||
{".ra", "audio/x-realaudio"},
|
||||
{".rar", "application/x-rar-compressed"},
|
||||
{".rpm", "application/x-redhat-package-manager"},
|
||||
{".rss", "text/xml"},
|
||||
{".run", "application/x-makeself"},
|
||||
{".sea", "application/x-sea"},
|
||||
{".shtml", "text/html"},
|
||||
{".sit", "application/x-stuffit"},
|
||||
{".swf", "application/x-shockwave-flash"},
|
||||
{".tcl", "application/x-tcl"},
|
||||
{".tk", "application/x-tcl"},
|
||||
{".txt", "text/plain"},
|
||||
{".war", "application/java-archive"},
|
||||
{".wbmp", "image/vnd.wap.wbmp"},
|
||||
{".wmv", "video/x-ms-wmv"},
|
||||
{".xml", "text/xml"},
|
||||
{".xpi", "application/x-xpinstall"},
|
||||
{".zip", "application/zip"},
|
||||
#endregion
|
||||
};
|
||||
private Thread _serverThread;
|
||||
private string _rootDirectory;
|
||||
private HttpListener _listener;
|
||||
private int _port;
|
||||
|
||||
public int Port
|
||||
{
|
||||
get { return _port; }
|
||||
private set { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct server with given port.
|
||||
/// </summary>
|
||||
/// <param name="path">Directory path to serve.</param>
|
||||
/// <param name="port">Port of the server.</param>
|
||||
public SimpleHTTPServer(string path, int port)
|
||||
{
|
||||
this.Initialize(path, port);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct server with suitable port.
|
||||
/// </summary>
|
||||
/// <param name="path">Directory path to serve.</param>
|
||||
public SimpleHTTPServer(string path)
|
||||
{
|
||||
//get an empty port
|
||||
TcpListener l = new TcpListener(IPAddress.Loopback, 0);
|
||||
l.Start();
|
||||
int port = ((IPEndPoint)l.LocalEndpoint).Port;
|
||||
l.Stop();
|
||||
this.Initialize(path, port);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop server and dispose all functions.
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
_serverThread = null;
|
||||
_listener.Stop();
|
||||
}
|
||||
|
||||
private void Listen()
|
||||
{
|
||||
_listener = new HttpListener();
|
||||
_listener.Prefixes.Add("http://*:" + _port.ToString() + "/");
|
||||
_listener.Start();
|
||||
while (_serverThread != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
IAsyncResult result = _listener.BeginGetContext(new AsyncCallback(ListenerCallback), null);
|
||||
result.AsyncWaitHandle.WaitOne();
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
public void ListenerCallback(IAsyncResult result)
|
||||
{
|
||||
if (_serverThread != null)
|
||||
{
|
||||
Process(_listener.EndGetContext(result));
|
||||
}
|
||||
}
|
||||
|
||||
private void Process(HttpListenerContext context)
|
||||
{
|
||||
string filename = context.Request.Url.AbsolutePath;
|
||||
Console.WriteLine(filename);
|
||||
filename = filename.Substring(1);
|
||||
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
{
|
||||
foreach (string indexFile in _indexFiles)
|
||||
{
|
||||
if (File.Exists(Path.Combine(_rootDirectory, indexFile)))
|
||||
{
|
||||
filename = indexFile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filename = Path.Combine(_rootDirectory, filename);
|
||||
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
try
|
||||
{
|
||||
Stream input = new FileStream(filename, FileMode.Open);
|
||||
|
||||
//Adding permanent http response headers
|
||||
string mime;
|
||||
context.Response.ContentType = _mimeTypeMappings.TryGetValue(Path.GetExtension(filename), out mime) ? mime : "application/octet-stream";
|
||||
context.Response.ContentLength64 = input.Length;
|
||||
context.Response.AddHeader("Date", DateTime.Now.ToString("r"));
|
||||
context.Response.AddHeader("Last-Modified", System.IO.File.GetLastWriteTime(filename).ToString("r"));
|
||||
|
||||
byte[] buffer = new byte[1024 * 16];
|
||||
int nbytes;
|
||||
while ((nbytes = input.Read(buffer, 0, buffer.Length)) > 0)
|
||||
context.Response.OutputStream.Write(buffer, 0, nbytes);
|
||||
input.Close();
|
||||
context.Response.OutputStream.Flush();
|
||||
|
||||
context.Response.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
context.Response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
}
|
||||
|
||||
context.Response.OutputStream.Close();
|
||||
}
|
||||
|
||||
private void Initialize(string path, int port)
|
||||
{
|
||||
this._rootDirectory = path;
|
||||
this._port = port;
|
||||
_serverThread = new Thread(this.Listen);
|
||||
_serverThread.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{8061AF63-B392-4737-9887-060EA205092E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UpnpEnumSupport</RootNamespace>
|
||||
<AssemblyName>UpnpEnumSupport</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</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="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="SimpleHTTPServer.cs" />
|
||||
<Compile Include="UpnpSupport.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="UPNPLib">
|
||||
<Guid>{DB3442A7-A2E9-4A59-9CB5-F5C1A5D901E5}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</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>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UPNPLib;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace UpnpEnumSupport
|
||||
{
|
||||
public class UpnpSupport
|
||||
{
|
||||
public static string[] FindDeviceByType(string URI)
|
||||
{
|
||||
IUPnPDeviceFinder DeviceFinder = new UPnPDeviceFinder();
|
||||
IUPnPDevices Devices = DeviceFinder.FindByType(URI, 0);
|
||||
if (Devices != null && Devices.Count > 0)
|
||||
{
|
||||
List<string> UDNList = new List<string>();
|
||||
foreach (IUPnPDevice Device in Devices)
|
||||
{
|
||||
UDNList.Add(Device.UniqueDeviceName);
|
||||
Marshal.FinalReleaseComObject(Device);
|
||||
}
|
||||
Marshal.FinalReleaseComObject(Devices);
|
||||
Marshal.FinalReleaseComObject(DeviceFinder);
|
||||
return UDNList.ToArray();
|
||||
}
|
||||
Marshal.FinalReleaseComObject(DeviceFinder);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
ebcb70a3660a60f17b41a09bfe642a0ba627eb75
|
||||
@@ -0,0 +1,12 @@
|
||||
C:\Users\tom.lu\documents\visual studio 2010\Projects\UpnpEnumSupport\UpnpEnumSupport\bin\Release\UpnpEnumSupport.dll
|
||||
C:\Users\tom.lu\documents\visual studio 2010\Projects\UpnpEnumSupport\UpnpEnumSupport\bin\Release\UpnpEnumSupport.pdb
|
||||
C:\Users\tom.lu\documents\visual studio 2010\Projects\UpnpEnumSupport\UpnpEnumSupport\obj\Release\Interop.UPNPLib.dll
|
||||
C:\Users\tom.lu\documents\visual studio 2010\Projects\UpnpEnumSupport\UpnpEnumSupport\obj\Release\UpnpEnumSupport.csproj.ResolveComReference.cache
|
||||
C:\Users\tom.lu\documents\visual studio 2010\Projects\UpnpEnumSupport\UpnpEnumSupport\obj\Release\UpnpEnumSupport.dll
|
||||
C:\Users\tom.lu\documents\visual studio 2010\Projects\UpnpEnumSupport\UpnpEnumSupport\obj\Release\UpnpEnumSupport.pdb
|
||||
C:\Projects\Hideout\PLTS\HIDEOUT_RPT_Test\UpnpEnumSupport\UpnpEnumSupport\bin\Release\UpnpEnumSupport.dll
|
||||
C:\Projects\Hideout\PLTS\HIDEOUT_RPT_Test\UpnpEnumSupport\UpnpEnumSupport\bin\Release\UpnpEnumSupport.pdb
|
||||
C:\Projects\Hideout\PLTS\HIDEOUT_RPT_Test\UpnpEnumSupport\UpnpEnumSupport\obj\Release\Interop.UPNPLib.dll
|
||||
C:\Projects\Hideout\PLTS\HIDEOUT_RPT_Test\UpnpEnumSupport\UpnpEnumSupport\obj\Release\UpnpEnumSupport.csproj.ResolveComReference.cache
|
||||
C:\Projects\Hideout\PLTS\HIDEOUT_RPT_Test\UpnpEnumSupport\UpnpEnumSupport\obj\Release\UpnpEnumSupport.dll
|
||||
C:\Projects\Hideout\PLTS\HIDEOUT_RPT_Test\UpnpEnumSupport\UpnpEnumSupport\obj\Release\UpnpEnumSupport.pdb
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user