This commit is contained in:
Jordan Ellis 2017-12-01 15:07:08 -08:00
Родитель 688a94fa88
Коммит 7cac1c29d5
47 изменённых файлов: 1757 добавлений и 207 удалений

Двоичный файл не отображается.

Просмотреть файл

@ -11,10 +11,14 @@
<AssemblyName>GamesTest.XboxConsole.Adapter.April2014</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>

Просмотреть файл

@ -11,10 +11,14 @@
<AssemblyName>GamesTest.XboxConsole.Adapter.August2014</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>

Просмотреть файл

@ -11,10 +11,14 @@
<AssemblyName>GamesTest.XboxConsole.Adapter.July2014</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>

Просмотреть файл

@ -11,10 +11,14 @@
<AssemblyName>GamesTest.XboxConsole.Adapter.May2014</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>

Просмотреть файл

@ -11,10 +11,14 @@
<AssemblyName>GamesTest.XboxConsole.Adapter.November2014</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>

Просмотреть файл

@ -45,6 +45,16 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.November2014
this.gamepads.Remove(gamepad);
}
/// <summary>
/// Disconnects all XboxGamepads from the console.
/// </summary>
/// <param name="systemIpAddress">The system IP address of the console.</param>
protected override void DisconnectAllXboxGamepadsImpl(string systemIpAddress)
{
this.XboxXdk.DisconnectAllXboxGamepads(systemIpAddress);
this.gamepads.Clear();
}
/// <summary>
/// Sets the state of the XboxGamepad.
/// </summary>

Просмотреть файл

@ -26,6 +26,8 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.November2014
/// </summary>
internal partial class XboxConsoleAdapter : XboxConsoleAdapterBase
{
private const int UnregisterNonFolderBasedDeploymentHResult = unchecked((int)0x8083000B);
private COMExceptionWhenConnectingHandler comExceptionWhenConnectingHandler = new COMExceptionWhenConnectingHandler();
/// <summary>
@ -387,7 +389,21 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.November2014
throw new ArgumentNullException("packageFullName");
}
this.XboxXdk.UnregisterPackage(systemIpAddress, packageFullName);
try
{
this.XboxXdk.UnregisterPackage(systemIpAddress, packageFullName);
}
catch (COMException ex)
{
if (ex.HResult == UnregisterNonFolderBasedDeploymentHResult)
{
throw new XboxConsoleException("Failed to unregister package. The package was not deployed with folder based deployment.", ex, systemIpAddress);
}
else
{
throw;
}
}
}
/// <summary>

Просмотреть файл

@ -571,6 +571,15 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.November2014
return new XboxGamepadAdapter(systemIpAddress, new XtfGamepad(systemIpAddress));
}
/// <summary>
/// Disconnects all XboxGamepads from the console.
/// </summary>
/// <param name="ipAddress">The tools IP address of the console.</param>
public override void DisconnectAllXboxGamepads(string ipAddress)
{
XtfGamepad.DisconnectAll(ipAddress);
}
/// <summary>
/// Push deploys loose files to the console.
/// </summary>

Просмотреть файл

@ -11,10 +11,14 @@
<AssemblyName>GamesTest.XboxConsole.Adapter.October2014</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>

Просмотреть файл

@ -45,6 +45,16 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.October2014
this.gamepads.Remove(gamepad);
}
/// <summary>
/// Disconnects all XboxGamepads from the console.
/// </summary>
/// <param name="systemIpAddress">The system IP address of the console.</param>
protected override void DisconnectAllXboxGamepadsImpl(string systemIpAddress)
{
this.XboxXdk.DisconnectAllXboxGamepads(systemIpAddress);
this.gamepads.Clear();
}
/// <summary>
/// Sets the state of the XboxGamepad.
/// </summary>

Просмотреть файл

@ -26,6 +26,8 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.October2014
/// </summary>
internal partial class XboxConsoleAdapter : XboxConsoleAdapterBase
{
private const int UnregisterNonFolderBasedDeploymentHResult = unchecked((int)0x8083000B);
private COMExceptionWhenConnectingHandler comExceptionWhenConnectingHandler = new COMExceptionWhenConnectingHandler();
/// <summary>
@ -386,8 +388,22 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.October2014
{
throw new ArgumentNullException("packageFullName");
}
this.XboxXdk.UnregisterPackage(systemIpAddress, packageFullName);
try
{
this.XboxXdk.UnregisterPackage(systemIpAddress, packageFullName);
}
catch (COMException ex)
{
if (ex.HResult == UnregisterNonFolderBasedDeploymentHResult)
{
throw new XboxConsoleException("Failed to unregister package. The package was not deployed with folder based deployment.", ex, systemIpAddress);
}
else
{
throw;
}
}
}
/// <summary>

Просмотреть файл

@ -571,6 +571,15 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.October2014
return new XboxGamepadAdapter(systemIpAddress, new XtfGamepad(systemIpAddress));
}
/// <summary>
/// Disconnects all XboxGamepads from the console.
/// </summary>
/// <param name="ipAddress">The tools IP address of the console.</param>
public override void DisconnectAllXboxGamepads(string ipAddress)
{
XtfGamepad.DisconnectAll(ipAddress);
}
/// <summary>
/// Push deploys loose files to the console.
/// </summary>

Просмотреть файл

@ -154,6 +154,11 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.Tests
Justification = "We need to implement unit tests referencing this code")]
public Func<string, IVirtualGamepad> CreateGamepadFunc { get; set; }
/// <summary>
/// Gets or sets a custom action to shim the DisconnectAllXboxGamepads method.
/// </summary>
public Action<string> DisconnectAllXboxGamepadsAction { get; set; }
/// <summary>
/// Gets or sets a custom func to shim the "DeployPushAsync" method.
/// </summary>
@ -749,6 +754,22 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.Tests
}
}
/// <summary>
/// Disconnects all connected XboxGamepads.
/// </summary>
/// <param name="ipAddress">The IP address of the console.</param>
public override void DisconnectAllXboxGamepads(string ipAddress)
{
if (this.DisconnectAllXboxGamepadsAction != null)
{
this.DisconnectAllXboxGamepadsAction(ipAddress);
}
else
{
throw new NotImplementedException("DisconnectAllXboxGamepadsAction is not set.");
}
}
/// <summary>
/// Push deploys loose files to the console.
/// </summary>

Двоичный файл не отображается.

Просмотреть файл

@ -16,10 +16,14 @@
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>

Просмотреть файл

@ -111,6 +111,49 @@ namespace Microsoft.Internal.GamesTest.Xbox.Adapter.Tests
this.adapter.DisconnectXboxGamepad(null, 0);
}
/// <summary>
/// Verifies that the DisconnectAllXboxGamepads method throws an exception if
/// the adapter has been disposed.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(AdapterInputTestCategory)]
[ExpectedException(typeof(ObjectDisposedException))]
public void TestDisconnectAllXboxGamepadsThrowsObjectDisposedException()
{
this.adapter.Dispose();
this.adapter.DisconnectAllXboxGamepads(SystemIpAddress);
}
/// <summary>
/// Verifies that the DisconnectAllXboxGamepads method throws an exception if
/// the systemIpAddress parameter is null.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(AdapterInputTestCategory)]
[ExpectedException(typeof(ArgumentNullException))]
public void TestDisconnectAllXboxGamepadsThrowsArgumentNullExceptionForNullSystemIpAddress()
{
this.adapter.DisconnectAllXboxGamepads(null);
}
/// <summary>
/// Verifies that the DisconnectAllXboxGamepads method in XboxXdk is invoked by the adapter.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(AdapterInputTestCategory)]
public void TestDisconnectAllXboxGamepads()
{
bool invoked = false;
this.fakeXboxXdk.DisconnectAllXboxGamepadsAction = (i) => { invoked = true; };
this.adapter.DisconnectAllXboxGamepads(SystemIpAddress);
Assert.IsTrue(invoked);
}
/// <summary>
/// Verifies that the SendGamepadReport method works correctly with valid parameters.
/// </summary>

Просмотреть файл

@ -16,10 +16,14 @@
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>

Просмотреть файл

@ -50,6 +50,21 @@ namespace Microsoft.Internal.GamesTest.Xbox
"Failed to disconnect a gamepad.");
}
/// <summary>
/// Disconnects all XboxGamepads from the console.
/// </summary>
/// <param name="systemIpAddress">The system IP address of the console.</param>
public void DisconnectAllXboxGamepads(string systemIpAddress)
{
this.ThrowIfDisposed();
this.ThrowIfInvalidSystemIpAddress(systemIpAddress);
this.PerformXdkAction(
systemIpAddress,
() => this.DisconnectAllXboxGamepadsImpl(systemIpAddress),
"Failed to disconnect all gamepads.");
}
/// <summary>
/// Sets the state of the XboxGamepad.
/// </summary>
@ -88,6 +103,15 @@ namespace Microsoft.Internal.GamesTest.Xbox
throw new XboxConsoleFeatureNotSupportedException(NotSupportedMessage);
}
/// <summary>
/// Disconnects all XboxGamepads from the console.
/// </summary>
/// <param name="systemIpAddress">The system IP address of the console.</param>
protected virtual void DisconnectAllXboxGamepadsImpl(string systemIpAddress)
{
throw new XboxConsoleFeatureNotSupportedException(NotSupportedMessage);
}
/// <summary>
/// Sets the state of the XboxGamepad.
/// </summary>

Просмотреть файл

@ -6,11 +6,26 @@
namespace Microsoft.Internal.GamesTest.Xbox.Configuration
{
using System;
using System.Globalization;
using System.IO;
using System.Xml;
/// <summary>
/// The base functionality of Xbox configuration classes.
/// </summary>
public class BaseXboxConfiguration
{
/// <summary>
/// Name of the settings root element in XML file used to store Xbox configuration.
/// </summary>
protected const string SettingsKey = "XboxSettings";
/// <summary>
/// Name of the attribute of the settings element used to store XDK version.
/// </summary>
protected const string XdkVersionAttribute = "xdk";
private const string EnvironmentKey = "Environment";
private const string SandboxIdKey = "SandboxId";
private const string OOBECompletedKey = "OOBECompleted";
@ -39,6 +54,12 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
private const string OpticalAudioKey = "OpticalAudio";
private const string AudioBitstreamFormatKey = "AudioBitstreamFormat";
private const string HostNameKey = "HostName";
private const string DebugMemoryModeKey = "DebugMemoryMode";
private const string DisableSelectiveSuspendKey = "DisableSelectiveSuspend";
private const string DevkitAllowACGKey = "DevkitAllowACG";
private const string AutoBootKey = "AutoBoot";
private const string MACAddressKey = "MACAddress";
private const string DNSServerKey = "DNSServer";
/// <summary>
/// Initializes a new instance of the BaseXboxConfiguration class.
@ -72,6 +93,12 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
this.HdmiAudioSetting = new XboxHdmiAudioConfigurationSetting(HdmiAudioKey);
this.OpticalAudioSetting = new XboxConfigurationSetting<OpticalAudioOutput>(OpticalAudioKey);
this.AudioBitstreamFormatSetting = new XboxConfigurationSetting<AudioBitstreamFormatType>(AudioBitstreamFormatKey);
this.DebugMemoryModeSetting = new XboxConfigurationSetting<DebugMemoryModeType>(DebugMemoryModeKey);
this.DisableSelectiveSuspendSetting = new XboxConfigurationSetting<bool?>(DisableSelectiveSuspendKey);
this.DevkitAllowACGSetting = new XboxDevkitAllowAcgConfigurationSetting(DevkitAllowACGKey);
this.AutoBootSetting = new XboxConfigurationSetting<bool?>(AutoBootKey);
this.MACAddressSetting = new XboxMacAddressConfigurationSetting(MACAddressKey);
this.DNSServerSetting = new XboxDnsServerConfigurationSetting(DNSServerKey);
this.HostNameSetting = new XboxHostNameConfigurationSetting(HostNameKey);
}
@ -210,9 +237,171 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
/// </summary>
internal XboxConfigurationSetting<AudioBitstreamFormatType> AudioBitstreamFormatSetting { get; private set; }
/// <summary>
/// Gets the DebugMemoryMode setting.
/// </summary>
internal XboxConfigurationSetting<DebugMemoryModeType> DebugMemoryModeSetting { get; private set; }
/// <summary>
/// Gets the DisableSelectiveSuspend setting.
/// </summary>
internal XboxConfigurationSetting<bool?> DisableSelectiveSuspendSetting { get; private set; }
/// <summary>
/// Gets the DevkitAllowACG setting.
/// </summary>
internal XboxDevkitAllowAcgConfigurationSetting DevkitAllowACGSetting { get; private set; }
/// <summary>
/// Gets the AutoBoot setting.
/// </summary>
internal XboxConfigurationSetting<bool?> AutoBootSetting { get; private set; }
/// <summary>
/// Gets the MACAddress setting.
/// </summary>
internal XboxMacAddressConfigurationSetting MACAddressSetting { get; private set; }
/// <summary>
/// Gets the DNSServer setting.
/// </summary>
internal XboxDnsServerConfigurationSetting DNSServerSetting { get; private set; }
/// <summary>
/// Gets the HostName setting.
/// </summary>
internal XboxHostNameConfigurationSetting HostNameSetting { get; private set; }
/// <summary>
/// Parses settings from strings returned by the specified functor.
/// </summary>
/// <param name="getSettingValue">Function called to get setting value given its name.</param>
internal void GetSettingValues(Func<string, string> getSettingValue)
{
if (getSettingValue == null)
{
throw new ArgumentNullException("getSettingValue");
}
this.EnvironmentSetting.StringValue = getSettingValue(this.EnvironmentSetting.Key);
this.SandboxIdSetting.StringValue = getSettingValue(this.SandboxIdSetting.Key);
this.OOBECompletedSetting.StringValue = getSettingValue(this.OOBECompletedSetting.Key);
this.ProfilingModeSetting.StringValue = getSettingValue(this.ProfilingModeSetting.Key);
this.PreferredLanguagesSetting.StringValue = getSettingValue(this.PreferredLanguagesSetting.Key);
this.GeographicRegionSetting.StringValue = getSettingValue(this.GeographicRegionSetting.Key);
this.TimeZoneSetting.StringValue = getSettingValue(this.TimeZoneSetting.Key);
this.SimulateVersionSwitchSetting.StringValue = getSettingValue(this.SimulateVersionSwitchSetting.Key);
this.EnableKernelDebuggingSetting.StringValue = getSettingValue(this.EnableKernelDebuggingSetting.Key);
this.SessionKeySetting.StringValue = getSettingValue(this.SessionKeySetting.Key);
this.AccessoryFlagsSetting.StringValue = getSettingValue(this.AccessoryFlagsSetting.Key);
this.PowerModeSetting.StringValue = getSettingValue(this.PowerModeSetting.Key);
this.IdleShutdownTimeoutSetting.StringValue = getSettingValue(this.IdleShutdownTimeoutSetting.Key);
this.DimTimeoutSetting.StringValue = getSettingValue(this.DimTimeoutSetting.Key);
this.HttpProxyHostSetting.StringValue = getSettingValue(this.HttpProxyHostSetting.Key);
this.DisplayResolutionSetting.StringValue = getSettingValue(this.DisplayResolutionSetting.Key);
this.ColorSpaceSetting.StringValue = getSettingValue(this.ColorSpaceSetting.Key);
this.ColorDepthSetting.StringValue = getSettingValue(this.ColorDepthSetting.Key);
this.NetworkTypeSetting.StringValue = getSettingValue(this.NetworkTypeSetting.Key);
this.NetworkAddressModeSetting.StringValue = getSettingValue(this.NetworkAddressModeSetting.Key);
this.DefaultUserSetting.StringValue = getSettingValue(this.DefaultUserSetting.Key);
this.DefaultUserPairingSetting.StringValue = getSettingValue(this.DefaultUserPairingSetting.Key);
this.WirelessRadioSettingsSetting.StringValue = getSettingValue(this.WirelessRadioSettingsSetting.Key);
this.AudioBitstreamFormatSetting.StringValue = getSettingValue(this.AudioBitstreamFormatSetting.Key);
this.HdmiAudioSetting.StringValue = getSettingValue(this.HdmiAudioSetting.Key);
this.OpticalAudioSetting.StringValue = getSettingValue(this.OpticalAudioSetting.Key);
this.DebugMemoryModeSetting.StringValue = getSettingValue(this.DebugMemoryModeSetting.Key);
this.DisableSelectiveSuspendSetting.StringValue = getSettingValue(this.DisableSelectiveSuspendSetting.Key);
this.DevkitAllowACGSetting.StringValue = getSettingValue(this.DevkitAllowACGSetting.Key);
this.AutoBootSetting.StringValue = getSettingValue(this.AutoBootSetting.Key);
this.MACAddressSetting.StringValue = getSettingValue(this.MACAddressSetting.Key);
this.DNSServerSetting.StringValue = getSettingValue(this.DNSServerSetting.Key);
this.HostNameSetting.StringValue = getSettingValue(this.HostNameSetting.Key);
}
/// <summary>
/// Sets setting values using the specified action.
/// </summary>
/// <param name="setSettingValue">The action called for each setting.</param>
internal void SetSettingValues(Action<string, string> setSettingValue)
{
if (setSettingValue == null)
{
throw new ArgumentNullException("setSettingValue");
}
// Converting the boolean strings to lowercase since the XML
// Boolean type doesn't support uppercase values.
var toLowerCase = new Func<string, string>((s) =>
{
// Switch statement used to get around dealing with CodeAnalysis error CA1308 : Microsoft.Globalization
// which doesn't allow using the ToLower or ToLowerInvariant methods.
switch (s)
{
case "True": return "true";
case "False": return "false";
default: return s;
}
});
setSettingValue(this.EnvironmentSetting.Key, this.EnvironmentSetting.StringValue);
setSettingValue(this.SandboxIdSetting.Key, this.SandboxIdSetting.StringValue);
setSettingValue(this.OOBECompletedSetting.Key, toLowerCase(this.OOBECompletedSetting.StringValue));
setSettingValue(this.ProfilingModeSetting.Key, this.ProfilingModeSetting.StringValue);
setSettingValue(this.PreferredLanguagesSetting.Key, this.PreferredLanguagesSetting.StringValue);
setSettingValue(this.GeographicRegionSetting.Key, this.GeographicRegionSetting.StringValue);
setSettingValue(this.TimeZoneSetting.Key, this.TimeZoneSetting.StringValue);
setSettingValue(this.SimulateVersionSwitchSetting.Key, toLowerCase(this.SimulateVersionSwitchSetting.StringValue));
setSettingValue(this.EnableKernelDebuggingSetting.Key, toLowerCase(this.EnableKernelDebuggingSetting.StringValue));
setSettingValue(this.SessionKeySetting.Key, this.SessionKeySetting.StringValue);
setSettingValue(this.AccessoryFlagsSetting.Key, this.AccessoryFlagsSetting.StringValue);
setSettingValue(this.PowerModeSetting.Key, this.PowerModeSetting.StringValue);
setSettingValue(this.IdleShutdownTimeoutSetting.Key, this.IdleShutdownTimeoutSetting.StringValue);
setSettingValue(this.DimTimeoutSetting.Key, this.DimTimeoutSetting.StringValue);
setSettingValue(this.HttpProxyHostSetting.Key, this.HttpProxyHostSetting.StringValue);
setSettingValue(this.DisplayResolutionSetting.Key, this.DisplayResolutionSetting.StringValue);
setSettingValue(this.ColorSpaceSetting.Key, this.ColorSpaceSetting.StringValue);
setSettingValue(this.ColorDepthSetting.Key, this.ColorDepthSetting.StringValue);
setSettingValue(this.DefaultUserSetting.Key, this.DefaultUserSetting.StringValue);
setSettingValue(this.DefaultUserPairingSetting.Key, this.DefaultUserPairingSetting.StringValue);
setSettingValue(this.WirelessRadioSettingsSetting.Key, this.WirelessRadioSettingsSetting.StringValue);
setSettingValue(this.HdmiAudioSetting.Key, this.HdmiAudioSetting.StringValue);
setSettingValue(this.OpticalAudioSetting.Key, this.OpticalAudioSetting.StringValue);
setSettingValue(this.AudioBitstreamFormatSetting.Key, this.AudioBitstreamFormatSetting.StringValue);
setSettingValue(this.DebugMemoryModeSetting.Key, this.DebugMemoryModeSetting.StringValue);
setSettingValue(this.DisableSelectiveSuspendSetting.Key, toLowerCase(this.DisableSelectiveSuspendSetting.StringValue));
setSettingValue(this.DevkitAllowACGSetting.Key, this.DevkitAllowACGSetting.StringValue);
setSettingValue(this.AutoBootSetting.Key, toLowerCase(this.AutoBootSetting.StringValue));
setSettingValue(this.HostNameSetting.Key, this.HostNameSetting.StringValue);
}
/// <summary>
/// Saves the Xbox Configuration to a path using the given XDK version.
/// </summary>
/// <param name="path">The configuration file path.</param>
/// <param name="xdkVersion">The XDK version to include in the file.</param>
internal void Save(string path, string xdkVersion)
{
using (FileStream stream = new FileStream(path, FileMode.Create))
{
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
using (XmlWriter writer = XmlWriter.Create(stream, settings))
{
writer.WriteStartElement(SettingsKey);
writer.WriteAttributeString(XdkVersionAttribute, xdkVersion);
this.SetSettingValues((setting, value) =>
{
if (value != null)
{
writer.WriteElementString(setting, value);
}
});
writer.WriteEndElement();
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,51 @@
//------------------------------------------------------------------------------
// <copyright file="DebugMemoryModeType.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.Internal.GamesTest.Xbox.Configuration
{
/// <summary>
/// Range of valid values for the DebugMemoryMode configuration setting.
/// </summary>
public enum DebugMemoryModeType
{
/// <summary>
/// Use Pix debug memory mode.
/// </summary>
Pix,
/// <summary>
/// Use Pix_Tool debug memory mode.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", Justification = "Matches xbconfig setting name")]
Pix_Tool,
/// <summary>
/// Use Pix_Title debug memory mode.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", Justification = "Matches xbconfig setting name")]
Pix_Title,
/// <summary>
/// Use PGI debug memory mode.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "PGI", Justification = "Matches xbconfig setting name")]
PGI,
/// <summary>
/// Use PGI_Title debug memory mode.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "PGI", Justification = "Matches xbconfig setting name")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", Justification = "Matches xbconfig setting name")]
PGI_Title,
/// <summary>
/// Use PGI_Tool debug memory mode.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "PGI", Justification = "Matches xbconfig setting name")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", Justification = "Matches xbconfig setting name")]
PGI_Tool
}
}

Просмотреть файл

@ -153,9 +153,55 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
/// </summary>
AudioBitstreamFormatType AudioBitstreamFormat { get; }
/// <summary>
/// Gets the DebugMemoryMode value.
/// </summary>
DebugMemoryModeType DebugMemoryMode { get; }
/// <summary>
/// Gets the DisableSelectiveSuspend value.
/// </summary>
bool? DisableSelectiveSuspend { get; }
/// <summary>
/// Gets the DevkitAllowACG value.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "ACG", Justification = "Matches xbconfig setting"),
System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Devkit", Justification = "Matches xbconfig setting")]
bool? DevkitAllowACG { get; }
/// <summary>
/// Gets the AutoBoot value.
/// </summary>
bool? AutoBoot { get; }
/// <summary>
/// Gets the MACAddress value.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "MAC", Justification = "Matches xbconfig setting")]
string MACAddress { get; }
/// <summary>
/// Gets the DNSServer value.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DNS", Justification = "Matches xbconfig setting")]
string DNSServer { get; }
/// <summary>
/// Gets the HostName value (network name).
/// </summary>
string HostName { get; }
/// <summary>
/// Load the Xbox configuration from an XML file.
/// </summary>
/// <param name="path">Configuration file path.</param>
void Load(string path);
/// <summary>
/// Save the Xbox configuration to an XML file.
/// </summary>
/// <param name="path">Configuration file path.</param>
void Save(string path);
}
}

Просмотреть файл

@ -45,8 +45,16 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
set
{
this.stringValue = value;
this.stronglyTypedValue = this.GetValueFromStringValue(value);
if (value == null)
{
this.stringValue = null;
}
else
{
this.stringValue = this.GetStringValueFromValue(this.stronglyTypedValue);
}
}
}

Просмотреть файл

@ -0,0 +1,58 @@
//------------------------------------------------------------------------------
// <copyright file="XboxDevkitAllowAcgConfigurationSetting.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.Internal.GamesTest.Xbox.Configuration
{
using System;
/// <summary>
/// An explicit override of the XboxConfigurationSetting class meant to represent the use of the string
/// of the HdmiAudio configuration setting (see xbconfig command line utility).
/// </summary>
internal class XboxDevkitAllowAcgConfigurationSetting : XboxConfigurationSetting<bool?>
{
/// <summary>
/// Initializes a new instance of the XboxDevkitAllowAcgConfigurationSetting class.
/// </summary>
/// <param name="key">The setting key.</param>
internal XboxDevkitAllowAcgConfigurationSetting(string key)
: base(key)
{
}
/// <summary>
/// Converts a strongly-typed value into a string value.
/// </summary>
/// <param name="devkitAllowAcgSetting">The value to be converted.</param>
/// <returns>The string value that corresponds to the specified value.</returns>
protected override string GetStringValueFromValue(bool? devkitAllowAcgSetting)
{
return devkitAllowAcgSetting.HasValue ? (devkitAllowAcgSetting.Value ? "On" : "Off") : "Off";
}
/// <summary>
/// Converts a string value into a stringly-typed value.
/// </summary>
/// <param name="stringVal">The string value to be converted.</param>
/// <returns>The strongly typed value corresponding to the specified string value.</returns>
protected override bool? GetValueFromStringValue(string stringVal)
{
if (string.IsNullOrEmpty(stringVal))
{
return false;
}
switch (stringVal.ToUpperInvariant())
{
default:
case "OFF":
return false;
case "ON":
return true;
}
}
}
}

Просмотреть файл

@ -0,0 +1,62 @@
//------------------------------------------------------------------------------
// <copyright file="XboxDnsServerConfigurationSetting.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.Internal.GamesTest.Xbox.Configuration
{
using System;
/// <summary>
/// An explicit override of the XboxConfigurationSetting class meant to represent the use of the string
/// of the DnsServer configuration setting (see xbconfig command line utility).
/// </summary>
internal class XboxDnsServerConfigurationSetting : XboxConfigurationSetting<string>
{
/// <summary>
/// Initializes a new instance of the XboxDnsServerConfigurationSetting class.
/// </summary>
/// <param name="key">The setting key.</param>
internal XboxDnsServerConfigurationSetting(string key)
: base(key)
{
}
/// <summary>
/// Converts a strongly-typed value into a string value.
/// </summary>
/// <param name="dnsServer">The value to be converted.</param>
/// <returns>The string value that corresponds to the specified value.</returns>
protected override string GetStringValueFromValue(string dnsServer)
{
if (string.IsNullOrEmpty(dnsServer))
{
return string.Empty;
}
// Enforce allowed values.
const string IpAddressRegex = @"([0-9]{1,3}\.){3}[0-9]{1,3}";
string[] values = dnsServer.Split(',');
bool firstBlank = string.IsNullOrEmpty(values[0]);
bool firstValid = System.Text.RegularExpressions.Regex.IsMatch(values[0], IpAddressRegex);
bool secondBlank = values.Length < 2 || string.IsNullOrEmpty(values[1]);
bool secondValid = false;
if (!secondBlank)
{
secondValid = System.Text.RegularExpressions.Regex.IsMatch(values[1], IpAddressRegex);
}
if (values.Length <= 2 && values.Length > 0 && (firstBlank || firstValid) && (secondBlank || secondValid))
{
return dnsServer;
}
else
{
throw new ArgumentException("DnsServer must be one or two valid IP addresses separated by a comma.", "dnsServer");
}
}
}
}

Просмотреть файл

@ -31,13 +31,13 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
protected override string GetStringValueFromValue(string hostName)
{
// Enforce allowed values.
if (string.IsNullOrEmpty(hostName) || (System.Text.RegularExpressions.Regex.IsMatch(hostName, "^[a-zA-Z0-9]{0,15}$") && !char.IsDigit(hostName[0])))
if (string.IsNullOrEmpty(hostName) || (hostName.Length <= 15 && System.Text.RegularExpressions.Regex.IsMatch(hostName, "^[-a-zA-Z0-9]*[a-zA-Z][-a-zA-Z0-9]*$")))
{
return hostName;
}
else
{
throw new ArgumentException("hostName must be either null or an alphanumeric string of 15 characters or less that doesn't start with a digit.", "hostName");
throw new ArgumentException("hostName must be either null or a string of 15 characters or less and only contain letters, numbers and hyphens.", "hostName");
}
}
}

Просмотреть файл

@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
// <copyright file="XboxMacAddressConfigurationSetting.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.Internal.GamesTest.Xbox.Configuration
{
using System;
/// <summary>
/// An explicit override of the XboxConfigurationSetting class meant to represent the use of the string
/// of the MACAddress configuration setting (see xbconfig command line utility).
/// </summary>
internal class XboxMacAddressConfigurationSetting : XboxConfigurationSetting<string>
{
/// <summary>
/// Initializes a new instance of the XboxMacAddressConfigurationSetting class.
/// </summary>
/// <param name="key">The setting key.</param>
internal XboxMacAddressConfigurationSetting(string key)
: base(key)
{
}
/// <summary>
/// Converts a strongly-typed value into a string value.
/// </summary>
/// <param name="macAddress">The value to be converted.</param>
/// <returns>The string value that corresponds to the specified value.</returns>
protected override string GetStringValueFromValue(string macAddress)
{
// Enforce allowed values.
if (string.IsNullOrEmpty(macAddress) || System.Text.RegularExpressions.Regex.IsMatch(macAddress, @"^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$"))
{
return macAddress;
}
else
{
throw new ArgumentException("MACAddress is expected to be formatted as six 2-digit hex components separated by dashes.", "macAddress");
}
}
}
}

Просмотреть файл

@ -0,0 +1,110 @@
//------------------------------------------------------------------------------
// <copyright file="XboxConfigurationValidationException.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Security;
using System.Xml.Schema;
namespace Microsoft.Internal.GamesTest.Xbox.Exceptions
{
/// <summary>
/// An exception that is thrown if the xml file loaded into a XboxConfiguration fails validation.
/// </summary>
[Serializable]
public class XboxConfigurationValidationException : XboxException
{
/// <summary>
/// Initializes a new instance of the <see cref="XboxConfigurationValidationException"/> class.
/// </summary>
public XboxConfigurationValidationException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="XboxConfigurationValidationException"/> class.
/// </summary>
/// <param name="message">The message.</param>
public XboxConfigurationValidationException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="XboxConfigurationValidationException"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="inner">The inner exception.</param>
public XboxConfigurationValidationException(string message, Exception inner)
: base(message, inner)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="XboxConfigurationValidationException"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="validationErrors">The list of validation errors.</param>
public XboxConfigurationValidationException(string message, IEnumerable<ValidationEventArgs> validationErrors)
: base(message)
{
this.ValidationErrors = validationErrors;
}
/// <summary>
/// Initializes a new instance of the <see cref="XboxConfigurationValidationException"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="inner">The inner exception.</param>
/// <param name="validationErrors">The list of validation errors.</param>
public XboxConfigurationValidationException(string message, Exception inner, IEnumerable<ValidationEventArgs> validationErrors)
: base(message, inner)
{
this.ValidationErrors = validationErrors;
}
/// <summary>
/// Initializes a new instance of the <see cref="XboxConfigurationValidationException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is null.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
/// </exception>
protected XboxConfigurationValidationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
/// <summary>
/// Gets the list of validation errors.
/// </summary>
public IEnumerable<ValidationEventArgs> ValidationErrors { get; private set; }
/// <summary>
/// When overridden in a derived class, sets the <see cref="T:System.Runtime.Serialization.SerializationInfo"/> with information about the exception.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is a null reference (Nothing in Visual Basic).
/// </exception>
[SecurityCritical]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
base.GetObjectData(info, context);
}
}
}

Просмотреть файл

@ -0,0 +1,64 @@
//------------------------------------------------------------------------------
// <copyright file="XdkVersionMismatchException.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.Internal.GamesTest.Xbox
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/// <summary>
/// An exception that is thrown if we detect that XDK versions don't match when performing certain actions.
/// For example, loading a configuration file saved on another XDK version.
/// </summary>
[Serializable]
public class XdkVersionMismatchException : XboxConsoleException
{
/// <summary>
/// Initializes a new instance of the <see cref="XdkVersionMismatchException"/> class.
/// </summary>
public XdkVersionMismatchException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="XdkVersionMismatchException"/> class.
/// </summary>
/// <param name="message">The message.</param>
public XdkVersionMismatchException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="XdkVersionMismatchException"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="inner">The inner exception.</param>
public XdkVersionMismatchException(string message, Exception inner)
: base(message, inner)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="XdkVersionMismatchException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is null.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
/// </exception>
protected XdkVersionMismatchException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
}
}

Просмотреть файл

@ -26,11 +26,13 @@ namespace Microsoft.Internal.GamesTest.Xbox
/// <summary>
/// ERA development specified on the console.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "DevKit", Justification = "Matches xbconfig setting.")]
EraDevKit = 0x1,
/// <summary>
/// SRA development specified on the console.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "DevKit", Justification = "Matches xbconfig setting.")]
SraDevKit = 0x2,
/// <summary>

Просмотреть файл

@ -11,10 +11,14 @@
<AssemblyName>GamesTest.XboxConsole.Infrastructure</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
@ -81,6 +85,9 @@
<Compile Include="Configuration\ColorDepthType.cs" />
<Compile Include="Configuration\ColorSpaceType.cs" />
<Compile Include="Configuration\AudioBitstreamFormatType.cs" />
<Compile Include="Configuration\XboxDevkitAllowAcgConfigurationSetting.cs" />
<Compile Include="Configuration\XboxDnsServerConfigurationSetting.cs" />
<Compile Include="Configuration\XboxMacAddressConfigurationSetting.cs" />
<Compile Include="Configuration\ProfilingModeType.cs" />
<Compile Include="Configuration\XboxIdleShutdownTimeoutConfigurationSetting.cs" />
<Compile Include="Configuration\OpticalAudioOutput.cs" />
@ -107,6 +114,7 @@
<Compile Include="Configuration\XboxProfilingModeConfigurationSetting.cs" />
<Compile Include="Configuration\XboxSessionKeyConfigurationSetting.cs" />
<Compile Include="Configuration\XboxTimeZoneConfigurationSetting.cs" />
<Compile Include="Configuration\DebugMemoryModeType.cs" />
<Compile Include="Deployment\XboxDeploymentError.cs" />
<Compile Include="Deployment\XboxDeploymentMetric.cs" />
<Compile Include="Deployment\XboxDeploymentInfo.cs" />
@ -116,6 +124,7 @@
<Compile Include="Exceptions\InvalidXuidException.cs" />
<Compile Include="Exceptions\NoLocalSignedInUsersInPartyException.cs" />
<Compile Include="Exceptions\XboxAggregateException.cs" />
<Compile Include="Exceptions\XboxConfigurationValidationException.cs" />
<Compile Include="Exceptions\XboxConsoleFeatureNotSupportedException.cs" />
<Compile Include="Exceptions\XboxDeployException.cs" />
<Compile Include="Exceptions\XboxInputException.cs" />
@ -123,6 +132,7 @@
<Compile Include="Exceptions\XboxSignInException.cs" />
<Compile Include="Exceptions\XboxSnapException.cs" />
<Compile Include="Exceptions\XboxUserNotSignedInException.cs" />
<Compile Include="Exceptions\XdkVersionMismatchException.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Input\XboxGamepadButtons.cs" />
<Compile Include="Input\XboxGamepadReading.cs" />

Просмотреть файл

@ -267,6 +267,15 @@ namespace Microsoft.Internal.GamesTest.Xbox
throw new XboxConsoleFeatureNotSupportedException(NotSupportedMessage);
}
/// <summary>
/// Disconnects all XboxGamepads from the console.
/// </summary>
/// <param name="ipAddress">The tools IP address of the console.</param>
public virtual void DisconnectAllXboxGamepads(string ipAddress)
{
throw new XboxConsoleFeatureNotSupportedException(NotSupportedMessage);
}
/// <summary>
/// Sets the state of the XboxGamepad.
/// </summary>

Двоичный файл не отображается.

Просмотреть файл

@ -34,6 +34,21 @@ namespace Microsoft.Internal.GamesTest.Xbox.Tests
ReadOnlyXboxConfiguration notUsedConfig = new ReadOnlyXboxConfiguration(null);
}
/// <summary>
/// Verifies that the ReadOnlyXboxConfiguration Load method throws InvalidOperationException.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
[ExpectedException(typeof(InvalidOperationException), "ReadOnlyXboxConfiguration constructor did not throw an InvalidOperationException as expected.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.Internal.GamesTest.Xbox.Configuration.ReadOnlyXboxConfiguration", Justification = "This is to test that the constructor throws an exception when passed a null parameter. The instance is never created as the constructor should throw an exception.")]
public void TestReadOnlyXboxConfigurationLoadMethodThrows()
{
ReadOnlyXboxConfiguration notUsedConfig = new ReadOnlyXboxConfiguration((configKey) => null);
notUsedConfig.Load("DoesntMatter");
}
/// <summary>
/// Verifies that the SandboxId property get functions correctly and the constructor calls the getSettingValue Func (parameter) to set the SandboxId.
/// </summary>

Просмотреть файл

@ -8,11 +8,13 @@ namespace Microsoft.Internal.GamesTest.Xbox.Tests
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using Microsoft.Internal.GamesTest.Xbox.Configuration;
using Microsoft.Internal.GamesTest.Xbox.Configuration.Fakes;
using Microsoft.Internal.GamesTest.Xbox.Fakes;
using Microsoft.QualityTools.Testing.Fakes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -580,6 +582,7 @@ namespace Microsoft.Internal.GamesTest.Xbox.Tests
public void TestXboxConfigurationHostName()
{
this.TestSetsAndGets<string>((testConfiguration, testValue) => { testConfiguration.HostName = testValue; return testConfiguration.HostName; }, "TestHostName", "HostName");
this.TestSetsAndGets<string>((testConfiguration, testValue) => { testConfiguration.HostName = testValue; return testConfiguration.HostName; }, "Test-Host-Name", "HostName");
this.TestSetsAndGets<string>((testConfiguration, testValue) => { testConfiguration.HostName = testValue; return testConfiguration.HostName; }, string.Empty, "HostName");
this.TestSetsAndGets<string>((testConfiguration, testValue) => { testConfiguration.HostName = testValue; return testConfiguration.HostName; }, null, "HostName");
}
@ -596,8 +599,293 @@ namespace Microsoft.Internal.GamesTest.Xbox.Tests
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "Ano+her", "HostName");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "Lets try spaces", "HostName");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "ThisIsAReallyLongStringThatShouldBeLongerThanFifteenCharacters", "HostName");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "1eet", "HostName");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "justslightlylong", "HostName");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "0123456", "HostName");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "012-3456", "HostName");
}
/// <summary>
/// Verifies that the DebugMemoryMode property returns the correct value.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationGetDebugMemoryMode()
{
this.TestGetter<DebugMemoryModeType>(config => config.DebugMemoryMode, DebugMemoryModeType.PGI_Tool, "DebugMemoryMode");
}
/// <summary>
/// Verifies that the DebugMemoryMode property sets the value by setting XboxConfigurationSettings value.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationSetDebugMemoryMode()
{
this.TestSetter<DebugMemoryModeType>(testConfiguration => testConfiguration.DebugMemoryMode = DebugMemoryModeType.Pix_Tool, DebugMemoryModeType.Pix_Tool, "DebugMemoryMode");
}
/// <summary>
/// Verifies that the DebugMemoryMode property gets the same value that it sets.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationDebugMemoryMode()
{
this.TestSetsAndGets<DebugMemoryModeType>((testConfiguration, testValue) => { testConfiguration.DebugMemoryMode = testValue; return testConfiguration.DebugMemoryMode; }, DebugMemoryModeType.Pix_Tool, "DebugMemoryMode");
}
/// <summary>
/// Verifies that the DisableSelectiveSuspend property returns the correct boolean.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationGetDisableSelectiveSuspend()
{
this.TestGetter<bool?>(config => config.DisableSelectiveSuspend, true, "DisableSelectiveSuspend");
}
/// <summary>
/// Verifies that the DisableSelectiveSuspend property sets the value by setting XboxConfigurationSettings Value.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationSetDisableSelectiveSuspend()
{
this.TestSetter<bool?>(testConfiguration => testConfiguration.DisableSelectiveSuspend = true, true, "DisableSelectiveSuspend");
}
/// <summary>
/// Verifies that the DisableSelectiveSuspend property gets the same value that it sets.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationDisableSelectiveSuspend()
{
this.TestSetsAndGets<bool?>((testConfiguration, testValue) => { testConfiguration.DisableSelectiveSuspend = testValue; return testConfiguration.DisableSelectiveSuspend; }, true, "DisableSelectiveSuspend");
}
/// <summary>
/// Verifies that the DevkitAllowACG property returns the correct boolean.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationGetDevkitAllowACG()
{
this.TestGetter<bool?>(config => config.DevkitAllowACG, true, "DevkitAllowACG");
}
/// <summary>
/// Verifies that the DevkitAllowACG property sets the value by setting XboxConfigurationSettings Value.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationSetDevkitAllowACG()
{
this.TestSetter<bool?>(testConfiguration => testConfiguration.DevkitAllowACG = true, true, "DevkitAllowACG");
}
/// <summary>
/// Verifies that the DevkitAllowACG property gets the same value that it sets.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationDevkitAllowACG()
{
this.TestSetsAndGets<bool?>((testConfiguration, testValue) => { testConfiguration.DevkitAllowACG = testValue; return testConfiguration.DevkitAllowACG; }, true, "DevkitAllowACG");
}
/// <summary>
/// Verifies that the AutoBoot property returns the correct boolean.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationGetAutoBoot()
{
this.TestGetter<bool?>(config => config.AutoBoot, true, "AutoBoot");
}
/// <summary>
/// Verifies that the AutoBoot property sets the value by setting XboxConfigurationSettings Value.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationSetAutoBoot()
{
this.TestSetter<bool?>(testConfiguration => testConfiguration.AutoBoot = true, true, "AutoBoot");
}
/// <summary>
/// Verifies that the AutoBoot property gets the same value that it sets.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationDevkitAutoBoot()
{
this.TestSetsAndGets<bool?>((testConfiguration, testValue) => { testConfiguration.AutoBoot = testValue; return testConfiguration.AutoBoot; }, true, "AutoBoot");
}
/// <summary>
/// Verifies that the MACAddress property returns the correct value (calls get on XboxConfigurationSettings Value).
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationGetMACAddress()
{
this.TestGetter<string>(config => config.MACAddress, "01-0b-02-0c-5e-ff", "MACAddress");
}
/// <summary>
/// Verifies that the MACAddress property throws exceptions on invalid values.
/// Special case for read-only property.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationMACAddressThrowsArgumentException()
{
XboxMacAddressConfigurationSetting setting = new XboxMacAddressConfigurationSetting("MACAddress");
bool thrown = false;
try
{
setting.StringValue = "Not a MAC address";
}
catch (ArgumentException)
{
thrown = true;
}
Assert.IsTrue(thrown, "MAC address not properly validated (using 'Not a MAC address' string).");
try
{
thrown = false;
setting.StringValue = "0104-01-b0-c1-f5-d5";
}
catch (ArgumentException)
{
thrown = true;
}
Assert.IsTrue(thrown, "MAC address not properly validated (using 4 hex digits in one group instad of max. 2).");
try
{
thrown = false;
setting.StringValue = "ff-df";
}
catch (ArgumentException)
{
thrown = true;
}
Assert.IsTrue(thrown, "MAC address not properly validated (using 2 groups of hex digits instead of min. 6).");
try
{
thrown = false;
setting.StringValue = "f4-a1-d0-cf-b3-f9-90-43";
}
catch (ArgumentException)
{
thrown = true;
}
Assert.IsTrue(thrown, "MAC address not properly validated (using 8 groups of hex digits instead of max. 6).");
}
/// <summary>
/// Verifies that the DNSServer property returns the correct value (calls get on XboxConfigurationSettings Value).
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationGetDNSServer()
{
this.TestGetter<string>(config => config.DNSServer, "192.168.55.20", "DNSServer");
}
/// <summary>
/// Verifies that the DNSServer property throws exceptions on invalid values.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationDnsServerThrowsArgumentException()
{
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "Not an IP addresss", "DNSServer");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "Not.an.IP.address", "DNSServer");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "920.25.25.30", "DNSServer");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "192.168.0.1.192.195.20", "DNSServer");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "192.28", "DNSServer");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "192.28.56.32,", "DNSServer");
this.TestSetInvalidValueThrowsException<string, ArgumentException>((testConfiguration, testValue) => testConfiguration.HostName = testValue, "192.28.56.256", "DNSServer");
}
/// <summary>
/// Tests that SerializationSchema.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxConfigurationTestCategory)]
public void TestXboxConfigurationSerializationSchema()
{
var schema = XboxConfiguration.SerializationSchema;
Assert.IsNotNull(schema, "XboxConfiguration static property SerializationSchema should not be null.");
// XmlSchema don't actually finish setting up the schema until they are "compiled"
// which happens either when the XmlSchema.Compile method, which is obsolete, or
// when a XmlSchemaSet compiles, which happens after automatically after calling
// add. Going with the XmlSchemaSet as Compile is obsolete.
var set = new System.Xml.Schema.XmlSchemaSet();
set.Add(schema);
Assert.AreEqual(30, schema.Elements.Count, "Schema didn't contain the expected amount of elements");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("XboxSettings")), "Schema missing a definition of the XboxSettings element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("Environment")), "Schema missing a definition of the Environment element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("SandboxId")), "Schema missing a definition of the SandboxId element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("OOBECompleted")), "Schema missing a definition of the OOBECompleted element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("ProfilingMode")), "Schema missing a definition of the ProfilingMode element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("PreferredLanguages")), "Schema missing a definition of the PreferredLanguages element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("GeographicRegion")), "Schema missing a definition of the GeographicRegion element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("TimeZone")), "Schema missing a definition of the TimeZone element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("SimulateVersionSwitch")), "Schema missing a definition of the SimulateVersionSwitch element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("EnableKernelDebugging")), "Schema missing a definition of the EnableKernelDebugging element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("SessionKey")), "Schema missing a definition of the SessionKey element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("AccessoryFlags")), "Schema missing a definition of the AccessoryFlags element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("PowerMode")), "Schema missing a definition of the PowerMode element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("IdleShutdownTimeout")), "Schema missing a definition of the IdleShutdownTimeout element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("DimTimeout")), "Schema missing a definition of the DimTimeout element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("HttpProxyHost")), "Schema missing a definition of the HttpProxyHost element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("DisplayResolution")), "Schema missing a definition of the DisplayResolution element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("ColorSpace")), "Schema missing a definition of the ColorSpace element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("ColorDepth")), "Schema missing a definition of the ColorDepth element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("DefaultUser")), "Schema missing a definition of the DefaultUser element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("DefaultUserPairing")), "Schema missing a definition of the DefaultUserPairing element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("WirelessRadioSettings")), "Schema missing a definition of the WirelessRadioSettings element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("HDMIAudio")), "Schema missing a definition of the HDMIAudio element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("OpticalAudio")), "Schema missing a definition of the OpticalAudio element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("AudioBitstreamFormat")), "Schema missing a definition of the AudioBitstreamFormat element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("HostName")), "Schema missing a definition of the HostName element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("DebugMemoryMode")), "Schema missing a definition of the DebugMemoryMode element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("DisableSelectiveSuspend")), "Schema missing a definition of the DisableSelectiveSuspend element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("DevkitAllowACG")), "Schema missing a definition of the DevkitAllowACG element");
Assert.IsTrue(schema.Elements.Contains(new System.Xml.XmlQualifiedName("AutoBoot")), "Schema missing a definition of the AutoBoot element");
}
/// <summary>

Просмотреть файл

@ -16,10 +16,14 @@
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
@ -53,6 +57,7 @@
<Reference Include="sysglobl" />
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.XML" />
<Reference Include="WindowsBase" />
</ItemGroup>
<Choose>
@ -86,7 +91,9 @@
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="ReadOnlyXboxConfigurationTests.cs" />
<Compile Include="XboxApplicationTests.cs" />
<Compile Include="XboxConfigurationTests.cs" />
<Compile Include="XboxConfigurationTests.cs">
<ExcludeFromStyleCop>False</ExcludeFromStyleCop>
</Compile>
<Compile Include="XboxConsoleDeploymentTests.cs" />
<Compile Include="XboxDirectoryTests.cs" />
<Compile Include="DirectoryInfoExtensionsTests.cs" />

Просмотреть файл

@ -623,7 +623,7 @@ namespace Microsoft.Internal.GamesTest.Xbox.Tests
string testAccessoryFlags = "0";
string testPowerMode = "EnergySaving";
string testIdleShutdownTimeout = "360";
string testDimTimeout = "6";
string testDimTimeout = "5";
string testHttpProxyHost = "10.161.24.254:8888";
string testDisplayResolution = "HD";
string testColorSpace = "RgbFull";
@ -637,6 +637,12 @@ namespace Microsoft.Internal.GamesTest.Xbox.Tests
string testOpticalAudio = "Bitstream";
string testAudioBitstreamFormat = "DolbyDigital";
string testHostName = "TestHostName";
string testDebugMemoryMode = "Pix_Tool";
string testSelectiveSuspend = "true";
string testDevkitAllowACG = "On";
string testAutoBoot = "true";
string testMacAddress = "60-45-BD-C4-95-2F";
string testDnsServer = "157.54.14.162,10.221.228.12";
ShimXboxConsole.ConstructorIPAddress = null;
ShimXboxConsoleAdapterBase.AllInstances.GetConfigValueStringString = (adapter, systemIpAddress, key) =>
@ -675,7 +681,13 @@ namespace Microsoft.Internal.GamesTest.Xbox.Tests
case "OpticalAudio": return testOpticalAudio;
case "AudioBitstreamFormat": return testAudioBitstreamFormat;
case "HostName": return testHostName;
default: Assert.Fail("The XboxConsole Configuration (get) property did not return the proper key."); break;
case "DebugMemoryMode": return testDebugMemoryMode;
case "DisableSelectiveSuspend": return testSelectiveSuspend;
case "DevkitAllowACG": return testDevkitAllowACG;
case "AutoBoot": return testAutoBoot;
case "MACAddress": return testMacAddress;
case "DNSServer": return testDnsServer;
default: Assert.Fail("The XboxConsole Configuration (get) property for {0} did not return the proper key.", key); break;
}
return null;
@ -1483,7 +1495,7 @@ namespace Microsoft.Internal.GamesTest.Xbox.Tests
}
};
ShimXboxConfiguration.AllInstances.SetSettingValuesActionOfStringString = (config, setSettingValue) =>
ShimBaseXboxConfiguration.AllInstances.SetSettingValuesActionOfStringString = (config, setSettingValue) =>
{
// We want to make sure Reboot is called AFTER applying the config
isRebootCalled = false;

Просмотреть файл

@ -527,20 +527,6 @@ namespace Microsoft.Internal.GamesTest.Xbox.Tests
Assert.IsTrue(isCorrectMethodCalled, "The Unregister() method didn't call the adapter's UninstallPackage(systemIpAddress, packageFullName).");
}
/// <summary>
/// Verifies that the Unregister method calls the adapter's UnregisterPackage method.
/// </summary>
[TestMethod]
[TestCategory("UnitTest")]
[TestCategory(XboxPackageTestCategory)]
[ExpectedException(typeof(InvalidOperationException))]
public void TestUnregisterThrowsForNonScratchPackage()
{
ShimXboxConsoleAdapterBase.AllInstances.UnregisterPackageStringString = (adapter, systemIpAddress, packageFullName) => { };
this.xboxPackage.Unregister();
}
private void TestExecutionStatePolling(Action subscriptionAction, Action unsubscriptionAction)
{
ManualResetEventSlim hasMethodBeenCalled = new ManualResetEventSlim(false);

Просмотреть файл

@ -36,45 +36,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XboxConsole.Adapter.November2014", "XboxConsole.Adapter.November2014\XboxConsole.Adapter.November2014.csproj", "{14889CB2-40C7-4F4F-A200-0A432D773A44}"
EndProject
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 12
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs12
SccProjectUniqueName0 = XboxConsole\\XboxConsole.csproj
SccProjectName0 = XboxConsole
SccLocalPath0 = XboxConsole
SccProjectUniqueName1 = XboxConsole.Adapter.Tests\\XboxConsole.Adapter.Tests.csproj
SccProjectName1 = XboxConsole.Adapter.Tests
SccLocalPath1 = XboxConsole.Adapter.Tests
SccProjectUniqueName2 = XboxConsole.Tests\\XboxConsole.Tests.csproj
SccProjectName2 = XboxConsole.Tests
SccLocalPath2 = XboxConsole.Tests
SccProjectUniqueName3 = XboxConsole.Infrastructure.Tests\\XboxConsole.Infrastructure.Tests.csproj
SccProjectName3 = XboxConsole.Infrastructure.Tests
SccLocalPath3 = XboxConsole.Infrastructure.Tests
SccProjectUniqueName4 = XboxConsole.Adapter.April2014\\XboxConsole.Adapter.April2014.csproj
SccProjectName4 = XboxConsole.Adapter.April2014
SccLocalPath4 = XboxConsole.Adapter.April2014
SccProjectUniqueName5 = XboxConsole.Infrastructure\\XboxConsole.Infrastructure.csproj
SccProjectName5 = XboxConsole.Infrastructure
SccLocalPath5 = XboxConsole.Infrastructure
SccProjectUniqueName6 = XboxConsole.Adapter.November2014\\XboxConsole.Adapter.November2014.csproj
SccProjectName6 = XboxConsole.Adapter.November2014
SccLocalPath6 = XboxConsole.Adapter.November2014
SccProjectUniqueName7 = XboxConsole.Adapter.October2014\\XboxConsole.Adapter.October2014.csproj
SccProjectName7 = XboxConsole.Adapter.October2014
SccLocalPath7 = XboxConsole.Adapter.October2014
SccProjectUniqueName8 = XboxConsole.Adapter.August2014\\XboxConsole.Adapter.August2014.csproj
SccProjectName8 = XboxConsole.Adapter.August2014
SccLocalPath8 = XboxConsole.Adapter.August2014
SccProjectUniqueName9 = XboxConsole.Adapter.July2014\\XboxConsole.Adapter.July2014.csproj
SccProjectName9 = XboxConsole.Adapter.July2014
SccLocalPath9 = XboxConsole.Adapter.July2014
SccProjectUniqueName10 = XboxConsole.Adapter.May2014\\XboxConsole.Adapter.May2014.csproj
SccProjectName10 = XboxConsole.Adapter.May2014
SccLocalPath10 = XboxConsole.Adapter.May2014
SccLocalPath11 = .
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64

Просмотреть файл

@ -19,56 +19,7 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
/// <param name="getSettingValue">The setting value provider.</param>
internal ReadOnlyXboxConfiguration(Func<string, string> getSettingValue)
{
if (getSettingValue == null)
{
throw new ArgumentNullException("getSettingValue");
}
this.EnvironmentSetting.StringValue = getSettingValue(this.EnvironmentSetting.Key);
this.SandboxIdSetting.StringValue = getSettingValue(this.SandboxIdSetting.Key);
this.OOBECompletedSetting.StringValue = getSettingValue(this.OOBECompletedSetting.Key);
this.ProfilingModeSetting.StringValue = getSettingValue(this.ProfilingModeSetting.Key);
this.PreferredLanguagesSetting.StringValue = getSettingValue(this.PreferredLanguagesSetting.Key);
this.GeographicRegionSetting.StringValue = getSettingValue(this.GeographicRegionSetting.Key);
this.TimeZoneSetting.StringValue = getSettingValue(this.TimeZoneSetting.Key);
this.SimulateVersionSwitchSetting.StringValue = getSettingValue(this.SimulateVersionSwitchSetting.Key);
this.EnableKernelDebuggingSetting.StringValue = getSettingValue(this.EnableKernelDebuggingSetting.Key);
this.SessionKeySetting.StringValue = getSettingValue(this.SessionKeySetting.Key);
if (this.SessionKeySetting.StringValue == null)
{
this.SessionKeySetting.StringValue = string.Empty;
}
this.AccessoryFlagsSetting.StringValue = getSettingValue(this.AccessoryFlagsSetting.Key);
this.PowerModeSetting.StringValue = getSettingValue(this.PowerModeSetting.Key);
this.IdleShutdownTimeoutSetting.StringValue = getSettingValue(this.IdleShutdownTimeoutSetting.Key);
this.DimTimeoutSetting.StringValue = getSettingValue(this.DimTimeoutSetting.Key);
this.HttpProxyHostSetting.StringValue = getSettingValue(this.HttpProxyHostSetting.Key);
if (this.HttpProxyHostSetting.StringValue == null)
{
this.HttpProxyHostSetting.StringValue = string.Empty;
}
this.DisplayResolutionSetting.StringValue = getSettingValue(this.DisplayResolutionSetting.Key);
this.ColorSpaceSetting.StringValue = getSettingValue(this.ColorSpaceSetting.Key);
this.ColorDepthSetting.StringValue = getSettingValue(this.ColorDepthSetting.Key);
this.NetworkTypeSetting.StringValue = getSettingValue(this.NetworkTypeSetting.Key);
this.NetworkAddressModeSetting.StringValue = getSettingValue(this.NetworkAddressModeSetting.Key);
this.DefaultUserSetting.StringValue = getSettingValue(this.DefaultUserSetting.Key);
if (this.DefaultUserSetting.StringValue == null)
{
this.DefaultUserSetting.StringValue = string.Empty;
}
this.DefaultUserPairingSetting.StringValue = getSettingValue(this.DefaultUserPairingSetting.Key);
this.WirelessRadioSettingsSetting.StringValue = getSettingValue(this.WirelessRadioSettingsSetting.Key);
this.AudioBitstreamFormatSetting.StringValue = getSettingValue(this.AudioBitstreamFormatSetting.Key);
this.HdmiAudioSetting.StringValue = getSettingValue(this.HdmiAudioSetting.Key);
this.OpticalAudioSetting.StringValue = getSettingValue(this.OpticalAudioSetting.Key);
this.HostNameSetting.StringValue = getSettingValue(this.HostNameSetting.Key);
this.GetSettingValues(getSettingValue);
}
/// <summary>
@ -369,6 +320,72 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
}
}
/// <summary>
/// Gets the DebugMemoryMode.
/// </summary>
public DebugMemoryModeType DebugMemoryMode
{
get
{
return this.DebugMemoryModeSetting.Value;
}
}
/// <summary>
/// Gets the DisableSelectiveSuspend.
/// </summary>
public bool? DisableSelectiveSuspend
{
get
{
return this.DisableSelectiveSuspendSetting.Value;
}
}
/// <summary>
/// Gets the DevkitAllowACG.
/// </summary>
public bool? DevkitAllowACG
{
get
{
return this.DevkitAllowACGSetting.Value;
}
}
/// <summary>
/// Gets the AutoBoot.
/// </summary>
public bool? AutoBoot
{
get
{
return this.AutoBootSetting.Value;
}
}
/// <summary>
/// Gets the MACAddress.
/// </summary>
public string MACAddress
{
get
{
return this.MACAddressSetting.Value;
}
}
/// <summary>
/// Gets the DNSServer.
/// </summary>
public string DNSServer
{
get
{
return this.DNSServerSetting.Value;
}
}
/// <summary>
/// Gets the HostName.
/// </summary>
@ -379,5 +396,23 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
return this.HostNameSetting.Value;
}
}
/// <summary>
/// Loads the Xbox configuration from an XML file.
/// </summary>
/// <param name="path">The configuration file path.</param>
public void Load(string path)
{
throw new InvalidOperationException("XboxConsole.Configuration describes the current configuration and cannot be loaded from file. Create a new XboxConfiguration, use its Load method, and apply it to XboxConsole using the Restart method.");
}
/// <summary>
/// Saves the Xbox configuration to an XML file.
/// </summary>
/// <param name="path">The configuration file path.</param>
public void Save(string path)
{
this.Save(path, XboxConsole.XdkVersion);
}
}
}

Просмотреть файл

@ -8,6 +8,9 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
{
using System;
using System.Globalization;
using System.Linq;
using System.Xml;
using Microsoft.Internal.GamesTest.Xbox.Exceptions;
using Microsoft.Internal.GamesTest.Xbox.Telemetry;
/// <summary>
@ -16,6 +19,14 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
/// </summary>
public class XboxConfiguration : BaseXboxConfiguration, IXboxConfiguration
{
private static readonly Lazy<System.Xml.Schema.XmlSchema> serializationSchema = new Lazy<System.Xml.Schema.XmlSchema>(() =>
{
using (var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Microsoft.Internal.GamesTest.Xbox.Configuration.XboxSettingsSchema.xsd"))
{
return System.Xml.Schema.XmlSchema.Read(stream, (o, a) => { });
}
});
/// <summary>
/// Initializes a new instance of the XboxConfiguration class. Call XboxConsole.Reboot method to apply configuration to a console.
/// </summary>
@ -62,6 +73,18 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
this.HdmiAudio = source.HdmiAudio;
this.OpticalAudio = source.OpticalAudio;
this.AudioBitstreamFormat = source.AudioBitstreamFormat;
this.DebugMemoryMode = source.DebugMemoryMode;
this.DisableSelectiveSuspend = source.DisableSelectiveSuspend;
this.DevkitAllowACG = source.DevkitAllowACG;
this.AutoBoot = source.AutoBoot;
}
/// <summary>
/// Gets the schema used for validating the serialized XboxConfiguration.
/// </summary>
public static System.Xml.Schema.XmlSchema SerializationSchema
{
get { return serializationSchema.Value; }
}
/// <summary>
@ -510,41 +533,144 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
}
/// <summary>
/// Sets setting values using the specified action.
/// Gets or sets the DebugMemoryMode value. Call XboxConsole.Reboot method to apply configuration to a console.
/// </summary>
/// <param name="setSettingValue">The action called for each setting.</param>
internal void SetSettingValues(Action<string, string> setSettingValue)
public DebugMemoryModeType DebugMemoryMode
{
if (setSettingValue == null)
get
{
throw new ArgumentNullException("setSettingValue");
return this.DebugMemoryModeSetting.Value;
}
setSettingValue(this.EnvironmentSetting.Key, this.EnvironmentSetting.StringValue);
setSettingValue(this.SandboxIdSetting.Key, this.SandboxIdSetting.StringValue);
setSettingValue(this.OOBECompletedSetting.Key, this.OOBECompletedSetting.StringValue);
setSettingValue(this.ProfilingModeSetting.Key, this.ProfilingModeSetting.StringValue);
setSettingValue(this.PreferredLanguagesSetting.Key, this.PreferredLanguagesSetting.StringValue);
setSettingValue(this.GeographicRegionSetting.Key, this.GeographicRegionSetting.StringValue);
setSettingValue(this.TimeZoneSetting.Key, this.TimeZoneSetting.StringValue);
setSettingValue(this.SimulateVersionSwitchSetting.Key, this.SimulateVersionSwitchSetting.StringValue);
setSettingValue(this.EnableKernelDebuggingSetting.Key, this.EnableKernelDebuggingSetting.StringValue);
setSettingValue(this.SessionKeySetting.Key, this.SessionKeySetting.StringValue);
setSettingValue(this.AccessoryFlagsSetting.Key, this.AccessoryFlagsSetting.StringValue);
setSettingValue(this.PowerModeSetting.Key, this.PowerModeSetting.StringValue);
setSettingValue(this.IdleShutdownTimeoutSetting.Key, this.IdleShutdownTimeoutSetting.StringValue);
setSettingValue(this.DimTimeoutSetting.Key, this.DimTimeoutSetting.StringValue);
setSettingValue(this.HttpProxyHostSetting.Key, this.HttpProxyHostSetting.StringValue);
setSettingValue(this.DisplayResolutionSetting.Key, this.DisplayResolutionSetting.StringValue);
setSettingValue(this.ColorSpaceSetting.Key, this.ColorSpaceSetting.StringValue);
setSettingValue(this.ColorDepthSetting.Key, this.ColorDepthSetting.StringValue);
setSettingValue(this.DefaultUserSetting.Key, this.DefaultUserSetting.StringValue);
setSettingValue(this.DefaultUserPairingSetting.Key, this.DefaultUserPairingSetting.StringValue);
setSettingValue(this.WirelessRadioSettingsSetting.Key, this.WirelessRadioSettingsSetting.StringValue);
setSettingValue(this.HdmiAudioSetting.Key, this.HdmiAudioSetting.StringValue);
setSettingValue(this.OpticalAudioSetting.Key, this.OpticalAudioSetting.StringValue);
setSettingValue(this.AudioBitstreamFormatSetting.Key, this.AudioBitstreamFormatSetting.StringValue);
setSettingValue(this.HostNameSetting.Key, this.HostNameSetting.StringValue);
set
{
this.DebugMemoryModeSetting.Value = value;
}
}
/// <summary>
/// Gets or sets the DisableSelectiveSuspend value. Call XboxConsole.Reboot method to apply configuration to a console.
/// </summary>
public bool? DisableSelectiveSuspend
{
get
{
return this.DisableSelectiveSuspendSetting.Value;
}
set
{
this.DisableSelectiveSuspendSetting.Value = value;
}
}
/// <summary>
/// Gets or sets the DevkitAllowACG value. Call XboxConsole.Reboot method to apply configuration to a console.
/// </summary>
public bool? DevkitAllowACG
{
get
{
return this.DevkitAllowACGSetting.Value;
}
set
{
this.DevkitAllowACGSetting.Value = value;
}
}
/// <summary>
/// Gets or sets the AutoBoot value. Call XboxConsole.Reboot method to apply configuration to a console.
/// </summary>
public bool? AutoBoot
{
get
{
return this.AutoBootSetting.Value;
}
set
{
this.AutoBootSetting.Value = value;
}
}
/// <summary>
/// Gets the MACAddress value. Call XboxConsole.Reboot method to apply configuration to a console.
/// </summary>
/// <remarks>
/// The MACAddress is formatted as a sequence of six 2-digit hex bytes separated by dashes.
/// </remarks>
public string MACAddress
{
get
{
return this.MACAddressSetting.Value;
}
}
/// <summary>
/// Gets the DNSServer value. Call XboxConsole.Reboot method to apply configuration to a console.
/// </summary>
/// <remarks>
/// The DNSServer can be one or two IPv4 addresses separated by a comma.
/// </remarks>
public string DNSServer
{
get
{
return this.DNSServerSetting.Value;
}
}
/// <summary>
/// Load the Xbox configuration from an XML file.
/// </summary>
/// <param name="path">The configuration file path.</param>
public void Load(string path)
{
// Read XML document
XmlDocument doc = new XmlDocument();
doc.Schemas.Add(XboxConfiguration.serializationSchema.Value);
doc.Load(path);
// Validate
if (doc.DocumentElement.Name != BaseXboxConfiguration.SettingsKey ||
!doc.DocumentElement.HasAttribute(BaseXboxConfiguration.XdkVersionAttribute))
{
throw new FormatException("The document is not a valid configuration settings file.");
}
if (doc.DocumentElement.Attributes[BaseXboxConfiguration.XdkVersionAttribute].Value != XboxConsole.XdkVersion)
{
throw new XdkVersionMismatchException("Attempted to load Xbox Configuration saved on another XDK version.");
}
System.Collections.Generic.List<System.Xml.Schema.ValidationEventArgs> validationErrors = new System.Collections.Generic.List<System.Xml.Schema.ValidationEventArgs>();
doc.Validate((o, e) => { validationErrors.Add(e); });
if (validationErrors.Count > 0)
{
throw new XboxConfigurationValidationException("Validation of XboxConfiguration XML file failed", validationErrors);
}
// Load settings
this.GetSettingValues((setting) =>
{
// Certain settings are read-only and will not exist in the configuration file.
XmlNodeList nodes = doc.DocumentElement.SelectNodes(setting);
return nodes.Count > 0 ? nodes[0].InnerText : null;
});
}
/// <summary>
/// Save the configuration to an XML file.
/// </summary>
/// <param name="path">The configuration file path.</param>
public void Save(string path)
{
this.Save(path, XboxConsole.XdkVersion);
}
/// <summary>
@ -589,6 +715,12 @@ namespace Microsoft.Internal.GamesTest.Xbox.Configuration
case "HDMIAudio": return this.HdmiAudioSetting.StringValue;
case "OpticalAudio": return this.OpticalAudioSetting.StringValue;
case "AudioBitstreamFormat": return this.AudioBitstreamFormatSetting.StringValue;
case "DebugMemoryMode": return this.DebugMemoryModeSetting.StringValue;
case "DisableSelectiveSuspend": return this.DisableSelectiveSuspendSetting.StringValue;
case "DevkitAllowACG": return this.DevkitAllowACGSetting.StringValue;
case "AutoBoot": return this.AutoBootSetting.StringValue;
case "MACAddress": return this.MACAddressSetting.StringValue;
case "DNSServer": return this.DNSServerSetting.StringValue;
default: throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Provided key '{0}' does not correspond to any XboxConfigurationSettings.", key));
}
}

Просмотреть файл

@ -0,0 +1,202 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="XboxSettingsSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Environment" fixed="prod">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:whiteSpace value="collapse" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="SandboxId">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:whiteSpace value="collapse" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="OOBECompleted" type="xs:boolean"/>
<xs:element name="ProfilingMode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="On" />
<xs:enumeration value="Off" />
<xs:enumeration value="Legacy" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="PreferredLanguages" type="xs:string" />
<xs:element name="GeographicRegion" type="xs:string" />
<xs:element name="TimeZone" type="xs:string" />
<xs:element name="SimulateVersionSwitch" type="xs:boolean" />
<xs:element name="EnableKernelDebugging" type="xs:boolean" />
<xs:element name="SessionKey">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9]{0,31}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AccessoryFlags" type="xs:unsignedInt" />
<xs:element name="PowerMode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="EnergySaving" />
<xs:enumeration value="InstantOn" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="IdleShutdownTimeout">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:enumeration value="0" />
<xs:enumeration value="60" />
<xs:enumeration value="360" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="DimTimeout" type="xs:unsignedByte" />
<xs:element name="HttpProxyHost" type="xs:string" />
<xs:element name="DisplayResolution">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="720p" />
<xs:enumeration value="1080p" />
<xs:enumeration value="640x480" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ColorSpace">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="RgbLimited" />
<xs:enumeration value="RgbFull" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ColorDepth">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:enumeration value="24" />
<xs:enumeration value="30" />
<xs:enumeration value="36" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="DefaultUser" type="xs:string" />
<xs:element name="DefaultUserPairing">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Gamepad" />
<xs:enumeration value="Virtual" />
<xs:enumeration value="AnyPhysical" />
<xs:enumeration value="None" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WirelessRadioSettings">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="On" />
<xs:enumeration value="Off" />
<xs:enumeration value="WLanOff" />
<xs:enumeration value="AccessoriesOff" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="HDMIAudio">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="off" />
<xs:enumeration value="stereo" />
<xs:enumeration value="5.1" />
<xs:enumeration value="7.1" />
<xs:enumeration value="bitstream" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="OpticalAudio">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Off" />
<xs:enumeration value="Stereo" />
<xs:enumeration value="Bitstream" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AudioBitstreamFormat">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="DolbyDigital" />
<xs:enumeration value="Dts" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="DebugMemoryMode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Pix" />
<xs:enumeration value="Pix_Tool" />
<xs:enumeration value="Pix_Title" />
<xs:enumeration value="PGI" />
<xs:enumeration value="PGI_Title" />
<xs:enumeration value="PGI_Tool" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="DisableSelectiveSuspend" type="xs:boolean"/>
<xs:element name="DevkitAllowACG">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="On" />
<xs:enumeration value="Off" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AutoBoot" type="xs:boolean"/>
<xs:element name="HostName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[-a-zA-Z0-9]*[a-zA-Z][-a-zA-Z0-9]*" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="XboxSettings">
<xs:complexType>
<xs:all>
<xs:element ref="Environment" minOccurs="0"/>
<xs:element ref="SandboxId" minOccurs="0"/>
<xs:element ref="OOBECompleted" minOccurs="0"/>
<xs:element ref="ProfilingMode" minOccurs="0"/>
<xs:element ref="PreferredLanguages" minOccurs="0"/>
<xs:element ref="GeographicRegion" minOccurs="0"/>
<xs:element ref="TimeZone" minOccurs="0"/>
<xs:element ref="SimulateVersionSwitch" minOccurs="0"/>
<xs:element ref="EnableKernelDebugging" minOccurs="0"/>
<xs:element ref="SessionKey" minOccurs="0"/>
<xs:element ref="AccessoryFlags" minOccurs="0"/>
<xs:element ref="PowerMode" minOccurs="0"/>
<xs:element ref="IdleShutdownTimeout" minOccurs="0"/>
<xs:element ref="DimTimeout" minOccurs="0"/>
<xs:element ref="HttpProxyHost" minOccurs="0"/>
<xs:element ref="DisplayResolution" minOccurs="0"/>
<xs:element ref="ColorSpace" minOccurs="0"/>
<xs:element ref="ColorDepth" minOccurs="0"/>
<xs:element ref="DefaultUser" minOccurs="0"/>
<xs:element ref="DefaultUserPairing" minOccurs="0"/>
<xs:element ref="WirelessRadioSettings" minOccurs="0"/>
<xs:element ref="HDMIAudio" minOccurs="0"/>
<xs:element ref="OpticalAudio" minOccurs="0"/>
<xs:element ref="AudioBitstreamFormat" minOccurs="0"/>
<xs:element ref="DebugMemoryMode" minOccurs="0"/>
<xs:element ref="DisableSelectiveSuspend" minOccurs="0"/>
<xs:element ref="DevkitAllowACG" minOccurs="0"/>
<xs:element ref="AutoBoot" minOccurs="0"/>
<xs:element ref="HostName" minOccurs="0"/>
</xs:all>
<xs:attribute name="xdk" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:schema>

Просмотреть файл

@ -32,6 +32,11 @@ namespace Microsoft.Internal.GamesTest.Xbox
/// </summary>
public class XboxConsole : DisposableObject
{
// These settings will return null from the console when they are set to nothing.
// As such when we get them from the console we will need to check for these keys
// and then return string.Empty if the value is null.
private static readonly string[] EmptyStringIfNullConfigurationKeys = { "SessionKey", "HttpProxyHost", "DefaultUser" };
/// <summary>
/// Initializes static members of the XboxConsole class.
/// </summary>
@ -202,6 +207,17 @@ namespace Microsoft.Internal.GamesTest.Xbox
}
}
/// <summary>
/// Gets the current XDK version.
/// </summary>
public static string XdkVersion
{
get
{
return XboxConsoleAdapterFactory.XdkVersion.ProductVersion;
}
}
/// <summary>
/// Gets the system IP address for this console.
/// </summary>
@ -282,7 +298,19 @@ namespace Microsoft.Internal.GamesTest.Xbox
this.ThrowIfDisposed();
return new ReadOnlyXboxConfiguration(settingKey => this.Adapter.GetConfigValue(this.SystemIpAddressAndSessionKeyCombined, settingKey));
return new ReadOnlyXboxConfiguration(settingKey =>
{
var value = this.Adapter.GetConfigValue(this.SystemIpAddressAndSessionKeyCombined, settingKey);
// Some configuration settings return null instead of an empty string.
// Check for that case and return string.empty.
if (value == null && EmptyStringIfNullConfigurationKeys.Contains(settingKey))
{
return string.Empty;
}
return value;
});
}
}
@ -552,6 +580,19 @@ namespace Microsoft.Internal.GamesTest.Xbox
return gamepad;
}
/// <summary>
/// Disconnects all connected gamepads for this console.
/// </summary>
public void DisconnectAllGamepads()
{
XboxConsoleEventSource.Logger.MethodCalled(XboxConsoleEventSource.GetCurrentMethod());
this.ThrowIfDisposed();
this.Adapter.DisconnectAllXboxGamepads(this.SystemIpAddressAndSessionKeyCombined);
this.XboxGamepads.Clear();
}
/// <summary>
/// Push deploys loose files to the console.
/// </summary>

Просмотреть файл

@ -11,10 +11,14 @@
<AssemblyName>GamesTest.XboxConsole</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
@ -78,6 +82,11 @@
<Compile Include="XboxUser.cs" />
<Compile Include="XboxUserBase.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Configuration\XboxSettingsSchema.xsd">
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<CodeAnalysisDictionary Include="..\dependencies\CodeAnalysis\CustomDictionary.xml">
<Link>CustomDictionary.xml</Link>

Просмотреть файл

@ -27,6 +27,8 @@ namespace Microsoft.Internal.GamesTest.Xbox
private const int May2014XdkBuild = 10951;
private const int April2014XdkBuild = 10812;
private static FileVersionInfo currentXdkVersion = null;
// The adapter lookup table puts a relationship between adapters and versions of XDK they support.
// The adapters must be listed in the latest-to-oldest order. Please add new adapters at the beginning of the list.
private static Tuple<int, Func<XboxConsoleAdapterBase>>[] adapterLookup =
@ -52,25 +54,43 @@ namespace Microsoft.Internal.GamesTest.Xbox
{ "xb_rel_1411", November2014XdkBuild }
};
/// <summary>
/// Gets the current XDK version from file, returning a previously cached version if called more than once.
/// </summary>
internal static FileVersionInfo XdkVersion
{
get
{
if (currentXdkVersion == null)
{
string xdkdir = Environment.GetEnvironmentVariable("DurangoXDK");
if (xdkdir == null)
{
throw new XdkNotFoundException("The environment variable for XDK location is not found. Please make sure the XDK is installed.");
}
string filePath = Directory.EnumerateFiles(Path.Combine(xdkdir, @"bin"), "xb*", SearchOption.TopDirectoryOnly).FirstOrDefault();
if (filePath == null)
{
throw new XboxConsoleException("Unable to find 'xb*' file to verify version of XDK installed");
}
currentXdkVersion = FileVersionInfo.GetVersionInfo(filePath);
}
return currentXdkVersion;
}
}
/// <summary>
/// Creates and returns an adapter compatible with installed XDK.
/// </summary>
/// <returns>The best compatible adapter.</returns>
internal static XboxConsoleAdapterBase CreateAdapterForInstalledXdk()
{
string xdkdir = Environment.GetEnvironmentVariable("DurangoXDK");
if (xdkdir == null)
{
throw new XdkNotFoundException("The environment variable for XDK location is not found. Please make sure the XDK is installed.");
}
string filePath = Directory.EnumerateFiles(Path.Combine(xdkdir, @"bin"), "xb*", SearchOption.TopDirectoryOnly).FirstOrDefault();
if (filePath == null)
{
throw new XboxConsoleException("Unable to find 'xb*' file to verify version of XDK installed");
}
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(filePath);
FileVersionInfo fileVersionInfo = XdkVersion;
var buildKey = fileVersionInfo.FileBuildPart;
// format: <version> (<branchName>.<timestamp>)

Просмотреть файл

@ -200,11 +200,6 @@ namespace Microsoft.Internal.GamesTest.Xbox
{
XboxConsoleEventSource.Logger.MethodCalled(XboxConsoleEventSource.GetCurrentMethod());
if (!this.Definition.IsScratchPackage)
{
throw new InvalidOperationException("Attempting to unregister a deployed package. Unregistering is supported only for packages registered with XboxConsole.RegisterPackage.");
}
this.Console.Adapter.UnregisterPackage(this.Console.SystemIpAddressAndSessionKeyCombined, this.Definition.FullName);
}

Просмотреть файл

@ -40,6 +40,7 @@
<Word>Bitstream</Word>
<Word>Dts</Word>
<Word>Xuid</Word>
<Word>Devkit</Word>
</Recognized>
</Words>
<Acronyms>
@ -56,6 +57,9 @@
<Acronym>UI</Acronym>
<Acronym>OOBE</Acronym>
<Acronym>XUID</Acronym>
<Acronym>ACG</Acronym>
<Acronym>DNS</Acronym>
<Acronym>MAC</Acronym>
</CasingExceptions>
</Acronyms>
</Dictionary>