This repository has been archived by the owner on Jan 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:lunchtimemama/Mono.Upnp
- Loading branch information
Showing
133 changed files
with
4,732 additions
and
533 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
Mono.Ssdp: | |||
Aaron Bockover | |||
Scott Thomas | |||
|
|||
Mono.Upnp: | |||
Scott Thomas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,19 @@ | |||
Copyright (C) 2008-2010 Novell | |||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy | |||
of this software and associated documentation files (the "Software"), to deal | |||
in the Software without restriction, including without limitation the rights | |||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
copies of the Software, and to permit persons to whom the Software is | |||
furnished to do so, subject to the following conditions: | |||
|
|||
The above copyright notice and this permission notice shall be included in | |||
all copies or substantial portions of the Software. | |||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,106 @@ | |||
Follow these simple guidelines when hacking on Mono.Upnp and you too will loose weight and find happiness! | |||
|
|||
C# Style Guidelines | |||
=================== | |||
|
|||
1. Indent with 4 spaces. Tabs are bad. Obviously. | |||
|
|||
2. Leave room for the Holy Ghost; put a space before parenthesis, like so: | |||
|
|||
this.ToString (); | |||
|
|||
2. With namespaces, types, and methods, Ms. Brace gets her own line, like so: | |||
|
|||
namespace Foo | |||
{ // This | |||
class Bar | |||
{ // Is | |||
public void Bat () | |||
{ // Stylish | |||
} | |||
} | |||
} | |||
|
|||
3. Ms. Brace shares a line with statements, however. Now you try sharing: | |||
|
|||
if (foo != null) { | |||
foo.Bar (); | |||
} | |||
|
|||
Statements such as else, else-if, catch, and do-while share a line with Ms. Closing Brace. Know what I mean? | |||
|
|||
if (something) { | |||
... | |||
} else { // This is what I mean | |||
... | |||
} | |||
|
|||
Always use braces with statements. Always use braces with statements. Always use braces with statements. | |||
|
|||
4. Properties look like this: | |||
|
|||
public string Foo { get; set; } // Automatic property | |||
|
|||
public string Bar { // 1-line accessor | |||
get { return "bar"; } | |||
} | |||
|
|||
public string Bat { // Multi-line accessor | |||
get { | |||
/* Your | |||
Code | |||
Here */ | |||
} | |||
} | |||
|
|||
5. Private fileds and local variables look_like_this: | |||
|
|||
string all_lower_case_with_underscores = null; | |||
|
|||
Method parameters lookLikeThis: | |||
|
|||
public void Foo (string lowerCaseAndThenUpperCase) // Camal casing | |||
{ | |||
} | |||
|
|||
Everything else (namespaces, types, methods, properties, events, and non-private fields) LookLikeThis: | |||
|
|||
public class MyClass // Pascal casing | |||
{ | |||
protected string NonPrivateField; // Pascal casing | |||
|
|||
void PrivateMethod () // Pascal casing | |||
{ | |||
} | |||
|
|||
public string PublicProperty { get; set; } // You get the idea | |||
} | |||
|
|||
6. Lines should not exceed 120 columns. Overlong method and constructor definitions should break for EACH parameter | |||
and indent to the opening parenthesis, like so: | |||
|
|||
public void CrazySuperLongMethodNameOhEmGeeThisThingIsPracticallyANovel (string parameter1, | |||
string parameter2, | |||
string parameter3) | |||
{ | |||
} | |||
|
|||
Overlong expressions should break at a logical location and indent 4 spaces, like so: | |||
|
|||
throw new InvalidOperationExceltion (string.Format ( | |||
"There is no action named {0} and the device {1}.", actionName, deviceName)); | |||
|
|||
Overlong expressions in a statement declaration should break logically and indent to the opening parenthesis. | |||
In these cases, Ms. Brace gets her own line, like so: | |||
|
|||
while (parameter1 == null || | |||
parameter2 == null || | |||
parameter3 == null) | |||
{ | |||
... | |||
} | |||
|
|||
7. Use the var keyword and array type-inference as much as you possible can! | |||
|
|||
8. Use NEITHER the "private" visibility modifier on members, NOR the "internal" visibility modifier on types; those | |||
are the default visibility levels. Github is paying for these bits, you know. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,31 @@ | |||
Mono.Upnp is set of client/server libraries for the Universal Plug 'n Play specifications. See http://www.upnp.org. | |||
|
|||
To build with Visual Studio or MonoDevelop, open Mono.Upnp.sln and build the solution. | |||
|
|||
To build with from the command line with Mono: | |||
xbuild Mono.Upnp.sln | |||
|
|||
To build with from the command line with .NET: | |||
msbuild Mono.Upnp.sln | |||
|
|||
About the projects: | |||
Mono.Ssdp: | |||
An implementation of the Simple Discovery Protocol (see UPnP Device Architecture 1.1, Section 1). | |||
|
|||
Mono.Upnp: | |||
An implementation of the UPnP Device Archetecture 1.1, Secions 2-5. | |||
|
|||
Mono.Upnp.GtkClient: | |||
An executable GTK+ user interface for inspecting UPnP devices and services on the network. | |||
|
|||
Mono.Upnp.Dcp.MediaServer1: | |||
An implementation of the UPnP Audio/Video MediaServer1 Device Control Protocol. | |||
|
|||
Mono.Upnp.Dcp.MediaServer1.FileSystem: | |||
A MediaServer1 implementation which serves media from the file system. | |||
|
|||
Mono.Upnp.Dcp.MediaServer1.FileSystem.ConsoleServer: | |||
An executable console program which serves media from the file system. | |||
|
|||
Mono.Upnp.Dcp.MSMediaServerRegistrar1: | |||
An implementation of the Microsoft MSMediaServerRegistrar1 Device Control Protocol. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...Dcp.MediaServer1/Mono.Upnp.Dcp.MediaServer1.ContentDirectory1/ObjectBasedQueryProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,74 @@ | |||
// | |||
// ObjectBasedQueryProvider.cs | |||
// | |||
// Author: | |||
// Scott Thomas <lunchtimemama@gmail.com> | |||
// | |||
// Copyright (c) 2010 Scott Thomas | |||
// | |||
// Permission is hereby granted, free of charge, to any person obtaining a copy | |||
// of this software and associated documentation files (the "Software"), to deal | |||
// in the Software without restriction, including without limitation the rights | |||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
// copies of the Software, and to permit persons to whom the Software is | |||
// furnished to do so, subject to the following conditions: | |||
// | |||
// The above copyright notice and this permission notice shall be included in | |||
// all copies or substantial portions of the Software. | |||
// | |||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||
// THE SOFTWARE. | |||
|
|||
using System; | |||
using System.Collections.Generic; | |||
|
|||
namespace Mono.Upnp.Dcp.MediaServer1.ContentDirectory1 | |||
{ | |||
public class ObjectBasedQueryProvider | |||
{ | |||
Dictionary<Type, ObjectQueryContext> queryContexts = new Dictionary<Type, ObjectQueryContext>(); | |||
|
|||
public IEnumerable<Object> Query (Query query, IEnumerable<Object> objects) | |||
{ | |||
if (query == null) { | |||
throw new ArgumentNullException ("query"); | |||
} else if (objects == null) { | |||
throw new ArgumentNullException ("objects"); | |||
} | |||
|
|||
foreach (var @object in objects) { | |||
if (Matches (query, @object)) { | |||
yield return @object; | |||
} | |||
} | |||
} | |||
|
|||
bool Matches (Query query, Object @object) | |||
{ | |||
var match = false; | |||
query (new ObjectQueryVisitor (GetQueryContext (@object.GetType ()), @object, result => match = result)); | |||
return match; | |||
} | |||
|
|||
ObjectQueryContext GetQueryContext (Type type) | |||
{ | |||
if (type == null) { | |||
return null; | |||
} | |||
|
|||
ObjectQueryContext context; | |||
if (!queryContexts.TryGetValue (type, out context)) { | |||
context = new ObjectQueryContext (type, GetQueryContext (type.BaseType)); | |||
queryContexts[type] = context; | |||
} | |||
|
|||
return context; | |||
} | |||
} | |||
} | |||
|
Oops, something went wrong.