Skip to content

Commit 956e7c1

Browse files
author
Jordan Ellis
committed
XboxConsole Ver 2.0.40820.0
1 parent 88fbe22 commit 956e7c1

File tree

146 files changed

+11834
-98
lines changed

Some content is hidden

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

146 files changed

+11834
-98
lines changed
Binary file not shown.

Documentation/XboxConsole.chm

110 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AdapterConfigurationKeyMapping.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// </copyright>
5+
//------------------------------------------------------------------------------
6+
7+
namespace Microsoft.Internal.GamesTest.Xbox.Adapter.July2014
8+
{
9+
using System;
10+
using System.Collections.Generic;
11+
using System.Linq;
12+
using System.Text;
13+
using System.Threading.Tasks;
14+
15+
/// <summary>
16+
/// This class holds mappings for configuration keys for Global XboxConsole keys to keys for the specific XDK.
17+
/// </summary>
18+
internal static class AdapterConfigurationKeyMapping
19+
{
20+
private static readonly Dictionary<string, string> KeyMappings = new Dictionary<string, string>()
21+
{
22+
{ "SessionKey", "AccessKey" },
23+
};
24+
25+
/// <summary>
26+
/// Maps the global XboxConsole configuration key to the XDK specific key.
27+
/// </summary>
28+
/// <param name="key">The key to map.</param>
29+
/// <returns>The XDK specific key.</returns>
30+
public static string MapKey(string key)
31+
{
32+
if (KeyMappings.ContainsKey(key))
33+
{
34+
return KeyMappings[key];
35+
}
36+
else
37+
{
38+
return key;
39+
}
40+
}
41+
}
42+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AssemblyInfo.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// </copyright>
5+
//------------------------------------------------------------------------------
6+
7+
using System;
8+
using System.Reflection;
9+
using System.Runtime.CompilerServices;
10+
using System.Runtime.InteropServices;
11+
12+
// General Information about an assembly is controlled through the following
13+
// set of attributes. Change these attribute values to modify the information
14+
// associated with an assembly.
15+
[assembly: AssemblyTitle("GamesTest.XboxConsole.Adapter.July2014")]
16+
[assembly: AssemblyDescription("GamesTest.XboxConsole.Adapter.July2014")]
17+
[assembly: AssemblyTrademark("")]
18+
[assembly: AssemblyCulture("")]
19+
20+
// Setting ComVisible to false makes the types in this assembly not visible
21+
// to COM components. If you need to access a type in this assembly from
22+
// COM, set the ComVisible attribute to true on that type.
23+
[assembly: ComVisible(false)]
24+
[assembly: CLSCompliant(false)]
25+
26+
[assembly: InternalsVisibleTo("GamesTest.XboxConsole")]
27+
[assembly: InternalsVisibleTo("GamesTest.XboxConsole.Adapter.Tests")]
28+
[assembly: InternalsVisibleTo("GamesTest.XboxConsole.TestApp")]
29+
30+
// The following GUID is for the ID of the typelib if this project is exposed to COM
31+
[assembly: Guid("AA0D922B-029F-4865-AA61-FE6E7682CE23")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
7+
<ProjectGuid>{E842B4D7-58D2-4435-B876-004DE9A45FBD}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>Microsoft.Internal.GamesTest.Xbox.Adapter.July2014</RootNamespace>
11+
<AssemblyName>GamesTest.XboxConsole.Adapter.July2014</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<SccProjectName>SAK</SccProjectName>
15+
<SccLocalPath>SAK</SccLocalPath>
16+
<SccAuxPath>SAK</SccAuxPath>
17+
<SccProvider>SAK</SccProvider>
18+
</PropertyGroup>
19+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
20+
<DebugSymbols>true</DebugSymbols>
21+
<OutputPath>bin\x64\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<DebugType>full</DebugType>
24+
<PlatformTarget>x64</PlatformTarget>
25+
<ErrorReport>prompt</ErrorReport>
26+
<CodeAnalysisRuleSet>..\dependencies\CodeAnalysis\Level3.ruleset</CodeAnalysisRuleSet>
27+
</PropertyGroup>
28+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
29+
<OutputPath>bin\x64\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<Optimize>true</Optimize>
32+
<DebugType>pdbonly</DebugType>
33+
<PlatformTarget>x64</PlatformTarget>
34+
<ErrorReport>prompt</ErrorReport>
35+
<CodeAnalysisRuleSet>..\dependencies\CodeAnalysis\Level3.ruleset</CodeAnalysisRuleSet>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="Microsoft.Xbox.Xtf, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
39+
<SpecificVersion>False</SpecificVersion>
40+
<HintPath>..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.dll</HintPath>
41+
</Reference>
42+
<Reference Include="Microsoft.Xbox.Xtf.Application, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
43+
<SpecificVersion>False</SpecificVersion>
44+
<HintPath>..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.Application.dll</HintPath>
45+
</Reference>
46+
<Reference Include="Microsoft.Xbox.Xtf.ConsoleControl, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
47+
<SpecificVersion>False</SpecificVersion>
48+
<HintPath>..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.ConsoleControl.dll</HintPath>
49+
</Reference>
50+
<Reference Include="Microsoft.Xbox.Xtf.ConsoleManager, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
51+
<SpecificVersion>False</SpecificVersion>
52+
<HintPath>..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.ConsoleManager.dll</HintPath>
53+
</Reference>
54+
<Reference Include="Microsoft.Xbox.Xtf.DebugMonitor, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
55+
<SpecificVersion>False</SpecificVersion>
56+
<HintPath>..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.DebugMonitor.dll</HintPath>
57+
</Reference>
58+
<Reference Include="Microsoft.Xbox.Xtf.FileIO, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
59+
<SpecificVersion>False</SpecificVersion>
60+
<HintPath>..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.FileIO.dll</HintPath>
61+
</Reference>
62+
<Reference Include="Microsoft.Xbox.Xtf.Input, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
63+
<SpecificVersion>False</SpecificVersion>
64+
<HintPath>..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.Input.dll</HintPath>
65+
</Reference>
66+
<Reference Include="Microsoft.Xbox.Xtf.Interop">
67+
<HintPath>$(DurangoXDK)\bin\Microsoft.Xbox.Xtf.Interop.dll</HintPath>
68+
<EmbedInteropTypes>False</EmbedInteropTypes>
69+
<Private>False</Private>
70+
</Reference>
71+
<Reference Include="Microsoft.Xbox.Xtf.RemoteRun, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
72+
<SpecificVersion>False</SpecificVersion>
73+
<HintPath>..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.RemoteRun.dll</HintPath>
74+
</Reference>
75+
<Reference Include="Microsoft.Xbox.Xtf.User, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
76+
<SpecificVersion>False</SpecificVersion>
77+
<HintPath>..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.User.dll</HintPath>
78+
</Reference>
79+
<Reference Include="System" />
80+
<Reference Include="System.Core" />
81+
<Reference Include="System.Runtime.Serialization" />
82+
<Reference Include="System.Xml.Linq" />
83+
<Reference Include="System.Data.DataSetExtensions" />
84+
<Reference Include="Microsoft.CSharp" />
85+
<Reference Include="System.Data" />
86+
<Reference Include="System.Xml" />
87+
</ItemGroup>
88+
<ItemGroup>
89+
<Compile Include="..\AssemblyInfoCore.cs">
90+
<Link>Properties\AssemblyInfoCore.cs</Link>
91+
</Compile>
92+
<Compile Include="AdapterConfigurationKeyMapping.cs" />
93+
<Compile Include="XboxConsoleAdapter.User.cs" />
94+
<Compile Include="GlobalSuppressions.cs" />
95+
<Compile Include="XboxConsoleAdapter.Input.cs" />
96+
<Compile Include="XboxConsoleAdapter.COMExceptionWhenConnectingHandler.cs" />
97+
<Compile Include="XboxConsoleAdapter.ExecutableManagement.cs" />
98+
<Compile Include="XboxDebugMonitorClient.cs" />
99+
<Compile Include="XboxConsoleAdapter.ConsoleControl.cs" />
100+
<Compile Include="XboxConsoleAdapter.cs" />
101+
<Compile Include="Properties\AssemblyInfo.cs" />
102+
<Compile Include="XboxConsoleAdapter.Debug.cs" />
103+
<Compile Include="XboxConsoleAdapter.FileIO.cs" />
104+
<Compile Include="XboxGamepadAdapter.cs" />
105+
<Compile Include="XboxXdk.cs" />
106+
</ItemGroup>
107+
<ItemGroup>
108+
<ProjectReference Include="..\XboxConsole.Infrastructure\XboxConsole.Infrastructure.csproj">
109+
<Project>{e0785338-9f71-4d35-95a8-6388bc7f5518}</Project>
110+
<Name>XboxConsole.Infrastructure</Name>
111+
</ProjectReference>
112+
</ItemGroup>
113+
<ItemGroup>
114+
<Compile Include="XboxConsoleAdapter.PackageManagement.cs" />
115+
</ItemGroup>
116+
<ItemGroup>
117+
<CodeAnalysisDictionary Include="..\dependencies\CodeAnalysis\CustomDictionary.xml">
118+
<Link>CustomDictionary.xml</Link>
119+
</CodeAnalysisDictionary>
120+
</ItemGroup>
121+
<ItemGroup>
122+
<EmbeddedResource Include="..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.Application.dll">
123+
<Link>Microsoft.Xbox.Xtf.Application.dll</Link>
124+
</EmbeddedResource>
125+
<EmbeddedResource Include="..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.ConsoleControl.dll">
126+
<Link>Microsoft.Xbox.Xtf.ConsoleControl.dll</Link>
127+
</EmbeddedResource>
128+
<EmbeddedResource Include="..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.ConsoleManager.dll">
129+
<Link>Microsoft.Xbox.Xtf.ConsoleManager.dll</Link>
130+
</EmbeddedResource>
131+
<EmbeddedResource Include="..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.DebugMonitor.dll">
132+
<Link>Microsoft.Xbox.Xtf.DebugMonitor.dll</Link>
133+
</EmbeddedResource>
134+
<EmbeddedResource Include="..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.dll">
135+
<Link>Microsoft.Xbox.Xtf.dll</Link>
136+
</EmbeddedResource>
137+
<EmbeddedResource Include="..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.FileIO.dll">
138+
<Link>Microsoft.Xbox.Xtf.FileIO.dll</Link>
139+
</EmbeddedResource>
140+
<EmbeddedResource Include="..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.Input.dll">
141+
<Link>Microsoft.Xbox.Xtf.Input.dll</Link>
142+
</EmbeddedResource>
143+
<EmbeddedResource Include="..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.RemoteRun.dll">
144+
<Link>Microsoft.Xbox.Xtf.RemoteRun.dll</Link>
145+
</EmbeddedResource>
146+
<EmbeddedResource Include="..\dependencies\GamesTest.ManagedXtf.2014.07.1.0.40811.0\lib\net45\Microsoft.Xbox.Xtf.User.dll">
147+
<Link>Microsoft.Xbox.Xtf.User.dll</Link>
148+
</EmbeddedResource>
149+
</ItemGroup>
150+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
151+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
152+
Other similar extension points exist, see Microsoft.Common.targets.
153+
<Target Name="BeforeBuild">
154+
</Target>
155+
<Target Name="AfterBuild">
156+
</Target>
157+
-->
158+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
//------------------------------------------------------------------------------
2+
// <copyright file="XboxConsoleAdapter.COMExceptionWhenConnectingHandler.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// </copyright>
5+
//------------------------------------------------------------------------------
6+
7+
namespace Microsoft.Internal.GamesTest.Xbox.Adapter.July2014
8+
{
9+
using System;
10+
using System.Collections.Generic;
11+
using System.Globalization;
12+
using System.Linq;
13+
using System.Runtime.InteropServices;
14+
using System.Runtime.Serialization;
15+
using System.Runtime.Serialization.Json;
16+
using System.Text;
17+
using System.Threading.Tasks;
18+
using System.Xml;
19+
using Microsoft.Internal.GamesTest.Xbox.Deployment;
20+
21+
/// <summary>
22+
/// This class represents an implemenation of the XboxConsoleAdapter
23+
/// that is supported by the July 2014 version of the XDK.
24+
/// </summary>
25+
internal partial class XboxConsoleAdapter : XboxConsoleAdapterBase
26+
{
27+
/// <summary>
28+
/// A helper class designed to execute a function within the Adapter and check for a specific sequence of COMExceptions
29+
/// that indicates that the console against which the user is making requests is currently rebooting. These COMExceptions
30+
/// are transformed into CannotConnectExceptions for easier consumption.
31+
/// </summary>
32+
private class COMExceptionWhenConnectingHandler
33+
{
34+
// The COMException with HResult -1945042173 is ALWAYS the first COMException thrown when trying to poll the
35+
// execution state of a package while the console is rebooting.
36+
private const int COMExceptionHResult = -1945042173;
37+
38+
// There are a handful of COMExceptions that are thrown when trying to poll the package state after the console has
39+
// been rebooted, all with different HResults, but they all share one commonality: The message contains
40+
// the text "Class not registered".
41+
private const string COMExceptionMessage = "Class not registered";
42+
43+
private bool rebootingBasedOnCOMExceptionStep1 = false;
44+
private bool rebootingBasedOnCOMExceptionStep2 = false;
45+
46+
/// <summary>
47+
/// Execute a function that returns an HResult and checks for a specific sequence of COMExceptions
48+
/// that indicates that the console against which the user is making requests is currently rebooting. These COMExceptions
49+
/// are transformed into CannotConnectExceptions for easier consumption.
50+
/// </summary>
51+
/// <param name="func">A function that makes a request of a console and returns an HResult.</param>
52+
/// <param name="systemIpAddress">The ip address of the console being used.</param>
53+
/// <returns>The HResult of the executed function.</returns>
54+
public uint CheckForCOMExceptionWhenConnecting(Func<uint> func, string systemIpAddress)
55+
{
56+
uint funcReturn;
57+
try
58+
{
59+
funcReturn = func();
60+
61+
// if we've made it this far after both stages of rebooting, we know that we've successfully completed rebooting
62+
if (this.rebootingBasedOnCOMExceptionStep1 && this.rebootingBasedOnCOMExceptionStep2)
63+
{
64+
this.rebootingBasedOnCOMExceptionStep1 = false;
65+
this.rebootingBasedOnCOMExceptionStep2 = false;
66+
}
67+
}
68+
catch (COMException ex)
69+
{
70+
// The inability to connect to a rebooting console will manifest as several COMExceptions.
71+
// At first a COMException with HResult -1945042173 is thrown, followed by one of several
72+
// COMExceptions with varying HResults, all containing the message: "Class not registered".
73+
74+
if (ex.HResult == COMExceptionHResult)
75+
{
76+
// if we've encountered the first COMException, we know that we're rebooting
77+
if (!this.rebootingBasedOnCOMExceptionStep1)
78+
{
79+
this.rebootingBasedOnCOMExceptionStep1 = true;
80+
}
81+
82+
this.ThrowCannotConnectException(systemIpAddress, ex);
83+
}
84+
else if (ex.Message.Contains(COMExceptionMessage) && this.rebootingBasedOnCOMExceptionStep1)
85+
{
86+
// if we've encountered the second COMException AFTER the first, we know that we're rebooting
87+
if (!this.rebootingBasedOnCOMExceptionStep2)
88+
{
89+
this.rebootingBasedOnCOMExceptionStep2 = true;
90+
}
91+
92+
this.ThrowCannotConnectException(systemIpAddress, ex);
93+
}
94+
95+
// if none of this is true, something bad has happened and we need to keep throwing the actual COMException
96+
throw;
97+
}
98+
99+
return funcReturn;
100+
}
101+
102+
/// <summary>
103+
/// Encapsulates a COMException within a CannotConnectException and throws the latter.
104+
/// </summary>
105+
/// <param name="systemIpAddress">The ip address of the unresponsive console.</param>
106+
/// <param name="ex">The COMException to be encapsulated.</param>
107+
private void ThrowCannotConnectException(string systemIpAddress, COMException ex)
108+
{
109+
// make sure to throw a CannotConnectException instead of the COMException
110+
throw new CannotConnectException(string.Format(CultureInfo.CurrentCulture, "Cannot connect to console with IP {0}; console is likely rebooting.", systemIpAddress), ex);
111+
}
112+
}
113+
}
114+
}

0 commit comments

Comments
 (0)