[Xamarin.MacDev] Add methods to map between iOS and macOS versions for Mac Catalyst. (#88)

This commit is contained in:
Rolf Bjarne Kvinge 2021-02-11 16:30:38 +01:00 коммит произвёл GitHub
Родитель 02d6d05be3
Коммит a3bb12c542
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 37 добавлений и 0 удалений

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

@ -159,6 +159,43 @@ namespace Xamarin.MacDev
return Path.Combine (GetSdkPath (version), "SDKSettings.plist");
}
Dictionary<string, string> catalyst_version_map_ios_to_macos;
Dictionary<string, string> catalyst_version_map_macos_to_ios;
void LoadCatalystVersionMaps (string version)
{
if (catalyst_version_map_ios_to_macos != null && catalyst_version_map_macos_to_ios != null)
return;
catalyst_version_map_ios_to_macos = new Dictionary<string, string> ();
catalyst_version_map_macos_to_ios = new Dictionary<string, string> ();
var fn = GetSdkPlistFilename (version);
var plist = PDictionary.FromFile (fn);
if (plist.TryGetValue ("VersionMap", out PDictionary versionMap)) {
if (versionMap.TryGetValue ("iOSMac_macOS", out PDictionary versionMapiOSToMac)) {
foreach (var kvp in versionMapiOSToMac)
catalyst_version_map_ios_to_macos [kvp.Key] = ((PString) kvp.Value).Value;
}
if (versionMap.TryGetValue ("macOS_iOSMac", out PDictionary versionMapMacToiOS)) {
foreach (var kvp in versionMapMacToiOS)
catalyst_version_map_macos_to_ios [kvp.Key] = ((PString) kvp.Value).Value;
}
}
}
public Dictionary<string, string> GetCatalystVersionMap_iOS_to_Mac (string version)
{
LoadCatalystVersionMaps (version);
return catalyst_version_map_ios_to_macos;
}
public Dictionary<string, string> GetCatalystVersionMap_Mac_to_iOS (string version)
{
LoadCatalystVersionMaps (version);
return catalyst_version_map_macos_to_ios;
}
bool IAppleSdk.SdkIsInstalled (IAppleSdkVersion version, bool isSimulator)
{
return SdkIsInstalled ((AppleSdkVersion) version);