Skip to content

Commit e441f8f

Browse files
committed
Initial version
0 parents  commit e441f8f

File tree

119 files changed

+11282
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+11282
-0
lines changed

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

.gitignore

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# OS junk files
2+
[Tt]humbs.db
3+
*.DS_Store
4+
5+
# Rider
6+
*.idea
7+
8+
# Visual Studio files
9+
*.[Oo]bj
10+
*.user
11+
*.aps
12+
*.pch
13+
*.vspscc
14+
*.vssscc
15+
*_i.c
16+
*_p.c
17+
*.ncb
18+
*.suo
19+
*.tlb
20+
*.tlh
21+
*.bak
22+
*.[Cc]ache
23+
*.ilk
24+
*.log
25+
*.lib
26+
*.sbr
27+
*.sdf
28+
*.opensdf
29+
*.unsuccessfulbuild
30+
ipch/
31+
[Oo]bj/
32+
[Bb]in
33+
[Dd]ebug*/
34+
[Rr]elease*/
35+
Ankh.NoLoad
36+
37+
# MonoDevelop
38+
*.pidb
39+
*.userprefs
40+
41+
# Tooling
42+
_ReSharper*/
43+
*.resharper
44+
[Tt]est[Rr]esult*
45+
*.sass-cache
46+
47+
# Project files
48+
[Bb]uild/
49+
50+
# Subversion files
51+
.svn
52+
53+
# Office Temp files
54+
~$*
55+
56+
# Vim Temp files
57+
*~
58+
59+
# NuGet
60+
packages/
61+
*.nupkg
62+
63+
# NCrunch
64+
*ncrunch*
65+
*crunch*.local.xml
66+
67+
# Visual Studio database projects
68+
*.dbmdl
69+
70+
# Test files
71+
*.testsettings
72+
73+
# Visual studio
74+
.vs/
75+
76+
# Any libraries
77+
!lib/**
78+
79+
# Cake build files
80+
build/tools/**
81+
!build/
82+
!build/tools/packages.config
83+
artifacts/**

GitVersion.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
assembly-versioning-scheme: MajorMinorPatch
2+
mode: ContinuousDelivery
3+
next-version: 1.0.0
4+
branches: {}
5+
ignore:
6+
sha: []

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Paul Stanley
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# ByteDev.Sonos
2+
3+
Set of classes and tools to help control Sonos devices.
4+
5+
## Usage
6+
7+
At the highest level there are two main classes in the ByteDev.Sonos assembly: `SonosController` and `SonosDeviceService`.
8+
9+
## SonosController
10+
11+
SonosController allows you to control the speaker, aspects of it's queue, and operations on it's current track.
12+
13+
```csharp
14+
SonosController controller = new SonosControllerFactory().Create("192.168.1.100");
15+
16+
SonosVolume volume = await controller.GetVolumeAsync();
17+
18+
volume.Increase(10);
19+
20+
await controller.SetVolumeAsync(volume);
21+
```
22+
23+
## SonosDeviceService
24+
25+
```csharp
26+
var service = new SonosDeviceService();
27+
28+
var httpMessage = await service.RebootAsync("192.168.1.100");
29+
```

appveyor.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 1.0.{build}
2+
image: Visual Studio 2017
3+
build_script:
4+
- ps: >-
5+
& cd build
6+
7+
& .\build.ps1
8+
test: off

build/ByteDev.Utilities.cake

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
string GetBuildConfiguration()
2+
{
3+
if(HasArgument("Configuration"))
4+
{
5+
return Argument<string>("Configuration");
6+
}
7+
8+
return EnvironmentVariable("Configuration") != null ?
9+
EnvironmentVariable("Configuration") :
10+
"Release";
11+
}
12+
13+
string GetNuGetVersion()
14+
{
15+
var settings = new GitVersionSettings
16+
{
17+
OutputType = GitVersionOutput.Json
18+
};
19+
20+
GitVersion versionInfo = GitVersion(settings);
21+
22+
Information("GitVersion:");
23+
Information(versionInfo.Dump<GitVersion>());
24+
25+
return versionInfo.NuGetVersion;
26+
}
27+
28+
void CleanObjDirectories()
29+
{
30+
var objSrcDirs = GetDirectories("../src/**/obj");
31+
32+
CleanDirectories(objSrcDirs);
33+
}
34+
35+
void CleanBinDirectories()
36+
{
37+
var binSrcDirs = GetDirectories("../src/**/bin");
38+
39+
CleanDirectories(binSrcDirs);
40+
}
41+
42+
FilePathCollection GetUnitTestProjFiles()
43+
{
44+
return GetFiles("../src/*.UnitTests/**/*.csproj");
45+
}
46+
47+
FilePathCollection GetIntTestProjFiles()
48+
{
49+
return GetFiles("../src/*.IntTests/**/*.csproj");
50+
}
51+
52+
void DotNetCoreTests(FilePathCollection projects, DotNetCoreTestSettings settings)
53+
{
54+
foreach(var project in projects)
55+
{
56+
DotNetCoreTest(project.FullPath, settings);
57+
}
58+
}
59+
60+
void DotNetCoreUnitTests(DotNetCoreTestSettings settings)
61+
{
62+
var projects = GetUnitTestProjFiles();
63+
64+
DotNetCoreTests(projects, settings);
65+
}
66+
67+
void DotNetCoreIntTests(DotNetCoreTestSettings settings)
68+
{
69+
var projects = GetIntTestProjFiles();
70+
71+
DotNetCoreTests(projects, settings);
72+
}
73+

build/build.cake

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#addin nuget:?package=Cake.Incubator&version=3.0.0
2+
#tool "nuget:?package=NUnit.Runners&version=2.6.4"
3+
#load "ByteDev.Utilities.cake"
4+
5+
var nugetSources = new[] {"https://api.nuget.org/v3/index.json"};
6+
7+
var target = Argument("target", "Default");
8+
9+
var solutionFilePath = "../src/ByteDev.Sonos.sln";
10+
11+
var artifactsDirectory = Directory("../artifacts");
12+
var nugetDirectory = artifactsDirectory + Directory("NuGet");
13+
14+
var configuration = GetBuildConfiguration();
15+
16+
Information("Configurtion: " + configuration);
17+
18+
19+
Task("Clean")
20+
.Does(() =>
21+
{
22+
CleanDirectory(artifactsDirectory);
23+
24+
CleanBinDirectories();
25+
CleanObjDirectories();
26+
});
27+
28+
Task("Restore")
29+
.IsDependentOn("Clean")
30+
.Does(() =>
31+
{
32+
var settings = new NuGetRestoreSettings
33+
{
34+
Source = nugetSources
35+
};
36+
37+
NuGetRestore(solutionFilePath, settings);
38+
});
39+
40+
Task("Build")
41+
.IsDependentOn("Restore")
42+
.Does(() =>
43+
{
44+
var settings = new DotNetCoreBuildSettings()
45+
{
46+
Configuration = configuration
47+
};
48+
49+
DotNetCoreBuild(solutionFilePath, settings);
50+
});
51+
52+
Task("UnitTests")
53+
.IsDependentOn("Build")
54+
.Does(() =>
55+
{
56+
var settings = new DotNetCoreTestSettings()
57+
{
58+
Configuration = configuration,
59+
NoBuild = true
60+
};
61+
62+
DotNetCoreUnitTests(settings);
63+
});
64+
65+
Task("CreateNuGetPackages")
66+
.IsDependentOn("UnitTests")
67+
.Does(() =>
68+
{
69+
var nugetVersion = GetNuGetVersion();
70+
71+
var settings = new DotNetCorePackSettings()
72+
{
73+
ArgumentCustomization = args => args.Append("/p:Version=" + nugetVersion),
74+
Configuration = configuration,
75+
OutputDirectory = nugetDirectory
76+
};
77+
78+
DotNetCorePack("../src/ByteDev.Sonos/ByteDev.DotNet.csproj", settings);
79+
DotNetCorePack("../src/ByteDev.Sonos.Upnp/ByteDev.DotNet.Upnp.csproj", settings);
80+
});
81+
82+
83+
Task("Default")
84+
.IsDependentOn("CreateNuGetPackages");
85+
86+
RunTarget(target);

0 commit comments

Comments
 (0)