C# (CSharp) Класс System. IntPtr Code Examples

C# (CSharp) System.IntPtr - 30 примеров найдено. Это лучшие примеры C# (CSharp) кода для класса System.IntPtr, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
Пример #1
0
 internal static byte[] GetRawInternal(IntPtr pointer)
 {
     var ret = new byte[PyString_Size(pointer)];
     var buffer = PyString_AsString(pointer);
     Marshal.Copy(buffer, ret, 0, ret.Length);
     return ret;
 }
		public unsafe BitmapDrawableResource (global::Android.Graphics.Drawables.BitmapDrawable p0, global::Com.Bumptech.Glide.Load.Engine.Bitmap_recycle.IBitmapPool p1)
			: base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer)
		{
			if (Handle != IntPtr.Zero)
				return;

			try {
				JValue* __args = stackalloc JValue [2];
				__args [0] = new JValue (p0);
				__args [1] = new JValue (p1);
				if (GetType () != typeof (BitmapDrawableResource)) {
					SetHandle (
							global::Android.Runtime.JNIEnv.StartCreateInstance (GetType (), "(Landroid/graphics/drawable/BitmapDrawable;Lcom/bumptech/glide/load/engine/bitmap_recycle/BitmapPool;)V", __args),
							JniHandleOwnership.TransferLocalRef);
					global::Android.Runtime.JNIEnv.FinishCreateInstance (Handle, "(Landroid/graphics/drawable/BitmapDrawable;Lcom/bumptech/glide/load/engine/bitmap_recycle/BitmapPool;)V", __args);
					return;
				}

				if (id_ctor_Landroid_graphics_drawable_BitmapDrawable_Lcom_bumptech_glide_load_engine_bitmap_recycle_BitmapPool_ == IntPtr.Zero)
					id_ctor_Landroid_graphics_drawable_BitmapDrawable_Lcom_bumptech_glide_load_engine_bitmap_recycle_BitmapPool_ = JNIEnv.GetMethodID (class_ref, "<init>", "(Landroid/graphics/drawable/BitmapDrawable;Lcom/bumptech/glide/load/engine/bitmap_recycle/BitmapPool;)V");
				SetHandle (
						global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_Landroid_graphics_drawable_BitmapDrawable_Lcom_bumptech_glide_load_engine_bitmap_recycle_BitmapPool_, __args),
						JniHandleOwnership.TransferLocalRef);
				JNIEnv.FinishCreateInstance (Handle, class_ref, id_ctor_Landroid_graphics_drawable_BitmapDrawable_Lcom_bumptech_glide_load_engine_bitmap_recycle_BitmapPool_, __args);
			} finally {
			}
		}
 public Pixels Capture(IntPtr windowHandle)
 {
     Bitmap bmp = ScreenCapture.CaptureWindow(windowHandle);
     Pixels pixels = BitmapToPixels(bmp);
     bmp.Dispose();
     return pixels;
 }
Пример #4
0
public static int get_tweenTargets(IntPtr L)
{
UIButtonColorExt self = Funcs.GetObj(L,1) as UIButtonColorExt;
if(self == null)
{
	LuaStatic.traceback(L,"nullobj call");
	LuaDLL.lua_error(L); return 1;
}
{
int i0 = 0;
LuaDLL.lua_newtable(L);
foreach(UnityEngine.GameObject item0 in self.tweenTargets)
{
if(item0 == null)  LuaStatic.addGameObject2Lua(L,null,""); else
{
LuaStatic.addGameObject2Lua(L,item0, "GameObject");
}
++i0;
LuaDLL.lua_pushnumber(L,i0);
LuaDLL.lua_insert(L,-2);
LuaDLL.lua_settable(L,-3);
}
}
return 1;
}
	static IntPtr n_City_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0)
	{
		global::Com.Baidu.Mapapi.Search.Sug.SuggestionSearchOption __this = global::Java.Lang.Object.GetObject<global::Com.Baidu.Mapapi.Search.Sug.SuggestionSearchOption> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
		string p0 = JNIEnv.GetString (native_p0, JniHandleOwnership.DoNotTransfer);
		IntPtr __ret = JNIEnv.ToLocalJniHandle (__this.City (p0));
		return __ret;
	}
Пример #6
0
	public object MarshalNativeToManaged (IntPtr pNativeData)
	{
		string s = UnixMarshal.PtrToString (pNativeData, UnixEncoding.Instance);
		// Console.WriteLine ("# FileNameMarshaler.MarshalNativeToManaged ({0:x})=`{1}'",
		// 		pNativeData, s);
		return s;
	}
Пример #7
0
 /// <summary>
 /// デバイスをクローズする
 /// </summary>
 public void Close()
 {
     if ( DeviceReady ) {
         Native.CloseHandle( hDev );
         hDev = IntPtr.Zero;
     }
 }
        private FilterReturn FilterFunc(IntPtr xevent, Event evnt)
        {
            if (xevent == IntPtr.Zero)
                return FilterReturn.Continue;

            var e = (X11.XEvent)Marshal.PtrToStructure(xevent, typeof(X11.XEvent));

            // Dropping these events is non standard but so is embeding a Gtk into
            // a X11 Window.
            if (e.type == X11.XEventName.FocusOut ||
                e.type == X11.XEventName.LeaveNotify)
            {
                return FilterReturn.Remove;
            }

            // Ensure Mouse clicks and Button go to the right place
            if (e.type == X11.XEventName.ButtonPress ||
                e.type == X11.XEventName.KeyPress)
            {
                // TODO: possibly cancel any tooltip windows.

                this.m_parent.Focus();
                return FilterReturn.Continue;
            }

            // Everything else just process as normal
            return FilterReturn.Continue;
        }
Пример #9
0
 public static IShellFolder GetShellFolder(IntPtr ptrShellFolder)
 {
     System.Type shellFolderType = GetShellFolderType();
     Object obj = Marshal.GetTypedObjectForIUnknown(ptrShellFolder,shellFolderType);
     IShellFolder RetVal = (IShellFolder)obj;
     return RetVal;
 }
Пример #10
0
 public PtrArray(System.Type element_type, bool owned, bool elements_owned)
 {
     handle = g_ptr_array_new ();
     this.element_type = element_type;
     managed = owned;
     this.elements_owned = elements_owned;
 }
Пример #11
0
 internal PtrArray(IntPtr raw, System.Type element_type, bool owned, bool elements_owned)
 {
     handle = raw;
     this.element_type = element_type;
     managed = owned;
     this.elements_owned = elements_owned;
 }
Пример #12
0
 public PtrArray(uint n_preallocs, System.Type element_type, bool owned, bool elements_owned)
 {
     handle = g_ptr_array_sized_new (n_preallocs);
     this.element_type = element_type;
     managed = owned;
     this.elements_owned = elements_owned;
 }
Пример #13
0
	public static int State(IntPtr L)
	{
		string err;
		try
		{
			IntPtr idptr = LuaDLL.lua_touserdata(L, 1);
			System.Object obj = default(System.Object);
			Animation self = default(Animation);
			if (objs.TryGetValue(idptr.ToInt32(), out obj))
				self = objs[idptr.ToInt32()] as Animation;
			else
			{
				LuaStatic.traceback(L);
				LuaDLL.lua_error(L);
				return 1;
			}
			string statename = LuaDLL.lua_tostring(L, 2);
			AnimationState state = self[statename];
			if (state == null)
			{
				LuaDLL.lua_pushnil(L);
			}
			else
				LuaStatic.addGameObject2Lua(L, state, "AnimationState");
			return 1;
		}
		catch (Exception e)
		{
			err = e.ToString();
		}
		LuaStatic.traceback(L, err);
		LuaDLL.lua_error(L);
		return 1;
	}
Пример #14
0
		internal static DataObject DragToDataObject (IntPtr dragref) {
			UInt32 items = 0;
			ArrayList flavorlist = new ArrayList ();

			CountDragItems (dragref, ref items);
			
			for (uint item_counter = 1; item_counter <= items; item_counter++) {
				IntPtr itemref = IntPtr.Zero;
				UInt32 flavors = 0;
				
				GetDragItemReferenceNumber (dragref, item_counter, ref itemref);
				CountDragItemFlavors (dragref, itemref, ref flavors);
				for (uint flavor_counter = 1; flavor_counter <= flavors; flavor_counter++) {
					FlavorHandler flavor = new FlavorHandler (dragref, itemref, flavor_counter);
					if (flavor.Supported)
						flavorlist.Add (flavor);
				}
			}

			if (flavorlist.Count > 0) {
				return ((FlavorHandler) flavorlist [0]).Convert (flavorlist);
			} 

			return new DataObject ();
		}
Пример #15
0
	public XcbSurface (IntPtr connection, uint drawable, IntPtr visual, int width, int height)
	{
		surface = CairoAPI.cairo_xcb_surface_create (connection, drawable, visual, width, height);
		lock (surfaces.SyncRoot) {
			surfaces [surface] = this;
		}
	}
Пример #16
0
	public static int IntPtrCopy(IntPtr source, Stream dest, int length)
	{
		var buffer = new Byte[length];
		Marshal.Copy(source, buffer, 0, length);
		dest.Write(buffer, 0, length);
		return length;
	}
Пример #17
0
		public static XcbSurface FromBitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height)
		{
			IntPtr ptr;

			ptr = CairoAPI.cairo_xcb_surface_create_for_bitmap (connection, bitmap, screen, width, height);
			return new XcbSurface (ptr, true);
		}
Пример #18
0
 public static extern IntPtr create_datawriter(
     IntPtr _this,
     IntPtr a_topic,
     IntPtr qos,
     IntPtr a_listener,
     StatusKind mask
     );
Пример #19
0
        public Shader(GraphicsDevice dev, string name)
        {
            this.dev = dev;
            string code;
            using (var file = new StreamReader(FileSystem.Open("cg{0}{1}.fx".F(Path.DirectorySeparatorChar, name))))
                code = file.ReadToEnd();
            effect = Tao.Cg.Cg.cgCreateEffect(dev.Context, code, null);

            if (effect == IntPtr.Zero)
            {
                var err = Tao.Cg.Cg.cgGetErrorString(Tao.Cg.Cg.cgGetError());
                var results = Tao.Cg.Cg.cgGetLastListing(dev.Context);
                throw new InvalidOperationException(
                    "Cg compile failed ({0}):\n{1}".F(err, results));
            }

            technique = Tao.Cg.Cg.cgGetFirstTechnique(effect);
            if (technique == IntPtr.Zero)
                throw new InvalidOperationException("No techniques");
            while (Tao.Cg.Cg.cgValidateTechnique(technique) == 0)
            {
                technique = Tao.Cg.Cg.cgGetNextTechnique(technique);
                if (technique == IntPtr.Zero)
                    throw new InvalidOperationException("No valid techniques");
            }
        }
	static IntPtr n_Location_Lcom_baidu_mapapi_model_LatLng_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0)
	{
		global::Com.Baidu.Mapapi.Search.Share.LocationShareURLOption __this = global::Java.Lang.Object.GetObject<global::Com.Baidu.Mapapi.Search.Share.LocationShareURLOption> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
		global::Com.Baidu.Mapapi.Model.LatLng p0 = global::Java.Lang.Object.GetObject<global::Com.Baidu.Mapapi.Model.LatLng> (native_p0, JniHandleOwnership.DoNotTransfer);
		IntPtr __ret = JNIEnv.ToLocalJniHandle (__this.Location (p0));
		return __ret;
	}
Пример #21
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        internal unsafe static Type GetTypeHelper(Type typeStart, Type[] genericArgs, IntPtr pModifiers, int cModifiers)
        {
            Type type = typeStart;

            if (genericArgs != null)
            {
                type = type.MakeGenericType(genericArgs);
            }

            if (cModifiers > 0)
            {
                int* arModifiers = (int*)pModifiers.ToPointer();
                for(int i = 0; i < cModifiers; i++)
                {
                    if ((CorElementType)Marshal.ReadInt32((IntPtr)arModifiers, i * sizeof(int)) == CorElementType.Ptr)
                        type = type.MakePointerType();
                    
                    else if ((CorElementType)Marshal.ReadInt32((IntPtr)arModifiers, i * sizeof(int)) == CorElementType.ByRef)
                        type = type.MakeByRefType();

                    else if ((CorElementType)Marshal.ReadInt32((IntPtr)arModifiers, i * sizeof(int)) == CorElementType.SzArray)
                        type = type.MakeArrayType();

                    else
                        type = type.MakeArrayType(Marshal.ReadInt32((IntPtr)arModifiers, ++i * sizeof(int)));
                }
            }
            
            return type;
        }
Пример #22
0
        public Snes()
        {
            mProcess = SearchProcess("snes9x.exe");
            mProcessPtr = OpenProcess(ProcessAccessFlags.PROCESS_VM_READ, false, mProcess.Id);

            updateMemory();
        }
Пример #23
0
public static int set_tweenTargets(IntPtr L)
{
UIButtonColorExt self = Funcs.GetObj(L,1) as UIButtonColorExt;
if(self == null)
{
	LuaStatic.traceback(L,"nullobj call");
	LuaDLL.lua_error(L); return 1;
}
{
self.tweenTargets = new List<UnityEngine.GameObject>();
int count0= LuaDLL.lua_objlen(L,2);
for(int i0=0;i0<count0;++i0)
{
UnityEngine.GameObject itemvalue0 = default(UnityEngine.GameObject);
LuaDLL.lua_pushinteger(L,i0+1);
LuaDLL.lua_gettable(L,-2);
if (LuaDLL.lua_isnil(L, -1) == false)
{
	itemvalue0  = (UnityEngine.GameObject)Funcs.GetObj(L,-1);
}
else {
	itemvalue0  = default(UnityEngine.GameObject);
}
LuaDLL.lua_pop(L,1);
self.tweenTargets.Add(itemvalue0);
}
}
return 0;
}
Пример #24
0
        static internal int checkDelegate(IntPtr l,int p,out System.Func<System.Boolean> ua) {
            int op = extractFunction(l,p);
			if(LuaDLL.lua_isnil(l,p)) {
				ua=null;
				return op;
			}
            else if (LuaDLL.lua_isuserdata(l, p)==1)
            {
                ua = (System.Func<System.Boolean>)checkObj(l, p);
                return op;
            }
            LuaDelegate ld;
            checkType(l, -1, out ld);
            if(ld.d!=null)
            {
                ua = (System.Func<System.Boolean>)ld.d;
                return op;
            }
			LuaDLL.lua_pop(l,1);
			
			l = LuaState.get(l).L;
            ua = () =>
            {
                int error = pushTry(l);

				ld.pcall(0, error);
				bool ret;
				checkType(l,error+1,out ret);
				LuaDLL.lua_settop(l, error-1);
				return ret;
			};
			ld.d=ua;
			return op;
		}
Пример #25
0
 static OuyaContent()
 {
     try
     {
         {
             string strName = "tv/ouya/console/api/content/OuyaContent";
             IntPtr localRef = AndroidJNI.FindClass(strName);
             if (localRef != IntPtr.Zero)
             {
     #if VERBOSE_LOGGING
                 Debug.Log(string.Format("Found {0} class", strName));
     #endif
                 _jcOuyaContent = AndroidJNI.NewGlobalRef(localRef);
                 AndroidJNI.DeleteLocalRef(localRef);
             }
             else
             {
                 Debug.LogError(string.Format("Failed to find {0} class", strName));
             }
         }
     }
     catch (System.Exception ex)
     {
         Debug.LogError(string.Format("Exception loading JNI - {0}", ex));
     }
 }
Пример #26
0
	public static extern bool DuplicateTokenEx(
		IntPtr hExistingToken,
		uint dwDesiredAccess,
		IntPtr lpTokenAttributes,
		NativeConstants.SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
		NativeConstants.TOKEN_TYPE TokenType,
		out IntPtr phNewToken);
Пример #27
0
		internal CMSampleBuffer (IntPtr handle, bool owns)
		{
			if (!owns)
				CFObject.CFRetain (handle);

			this.handle = handle;
		}
        static internal int checkDelegate(IntPtr l,int p,out UnityEngine.Display.DisplaysUpdatedDelegate ua) {
            int op = extractFunction(l,p);
			if(LuaDLL.lua_isnil(l,p)) {
				ua=null;
				return op;
			}
            else if (LuaDLL.lua_isuserdata(l, p)==1)
            {
                ua = (UnityEngine.Display.DisplaysUpdatedDelegate)checkObj(l, p);
                return op;
            }
            LuaDelegate ld;
            checkType(l, -1, out ld);
            if(ld.d!=null)
            {
                ua = (UnityEngine.Display.DisplaysUpdatedDelegate)ld.d;
                return op;
            }
			LuaDLL.lua_pop(l,1);
			
			l = LuaState.get(l).L;
            ua = () =>
            {
                int error = pushTry(l);

				ld.pcall(0, error);
				LuaDLL.lua_settop(l, error-1);
			};
			ld.d=ua;
			return op;
		}
        private void CreateDevice(IntPtr windowHandle, int width, int height)
        {
            try
            {
                parameters = new PresentationParameters();

                parameters.BackBufferWidth = Math.Max(width, 1);
                parameters.BackBufferHeight = Math.Max(height, 1);
                parameters.BackBufferFormat = SurfaceFormat.Color;
                parameters.DepthStencilFormat = DepthFormat.Depth24;
                parameters.DeviceWindowHandle = windowHandle;
                parameters.PresentationInterval = PresentInterval.Immediate;
                parameters.IsFullScreen = false;

                graphicsDevice = new GraphicsDevice(
                    GraphicsAdapter.DefaultAdapter,
                    GraphicsProfile.Reach,
                    parameters);

                if (DeviceCreated != null)
                    DeviceCreated(this, EventArgs.Empty);

            }
            catch (Exception ex)
            {
                throw new ApplicationException("Failed to initialize GraphicsDeviceService. See inner exception for details.", ex);
            }
        }
	public static void SetBlobCacheFuncsANDROID(IntPtr dpy, SetBlobFuncDelegate set, GetBlobFuncDelegate get)
	{
		Debug.Assert(Delegates.peglSetBlobCacheFuncsANDROID != null, "peglSetBlobCacheFuncsANDROID not implemented");
		Delegates.peglSetBlobCacheFuncsANDROID(dpy, set, get);
		LogFunction("eglSetBlobCacheFuncsANDROID(0x{0}, {1}, {2})", dpy.ToString("X8"), set, get);
		DebugCheckErrors(null);
	}