static CoreFoundation() { if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix) { CoreImpl = new CoreFoundationOSX(); } else { CoreImpl = new CoreFoundationWin32(); } }
static void InitializeCoreFoundation() { if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix) { CoreImpl = new CoreFoundationOSX(); } else { CoreImpl = new CoreFoundationWin(); IntPtr CoreFoundation = RequiredWinAPI.GetModuleHandle("CoreFoundation.dll"); kCFAllocatorDefault = RequiredWinAPI.GetProcAddress(CoreFoundation, "kCFAllocatorDefault"); kCFTypeDictionaryKeyCallBacks = RequiredWinAPI.GetProcAddress(CoreFoundation, "kCFTypeDictionaryKeyCallBacks"); kCFTypeDictionaryValueCallBacks = RequiredWinAPI.GetProcAddress(CoreFoundation, "kCFTypeDictionaryValueCallBacks"); kCFBooleanTrue = RequiredWinAPI.GetProcAddress(CoreFoundation, "kCFBooleanTrue"); kCFBooleanFalse = RequiredWinAPI.GetProcAddress(CoreFoundation, "kCFBooleanFalse"); } }
static CoreFoundation() { if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix) { CoreImpl = new CoreFoundationOSX(); } else { List <string> PathBits = new List <string>(); PathBits.Add(Environment.GetEnvironmentVariable("Path")); // Try to add the paths from the registry (they aren't always available on newer iTunes installs though) object RegistrySupportDir = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Apple Inc.\Apple Application Support", "InstallDir", Environment.CurrentDirectory); if (RegistrySupportDir != null) { DirectoryInfo ApplicationSupportDirectory = new DirectoryInfo(RegistrySupportDir.ToString()); if (ApplicationSupportDirectory.Exists) { PathBits.Add(ApplicationSupportDirectory.FullName); } } // Add some guesses as well DirectoryInfo AppleMobileDeviceSupport = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles) + @"\Apple\Mobile Device Support"); if (AppleMobileDeviceSupport.Exists) { PathBits.Add(AppleMobileDeviceSupport.FullName); } DirectoryInfo AppleMobileDeviceSupportX86 = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86) + @"\Apple\Mobile Device Support"); if ((AppleMobileDeviceSupport != AppleMobileDeviceSupportX86) && (AppleMobileDeviceSupportX86.Exists)) { PathBits.Add(AppleMobileDeviceSupportX86.FullName); } // Set the path from all the individual bits Environment.SetEnvironmentVariable("Path", string.Join(";", PathBits)); CoreImpl = new CoreFoundationWin32(); } }
static CoreFoundation() { if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix) { CoreImpl = new CoreFoundationOSX(); } else { List<string> PathBits = new List<string>(); PathBits.Add(Environment.GetEnvironmentVariable("Path")); // Try to add the paths from the registry (they aren't always available on newer iTunes installs though) object RegistrySupportDir = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Apple Inc.\Apple Application Support", "InstallDir", Environment.CurrentDirectory); if (RegistrySupportDir != null) { DirectoryInfo ApplicationSupportDirectory = new DirectoryInfo(RegistrySupportDir.ToString()); if (ApplicationSupportDirectory.Exists) { PathBits.Add(ApplicationSupportDirectory.FullName); } } // Add some guesses as well DirectoryInfo AppleMobileDeviceSupport = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles) + @"\Apple\Mobile Device Support"); if (AppleMobileDeviceSupport.Exists) { PathBits.Add(AppleMobileDeviceSupport.FullName); } DirectoryInfo AppleMobileDeviceSupportX86 = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86) + @"\Apple\Mobile Device Support"); if ((AppleMobileDeviceSupport != AppleMobileDeviceSupportX86) && (AppleMobileDeviceSupportX86.Exists)) { PathBits.Add(AppleMobileDeviceSupportX86.FullName); } // Set the path from all the individual bits Environment.SetEnvironmentVariable("Path", string.Join(";", PathBits)); CoreImpl = new CoreFoundationWin32(); } }