Beispiel #1
0
        public void CameraMaker()
        {
            // since only Canon and Nikon have dictionary key values I assume the others are "placeholder" at the moment !?!
            Assert.NotNull(CGImageProperties.MakerCanonDictionary, "MakerCanonDictionary");
            Assert.NotNull(CGImageProperties.MakerNikonDictionary, "MakerNikonDictionary");

            // iOS 8.3 finally fixed them :)
            if (TestRuntime.CheckiOSSystemVersion(8, 3))
            {
                Assert.NotNull(CGImageProperties.MakerMinoltaDictionary, "MakerMinoltaDictionary");
                Assert.NotNull(CGImageProperties.MakerFujiDictionary, "MakerFujiDictionary");
                Assert.NotNull(CGImageProperties.MakerOlympusDictionary, "MakerOlympusDictionary");
                Assert.NotNull(CGImageProperties.MakerPentaxDictionary, "MakerPentaxDictionary");
                return;
            }

            // documented as new in iOS 4.0 - https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CGImageProperties_Reference/Reference/reference.html
            // but symbols are not available in iOS 5.1.1
            // this test will fail if Apple decide to include them in the future
            IntPtr lib = Dlfcn.dlopen(Constants.ImageIOLibrary, 0);

            try {
                Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyMakerMinoltaDictionary"), Is.EqualTo(IntPtr.Zero), "kCGImagePropertyMakerMinoltaDictionary");
                Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyMakerFujiDictionary"), Is.EqualTo(IntPtr.Zero), "kCGImagePropertyMakerFujiDictionary");
                Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyMakerOlympusDictionary"), Is.EqualTo(IntPtr.Zero), "kCGImagePropertyMakerOlympusDictionary");
                Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyMakerPentaxDictionary"), Is.EqualTo(IntPtr.Zero), "kCGImagePropertyMakerPentaxDictionary");
            }
            finally {
                Dlfcn.dlclose(lib);
            }
        }
        public void Sqlite3()
        {
            var lib = Dlfcn.dlopen("/usr/lib/libsqlite3.dylib", 0);

            Assert.That(lib, Is.Not.EqualTo(IntPtr.Zero), "/usr/lib/libsqlite3.dylib");
            try {
                Assert.That(Dlfcn.dlsym(lib, "sqlite3_bind_int"), Is.Not.EqualTo(IntPtr.Zero), "sqlite3_bind_int");
                // iOS does not have some symbols defined - if that change/fail in the future we'll need to update Mono.Data.Sqlite
                // note: Apple devices (at least iOS and AppleTV) running 10.x have a more recent version of libsqlite which includes _key and _rekey
                var version = TestRuntime.CheckXcodeVersion(8, 0);
                if (version && (Runtime.Arch == Arch.DEVICE))
                {
                    Assert.That(Dlfcn.dlsym(lib, "sqlite3_key"), Is.Not.EqualTo(IntPtr.Zero), "sqlite3_key");
                    Assert.That(Dlfcn.dlsym(lib, "sqlite3_rekey"), Is.Not.EqualTo(IntPtr.Zero), "sqlite3_rekey");
                }
                else
                {
                    Assert.That(Dlfcn.dlsym(lib, "sqlite3_key"), Is.EqualTo(IntPtr.Zero), "sqlite3_key");
                    Assert.That(Dlfcn.dlsym(lib, "sqlite3_rekey"), Is.EqualTo(IntPtr.Zero), "sqlite3_rekey");
                }
                Assert.That(Dlfcn.dlsym(lib, "sqlite3_column_database_name"), Is.EqualTo(IntPtr.Zero), "sqlite3_column_database_name");
                Assert.That(Dlfcn.dlsym(lib, "sqlite3_column_database_name16"), Is.EqualTo(IntPtr.Zero), "sqlite3_column_database_name16");
                Assert.That(Dlfcn.dlsym(lib, "sqlite3_column_origin_name"), Is.EqualTo(IntPtr.Zero), "sqlite3_column_origin_name");
                Assert.That(Dlfcn.dlsym(lib, "sqlite3_column_origin_name16"), Is.EqualTo(IntPtr.Zero), "sqlite3_column_origin_name16");
                Assert.That(Dlfcn.dlsym(lib, "sqlite3_column_table_name"), Is.EqualTo(IntPtr.Zero), "sqlite3_column_table_name");
                Assert.That(Dlfcn.dlsym(lib, "sqlite3_column_table_name16"), Is.EqualTo(IntPtr.Zero), "sqlite3_column_table_name16");
            }
            finally {
                Dlfcn.dlclose(lib);
            }
        }
        static CTBaselineFondID()
        {
            var handle = Libraries.CoreText.Handle;

            Reference = Dlfcn.GetStringConstant(handle, "kCTBaselineReferenceFont");
            Original  = Dlfcn.GetStringConstant(handle, "kCTBaselineOriginalFont");
        }
        static CTFontDescriptorAttributeKey()
        {
            var handle = Libraries.CoreText.Handle;

            Url                = Dlfcn.GetStringConstant(handle, "kCTFontURLAttribute");
            Name               = Dlfcn.GetStringConstant(handle, "kCTFontNameAttribute");
            DisplayName        = Dlfcn.GetStringConstant(handle, "kCTFontDisplayNameAttribute");
            FamilyName         = Dlfcn.GetStringConstant(handle, "kCTFontFamilyNameAttribute");
            StyleName          = Dlfcn.GetStringConstant(handle, "kCTFontStyleNameAttribute");
            Traits             = Dlfcn.GetStringConstant(handle, "kCTFontTraitsAttribute");
            Variation          = Dlfcn.GetStringConstant(handle, "kCTFontVariationAttribute");
            Size               = Dlfcn.GetStringConstant(handle, "kCTFontSizeAttribute");
            Matrix             = Dlfcn.GetStringConstant(handle, "kCTFontMatrixAttribute");
            CascadeList        = Dlfcn.GetStringConstant(handle, "kCTFontCascadeListAttribute");
            CharacterSet       = Dlfcn.GetStringConstant(handle, "kCTFontCharacterSetAttribute");
            Languages          = Dlfcn.GetStringConstant(handle, "kCTFontLanguagesAttribute");
            BaselineAdjust     = Dlfcn.GetStringConstant(handle, "kCTFontBaselineAdjustAttribute");
            MacintoshEncodings = Dlfcn.GetStringConstant(handle, "kCTFontMacintoshEncodingsAttribute");
            Features           = Dlfcn.GetStringConstant(handle, "kCTFontFeaturesAttribute");
            FeatureSettings    = Dlfcn.GetStringConstant(handle, "kCTFontFeatureSettingsAttribute");
            FixedAdvance       = Dlfcn.GetStringConstant(handle, "kCTFontFixedAdvanceAttribute");
            FontOrientation    = Dlfcn.GetStringConstant(handle, "kCTFontOrientationAttribute");
            FontFormat         = Dlfcn.GetStringConstant(handle, "kCTFontFormatAttribute");
            RegistrationScope  = Dlfcn.GetStringConstant(handle, "kCTFontRegistrationScopeAttribute");
            Priority           = Dlfcn.GetStringConstant(handle, "kCTFontPriorityAttribute");
            Enabled            = Dlfcn.GetStringConstant(handle, "kCTFontEnabledAttribute");
        }
Beispiel #5
0
        public void CopyProperties()
        {
            // what we had to answer with 5.2 for http://stackoverflow.com/q/10753108/220643
            IntPtr lib = Dlfcn.dlopen(Constants.ImageIOLibrary, 0);

            try {
                NSString kCGImageSourceShouldCache   = Dlfcn.GetStringConstant(lib, "kCGImageSourceShouldCache");
                NSString kCGImagePropertyPixelWidth  = Dlfcn.GetStringConstant(lib, "kCGImagePropertyPixelWidth");
                NSString kCGImagePropertyPixelHeight = Dlfcn.GetStringConstant(lib, "kCGImagePropertyPixelHeight");

#if MONOMAC
                using (var imageSource = CGImageSource.FromUrl(fileUrl)) {
#else
                using (var imageSource = CGImageSource.FromUrl(NSUrl.FromFilename(filename))) {
#endif
                    using (var dict = new NSMutableDictionary()) {
                        dict [kCGImageSourceShouldCache] = NSNumber.FromBoolean(false);
                        using (var props = imageSource.CopyProperties(dict)) {
                            Assert.Null(props.ValueForKey(kCGImagePropertyPixelWidth), "kCGImagePropertyPixelWidth");
                            Assert.Null(props.ValueForKey(kCGImagePropertyPixelHeight), "kCGImagePropertyPixelHeight");
                            NSNumber n = (NSNumber)props ["FileSize"];
                            // image is "optimized" for devices (and a lot bigger at 10351 bytes ;-)
                            Assert.That((int)n, Is.AtLeast(7318), "FileSize");
                        }
                    }
                }
            }
            finally {
                Dlfcn.dlclose(lib);
            }
        }
            public VnodeMonitor(string path, VnodeMonitorKind vnodeKind, DispatchQueue queue = null)
            {
                if (path == null)
                {
                    throw new ArgumentNullException("path");
                }

                fd = open(path, O_EVTONLY);
                if (fd == -1)
                {
                    throw new IOException("Failure to open the file", Marshal.GetLastWin32Error());
                }
                if (type_vnode == IntPtr.Zero)
                {
                    type_vnode = Dlfcn.dlsym(Libraries.System.Handle, "_dispatch_source_type_vnode");
                }
                this.queue = queue;

                var handle = dispatch_source_create(type_vnode,
                                                    handle: (IntPtr)fd,
                                                    mask:   (IntPtr)vnodeKind,
                                                    queue:  queue == null ? IntPtr.Zero : queue.Handle);

                if (handle != IntPtr.Zero)
                {
                    InitializeHandle(handle);
                }
            }
Beispiel #7
0
        static CVPixelBuffer()
        {
            var handle = Dlfcn.dlopen(Constants.CoreVideoLibrary, 0);

            if (handle == IntPtr.Zero)
            {
                return;
            }
            try {
                PixelFormatTypeKey              = Dlfcn.GetStringConstant(handle, "kCVPixelBufferPixelFormatTypeKey");
                MemoryAllocatorKey              = Dlfcn.GetStringConstant(handle, "kCVPixelBufferMemoryAllocatorKey");
                WidthKey                        = Dlfcn.GetStringConstant(handle, "kCVPixelBufferWidthKey");
                HeightKey                       = Dlfcn.GetStringConstant(handle, "kCVPixelBufferHeightKey");
                ExtendedPixelsLeftKey           = Dlfcn.GetStringConstant(handle, "kCVPixelBufferExtendedPixelsLeftKey");
                ExtendedPixelsTopKey            = Dlfcn.GetStringConstant(handle, "kCVPixelBufferExtendedPixelsTopKey");
                ExtendedPixelsRightKey          = Dlfcn.GetStringConstant(handle, "kCVPixelBufferExtendedPixelsRightKey");
                ExtendedPixelsBottomKey         = Dlfcn.GetStringConstant(handle, "kCVPixelBufferExtendedPixelsBottomKey");
                BytesPerRowAlignmentKey         = Dlfcn.GetStringConstant(handle, "kCVPixelBufferBytesPerRowAlignmentKey");
                CGBitmapContextCompatibilityKey = Dlfcn.GetStringConstant(handle, "kCVPixelBufferCGBitmapContextCompatibilityKey");
                CGImageCompatibilityKey         = Dlfcn.GetStringConstant(handle, "kCVPixelBufferCGImageCompatibilityKey");
                OpenGLCompatibilityKey          = Dlfcn.GetStringConstant(handle, "kCVPixelBufferOpenGLCompatibilityKey");
                IOSurfacePropertiesKey          = Dlfcn.GetStringConstant(handle, "kCVPixelBufferIOSurfacePropertiesKey");
                PlaneAlignmentKey               = Dlfcn.GetStringConstant(handle, "kCVPixelBufferPlaneAlignmentKey");
                CVImageBufferType               = GetTypeID();
                MetalCompatibilityKey           = Dlfcn.GetStringConstant(handle, "kCVPixelBufferMetalCompatibilityKey");
#if !MONOMAC
                OpenGLESCompatibilityKey = Dlfcn.GetStringConstant(handle, "kCVPixelBufferOpenGLESCompatibilityKey");
#endif
            }
            finally {
                Dlfcn.dlclose(handle);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Initializes static members of the <see cref="KSec"/> class.
        /// </summary>
        static KSec()
        {
            IntPtr handle = Dlfcn.dlopen(Constants.SecurityLibrary, 0);

            Assumes.False(handle == IntPtr.Zero);

            try
            {
                AttrApplicationTag = Dlfcn.GetStringConstant(handle, "kSecAttrApplicationTag");
                AttrKeyType        = Dlfcn.GetStringConstant(handle, "kSecAttrKeyType");
                AttrKeySizeInBits  = Dlfcn.GetStringConstant(handle, "kSecAttrKeySizeInBits");
                AttrKeyTypeRSA     = Dlfcn.GetStringConstant(handle, "kSecAttrKeyTypeRSA");
                AttrIsPermanent    = Dlfcn.GetStringConstant(handle, "kSecAttrIsPermanent");
                PublicKeyAttrs     = Dlfcn.GetStringConstant(handle, "kSecPublicKeyAttrs");
                PrivateKeyAttrs    = Dlfcn.GetStringConstant(handle, "kSecPrivateKeyAttrs");
                ClassKey           = Dlfcn.GetStringConstant(handle, "kSecClassKey");
                Class                      = Dlfcn.GetStringConstant(handle, "kSecClass");
                AttrKeyClass               = Dlfcn.GetStringConstant(handle, "kSecAttrKeyClass");
                AttrKeyClassPublic         = Dlfcn.GetStringConstant(handle, "kSecAttrKeyClassPublic");
                AttrKeyClassPrivate        = Dlfcn.GetStringConstant(handle, "kSecAttrKeyClassPrivate");
                ReturnData                 = Dlfcn.GetStringConstant(handle, "kSecReturnData");
                ReturnPersistentRef        = Dlfcn.GetStringConstant(handle, "kSecReturnPersistentRef");
                AttrAccessibleWhenUnlocked = Dlfcn.GetStringConstant(handle, "kSecAttrAccessibleWhenUnlocked");
                AttrAccessible             = Dlfcn.GetStringConstant(handle, "kSecAttrAccessible");
                ReturnRef                  = Dlfcn.GetStringConstant(handle, "kSecReturnRef");
                ValueData                  = Dlfcn.GetStringConstant(handle, "kSecValueData");
            }
            finally
            {
                Dlfcn.dlclose(handle);
            }
        }
        public void FieldExists()
        {
            var failed_fields = new List <string> ();

            Errors = 0;
            int n = 0;

            foreach (var p in AllProperties())
            {
                var f = p.GetCustomAttribute <FieldAttribute> ();
                if (f == null)
                {
                    continue;
                }

                string name = f.SymbolName;
                if (Skip(name))
                {
                    continue;
                }

                string path = FindLibrary(f.LibraryName);
                IntPtr lib  = Dlfcn.dlopen(path, 0);
                if (Dlfcn.GetIndirect(lib, name) == IntPtr.Zero)
                {
                    ReportError("Could not find the field '{0}' in {1}", name, path);
                    failed_fields.Add(name);
                }
                Dlfcn.dlclose(lib);
                n++;
            }
            Assert.AreEqual(0, Errors, "{0} errors found in {1} fields validated: {2}", Errors, n, string.Join(", ", failed_fields));
        }
Beispiel #10
0
        internal static void Init()
        {
            var handle = Libraries.AddressBook.Handle;

            Organization = Dlfcn.GetNSNumber(handle, "kABPersonKindOrganization");
            Person       = Dlfcn.GetNSNumber(handle, "kABPersonKindPerson");
        }
Beispiel #11
0
        internal static void Init()
        {
            var handle = Libraries.AddressBook.Handle;

            Service  = Dlfcn.GetStringConstant(handle, "kABPersonInstantMessageServiceKey");
            Username = Dlfcn.GetStringConstant(handle, "kABPersonInstantMessageUsernameKey");
        }
Beispiel #12
0
            internal override void LoadExternalDependencies(
                Assembly loadedAssembly,
                IReadOnlyList <AssemblyDependency> externalDependencies)
            {
                if (externalDependencies == null)
                {
                    return;
                }

                foreach (var externalDep in externalDependencies)
                {
                    var location = externalDep.Location;

                    if (externalDep.Data != null)
                    {
                        try {
                            Directory.CreateDirectory(tmpDir);
                            location = Path.Combine(
                                tmpDir,
                                Path.GetFileName(externalDep.Location));
                            File.WriteAllBytes(location, externalDep.Data);
                        } catch {
                            continue;
                        }
                    }

                    Dlfcn.dlopen(location, 0);

                    if (externalDep.Data != null)
                    {
                        File.Delete(location);
                    }
                }
            }
Beispiel #13
0
        static CFAllocator()
        {
            var handle = Dlfcn.dlopen(Constants.CoreFoundationLibrary, 0);

            null_ptr = Dlfcn.GetIntPtr(handle, "kCFAllocatorNull");
            Dlfcn.dlclose(handle);
        }
Beispiel #14
0
        public void Exif43Fields()
        {
            // documented as new in iOS 4.3 - https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CGImageProperties_Reference/Reference/reference.html
            IntPtr lib = Dlfcn.dlopen(Constants.ImageIOLibrary, 0);

            try {
                if (TestRuntime.CheckSystemAndSDKVersion(6, 0))
                {
                    // symbols are available in iOS 6.0 beta 1
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifCameraOwnerName"), Is.Not.EqualTo(IntPtr.Zero), "kCGImagePropertyExifCameraOwnerName");
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifBodySerialNumber"), Is.Not.EqualTo(IntPtr.Zero), "kCGImagePropertyExifBodySerialNumber");
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifLensSpecification"), Is.Not.EqualTo(IntPtr.Zero), "kCGImagePropertyExifLensSpecification");
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifLensMake"), Is.Not.EqualTo(IntPtr.Zero), "kCGImagePropertyExifLensMake");
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifLensModel"), Is.Not.EqualTo(IntPtr.Zero), "kCGImagePropertyExifLensModel");
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifLensSerialNumber"), Is.Not.EqualTo(IntPtr.Zero), "kCGImagePropertyExifLensSerialNumber");
                }
                else
                {
                    // but symbols are not available in iOS 5.1.1
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifCameraOwnerName"), Is.EqualTo(IntPtr.Zero), "kCGImagePropertyExifCameraOwnerName");
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifBodySerialNumber"), Is.EqualTo(IntPtr.Zero), "kCGImagePropertyExifBodySerialNumber");
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifLensSpecification"), Is.EqualTo(IntPtr.Zero), "kCGImagePropertyExifLensSpecification");
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifLensMake"), Is.EqualTo(IntPtr.Zero), "kCGImagePropertyExifLensMake");
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifLensModel"), Is.EqualTo(IntPtr.Zero), "kCGImagePropertyExifLensModel");
                    Assert.That(Dlfcn.dlsym(lib, "kCGImagePropertyExifLensSerialNumber"), Is.EqualTo(IntPtr.Zero), "kCGImagePropertyExifLensSerialNumber");
                }
            }
            finally {
                Dlfcn.dlclose(lib);
            }
        }
Beispiel #15
0
        static NSHttpCookie()
        {
            var handle = Dlfcn.dlopen(Constants.FoundationLibrary, 0);

            if (handle == IntPtr.Zero)
            {
                return;
            }

            try {
                KeyName       = Dlfcn.GetStringConstant(handle, "NSHTTPCookieName");
                KeyValue      = Dlfcn.GetStringConstant(handle, "NSHTTPCookieValue");
                KeyOriginURL  = Dlfcn.GetStringConstant(handle, "NSHTTPCookieOriginURL");
                KeyVersion    = Dlfcn.GetStringConstant(handle, "NSHTTPCookieVersion");
                KeyDomain     = Dlfcn.GetStringConstant(handle, "NSHTTPCookieDomain");
                KeyPath       = Dlfcn.GetStringConstant(handle, "NSHTTPCookiePath");
                KeySecure     = Dlfcn.GetStringConstant(handle, "NSHTTPCookieSecure");
                KeyExpires    = Dlfcn.GetStringConstant(handle, "NSHTTPCookieExpires");
                KeyComment    = Dlfcn.GetStringConstant(handle, "NSHTTPCookieComment");
                KeyCommentURL = Dlfcn.GetStringConstant(handle, "NSHTTPCookieCommentURL");
                KeyDiscard    = Dlfcn.GetStringConstant(handle, "NSHTTPCookieDiscard");
                KeyMaximumAge = Dlfcn.GetStringConstant(handle, "NSHTTPCookieMaximumAge");
                KeyPort       = Dlfcn.GetStringConstant(handle, "NSHTTPCookiePort");
            } finally {
                Dlfcn.dlclose(handle);
            }
        }
        static CVImageBuffer()
        {
            var handle = Dlfcn.dlopen(Constants.CoreVideoLibrary, 0);

            if (handle == IntPtr.Zero)
            {
                return;
            }
            try
            {
                CGColorSpaceKey                      = Dlfcn.GetStringConstant(handle, "kCVImageBufferCGColorSpaceKey");
                GammaLevelKey                        = Dlfcn.GetStringConstant(handle, "kCVImageBufferGammaLevelKey");
                CleanApertureKey                     = Dlfcn.GetStringConstant(handle, "kCVImageBufferCleanApertureKey");
                PreferredCleanApertureKey            = Dlfcn.GetStringConstant(handle, "kCVImageBufferPreferredCleanApertureKey");
                CleanApertureWidthKey                = Dlfcn.GetStringConstant(handle, "kCVImageBufferCleanApertureWidthKey");
                CleanApertureHeightKey               = Dlfcn.GetStringConstant(handle, "kCVImageBufferCleanApertureHeightKey");
                CleanApertureHorizontalOffsetKey     = Dlfcn.GetStringConstant(handle, "kCVImageBufferCleanApertureHorizontalOffsetKey");
                CleanApertureVerticalOffsetKey       = Dlfcn.GetStringConstant(handle, "kCVImageBufferCleanApertureVerticalOffsetKey");
                FieldCountKey                        = Dlfcn.GetStringConstant(handle, "kCVImageBufferFieldCountKey");
                FieldDetailKey                       = Dlfcn.GetStringConstant(handle, "kCVImageBufferFieldDetailKey");
                FieldDetailTemporalTopFirst          = Dlfcn.GetStringConstant(handle, "kCVImageBufferFieldDetailTemporalTopFirst");
                FieldDetailTemporalBottomFirst       = Dlfcn.GetStringConstant(handle, "kCVImageBufferFieldDetailTemporalBottomFirst");
                FieldDetailSpatialFirstLineEarly     = Dlfcn.GetStringConstant(handle, "kCVImageBufferFieldDetailSpatialFirstLineEarly");
                FieldDetailSpatialFirstLineLate      = Dlfcn.GetStringConstant(handle, "kCVImageBufferFieldDetailSpatialFirstLineLate");
                PixelAspectRatioKey                  = Dlfcn.GetStringConstant(handle, "kCVImageBufferPixelAspectRatioKey");
                PixelAspectRatioHorizontalSpacingKey = Dlfcn.GetStringConstant(handle, "kCVImageBufferPixelAspectRatioHorizontalSpacingKey");
                PixelAspectRatioVerticalSpacingKey   = Dlfcn.GetStringConstant(handle, "kCVImageBufferPixelAspectRatioVerticalSpacingKey");
                DisplayDimensionsKey                 = Dlfcn.GetStringConstant(handle, "kCVImageBufferDisplayDimensionsKey");
                DisplayWidthKey                      = Dlfcn.GetStringConstant(handle, "kCVImageBufferDisplayWidthKey");
                DisplayHeightKey                     = Dlfcn.GetStringConstant(handle, "kCVImageBufferDisplayHeightKey");
                YCbCrMatrixKey                       = Dlfcn.GetStringConstant(handle, "kCVImageBufferYCbCrMatrixKey");
                YCbCrMatrix_ITU_R_709_2              = Dlfcn.GetStringConstant(handle, "kCVImageBufferYCbCrMatrix_ITU_R_709_2");
                YCbCrMatrix_ITU_R_601_4              = Dlfcn.GetStringConstant(handle, "kCVImageBufferYCbCrMatrix_ITU_R_601_4");
                YCbCrMatrix_SMPTE_240M_1995          = Dlfcn.GetStringConstant(handle, "kCVImageBufferYCbCrMatrix_SMPTE_240M_1995");

                ChromaSubsamplingKey  = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaSubsamplingKey");
                ChromaSubsampling_420 = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaSubsampling_420");
                ChromaSubsampling_422 = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaSubsampling_422");
                ChromaSubsampling_411 = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaSubsampling_411");

                TransferFunctionKey              = Dlfcn.GetStringConstant(handle, "kCVImageBufferTransferFunctionKey");
                TransferFunction_ITU_R_709_2     = Dlfcn.GetStringConstant(handle, "kCVImageBufferTransferFunction_ITU_R_709_2");
                TransferFunction_SMPTE_240M_1995 = Dlfcn.GetStringConstant(handle, "kCVImageBufferTransferFunction_SMPTE_240M_1995");
                TransferFunction_UseGamma        = Dlfcn.GetStringConstant(handle, "kCVImageBufferTransferFunction_UseGamma");

                ChromaLocationTopFieldKey    = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaLocationTopFieldKey");
                ChromaLocationBottomFieldKey = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaLocationBottomFieldKey");
                ChromaLocation_Left          = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaLocation_Left");
                ChromaLocation_Center        = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaLocation_Center");
                ChromaLocation_TopLeft       = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaLocation_TopLeft");
                ChromaLocation_Top           = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaLocation_Top");
                ChromaLocation_BottomLeft    = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaLocation_BottomLeft");
                ChromaLocation_Bottom        = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaLocation_Bottom");
                ChromaLocation_DV420         = Dlfcn.GetStringConstant(handle, "kCVImageBufferChromaLocation_DV420");
            }
            finally
            {
                Dlfcn.dlclose(handle);
            }
        }
Beispiel #17
0
        static CFDictionary()
        {
            var lib = Libraries.CoreFoundation.Handle;

            KeyCallbacks   = Dlfcn.GetIndirect(lib, "kCFTypeDictionaryKeyCallBacks");
            ValueCallbacks = Dlfcn.GetIndirect(lib, "kCFTypeDictionaryValueCallBacks");
        }
Beispiel #18
0
        static CTFontNameKeyId()
        {
            var handle = Dlfcn.dlopen(Constants.CoreTextLibrary, 0);

            if (handle == IntPtr.Zero)
            {
                return;
            }
            try {
                Copyright     = Dlfcn.GetStringConstant(handle, "kCTFontCopyrightNameKey");
                Family        = Dlfcn.GetStringConstant(handle, "kCTFontFamilyNameKey");
                SubFamily     = Dlfcn.GetStringConstant(handle, "kCTFontSubFamilyNameKey");
                Style         = Dlfcn.GetStringConstant(handle, "kCTFontStyleNameKey");
                Unique        = Dlfcn.GetStringConstant(handle, "kCTFontUniqueNameKey");
                Full          = Dlfcn.GetStringConstant(handle, "kCTFontFullNameKey");
                Version       = Dlfcn.GetStringConstant(handle, "kCTFontVersionNameKey");
                PostScript    = Dlfcn.GetStringConstant(handle, "kCTFontPostScriptNameKey");
                Trademark     = Dlfcn.GetStringConstant(handle, "kCTFontTrademarkNameKey");
                Manufacturer  = Dlfcn.GetStringConstant(handle, "kCTFontManufacturerNameKey");
                Designer      = Dlfcn.GetStringConstant(handle, "kCTFontDesignerNameKey");
                Description   = Dlfcn.GetStringConstant(handle, "kCTFontDescriptionNameKey");
                VendorUrl     = Dlfcn.GetStringConstant(handle, "kCTFontVendorURLNameKey");
                DesignerUrl   = Dlfcn.GetStringConstant(handle, "kCTFontDesignerURLNameKey");
                License       = Dlfcn.GetStringConstant(handle, "kCTFontLicenseNameKey");
                LicenseUrl    = Dlfcn.GetStringConstant(handle, "kCTFontLicenseURLNameKey");
                SampleText    = Dlfcn.GetStringConstant(handle, "kCTFontSampleTextNameKey");
                PostscriptCid = Dlfcn.GetStringConstant(handle, "kCTFontPostScriptCIDNameKey");
            }
            finally {
                Dlfcn.dlclose(handle);
            }
        }
Beispiel #19
0
        static CGPDFInfo()
        {
            IntPtr h = Dlfcn.dlopen(Constants.CoreGraphicsLibrary, 0);

            try {
                kCGPDFContextTitle               = Dlfcn.GetIndirect(h, "kCGPDFContextTitle");
                kCGPDFContextAuthor              = Dlfcn.GetIndirect(h, "kCGPDFContextAuthor");
                kCGPDFContextSubject             = Dlfcn.GetIndirect(h, "kCGPDFContextSubject");
                kCGPDFContextKeywords            = Dlfcn.GetIndirect(h, "kCGPDFContextKeywords");
                kCGPDFContextCreator             = Dlfcn.GetIndirect(h, "kCGPDFContextCreator");
                kCGPDFContextOwnerPassword       = Dlfcn.GetIndirect(h, "kCGPDFContextOwnerPassword");
                kCGPDFContextUserPassword        = Dlfcn.GetIndirect(h, "kCGPDFContextUserPassword");
                kCGPDFContextEncryptionKeyLength = Dlfcn.GetIndirect(h, "kCGPDFContextEncryptionKeyLength");
                kCGPDFContextAllowsPrinting      = Dlfcn.GetIndirect(h, "kCGPDFContextAllowsPrinting");
                kCGPDFContextAllowsCopying       = Dlfcn.GetIndirect(h, "kCGPDFContextAllowsCopying");
#if false
                kCGPDFContextOutputIntent        = Dlfcn.GetIndirect(h, "kCGPDFContextOutputIntent");
                kCGPDFXOutputIntentSubtype       = Dlfcn.GetIndirect(h, "kCGPDFXOutputIntentSubtype");
                kCGPDFXOutputConditionIdentifier = Dlfcn.GetIndirect(h, "kCGPDFXOutputConditionIdentifier");
                kCGPDFXOutputCondition           = Dlfcn.GetIndirect(h, "kCGPDFXOutputCondition");
                kCGPDFXRegistryName             = Dlfcn.GetIndirect(h, "kCGPDFXRegistryName");
                kCGPDFXInfo                     = Dlfcn.GetIndirect(h, "kCGPDFXInfo");
                kCGPDFXDestinationOutputProfile = Dlfcn.GetIndirect(h, "kCGPDFXDestinationOutputProfile");
                kCGPDFContextOutputIntents      = Dlfcn.GetIndirect(h, "kCGPDFContextOutputIntents");
#endif
            } finally {
                Dlfcn.dlclose(h);
            }
        }
Beispiel #20
0
        public Ventriloquist()
        {
            // Load the dynamic library for aggregating audio output devices
            var libPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "xamspeech.dylib");

            Dlfcn.dlopen(libPath, 0);

            // Esure paths exist
            if (!Directory.Exists(audiopath))
            {
                Directory.CreateDirectory(audiopath);
            }
            //Console.WriteLine (appsupportpath);
            //if(!Directory.Exists(appsupportpath)) {
            //	Directory.CreateDirectory (appsupportpath);
            //}
            config = Config.GetInstance();
            config.PropertyChanged += async(object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName.Equals("localonly"))
                {
                    server.Stop();
                    foreach (var socket in allSockets)
                    {
                        try {
                            socket.Close();
                        } catch (Exception ex) {
                        }
                    }
                    websocketserver.ListenerSocket.Close();
                    websocketserver.Dispose();
                    InitHTTPServer();
                }
            };
        }
        static CMTimeRange()
        {
            var lib = Dlfcn.dlopen(Constants.CoreMediaLibrary, 0);

            if (lib != IntPtr.Zero)
            {
                try {
                    var retZero = Dlfcn.dlsym(lib, "kCMTimeRangeZero");
                    Zero = (CMTimeRange)Marshal.PtrToStructure(retZero, typeof(CMTimeRange));

                    var retInvalid = Dlfcn.dlsym(lib, "kCMTimeRangeInvalid");
#if !XAMCORE_3_0
                    Invalid = (CMTimeRange)Marshal.PtrToStructure(retInvalid, typeof(CMTimeRange));
#endif
                    InvalidRange = (CMTimeRange)Marshal.PtrToStructure(retInvalid, typeof(CMTimeRange));

                    var retMappingInvalid = Dlfcn.dlsym(lib, "kCMTimeMappingInvalid");
                    if (retMappingInvalid != IntPtr.Zero)
                    {
                        InvalidMapping = (CMTimeRange)Marshal.PtrToStructure(retMappingInvalid, typeof(CMTimeRange));
                    }

                    TimeMappingSourceKey = Dlfcn.GetStringConstant(lib, "kCMTimeMappingSourceKey");
                    TimeMappingTargetKey = Dlfcn.GetStringConstant(lib, "kCMTimeMappingTargetKey");
                } finally {
                    Dlfcn.dlclose(lib);
                }
            }
        }
        static EAGLColorFormat()
        {
            var handle = Libraries.OpenGLES.Handle;

            RGB565 = Dlfcn.GetStringConstant(handle, "kEAGLColorFormatRGB565");
            RGBA8  = Dlfcn.GetStringConstant(handle, "kEAGLColorFormatRGBA8");
        }
Beispiel #23
0
        internal static void Init()
        {
            var handle = Libraries.AddressBook.Handle;

            Name = Dlfcn.GetInt32(handle, "kABSourceNameProperty");
            Type = Dlfcn.GetInt32(handle, "kABSourceTypeProperty");
        }
Beispiel #24
0
        static CFHTTPMessage()
        {
            var handle = Dlfcn.dlopen(Constants.CFNetworkLibrary, 0);

            if (handle == IntPtr.Zero)
            {
                throw new InvalidOperationException();
            }

            try {
                _HTTPVersion1_0 = GetStringConstant(handle, "kCFHTTPVersion1_0");
                _HTTPVersion1_1 = GetStringConstant(handle, "kCFHTTPVersion1_1");

                _AuthenticationSchemeBasic = GetStringConstant(
                    handle, "kCFHTTPAuthenticationSchemeBasic");
                _AuthenticationSchemeNegotiate = GetStringConstant(
                    handle, "kCFHTTPAuthenticationSchemeNegotiate");
                _AuthenticationSchemeNTLM = GetStringConstant(
                    handle, "kCFHTTPAuthenticationSchemeNTLM");
                _AuthenticationSchemeDigest = GetStringConstant(
                    handle, "kCFHTTPAuthenticationSchemeDigest");

                _AuthenticationUsername = GetStringConstant(
                    handle, "kCFHTTPAuthenticationUsername");
                _AuthenticationPassword = GetStringConstant(
                    handle, "kCFHTTPAuthenticationPassword");
                _AuthenticationAccountDomain = GetStringConstant(
                    handle, "kCFHTTPAuthenticationAccountDomain");
            } finally {
                Dlfcn.dlclose(handle);
            }
        }
Beispiel #25
0
        static CFHTTPStream()
        {
            var handle = Dlfcn.dlopen(Constants.CFNetworkLibrary, 0);

            if (handle == IntPtr.Zero)
            {
                throw new InvalidOperationException();
            }

            try {
                _AttemptPersistentConnection = GetStringConstant(
                    handle, "kCFStreamPropertyHTTPAttemptPersistentConnection");
                _FinalURL = GetStringConstant(
                    handle, "kCFStreamPropertyHTTPFinalURL");
                _FinalRequest = GetStringConstant(
                    handle, "kCFStreamPropertyHTTPFinalRequest");
                _Proxy = GetStringConstant(
                    handle, "kCFStreamPropertyHTTPProxy");
                _RequestBytesWrittenCount = GetStringConstant(
                    handle, "kCFStreamPropertyHTTPRequestBytesWrittenCount");
                _ResponseHeader = GetStringConstant(
                    handle, "kCFStreamPropertyHTTPResponseHeader");
                _ShouldAutoredirect = GetStringConstant(
                    handle, "kCFStreamPropertyHTTPShouldAutoredirect");
            } finally {
                Dlfcn.dlclose(handle);
            }
        }
Beispiel #26
0
        internal static void Init()
        {
            var handle = Dlfcn.dlopen(Constants.AddressBookLibrary, 0);

            if (handle == IntPtr.Zero)
            {
                return;
            }
            try {
                Assistant = Dlfcn.GetStringConstant(handle, "kABPersonAssistantLabel");
                Brother   = Dlfcn.GetStringConstant(handle, "kABPersonBrotherLabel");
                Child     = Dlfcn.GetStringConstant(handle, "kABPersonChildLabel");
                Father    = Dlfcn.GetStringConstant(handle, "kABPersonFatherLabel");
                Friend    = Dlfcn.GetStringConstant(handle, "kABPersonFriendLabel");
                Manager   = Dlfcn.GetStringConstant(handle, "kABPersonManagerLabel");
                Mother    = Dlfcn.GetStringConstant(handle, "kABPersonMotherLabel");
                Parent    = Dlfcn.GetStringConstant(handle, "kABPersonParentLabel");
                Partner   = Dlfcn.GetStringConstant(handle, "kABPersonPartnerLabel");
                Sister    = Dlfcn.GetStringConstant(handle, "kABPersonSisterLabel");
                Spouse    = Dlfcn.GetStringConstant(handle, "kABPersonSpouseLabel");
            }
            finally {
                Dlfcn.dlclose(handle);
            }
        }
        private PlatformPerformance()
        {
            var handle = Dlfcn.dlopen("/usr/lib/libSystem.dylib", 0);

            self = Dlfcn.GetIntPtr(handle, "mach_task_self_");
            Dlfcn.dlclose(handle);
        }
        public SparkleController() : base()
        {
            using (var a = new NSAutoreleasePool())
            {
                string content_path =
                    Directory.GetParent(System.AppDomain.CurrentDomain.BaseDirectory).ToString();

                string app_path   = Directory.GetParent(content_path).ToString();
                string growl_path = Path.Combine(app_path, "Frameworks", "Growl.framework", "Growl");

                // Needed for Growl
                Dlfcn.dlopen(growl_path, 0);
                NSApplication.Init();
            }


            // Let's use the bundled git first
            SparkleLib.Git.SparkleGit.Path =
                Path.Combine(NSBundle.MainBundle.ResourcePath,
                             "git", "libexec", "git-core", "git");

            SparkleLib.Git.SparkleGit.ExecPath =
                Path.Combine(NSBundle.MainBundle.ResourcePath,
                             "git", "libexec", "git-core");
        }
Beispiel #29
0
        internal static void Init()
        {
            var handle = Libraries.AddressBook.Handle;

            Address            = Dlfcn.GetInt32(handle, "kABPersonAddressProperty");
            Birthday           = Dlfcn.GetInt32(handle, "kABPersonBirthdayProperty");
            CreationDate       = Dlfcn.GetInt32(handle, "kABPersonCreationDateProperty");
            Date               = Dlfcn.GetInt32(handle, "kABPersonDateProperty");
            Department         = Dlfcn.GetInt32(handle, "kABPersonDepartmentProperty");
            Email              = Dlfcn.GetInt32(handle, "kABPersonEmailProperty");
            FirstName          = Dlfcn.GetInt32(handle, "kABPersonFirstNameProperty");
            FirstNamePhonetic  = Dlfcn.GetInt32(handle, "kABPersonFirstNamePhoneticProperty");
            InstantMessage     = Dlfcn.GetInt32(handle, "kABPersonInstantMessageProperty");
            JobTitle           = Dlfcn.GetInt32(handle, "kABPersonJobTitleProperty");
            Kind               = Dlfcn.GetInt32(handle, "kABPersonKindProperty");
            LastName           = Dlfcn.GetInt32(handle, "kABPersonLastNameProperty");
            LastNamePhonetic   = Dlfcn.GetInt32(handle, "kABPersonLastNamePhoneticProperty");
            MiddleName         = Dlfcn.GetInt32(handle, "kABPersonMiddleNameProperty");
            MiddleNamePhonetic = Dlfcn.GetInt32(handle, "kABPersonMiddleNamePhoneticProperty");
            ModificationDate   = Dlfcn.GetInt32(handle, "kABPersonModificationDateProperty");
            Nickname           = Dlfcn.GetInt32(handle, "kABPersonNicknameProperty");
            Note               = Dlfcn.GetInt32(handle, "kABPersonNoteProperty");
            Organization       = Dlfcn.GetInt32(handle, "kABPersonOrganizationProperty");
            Phone              = Dlfcn.GetInt32(handle, "kABPersonPhoneProperty");
            Prefix             = Dlfcn.GetInt32(handle, "kABPersonPrefixProperty");
            RelatedNames       = Dlfcn.GetInt32(handle, "kABPersonRelatedNamesProperty");
            Suffix             = Dlfcn.GetInt32(handle, "kABPersonSuffixProperty");
            Url           = Dlfcn.GetInt32(handle, "kABPersonURLProperty");
            SocialProfile = Dlfcn.GetInt32(handle, "kABPersonSocialProfileProperty");
        }
Beispiel #30
0
        static CTStringAttributeKey()
        {
            var handle = Libraries.CoreText.Handle;

            Font = Dlfcn.GetStringConstant(handle, "kCTFontAttributeName");
            ForegroundColorFromContext = Dlfcn.GetStringConstant(handle, "kCTForegroundColorFromContextAttributeName");
            KerningAdjustment          = Dlfcn.GetStringConstant(handle, "kCTKernAttributeName");
            LigatureFormation          = Dlfcn.GetStringConstant(handle, "kCTLigatureAttributeName");
            ForegroundColor            = Dlfcn.GetStringConstant(handle, "kCTForegroundColorAttributeName");
            BackgroundColor            = Dlfcn.GetStringConstant(handle, "kCTBackgroundColorAttributeName");
            ParagraphStyle             = Dlfcn.GetStringConstant(handle, "kCTParagraphStyleAttributeName");
            StrokeWidth               = Dlfcn.GetStringConstant(handle, "kCTStrokeWidthAttributeName");
            StrokeColor               = Dlfcn.GetStringConstant(handle, "kCTStrokeColorAttributeName");
            UnderlineStyle            = Dlfcn.GetStringConstant(handle, "kCTUnderlineStyleAttributeName");
            Superscript               = Dlfcn.GetStringConstant(handle, "kCTSuperscriptAttributeName");
            UnderlineColor            = Dlfcn.GetStringConstant(handle, "kCTUnderlineColorAttributeName");
            VerticalForms             = Dlfcn.GetStringConstant(handle, "kCTVerticalFormsAttributeName");
            HorizontalInVerticalForms = Dlfcn.GetStringConstant(handle, "kCTHorizontalInVerticalFormsAttributeName");
            GlyphInfo      = Dlfcn.GetStringConstant(handle, "kCTGlyphInfoAttributeName");
            CharacterShape = Dlfcn.GetStringConstant(handle, "kCTCharacterShapeAttributeName");
            RunDelegate    = Dlfcn.GetStringConstant(handle, "kCTRunDelegateAttributeName");
            BaselineOffset = Dlfcn.GetStringConstant(handle, "kCTBaselineOffsetAttributeName");

#if !MONOMAC
            BaselineClass         = Dlfcn.GetStringConstant(handle, "kCTBaselineClassAttributeName");
            BaselineInfo          = Dlfcn.GetStringConstant(handle, "kCTBaselineInfoAttributeName");
            BaselineReferenceInfo = Dlfcn.GetStringConstant(handle, "kCTBaselineReferenceInfoAttributeName");
            WritingDirection      = Dlfcn.GetStringConstant(handle, "kCTWritingDirectionAttributeName");
#endif
        }