/// <summary> /// Gets the "other" SDL version information. /// </summary> /// <returns>The other SDL version data, including a download URL.</returns> internal SDLDiskImageInfo GetOtherSDLVersionInfo() { var otherVersion = SDLVersion.Unknown; var otherVersionNumber = string.Empty; switch (Version) { case SDLVersion.SDL: otherVersion = SDLVersion.SDL2; otherVersionNumber = FallbackSDL2Version; break; case SDLVersion.SDL2: otherVersion = SDLVersion.SDL; otherVersionNumber = FallbackSDLVersion; break; default: break; } var otherSDLVersionInfo = new SDLDiskImageInfo(); if (otherVersion != SDLVersion.Unknown) { var downloadPath = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DownloadsDirectory, NSSearchPathDomain.All)?.FirstOrDefault(); var otherVersionFileName = $"{otherVersion}-{otherVersionNumber}{DiskImageFileExtension}"; otherSDLVersionInfo = new SDLDiskImageInfo(otherVersion, otherVersionNumber, downloadPath?.Append(otherVersionFileName, isDirectory: false)?.Path) { DownloadUrl = new Uri($"https://www.libsdl.org/release/{otherVersionFileName}", UriKind.Absolute) }; } return(otherSDLVersionInfo); }
private static SDLDiskImageInfo GetIncludedSDLVersion() { var sdlVersionInfo = new SDLDiskImageInfo(); var sdlImageResourcePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "jzIntv/Mac/bin"); if (Directory.Exists(sdlImageResourcePath)) { var includedSDLDiskImages = PathUtils.EnumerateFilesWithPattern(sdlImageResourcePath, DiskImageFileExtension); if (includedSDLDiskImages.Count() == 1) { var includedSDLDiskImage = includedSDLDiskImages.First(); var fileName = Path.GetFileNameWithoutExtension(includedSDLDiskImage); var fileNameParts = fileName.Split('-'); var sdlVersion = SDLVersion.Unknown; if ((fileNameParts.Length > 1) && Enum.TryParse(fileNameParts[0], out sdlVersion)) { sdlVersionInfo = new SDLDiskImageInfo(sdlVersion, fileNameParts[1], includedSDLDiskImage); } } } return(sdlVersionInfo); }
/// <summary> /// Initializes a new instance of the <see cref="InstallSDLTaskData"/> class. /// </summary> /// <param name="task">The installation task.</param> /// <param name="diskImageInfo">Description of the SDL disk image.</param> internal InstallSDLTaskData(AsyncTaskWithProgress task, SDLDiskImageInfo diskImageInfo) : base(task) { DiskImageInfo = diskImageInfo; }