Windows Phone 7 SDK (バージョン 7.0、7.1、および/または 7.11) と、エミュレーター、エミュレーター バージョン、エミュレーター イメージ バージョン、アセンブリなどの特定のコンポーネントの存在をプログラムで検出する方法はありますか?
シンプルな .NET 4 コンソール アプリからこれを実行しようとしています。マシンが使用している WP7 SDK のバージョンを確認するにはどうすればよいですか? 少し情報がありますが、完全ではないようです。
ありがとう
Windows Phone 7 SDK (バージョン 7.0、7.1、および/または 7.11) と、エミュレーター、エミュレーター バージョン、エミュレーター イメージ バージョン、アセンブリなどの特定のコンポーネントの存在をプログラムで検出する方法はありますか?
シンプルな .NET 4 コンソール アプリからこれを実行しようとしています。マシンが使用している WP7 SDK のバージョンを確認するにはどうすればよいですか? 少し情報がありますが、完全ではないようです。
ありがとう
開発者マシンにインストールされている開発者ツールに関する情報を入手したいと思います。そのため、インストールされているフォルダを確認する方法が1つあり、そのために次のコードを使用できます。
public static List<double> GetSdkVersion()
{
var versions = new List<double>();
var data = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFilesX86);
var sdkPath = Path.Combine(data, @"Microsoft SDKs\Windows Phone\v7.0");
var version = Directory.Exists(sdkPath);
versions.Add(7.0);
sdkPath = Path.Combine(data, @"Microsoft SDKs\Windows Phone\v7.1");
return versions;
}
public static List<double> GetEmulatorVersios()
{
var versions = new List<double>();
var data = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFilesX86);
var sdkPath = Path.Combine(data, @"Microsoft XDE\1.0");
var version = Directory.Exists(sdkPath);
versions.Add(1.0);
return versions;
}
確かに、このコードを書く方が良いかもしれませんが、これは私が持って来ることができるものです。それが役に立てば幸い。
これは私がデバイス情報に使用するクラスです
public class DeviceInformation
{
public static Device GetDeviceInfo()
{
Device deviceInfo = new Device();
deviceInfo.Id = getDeviceId();
deviceInfo.Name = getDeviceName();
deviceInfo.Manufacturer = getDeviceManufacturer();
deviceInfo.OSVersion = System.Environment.OSVersion.ToString();
deviceInfo.Language = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;
return deviceInfo;
}
private static String getDeviceId()
{
Object uniqueId;
StringBuilder deviceId = new StringBuilder();
if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId))
{
for (int i = 0; i < ((byte[])uniqueId).Length; i++)
{
deviceId.Append(((byte[])uniqueId)[i]);
}
}
return deviceId.ToString();
}
private static String getDeviceName()
{
Object deviceName;
DeviceExtendedProperties.TryGetValue("DeviceName", out deviceName);
return deviceName.ToString();
}
private static String getDeviceManufacturer()
{
Object deviceManufacturer;
DeviceExtendedProperties.TryGetValue("DeviceManufacturer", out deviceManufacturer);
return deviceManufacturer.ToString();
}
}
挨拶