当前位置: 首页>>代码示例>>C#>>正文


C# Native类代码示例

本文整理汇总了C#中Native的典型用法代码示例。如果您正苦于以下问题:C# Native类的具体用法?C# Native怎么用?C# Native使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Native类属于命名空间,在下文中一共展示了Native类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LowLevelKeyboardProc

 static IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, ref Native.KBDLLHOOKSTRUCT lParam)
 {
     bool cancel = false;
     if(nCode == Native.HC_ACTION) {
         KeybordCaptureEventArgs e = new KeybordCaptureEventArgs(lParam);
         switch(wParam.ToInt32()) {
             case Native.WM_KEYDOWN:
                 if(KeyDown != null)
                     KeyDown(null, e);
                 break;
             case Native.WM_KEYUP:
                 if(KeyUp != null)
                     KeyUp(null, e);
                 break;
             case Native.WM_SYSKEYDOWN:
                 if(SysKeyDown != null)
                     SysKeyDown(null, e);
                 break;
             case Native.WM_SYSKEYUP:
                 if(SysKeyUp != null)
                     SysKeyUp(null, e);
                 break;
         }
         cancel = e.Cancel;
     }
     return cancel ? (IntPtr)1 : Native.CallNextHookEx(s_hook, nCode, wParam, ref lParam);
 }
开发者ID:masaakif,项目名称:TwiDaken,代码行数:27,代码来源:KeyBoardHook.cs

示例2: PopulateConfiguration

        internal void PopulateConfiguration(ref Native.Configuration configuration)
        {
            var migrationHandle = GCHandle.Alloc(this);

            configuration.migration_callback = MigrationCallback;
            configuration.managed_migration_handle = GCHandle.ToIntPtr(migrationHandle);
        }
开发者ID:realm,项目名称:realm-dotnet,代码行数:7,代码来源:Migration.cs

示例3: UnixFileSystemInfo

 internal UnixFileSystemInfo(String path, Native.Stat stat)
 {
     this.originalPath = path;
     this.fullPath = UnixPath.GetFullPath (path);
     this.stat = stat;
     this.valid = true;
 }
开发者ID:xxtbg,项目名称:coredroidservice,代码行数:7,代码来源:UnixFileSystemInfo.cs

示例4: App

    public App(string nibName)
    {
        NSObject app = (NSObject) new Class("NSApplication").Call("sharedApplication");

        // Load our nib. This will instantiate all of the native objects and wire them together.
        // The C# SimpleLayoutView will be created the first time Objective-C calls one of the
        // methods SimpleLayoutView added or overrode.
        NSObject dict = new Class("NSMutableDictionary").Call("alloc").Call("init").To<NSObject>();
        NSObject key = new Class("NSString").Call("stringWithUTF8String:", Marshal.StringToHGlobalAuto("NSOwner")).To<NSObject>();
        dict.Call("setObject:forKey:", app, key);

        NSObject bundle = new Class("NSBundle").Call("mainBundle").To<NSObject>();

        NSObject nib = new Class("NSString").Call("stringWithUTF8String:", Marshal.StringToHGlobalAuto(nibName)).To<NSObject>();
        sbyte loaded = (sbyte) bundle.Call("loadNibFile:externalNameTable:withZone:", nib, dict, null);
        if (loaded != 1)
            throw new InvalidOperationException("Couldn't load the nib file");

        // We need an NSAutoreleasePool to do Native.Call, but we don't want to have one
        // hanging around while we're in the main event loop because that may hide bugs.
        // So, we'll instantiate a Native instance here and call Invoke later which can
        // be done without an NSAutoreleasePool.
        m_run = new Native(app, new Selector("run"));

        dict.release();
    }
开发者ID:afrog33k,项目名称:mobjc,代码行数:26,代码来源:NSApplication.cs

示例5: Create

		public UnixStream Create (Native.FilePermissions mode)
		{
			int fd = Native.Syscall.creat (FullPath, mode);
			if (fd < 0)
				UnixMarshal.ThrowExceptionForLastError ();
			base.Refresh ();
			return new UnixStream (fd);
		}
开发者ID:Jakosa,项目名称:MonoLibraries,代码行数:8,代码来源:UnixFileInfo.cs

示例6: NativeInputPortConfiguration

 /// <summary>
 /// Creates new instance of this type.
 /// </summary>
 /// <param name="name">Name of the port.</param>
 /// <param name="displayName">Display name of this port.</param>
 /// <param name="description">Description of this port.</param>
 /// <param name="enumConfig">Enumeration config.</param>
 /// <param name="defaultValue">Default value to use.</param>
 public NativeInputPortConfiguration(string name, string displayName, string description, string enumConfig, Native.FlowInputData defaultValue)
 {
     this.Name = Marshal.StringToHGlobalUni(name);
     this.HumanName = Marshal.StringToHGlobalUni(displayName);
     this.Description = Marshal.StringToHGlobalUni(description);
     this.EnumConfig = Marshal.StringToHGlobalUni(enumConfig);
     this.DefaultValue = defaultValue;
 }
开发者ID:RoqueDeicide,项目名称:CryCIL,代码行数:16,代码来源:FlowGraphNode.Configuration.cs

示例7: CopyGroup

		private static Native.Group CopyGroup (Native.Group group)
		{
			Native.Group g = new Native.Group ();

			g.gr_gid    = group.gr_gid;
			g.gr_mem    = group.gr_mem;
			g.gr_name   = group.gr_name;
			g.gr_passwd = group.gr_passwd;

			return g;
		}
开发者ID:Jakosa,项目名称:MonoLibraries,代码行数:11,代码来源:UnixGroupInfo.cs

示例8: strerror_r

		private static string strerror_r (Native.Errno errno)
		{
			StringBuilder buf = new StringBuilder (16);
			int r = 0;
			do {
				buf.Capacity *= 2;
				r = Native.Syscall.strerror_r (errno, buf);
			} while (r == -1 && Native.Stdlib.GetLastError() == Native.Errno.ERANGE);

			if (r == -1)
				return "** Unknown error code: " + ((int) errno) + "**";
			return buf.ToString();
		}
开发者ID:Jakosa,项目名称:MonoLibraries,代码行数:13,代码来源:UnixMarshal.cs

示例9: CopyPasswd

		private static Native.Passwd CopyPasswd (Native.Passwd pw)
		{
			Native.Passwd p = new Native.Passwd ();

			p.pw_name   = pw.pw_name;
			p.pw_passwd = pw.pw_passwd;
			p.pw_uid    = pw.pw_uid;
			p.pw_gid    = pw.pw_gid;
			p.pw_gecos  = pw.pw_gecos;
			p.pw_dir    = pw.pw_dir;
			p.pw_shell  = pw.pw_shell;

			return p;
		}
开发者ID:Jakosa,项目名称:MonoLibraries,代码行数:14,代码来源:UnixUserInfo.cs

示例10: OpenWithSync

        public static SharedRealmHandle OpenWithSync(Realms.Native.Configuration configuration, Native.SyncConfiguration syncConfiguration, RealmSchema schema, byte[] encryptionKey)
        {
            DoInitialFileSystemConfiguration();

            var marshaledSchema = new SharedRealmHandle.SchemaMarshaler(schema);

            NativeException nativeException;
            var result = NativeMethods.open_with_sync(configuration, syncConfiguration, marshaledSchema.Objects, marshaledSchema.Objects.Length, marshaledSchema.Properties, encryptionKey, out nativeException);
            nativeException.ThrowIfNecessary();

            var handle = new SharedRealmHandle();
            handle.SetHandle(result);
            return handle;
        }
开发者ID:realm,项目名称:realm-dotnet,代码行数:14,代码来源:SharedRealmHandleExtensions.cs

示例11: DoEnableDisable

        public static void DoEnableDisable(
            Native.DeviceInfoListHandle devs, ref Native.SP_DEVINFO_DATA devInfo,
            string deviceId, EnableDisableParameters parms
        )
        {
            if (devInfo.ClassGuid != parms.ClassGuid)
                return;
            if (devInfo.DevInst != parms.DevInst)
                return;

            var options = parms.AppParams.Options;

            if ((options.Count == 0) || options.Contains("disable")) {
                Console.WriteLine(
                    "// Physical ID for volume {0} is #{1}. You can use this ID to re-enable the volume.",
                    parms.DriveLetter, devInfo.DevInst
                );

                Console.Write("Disabling volume {0}... ", parms.DriveLetter);
                try {
                    Native.ChangeDeviceEnabledState(
                        devs, ref devInfo,
                        DiClassInstallState.DICS_DISABLE,
                        DiClassInstallScope.DICS_FLAG_CONFIGSPECIFIC,
                        DiClassInstallFunction.DIF_PROPERTYCHANGE
                    );

                    Console.WriteLine("ok.");
                } catch (Exception ex) {
                    Console.WriteLine("failed.");
                }
            }

            if ((options.Count == 0) || options.Contains("enable")) {
                Console.Write("Enabling volume {0}... ", parms.DriveLetter);
                try {
                    Native.ChangeDeviceEnabledState(
                        devs, ref devInfo,
                        DiClassInstallState.DICS_ENABLE,
                        DiClassInstallScope.DICS_FLAG_CONFIGSPECIFIC,
                        DiClassInstallFunction.DIF_PROPERTYCHANGE
                    );

                    Console.WriteLine("ok.");
                } catch (Exception ex) {
                    Console.WriteLine("failed.");
                }
            }
        }
开发者ID:kg,项目名称:DeviceRemount,代码行数:49,代码来源:Program.cs

示例12: SendKeyboardKey

 public void SendKeyboardKey( Native.KeyboardKeys key )
 {
     NativeKeySendingEventArgs e = new NativeKeySendingEventArgs( key );
     if( this.KeySending != null )
     {
         this.KeySending( this, e );
     }
     if( !e.Cancel )
     {
         KeyboardProcessor.Process( key );
         if( this.KeySent != null )
         {
             this.KeySent( this, new NativeKeySentEventArgs( key ) );
         }
     }
 }
开发者ID:Invenietis,项目名称:ck-certified,代码行数:16,代码来源:SendStringPlugin.cs

示例13: CallCreate2P

        /// <summary>
        /// XmCreateXXの呼び出し
        /// </summary>
        public static IntPtr CallCreate2P(Native.Motif.CreateSymbol sym, Widgets.IWidget parent,string name, Native.Xt.XtArg[] args)
        {
            if (null ==args || 0 == args.Length) {
                return Instance.xmCreateFuncs[(int)sym](parent.NativeHandle.Widget, name, null, 0);
            }

            Native.Xt.NativeXtArg[] au = new Native.Xt.NativeXtArg[args.Length];
            int argc = ExtremeSports.TnkConvertResourceEx(args, au, true);
            foreach(Native.Xt.NativeXtArg k in au) {
                System.Diagnostics.Debug.WriteLine($"NA<A>: {k.Name} : {k.Value}");
            }
            System.Diagnostics.Debug.WriteLine($"XM_CVT {au.Length} -> {argc}");
            IntPtr wgt = Instance.xmCreateFuncs[(int)sym](parent.NativeHandle.Widget, name, au, argc);
            ExtremeSports.TnkFreeDeepCopyArg(au);

            return wgt;
        }
开发者ID:sazae657,项目名称:TonNurako,代码行数:20,代码来源:XmCall.cs

示例14: RestoreFilePosition

		public void RestoreFilePosition (Native.FilePosition pos)
		{
			AssertNotDisposed ();
			if (pos == null)
				throw new ArgumentNullException ("value");
			int r = Native.Stdlib.fsetpos (file, pos);
			UnixMarshal.ThrowExceptionForLastErrorIf (r);
			GC.KeepAlive (this);
		}
开发者ID:sushihangover,项目名称:playscript,代码行数:9,代码来源:StdioFileStream.cs

示例15: SaveFilePosition

		public void SaveFilePosition (Native.FilePosition pos)
		{
			AssertNotDisposed ();
			int r = Native.Stdlib.fgetpos (file, pos);
			UnixMarshal.ThrowExceptionForLastErrorIf (r);
			GC.KeepAlive (this);
		}
开发者ID:sushihangover,项目名称:playscript,代码行数:7,代码来源:StdioFileStream.cs


注:本文中的Native类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。