/// <summary> /// Gets the paradox SDK dir. /// </summary> /// <returns></returns> private static string FindParadoxSdkDir() { // TODO: Maybe move it in some common class somewhere? (in this case it would be included with "Add as link" in VSPackage) var paradoxSdkDir = Environment.GetEnvironmentVariable("SiliconStudioParadoxDir"); // Check if it is a dev directory if (File.Exists(Path.Combine(paradoxSdkDir, "build\\Paradox.sln"))) { return(paradoxSdkDir); } // Check if we are in a root directory with store/packages facilities if (NugetStore.IsStoreDirectory(paradoxSdkDir)) { var store = new NugetStore(paradoxSdkDir) { DefaultPackageId = "Paradox" }; var paradoxPackage = store.GetLatestPackageInstalled(store.DefaultPackageId); if (paradoxPackage == null) { return(null); } var packageDirectory = store.PathResolver.GetPackageDirectory(paradoxPackage); return(Path.Combine(paradoxSdkDir, NugetStore.DefaultGamePackagesDirectory, packageDirectory)); } return(null); }
/// <summary> /// Gets the xenko SDK dir. /// </summary> /// <returns></returns> private static PackageInfo FindXenkoSdkDir() { // Resolve the sdk version to load from the solution's package var packageInfo = new PackageInfo { ExpectedVersion = PackageSessionHelper.GetPackageVersion(solution) }; // TODO: Maybe move it in some common class somewhere? (in this case it would be included with "Add as link" in VSPackage) var xenkoSdkDir = Environment.GetEnvironmentVariable("SiliconStudioXenkoDir"); // Failed to locate xenko if (xenkoSdkDir == null) { return(packageInfo); } // If we are in a dev directory, assume we have the right version if (File.Exists(Path.Combine(xenkoSdkDir, "build\\Xenko.sln"))) { packageInfo.SdkPath = xenkoSdkDir; packageInfo.LoadedVersion = packageInfo.ExpectedVersion; return(packageInfo); } // Check if we are in a root directory with store/packages facilities if (NugetStore.IsStoreDirectory(xenkoSdkDir)) { var store = new NugetStore(xenkoSdkDir); IPackage xenkoPackage = null; // Try to find the package with the expected version if (packageInfo.ExpectedVersion != null && packageInfo.ExpectedVersion >= MinimumVersion) { xenkoPackage = store.GetPackagesInstalled(store.MainPackageIds).FirstOrDefault(package => GetVersion(package) == packageInfo.ExpectedVersion); } // If the expected version is not found, get the latest package if (xenkoPackage == null) { xenkoPackage = store.GetLatestPackageInstalled(store.MainPackageIds); } // If no package was found, return no sdk path if (xenkoPackage == null) { return(packageInfo); } // Return the loaded version and the sdk path var packageDirectory = store.PathResolver.GetPackageDirectory(xenkoPackage); packageInfo.LoadedVersion = GetVersion(xenkoPackage); packageInfo.SdkPath = Path.Combine(xenkoSdkDir, store.RepositoryPath, packageDirectory); } return(packageInfo); }