Skip to content

Commit 7cac1c2

Browse files
author
Jordan Ellis
committed
XboxConsole 2.0.50317.0
1 parent 688a94f commit 7cac1c2

File tree

47 files changed

+1756
-206
lines changed

Some content is hidden

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

47 files changed

+1756
-206
lines changed
Binary file not shown.

XboxConsole.Adapter.April2014/XboxConsole.Adapter.April2014.csproj

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
<AssemblyName>GamesTest.XboxConsole.Adapter.April2014</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
14-
<SccProjectName>SAK</SccProjectName>
15-
<SccLocalPath>SAK</SccLocalPath>
16-
<SccAuxPath>SAK</SccAuxPath>
17-
<SccProvider>SAK</SccProvider>
14+
<SccProjectName>
15+
</SccProjectName>
16+
<SccLocalPath>
17+
</SccLocalPath>
18+
<SccAuxPath>
19+
</SccAuxPath>
20+
<SccProvider>
21+
</SccProvider>
1822
</PropertyGroup>
1923
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
2024
<DebugSymbols>true</DebugSymbols>

XboxConsole.Adapter.August2014/XboxConsole.Adapter.August2014.csproj

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
<AssemblyName>GamesTest.XboxConsole.Adapter.August2014</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
14-
<SccProjectName>SAK</SccProjectName>
15-
<SccLocalPath>SAK</SccLocalPath>
16-
<SccAuxPath>SAK</SccAuxPath>
17-
<SccProvider>SAK</SccProvider>
14+
<SccProjectName>
15+
</SccProjectName>
16+
<SccLocalPath>
17+
</SccLocalPath>
18+
<SccAuxPath>
19+
</SccAuxPath>
20+
<SccProvider>
21+
</SccProvider>
1822
</PropertyGroup>
1923
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
2024
<DebugSymbols>true</DebugSymbols>

XboxConsole.Adapter.July2014/XboxConsole.Adapter.July2014.csproj

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
<AssemblyName>GamesTest.XboxConsole.Adapter.July2014</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
14-
<SccProjectName>SAK</SccProjectName>
15-
<SccLocalPath>SAK</SccLocalPath>
16-
<SccAuxPath>SAK</SccAuxPath>
17-
<SccProvider>SAK</SccProvider>
14+
<SccProjectName>
15+
</SccProjectName>
16+
<SccLocalPath>
17+
</SccLocalPath>
18+
<SccAuxPath>
19+
</SccAuxPath>
20+
<SccProvider>
21+
</SccProvider>
1822
</PropertyGroup>
1923
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
2024
<DebugSymbols>true</DebugSymbols>

XboxConsole.Adapter.May2014/XboxConsole.Adapter.May2014.csproj

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
<AssemblyName>GamesTest.XboxConsole.Adapter.May2014</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
14-
<SccProjectName>SAK</SccProjectName>
15-
<SccLocalPath>SAK</SccLocalPath>
16-
<SccAuxPath>SAK</SccAuxPath>
17-
<SccProvider>SAK</SccProvider>
14+
<SccProjectName>
15+
</SccProjectName>
16+
<SccLocalPath>
17+
</SccLocalPath>
18+
<SccAuxPath>
19+
</SccAuxPath>
20+
<SccProvider>
21+
</SccProvider>
1822
</PropertyGroup>
1923
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
2024
<DebugSymbols>true</DebugSymbols>

XboxConsole.Adapter.November2014/XboxConsole.Adapter.November2014.csproj

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
<AssemblyName>GamesTest.XboxConsole.Adapter.November2014</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
14-
<SccProjectName>SAK</SccProjectName>
15-
<SccLocalPath>SAK</SccLocalPath>
16-
<SccAuxPath>SAK</SccAuxPath>
17-
<SccProvider>SAK</SccProvider>
14+
<SccProjectName>
15+
</SccProjectName>
16+
<SccLocalPath>
17+
</SccLocalPath>
18+
<SccAuxPath>
19+
</SccAuxPath>
20+
<SccProvider>
21+
</SccProvider>
1822
</PropertyGroup>
1923
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
2024
<DebugSymbols>true</DebugSymbols>

XboxConsole.Adapter.November2014/XboxConsoleAdapter.Input.cs

+10
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ protected override void DisconnectXboxGamepadImpl(string systemIpAddress, ulong
4545
this.gamepads.Remove(gamepad);
4646
}
4747

48+
/// <summary>
49+
/// Disconnects all XboxGamepads from the console.
50+
/// </summary>
51+
/// <param name="systemIpAddress">The system IP address of the console.</param>
52+
protected override void DisconnectAllXboxGamepadsImpl(string systemIpAddress)
53+
{
54+
this.XboxXdk.DisconnectAllXboxGamepads(systemIpAddress);
55+
this.gamepads.Clear();
56+
}
57+
4858
/// <summary>
4959
/// Sets the state of the XboxGamepad.
5060
/// </summary>

XboxConsole.Adapter.November2014/XboxConsoleAdapter.PackageManagement.cs

+17-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.November2014
2626
/// </summary>
2727
internal partial class XboxConsoleAdapter : XboxConsoleAdapterBase
2828
{
29+
private const int UnregisterNonFolderBasedDeploymentHResult = unchecked((int)0x8083000B);
30+
2931
private COMExceptionWhenConnectingHandler comExceptionWhenConnectingHandler = new COMExceptionWhenConnectingHandler();
3032

3133
/// <summary>
@@ -387,7 +389,21 @@ protected override void UnregisterPackageImpl(string systemIpAddress, string pac
387389
throw new ArgumentNullException("packageFullName");
388390
}
389391

390-
this.XboxXdk.UnregisterPackage(systemIpAddress, packageFullName);
392+
try
393+
{
394+
this.XboxXdk.UnregisterPackage(systemIpAddress, packageFullName);
395+
}
396+
catch (COMException ex)
397+
{
398+
if (ex.HResult == UnregisterNonFolderBasedDeploymentHResult)
399+
{
400+
throw new XboxConsoleException("Failed to unregister package. The package was not deployed with folder based deployment.", ex, systemIpAddress);
401+
}
402+
else
403+
{
404+
throw;
405+
}
406+
}
391407
}
392408

393409
/// <summary>

XboxConsole.Adapter.November2014/XboxXdk.cs

+9
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,15 @@ public override IVirtualGamepad CreateXboxGamepad(string systemIpAddress)
571571
return new XboxGamepadAdapter(systemIpAddress, new XtfGamepad(systemIpAddress));
572572
}
573573

574+
/// <summary>
575+
/// Disconnects all XboxGamepads from the console.
576+
/// </summary>
577+
/// <param name="ipAddress">The tools IP address of the console.</param>
578+
public override void DisconnectAllXboxGamepads(string ipAddress)
579+
{
580+
XtfGamepad.DisconnectAll(ipAddress);
581+
}
582+
574583
/// <summary>
575584
/// Push deploys loose files to the console.
576585
/// </summary>

XboxConsole.Adapter.October2014/XboxConsole.Adapter.October2014.csproj

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
<AssemblyName>GamesTest.XboxConsole.Adapter.October2014</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
14-
<SccProjectName>SAK</SccProjectName>
15-
<SccLocalPath>SAK</SccLocalPath>
16-
<SccAuxPath>SAK</SccAuxPath>
17-
<SccProvider>SAK</SccProvider>
14+
<SccProjectName>
15+
</SccProjectName>
16+
<SccLocalPath>
17+
</SccLocalPath>
18+
<SccAuxPath>
19+
</SccAuxPath>
20+
<SccProvider>
21+
</SccProvider>
1822
</PropertyGroup>
1923
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
2024
<DebugSymbols>true</DebugSymbols>

XboxConsole.Adapter.October2014/XboxConsoleAdapter.Input.cs

+10
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ protected override void DisconnectXboxGamepadImpl(string systemIpAddress, ulong
4545
this.gamepads.Remove(gamepad);
4646
}
4747

48+
/// <summary>
49+
/// Disconnects all XboxGamepads from the console.
50+
/// </summary>
51+
/// <param name="systemIpAddress">The system IP address of the console.</param>
52+
protected override void DisconnectAllXboxGamepadsImpl(string systemIpAddress)
53+
{
54+
this.XboxXdk.DisconnectAllXboxGamepads(systemIpAddress);
55+
this.gamepads.Clear();
56+
}
57+
4858
/// <summary>
4959
/// Sets the state of the XboxGamepad.
5060
/// </summary>

XboxConsole.Adapter.October2014/XboxConsoleAdapter.PackageManagement.cs

+18-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.October2014
2626
/// </summary>
2727
internal partial class XboxConsoleAdapter : XboxConsoleAdapterBase
2828
{
29+
private const int UnregisterNonFolderBasedDeploymentHResult = unchecked((int)0x8083000B);
30+
2931
private COMExceptionWhenConnectingHandler comExceptionWhenConnectingHandler = new COMExceptionWhenConnectingHandler();
3032

3133
/// <summary>
@@ -386,8 +388,22 @@ protected override void UnregisterPackageImpl(string systemIpAddress, string pac
386388
{
387389
throw new ArgumentNullException("packageFullName");
388390
}
389-
390-
this.XboxXdk.UnregisterPackage(systemIpAddress, packageFullName);
391+
392+
try
393+
{
394+
this.XboxXdk.UnregisterPackage(systemIpAddress, packageFullName);
395+
}
396+
catch (COMException ex)
397+
{
398+
if (ex.HResult == UnregisterNonFolderBasedDeploymentHResult)
399+
{
400+
throw new XboxConsoleException("Failed to unregister package. The package was not deployed with folder based deployment.", ex, systemIpAddress);
401+
}
402+
else
403+
{
404+
throw;
405+
}
406+
}
391407
}
392408

393409
/// <summary>

XboxConsole.Adapter.October2014/XboxXdk.cs

+9
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,15 @@ public override IVirtualGamepad CreateXboxGamepad(string systemIpAddress)
571571
return new XboxGamepadAdapter(systemIpAddress, new XtfGamepad(systemIpAddress));
572572
}
573573

574+
/// <summary>
575+
/// Disconnects all XboxGamepads from the console.
576+
/// </summary>
577+
/// <param name="ipAddress">The tools IP address of the console.</param>
578+
public override void DisconnectAllXboxGamepads(string ipAddress)
579+
{
580+
XtfGamepad.DisconnectAll(ipAddress);
581+
}
582+
574583
/// <summary>
575584
/// Push deploys loose files to the console.
576585
/// </summary>

XboxConsole.Adapter.Tests/FakeXboxXdk.cs

+21
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ internal class FakeXboxXdk : XboxXdkBase
154154
Justification = "We need to implement unit tests referencing this code")]
155155
public Func<string, IVirtualGamepad> CreateGamepadFunc { get; set; }
156156

157+
/// <summary>
158+
/// Gets or sets a custom action to shim the DisconnectAllXboxGamepads method.
159+
/// </summary>
160+
public Action<string> DisconnectAllXboxGamepadsAction { get; set; }
161+
157162
/// <summary>
158163
/// Gets or sets a custom func to shim the "DeployPushAsync" method.
159164
/// </summary>
@@ -749,6 +754,22 @@ public override IVirtualGamepad CreateXboxGamepad(string ipAddress)
749754
}
750755
}
751756

757+
/// <summary>
758+
/// Disconnects all connected XboxGamepads.
759+
/// </summary>
760+
/// <param name="ipAddress">The IP address of the console.</param>
761+
public override void DisconnectAllXboxGamepads(string ipAddress)
762+
{
763+
if (this.DisconnectAllXboxGamepadsAction != null)
764+
{
765+
this.DisconnectAllXboxGamepadsAction(ipAddress);
766+
}
767+
else
768+
{
769+
throw new NotImplementedException("DisconnectAllXboxGamepadsAction is not set.");
770+
}
771+
}
772+
752773
/// <summary>
753774
/// Push deploys loose files to the console.
754775
/// </summary>
Binary file not shown.

XboxConsole.Adapter.Tests/XboxConsole.Adapter.Tests.csproj

+8-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
1717
<IsCodedUITest>False</IsCodedUITest>
1818
<TestProjectType>UnitTest</TestProjectType>
19-
<SccProjectName>SAK</SccProjectName>
20-
<SccLocalPath>SAK</SccLocalPath>
21-
<SccAuxPath>SAK</SccAuxPath>
22-
<SccProvider>SAK</SccProvider>
19+
<SccProjectName>
20+
</SccProjectName>
21+
<SccLocalPath>
22+
</SccLocalPath>
23+
<SccAuxPath>
24+
</SccAuxPath>
25+
<SccProvider>
26+
</SccProvider>
2327
</PropertyGroup>
2428
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
2529
<PlatformTarget>x64</PlatformTarget>

XboxConsole.Adapter.Tests/XboxConsoleAdapter.Input.Tests.cs

+43
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,49 @@ public void TestDisconnectGamepadThrowsArgumentNullExceptionForNullSystemIpAddre
111111
this.adapter.DisconnectXboxGamepad(null, 0);
112112
}
113113

114+
/// <summary>
115+
/// Verifies that the DisconnectAllXboxGamepads method throws an exception if
116+
/// the adapter has been disposed.
117+
/// </summary>
118+
[TestMethod]
119+
[TestCategory("UnitTest")]
120+
[TestCategory(AdapterInputTestCategory)]
121+
[ExpectedException(typeof(ObjectDisposedException))]
122+
public void TestDisconnectAllXboxGamepadsThrowsObjectDisposedException()
123+
{
124+
this.adapter.Dispose();
125+
this.adapter.DisconnectAllXboxGamepads(SystemIpAddress);
126+
}
127+
128+
/// <summary>
129+
/// Verifies that the DisconnectAllXboxGamepads method throws an exception if
130+
/// the systemIpAddress parameter is null.
131+
/// </summary>
132+
[TestMethod]
133+
[TestCategory("UnitTest")]
134+
[TestCategory(AdapterInputTestCategory)]
135+
[ExpectedException(typeof(ArgumentNullException))]
136+
public void TestDisconnectAllXboxGamepadsThrowsArgumentNullExceptionForNullSystemIpAddress()
137+
{
138+
this.adapter.DisconnectAllXboxGamepads(null);
139+
}
140+
141+
/// <summary>
142+
/// Verifies that the DisconnectAllXboxGamepads method in XboxXdk is invoked by the adapter.
143+
/// </summary>
144+
[TestMethod]
145+
[TestCategory("UnitTest")]
146+
[TestCategory(AdapterInputTestCategory)]
147+
public void TestDisconnectAllXboxGamepads()
148+
{
149+
bool invoked = false;
150+
this.fakeXboxXdk.DisconnectAllXboxGamepadsAction = (i) => { invoked = true; };
151+
152+
this.adapter.DisconnectAllXboxGamepads(SystemIpAddress);
153+
154+
Assert.IsTrue(invoked);
155+
}
156+
114157
/// <summary>
115158
/// Verifies that the SendGamepadReport method works correctly with valid parameters.
116159
/// </summary>

XboxConsole.Infrastructure.Tests/XboxConsole.Infrastructure.Tests.csproj

+8-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
1717
<IsCodedUITest>False</IsCodedUITest>
1818
<TestProjectType>UnitTest</TestProjectType>
19-
<SccProjectName>SAK</SccProjectName>
20-
<SccLocalPath>SAK</SccLocalPath>
21-
<SccAuxPath>SAK</SccAuxPath>
22-
<SccProvider>SAK</SccProvider>
19+
<SccProjectName>
20+
</SccProjectName>
21+
<SccLocalPath>
22+
</SccLocalPath>
23+
<SccAuxPath>
24+
</SccAuxPath>
25+
<SccProvider>
26+
</SccProvider>
2327
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
2428
<RestorePackages>true</RestorePackages>
2529
</PropertyGroup>

0 commit comments

Comments
 (0)