コード例 #1
0
        internal static void IORegistryEntrySetCFProperty(IOKitObject entry, string propertyName, bool property)
        {
            var    handle  = Dlfcn.dlopen(Constants.CoreFoundationLibrary, 0);
            IntPtr macbool = Dlfcn.GetIntPtr(handle, property ? "kCFBooleanTrue" : "kCFBooleanFalse");

            IORegistryEntrySetCFProperty((IntPtr)entry, ((CFString)propertyName).Handle, macbool);
        }
コード例 #2
0
        internal static IOKitObject IOServiceOpen(IOKitObject service)
        {
            IntPtr connect;

            CheckResult(IOServiceOpen(service, mach_task_self(), 0, out connect));

            return(connect);
        }
コード例 #3
0
        public IOKitMotionSensor()
        {
            var matchingDictionary = IOKit.IOServiceMatching("SMCMotionSensor");

            using (var iterator = IOKit.IOServiceGetMatchingServices(IOKit.IOMasterPort(), matchingDictionary)) {
                using (var service = IOKit.IOIteratorNext(iterator)) {
                    connect = IOKit.IOServiceOpen(service);
                }
            }
        }
コード例 #4
0
        public IOKitMotionSensor()
        {
            var matchingDictionary = IOKit.IOServiceMatching ("SMCMotionSensor");

            using (var iterator = IOKit.IOServiceGetMatchingServices(IOKit.IOMasterPort (), matchingDictionary)) {
                using (var service = IOKit.IOIteratorNext (iterator)) {
                    connect = IOKit.IOServiceOpen (service);
                }
            }
        }
コード例 #5
0
ファイル: IOKit.cs プロジェクト: nagyistoce/MacGreenerCS
        internal static IOKitObject IOIteratorNext(IOKitObject iterator)
        {
            IntPtr service = IOIteratorNext ((IntPtr) iterator);

            if (service.ToInt32() == IOKit.kIOReturnNoDevice) {
                throw new IOKitException (IOKit.kIOReturnNoDevice);
            }

            return service;
        }
コード例 #6
0
        internal static IOKitObject IOIteratorNext(IOKitObject iterator)
        {
            IntPtr service = IOIteratorNext((IntPtr)iterator);

            if (service.ToInt32() == IOKit.kIOReturnNoDevice)
            {
                throw new IOKitException(IOKit.kIOReturnNoDevice);
            }

            return(service);
        }
コード例 #7
0
ファイル: IOKit.cs プロジェクト: nagyistoce/MacGreenerCS
        internal static sbyte[] IOConnectCallStructMethod(IOKitObject connect)
        {
            uint osize = 40, isize = 40;

            sbyte[] @out = new sbyte[osize];
            if (IOConnectCallStructMethodIn == null) {
                IOConnectCallStructMethodIn = new sbyte[isize];

                for (int i = 0; i<isize; i++) {
                    IOConnectCallStructMethodIn [i] = 1;
                }
            }

            IOKit.CheckResult (IOKit.IOConnectCallStructMethod (
                connect, 5, IOConnectCallStructMethodIn, osize, @out, ref isize
            ));

            return @out;
        }
コード例 #8
0
        internal static sbyte[] IOConnectCallStructMethod(IOKitObject connect)
        {
            uint osize = 40, isize = 40;

            sbyte[] @out = new sbyte[osize];
            if (IOConnectCallStructMethodIn == null)
            {
                IOConnectCallStructMethodIn = new sbyte[isize];

                for (int i = 0; i < isize; i++)
                {
                    IOConnectCallStructMethodIn [i] = 1;
                }
            }

            IOKit.CheckResult(IOKit.IOConnectCallStructMethod(
                                  connect, 5, IOConnectCallStructMethodIn, osize, @out, ref isize
                                  ));

            return(@out);
        }
コード例 #9
0
ファイル: IOKit.cs プロジェクト: nagyistoce/MacGreenerCS
        internal static IOKitObject IOServiceOpen(IOKitObject service)
        {
            IntPtr connect;
            CheckResult (IOServiceOpen (service, mach_task_self (), 0, out connect));

            return connect;
        }
コード例 #10
0
ファイル: IOKit.cs プロジェクト: nagyistoce/MacGreenerCS
        internal static void IORegistryEntrySetCFProperty(IOKitObject entry, string propertyName, bool property)
        {
            var handle = Dlfcn.dlopen (Constants.CoreFoundationLibrary, 0);
            IntPtr macbool = Dlfcn.GetIntPtr (handle, property ? "kCFBooleanTrue" : "kCFBooleanFalse");

            IORegistryEntrySetCFProperty((IntPtr)entry, ((CFString)propertyName).Handle, macbool);
        }