Beispiel #1
0
 public VkInstance(HandleType handle, VkAllocationCallbacks allocator)
 {
     Handle = handle;
     Allocator = allocator;
     Direct = new DirectFunctions(this);
     PhysicalDevices = EnumeratePhysicalDevices();
 }
Beispiel #2
0
        /// <summary>
        /// パラメータを指定して新しい Handle クラスのインスタンスを初期化します。
        /// </summary>
        /// <param name="targetPart">ハンドルが適用されるパート。</param>
        /// <param name="type">ハンドルの種類。</param>
        /// <param name="data1">パラメータに対する整数パラメータ。</param>
        public Handle(int targetPart, HandleType type, int data1)
        {
            this.targetPart = targetPart;
            this.type = type;

            this.data1 = data1;
            this.data2 = 0.0f;
        }
Beispiel #3
0
        /// <summary>
        /// パラメータを指定して新しい Handle クラスのインスタンスを初期化します。
        /// </summary>
        /// <param name="targetPart">ハンドルが適用されるパート。</param>
        /// <param name="type">ハンドルの種類。</param>
        /// <param name="data1">パラメータに対する整数パラメータ。</param>
        /// <param name="data2">パラメータに対する実数パラメータ。</param>
        public Handle(int targetPart, HandleType type, int data1, float data2)
        {
            this.targetPart = targetPart;
            this.type = type;

            this.data1 = data1;
            this.data2 = data2;
        }
 public FileTransferChannelInfo(ChannelType type, 
                        HandleType target, 
                        string content_type, 
                        string description)
     : base(type, target)
 {
     ContentType = content_type;
     Description = description;
 }
 public ContactService(ContactServiceType type,
                        HandleType target,
                        string service,
                        object address)
 {
     Type = type;
     TargetHandleType = target;
     Service = service;
     Address = address;
 }
 private void OnHandleAdd(string handleName, IntPtr handle, int handleCount)
 {
     HandleType type = (HandleType) handleTypes[handleName];
     if (type == null)
     {
         type = new HandleType(handleName);
         handleTypes[handleName] = type;
     }
     type.Add(handle);
 }
Beispiel #7
0
        /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.RegisterType"]/*' />
        /// <devdoc>
        ///     Registers a new type of handle with the handle collector.
        /// </devdoc>
        internal static int RegisterType(string typeName, int expense, int initialThreshold) {
            lock (internalSyncObject){
                if (handleTypeCount == 0 || handleTypeCount == handleTypes.Length) {
                    HandleType[] newTypes = new HandleType[handleTypeCount + 10];
                    if (handleTypes != null) {
                        Array.Copy(handleTypes, 0, newTypes, 0, handleTypeCount);
                    }
                    handleTypes = newTypes;
                }

                handleTypes[handleTypeCount++] = new HandleType(typeName, expense, initialThreshold);
                return handleTypeCount;
            }
        }
        /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.IgnoreCurrentHandlesAsLeaks"]/*' />
        /// <devdoc>
        ///     All handles available at this time will be not be considered as leaks
        ///     when CheckLeaks is called to report leaks.
        /// </devdoc>
        /** @conditional(DEBUG) */
        public static void IgnoreCurrentHandlesAsLeaks() {
            lock(internalSyncObject) {
                if (CompModSwitches.HandleLeak.Level >= TraceLevel.Warning) {
                    HandleType[] types = new HandleType[handleTypes.Values.Count];
                    handleTypes.Values.CopyTo(types, 0);

                    for (int i = 0; i < types.Length; i++) {
                        if (types[i] != null) {
                            types[i].IgnoreCurrentHandlesAsLeaks();
                        }
                    }
                }
            }
        }
Beispiel #9
0
        public void DockFocusToCtl(bool pVisible)
        {
            Rectangle rect = _DesignCtl.GetOutFocusRect();
            int       RECT_X = rect.X, RECT_Y = rect.Y,
                      RECT_WIDTH = rect.Width, RECT_HEIGHT = rect.Height;

            foreach (FocusHandleCTL ctl in this)
            {
                HandleType type = ctl.FocusType;
                ctl.Visible = false;
                switch (type)
                {
                case HandleType.LeftTop:                        //顶端靠左
                    ctl.Location = new Point(RECT_X, RECT_Y);
                    break;

                case HandleType.MiddleTop:                        //顶靠中
                    ctl.Location = new Point(RECT_X + RECT_WIDTH / 2 - HALF_FUDGER, RECT_Y);
                    break;

                case HandleType.RightTop:                        //顶靠右
                    ctl.Location = new Point(RECT_X + RECT_WIDTH - FUDGER, RECT_Y);
                    break;

                case HandleType.RightMiddle:                        //右中间
                    ctl.Location = new Point(RECT_X + RECT_WIDTH - FUDGER, RECT_Y + RECT_HEIGHT / 2 - HALF_FUDGER);
                    break;

                case HandleType.RightBottom:                        //底靠右
                    ctl.Location = new Point(RECT_X + RECT_WIDTH - FUDGER, RECT_Y + RECT_HEIGHT - FUDGER);
                    break;

                case HandleType.BottomMiddle:                         //底靠中
                    ctl.Location = new Point(RECT_X + RECT_WIDTH / 2 - HALF_FUDGER, RECT_Y + RECT_HEIGHT - FUDGER);
                    break;

                case HandleType.LeftBottom:                        //底靠左
                    ctl.Location = new Point(RECT_X, RECT_Y + RECT_HEIGHT - FUDGER);
                    break;

                case HandleType.LeftMiddle:                         //左中间
                    ctl.Location = new Point(RECT_X, RECT_Y + RECT_HEIGHT / 2 - HALF_FUDGER);
                    break;
                }
                ctl.Visible = pVisible;
            }
        }
Beispiel #10
0
        void Awake()
        {
            contextMenuState = ContextPointerMenu.ContextState.CUSTOM_OBJECTS;

            raycastLayer = LayerMask.NameToLayer(raycastLayerName);

            movedHandle = new UnityEvent();

            previousType = type;

            if (target == null)
            {
                target = transform;
            }

            CreateHandles();
        }
Beispiel #11
0
        private static Handle GetAttributeTypeHandle(this CustomAttribute customAttribute, MetadataReader reader)
        {
            HandleType constructorHandleType = customAttribute.Constructor.HandleType;

            if (constructorHandleType == HandleType.QualifiedMethod)
            {
                return(customAttribute.Constructor.ToQualifiedMethodHandle(reader).GetQualifiedMethod(reader).EnclosingType);
            }
            else if (constructorHandleType == HandleType.MemberReference)
            {
                return(customAttribute.Constructor.ToMemberReferenceHandle(reader).GetMemberReference(reader).Parent);
            }
            else
            {
                throw new BadImageFormatException();
            }
        }
Beispiel #12
0
        private Exception TryResolveCaseInsensitive(ReflectionDomain reflectionDomain, RuntimeAssembly currentAssembly, out RuntimeType result)
        {
            String fullName = this.ToString().ToLower();

            LowLevelDictionary <String, QHandle> dict = GetCaseInsensitiveTypeDictionary(currentAssembly);
            QHandle qualifiedHandle;

            if (!dict.TryGetValue(fullName, out qualifiedHandle))
            {
                result = null;
                return(new TypeLoadException(SR.Format(SR.TypeLoad_TypeNotFound, this.ToString(), currentAssembly.FullName)));
            }

            MetadataReader reader = qualifiedHandle.Reader;
            Handle         typeDefOrForwarderHandle = qualifiedHandle.Handle;

            HandleType handleType = typeDefOrForwarderHandle.HandleType;

            switch (handleType)
            {
            case HandleType.TypeDefinition:
            {
                TypeDefinitionHandle typeDefinitionHandle = typeDefOrForwarderHandle.ToTypeDefinitionHandle(reader);
                result = reflectionDomain.ResolveTypeDefinition(reader, typeDefinitionHandle);
                return(null);
            }

            case HandleType.TypeForwarder:
            {
                TypeForwarder        typeForwarder           = typeDefOrForwarderHandle.ToTypeForwarderHandle(reader).GetTypeForwarder(reader);
                ScopeReferenceHandle destinationScope        = typeForwarder.Scope;
                RuntimeAssemblyName  destinationAssemblyName = destinationScope.ToRuntimeAssemblyName(reader);
                RuntimeAssembly      destinationAssembly;
                Exception            exception = RuntimeAssembly.TryGetRuntimeAssembly(reflectionDomain, destinationAssemblyName, out destinationAssembly);
                if (exception != null)
                {
                    result = null;
                    return(exception);
                }
                return(TryResolveCaseInsensitive(reflectionDomain, destinationAssembly, out result));
            }

            default:
                throw new InvalidOperationException();
            }
        }
Beispiel #13
0
                /// <summary>
                /// Converts this handle to a printable string.  the string consists of the handle value along with
                /// the callstack for it's allocation.
                /// </summary>
                public string ToString(HandleType type)
                {
                    StackParser sp = new StackParser(callStack);

                    // Discard all of the stack up to and including the "Handle.create" call
                    sp.DiscardTo("HandleCollector.Add");

                    // Skip the next call as it is always a debug wrapper
                    sp.DiscardNext();

                    // Now recreate the leak list with a lot of stack entries
                    sp.Truncate(40);

                    string description = "";

                    return(Convert.ToString(unchecked ((int)handle), 16) + description + ": " + sp.ToString());
                }
Beispiel #14
0
 internal static int RegisterType(string typeName, int expense, int initialThreshold)
 {
     lock (internalSyncObject)
     {
         if ((handleTypeCount == 0) || (handleTypeCount == handleTypes.Length))
         {
             HandleType[] destinationArray = new HandleType[handleTypeCount + 10];
             if (handleTypes != null)
             {
                 Array.Copy(handleTypes, 0, destinationArray, 0, handleTypeCount);
             }
             handleTypes = destinationArray;
         }
         handleTypes[handleTypeCount++] = new HandleType(typeName, expense, initialThreshold);
         return(handleTypeCount);
     }
 }
        public Rectangle ReSetCtlDragFrame(HandleType pType, Rectangle pRect, int pWidth, int pHeight)
        {
            int       left = pRect.Left, top = pRect.Top;
            Rectangle newRect;

            switch (pType)
            {
            case HandleType.LeftTop:
                newRect = new Rectangle(left + pWidth, top + pHeight, pRect.Width - pWidth, pRect.Height - pHeight);
                break;

            case HandleType.MiddleTop:
                newRect = new Rectangle(left, top + pHeight, pRect.Width, pRect.Height - pHeight);
                break;

            case HandleType.RightTop:
                newRect = new Rectangle(left, top + pHeight, pRect.Width + pWidth, pRect.Height - pHeight);
                break;

            case HandleType.RightMiddle:
                newRect = new Rectangle(left, top, pRect.Width + pWidth, pRect.Height);
                break;

            case HandleType.RightBottom:
                newRect = new Rectangle(left, top, pRect.Width + pWidth, pRect.Height + pHeight);
                break;

            case HandleType.BottomMiddle:
                newRect = new Rectangle(left, top, pRect.Width, pRect.Height + pHeight);
                break;

            case HandleType.LeftBottom:
                newRect = new Rectangle(left + pWidth, top, pRect.Width - pWidth, pRect.Height + pHeight);
                break;

            case HandleType.LeftMiddle:
                newRect = new Rectangle(left + pWidth, top, pRect.Width - pWidth, pRect.Height);
                break;

            default:
                newRect = pRect;
                break;
            }
            return(newRect);
        }
Beispiel #16
0
 public static void IgnoreCurrentHandlesAsLeaks()
 {
     lock (internalSyncObject)
     {
         if (System.ComponentModel.CompModSwitches.HandleLeak.Level >= TraceLevel.Warning)
         {
             HandleType[] array = new HandleType[handleTypes.Values.Count];
             handleTypes.Values.CopyTo(array, 0);
             for (int i = 0; i < array.Length; i++)
             {
                 if (array[i] != null)
                 {
                     array[i].IgnoreCurrentHandlesAsLeaks();
                 }
             }
         }
     }
 }
        internal static int RegisterType(string typeName, int expense, int initialThreshold)
        {
            lock (HandleMutex)
            {
                if (HandleTypeCount == 0 || HandleTypeCount == HandleTypes.Length)
                {
                    HandleType[] newTypes = new HandleType[HandleTypeCount + 10];
                    if (HandleTypes != null)
                    {
                        Array.Copy(HandleTypes, 0, newTypes, 0, HandleTypeCount);
                    }
                    HandleTypes = newTypes;
                }

                HandleTypes[HandleTypeCount++] = new HandleType(expense, initialThreshold);
                return(HandleTypeCount);
            }
        }
 public void GridInputHandle(HandleType handleType)
 {
     if (handleType == HandleType.handleLeft || handleType == HandleType.handleRight)
     {
         MoveGridGroup(handleType == HandleType.handleLeft);
     }
     else if (handleType == HandleType.hanelePush)
     {
         List <Grid> grids = PushBoxGame.Instance.gridGroup;
         for (int i = 0; i < grids.Count; i++)
         {
             //Node node = MoveDestinateNode(grids[i].Node, true);
             Node node = new Node(grids[i].Node.X, selfColDestNode[grids[i].Node.X]);
             grids[i].Move(node, 20);
         }
         SpawnGridGroup(grids[(int)(0.5f * (grids.Count))].Node.RightNode());
     }
 }
 public static void IgnoreCurrentHandlesAsLeaks()
 {
     lock (internalSyncObject)
     {
         if (System.ComponentModel.CompModSwitches.HandleLeak.Level >= TraceLevel.Warning)
         {
             HandleType[] array = new HandleType[handleTypes.Values.Count];
             handleTypes.Values.CopyTo(array, 0);
             for (int i = 0; i < array.Length; i++)
             {
                 if (array[i] != null)
                 {
                     array[i].IgnoreCurrentHandlesAsLeaks();
                 }
             }
         }
     }
 }
        /// <summary>
        /// Registers a new type of handle with the handle collector.
        /// </summary>
        internal static int RegisterType(string typeName, int expense, int initialThreshold)
        {
            lock (s_internalSyncObject)
            {
                if (s_handleTypeCount == 0 || s_handleTypeCount == s_handleTypes.Length)
                {
                    HandleType[] newTypes = new HandleType[s_handleTypeCount + 10];
                    if (s_handleTypes != null)
                    {
                        Array.Copy(s_handleTypes, 0, newTypes, 0, s_handleTypeCount);
                    }
                    s_handleTypes = newTypes;
                }

                s_handleTypes[s_handleTypeCount++] = new HandleType(typeName, expense, initialThreshold);
                return s_handleTypeCount;
            }
        }
Beispiel #21
0
        /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.IgnoreCurrentHandlesAsLeaks"]/*' />
        /// <devdoc>
        ///     All handles available at this time will be not be considered as leaks
        ///     when CheckLeaks is called to report leaks.
        /// </devdoc>
        /** @conditional(DEBUG) */
        public static void IgnoreCurrentHandlesAsLeaks()
        {
            lock (internalSyncObject) {
                if (CompModSwitches.HandleLeak.Level >= TraceLevel.Warning)
                {
                    HandleType[] types = new HandleType[handleTypes.Values.Count];
                    handleTypes.Values.CopyTo(types, 0);

                    for (int i = 0; i < types.Length; i++)
                    {
                        if (types[i] != null)
                        {
                            types[i].IgnoreCurrentHandlesAsLeaks();
                        }
                    }
                }
            }
        }
        protected override MethodImplRecord[] ComputeVirtualMethodImplsForType()
        {
            ArrayBuilder <MethodImplRecord> records = new ArrayBuilder <MethodImplRecord>();

            MetadataReader metadataReader = _metadataUnit.MetadataReader;

            foreach (var methodImplHandle in _typeDefinition.MethodImpls)
            {
                MethodImpl methodImpl = metadataReader.GetMethodImpl(methodImplHandle);

                Handle     methodDeclCheckHandle = methodImpl.MethodDeclaration;
                HandleType methodDeclHandleType  = methodDeclCheckHandle.HandleType;

                MetadataType owningType = null;
                switch (methodDeclHandleType)
                {
                case HandleType.QualifiedMethod:
                    QualifiedMethod qualifiedMethod = metadataReader.GetQualifiedMethod(methodDeclCheckHandle.ToQualifiedMethodHandle(metadataReader));
                    owningType = (MetadataType)_metadataUnit.GetType(qualifiedMethod.EnclosingType);
                    break;

                case HandleType.MemberReference:
                    Handle owningTypeHandle = metadataReader.GetMemberReference(methodDeclCheckHandle.ToMemberReferenceHandle(metadataReader)).Parent;
                    owningType = _metadataUnit.GetType(owningTypeHandle) as MetadataType;
                    break;

                default:
                    Debug.Assert(false, "unexpected methodDeclHandleType");
                    break;
                }

                // We want to check that the type is not an interface match before actually getting the MethodDesc.
                if (!owningType.IsInterface)
                {
                    MethodDesc newRecordDecl = (MethodDesc)_metadataUnit.GetObject(methodImpl.MethodDeclaration, null);
                    MethodDesc newRecordBody = (MethodDesc)_metadataUnit.GetObject(methodImpl.MethodBody, null);

                    records.Add(new MethodImplRecord(newRecordDecl, newRecordBody));
                }
            }

            return(records.ToArray());
        }
Beispiel #23
0
 public ItemDefinition(MySqlDataReader reader)
 {
     Id         = reader.GetInt32("Id");
     SwfName    = reader.GetString("swf_name");
     SpriteType = reader.GetString("sprite_type");
     SpriteId   = reader.GetInt32("sprite_id");
     Length     = reader.GetInt32("length");
     Width      = reader.GetInt32("width");
     Height     = reader.GetDouble("height");
     CanStack   = reader.GetBoolean("can_stack");
     ItemType   = reader.GetString("item_type");
     CanGift    = reader.GetBoolean("can_gift");
     CanRecycle = reader.GetBoolean("can_recycle");
     InteractorRightsRequired = reader.GetBoolean("interactor_requires_rights");
     InteractorType           = reader.GetString("interactor_type");
     InteractorCount          = reader.GetInt32("interactor_count");
     HandleType = HandlerParser.GetItemHandle(InteractorType);
     VendorIDs  = reader.GetString("vendor_ids");
 }
        private String GetTypeFullNameFromTypeRef(TypeReferenceHandle typeReferenceHandle, MetadataReader reader)
        {
            String s = "";

            TypeReference typeReference = typeReferenceHandle.GetTypeReference(reader);

            s = typeReference.TypeName.GetString(reader);
            Handle     parentHandle     = typeReference.ParentNamespaceOrType;
            HandleType parentHandleType = parentHandle.HandleType;

            if (parentHandleType == HandleType.TypeReference)
            {
                String containingTypeName = GetTypeFullNameFromTypeRef(parentHandle.ToTypeReferenceHandle(reader), reader);
                s = containingTypeName + "+" + s;
            }
            else if (parentHandleType == HandleType.NamespaceReference)
            {
                NamespaceReferenceHandle namespaceReferenceHandle = parentHandle.ToNamespaceReferenceHandle(reader);
                for (;;)
                {
                    NamespaceReference namespaceReference = namespaceReferenceHandle.GetNamespaceReference(reader);
                    String             namespacePart      = namespaceReference.Name.GetStringOrNull(reader);
                    if (namespacePart == null)
                    {
                        break; // Reached the root namespace.
                    }
                    s = namespacePart + "." + s;
                    if (namespaceReference.ParentScopeOrNamespace.HandleType != HandleType.NamespaceReference)
                    {
                        break; // Should have reached the root namespace first but this helper is for ToString() - better to
                    }
                    // return partial information than crash.
                    namespaceReferenceHandle = namespaceReference.ParentScopeOrNamespace.ToNamespaceReferenceHandle(reader);
                }
            }
            else
            {
                // If we got here, the metadata is illegal but this helper is for ToString() - better to
                // return something partial than throw.
            }

            return(s);
        }
Beispiel #25
0
        public static Handle SkipCustomModifiers(this Handle handle, MetadataReader reader)
        {
            HandleType handleType = handle.HandleType;

            Debug.Assert(handleType == HandleType.TypeDefinition || handleType == HandleType.TypeReference || handleType == HandleType.TypeSpecification || handleType == HandleType.ModifiedType);
            if (handleType != HandleType.ModifiedType)
            {
                return(handle);
            }

            do
            {
                ModifiedType modifiedType = handle.ToModifiedTypeHandle(reader).GetModifiedType(reader);
                handle     = modifiedType.Type;
                handleType = handle.HandleType;
            }while (handleType == HandleType.ModifiedType);

            return(handle);
        }
        /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.CheckLeaks"]/*' />
        /// <devdoc>
        ///     Called at shutdown to check for handles that are currently allocated.
        ///     Normally, there should be none.  This will print a list of all
        ///     handle leaks.
        /// </devdoc>
        /** @conditional(DEBUG) */
        public static void CheckLeaks()
        {
            lock (typeof(DebugHandleTracker)) {
                if (CompModSwitches.HandleLeak.Level >= TraceLevel.Warning)
                {
                    GC.Collect();
                    HandleType[] types = new HandleType[handleTypes.Values.Count];
                    handleTypes.Values.CopyTo(types, 0);

                    for (int i = 0; i < types.Length; i++)
                    {
                        if (types[i] != null)
                        {
                            types[i].CheckLeaks();
                        }
                    }
                }
            }
        }
Beispiel #27
0
        private static void AppendNamespaceHashCode(ref HashCodeBuilder builder, NamespaceReferenceHandle namespaceRefHandle, MetadataReader reader)
        {
            NamespaceReference namespaceReference = reader.GetNamespaceReference(namespaceRefHandle);

            Handle     parentHandle     = namespaceReference.ParentScopeOrNamespace;
            HandleType parentHandleType = parentHandle.HandleType;

            if (parentHandleType == HandleType.NamespaceReference)
            {
                AppendNamespaceHashCode(ref builder, parentHandle.ToNamespaceReferenceHandle(reader), reader);
                string namespaceNamePart = reader.GetString(namespaceReference.Name);
                builder.Append(namespaceNamePart);
                builder.Append(".");
            }
            else
            {
                Debug.Assert(parentHandleType == HandleType.ScopeReference);
                Debug.Assert(String.IsNullOrEmpty(reader.GetString(namespaceReference.Name)), "Root namespace with a name?");
            }
        }
Beispiel #28
0
        public static int RegisterType(string typeName, int expense, int initialThreshold)
        {
            int num1;

            lock (internalSyncObject)
            {
                if ((handleTypeCount == 0) || (handleTypeCount == handleTypes.Length))
                {
                    var typeArray1 = new HandleType[handleTypeCount + 10];
                    if (handleTypes != null)
                    {
                        Array.Copy(handleTypes, 0, typeArray1, 0, handleTypeCount);
                    }
                    handleTypes = typeArray1;
                }
                handleTypes[handleTypeCount++] = new HandleType(typeName, expense, initialThreshold);
                num1 = handleTypeCount;
            }
            return(num1);
        }
Beispiel #29
0
 public static void CheckLeaks()
 {
     lock (internalSyncObject)
     {
         if (System.ComponentModel.CompModSwitches.HandleLeak.Level >= TraceLevel.Warning)
         {
             GC.Collect();
             GC.WaitForPendingFinalizers();
             HandleType[] array = new HandleType[handleTypes.Values.Count];
             handleTypes.Values.CopyTo(array, 0);
             for (int i = 0; i < array.Length; i++)
             {
                 if (array[i] != null)
                 {
                     array[i].CheckLeaks();
                 }
             }
         }
     }
 }
Beispiel #30
0
        /// <summary>
        /// Called at shutdown to check for handles that are currently allocated. Normally, there should be none.
        /// This will print a list of all handle leaks.
        /// </summary>
        public static void CheckLeaks()
        {
            lock (s_internalSyncObject)
            {
                if (CompModSwitches.HandleLeak.Level >= TraceLevel.Warning)
                {
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    HandleType[] types = new HandleType[s_handleTypes.Values.Count];
                    s_handleTypes.Values.CopyTo(types, 0);

                    Debug.WriteLine("------------Begin--CheckLeaks--------------------");
                    for (int i = 0; i < types.Length; i++)
                    {
                        types[i]?.CheckLeaks();
                    }
                    Debug.WriteLine("-------------End--CheckLeaks---------------------");
                }
            }
        }
 public static void CheckLeaks()
 {
     lock (internalSyncObject)
     {
         if (System.ComponentModel.CompModSwitches.HandleLeak.Level >= TraceLevel.Warning)
         {
             GC.Collect();
             GC.WaitForPendingFinalizers();
             HandleType[] array = new HandleType[handleTypes.Values.Count];
             handleTypes.Values.CopyTo(array, 0);
             for (int i = 0; i < array.Length; i++)
             {
                 if (array[i] != null)
                 {
                     array[i].CheckLeaks();
                 }
             }
         }
     }
 }
Beispiel #32
0
                /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.ToString"]/*' />
                /// <devdoc>
                ///     Converts this handle to a printable string.  the string consists
                ///     of the handle value along with the callstack for it's
                ///     allocation.
                /// </devdoc>
                public string ToString(HandleType type)
                {
                    StackParser sp = new StackParser(callStack);

                    // Discard all of the stack up to and including the "Handle.create" call
                    //
                    sp.DiscardTo("HandleCollector.Add");

                    // Skip the next call as it is always a debug wrapper
                    //
                    sp.DiscardNext();

                    // Now recreate the leak list with a lot of stack entries
                    //
                    sp.Truncate(40);

                    string description = "";

                    /*if (type.name.Equals("GDI") || type.name.Equals("HDC")) {
                     *  int objectType = UnsafeNativeMethods.GetObjectType(new HandleRef(null, handle));
                     *  switch (objectType) {
                     *      case NativeMethods.OBJ_DC: description = "normal DC"; break;
                     *      case NativeMethods.OBJ_MEMDC: description = "memory DC"; break;
                     *      case NativeMethods.OBJ_METADC: description = "metafile DC"; break;
                     *      case NativeMethods.OBJ_ENHMETADC: description = "enhanced metafile DC"; break;
                     *
                     *      case NativeMethods.OBJ_PEN: description = "Pen"; break;
                     *      case NativeMethods.OBJ_BRUSH: description = "Brush"; break;
                     *      case NativeMethods.OBJ_PAL: description = "Palette"; break;
                     *      case NativeMethods.OBJ_FONT: description = "Font"; break;
                     *      case NativeMethods.OBJ_BITMAP: description = "Bitmap"; break;
                     *      case NativeMethods.OBJ_REGION: description = "Region"; break;
                     *      case NativeMethods.OBJ_METAFILE: description = "Metafile"; break;
                     *      case NativeMethods.OBJ_EXTPEN: description = "Extpen"; break;
                     *      default: description = "?"; break;
                     *  }
                     *  description = " (" + description + ")";
                     * }*/

                    return(Convert.ToString(unchecked ((int)handle), 16) + description + ": " + sp.ToString());
                }
Beispiel #33
0
        internal override Dictionary <ulong, List <ulong> > GetDependentHandleMap(CancellationToken cancelToken)
        {
            Dictionary <ulong, List <ulong> > result = new Dictionary <ulong, List <ulong> >();

            using (SOSHandleEnum handleEnum = _sos.EnumerateHandles())
            {
                if (handleEnum == null)
                {
                    return(result);
                }

                HandleData[] handles = new HandleData[32];

                int fetched;
                while ((fetched = handleEnum.ReadHandles(handles)) != 0)
                {
                    for (int i = 0; i < fetched; i++)
                    {
                        cancelToken.ThrowIfCancellationRequested();

                        HandleType type = (HandleType)handles[i].Type;
                        if (type != HandleType.Dependent)
                        {
                            continue;
                        }

                        if (ReadPointer(handles[i].Handle, out ulong address))
                        {
                            if (!result.TryGetValue(address, out List <ulong> value))
                            {
                                result[address] = value = new List <ulong>();
                            }

                            value.Add(handles[i].Secondary);
                        }
                    }
                }

                return(result);
            }
        }
Beispiel #34
0
        public static bool GetAttributeTypeNamespaceAndName(this MetadataReader metadataReader, Handle attributeType,
                                                            out string namespaceString, out ConstantStringValueHandle nameHandle)
        {
            namespaceString = null;
            nameHandle      = default(ConstantStringValueHandle);

            if (attributeType.HandleType == HandleType.TypeReference)
            {
                TypeReference typeRefRow = metadataReader.GetTypeReference(attributeType.ToTypeReferenceHandle(metadataReader));
                HandleType    handleType = typeRefRow.ParentNamespaceOrType.HandleType;

                // Nested type?
                if (handleType == HandleType.TypeReference || handleType == HandleType.TypeDefinition)
                {
                    return(false);
                }

                nameHandle      = typeRefRow.TypeName;
                namespaceString = metadataReader.GetNamespaceName(typeRefRow.ParentNamespaceOrType.ToNamespaceReferenceHandle(metadataReader));
                return(true);
            }
            else if (attributeType.HandleType == HandleType.TypeDefinition)
            {
                var def = metadataReader.GetTypeDefinition(attributeType.ToTypeDefinitionHandle(metadataReader));

                // Nested type?
                if (IsNested(def.Flags))
                {
                    return(false);
                }

                nameHandle      = def.Name;
                namespaceString = metadataReader.GetNamespaceName(def.NamespaceDefinition);
                return(true);
            }
            else
            {
                // unsupported metadata
                return(false);
            }
        }
Beispiel #35
0
        internal static RuntimeTypeInfo TryResolve(this Handle typeDefRefOrSpec, MetadataReader reader, TypeContext typeContext, ref Exception exception)
        {
            HandleType handleType = typeDefRefOrSpec.HandleType;

            if (handleType == HandleType.TypeDefinition)
            {
                return(typeDefRefOrSpec.ToTypeDefinitionHandle(reader).ResolveTypeDefinition(reader));
            }
            else if (handleType == HandleType.TypeReference)
            {
                return(typeDefRefOrSpec.ToTypeReferenceHandle(reader).TryResolveTypeReference(reader, ref exception));
            }
            else if (handleType == HandleType.TypeSpecification)
            {
                return(typeDefRefOrSpec.ToTypeSpecificationHandle(reader).TryResolveTypeSignature(reader, typeContext, ref exception));
            }
            else
            {
                throw new BadImageFormatException();  // Expected TypeRef, Def or Spec.
            }
        }
Beispiel #36
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // =============================================== CONSTRUCTORS =========================================== //
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////

        #region Initialization

        public LineManipulator3DNumeric()
            : base()
        {
            // define materials
            var rm = new PhongMaterial();

            rm.DiffuseColor      = new Color4(1f, 0f, 0f, 1f);
            rm.AmbientColor      = new Color4(0.8f, 0.4f, 0.4f, 1f);
            rm.SpecularColor     = new Color4(1f, 0.75f, 0f, 1f);
            rm.SpecularShininess = 3;
            rm.EmissiveColor     = new Color4(0.8f, 0f, 0f, 1f);
            this.RedMaterial     = rm;

            // define commands
            this.ApplyDeltaToHandleCmd = new HelixToolkit.SharpDX.Wpf.RelayCommand((x) => ApplyDeltaToHandle(),
                                                                                   (x) => CanExecute_ApplyDeltaToHandle());

            UpdateOnCoordsChange();
            this.SelHandleIndInChildren = -1;
            this.SelHandleType          = HandleType.NONE;
        }
        protected void OnNewChannels(ChannelDetails[] channels)
        {
            foreach (ChannelDetails c in channels)
            {
                string     object_path   = c.Channel.ToString();
                string     channel_type  = (string)c.Properties[Constants.CHANNEL_IFACE + ".ChannelType"];
                HandleType handle_type   = (HandleType)c.Properties[Constants.CHANNEL_IFACE + ".TargetHandleType"];
                uint       target_handle = (uint)c.Properties[Constants.CHANNEL_IFACE + ".TargetHandle"];

                if (channel_type.Equals(ChannelType) && CanProcess(c))
                {
                    Console.WriteLine("NewChannel detected: object path {0}, channel_type {1}, handle_type {2}, target_handle {3}",
                                      object_path, channel_type, handle_type.ToString(), target_handle);

                    uint initiator_handle = (uint)DBusUtility.GetProperty(Connection.Bus, Connection.BusName, object_path,
                                                                          Constants.CHANNEL_IFACE, "InitiatorHandle");
                    ProcessNewChannel(object_path, initiator_handle, target_handle, c);
                    return;
                }
            }
        }
Beispiel #38
0
    public void OnUpdate()
    {
        if (dic_HandleNetMessages == null || dic_HandleNetMessages.Count <= 0)
        {
            return;
        }

        foreach (KeyValuePair <MessageID, List <NetMessageInfo> > keyValue in dic_HandleNetMessages)
        {
            List <NetMessageInfo> netMessageList = keyValue.Value;

            if (netMessageList == null || netMessageList.Count <= 0)
            {
                continue;
            }

            for (int i = 0; i < netMessageList.Count; i++)
            {
                NetMessageBase netBase = netMessageList[i].msgBase;
                HandleType     type    = netMessageList[i].handleType;

                if (netBase == null)
                {
                    netMessageList.Remove(netMessageList[i]);
                    i--;
                    continue;
                }

                HandleMessage(type, netBase);

                if (!netBase.isFree)
                {
                    continue;
                }

                netMessageList.Remove(netMessageList[i]);
                i--;
            }
        }
    }
Beispiel #39
0
        private void setCursor(HandleType pType)
        {
            switch (pType)
            {
            case HandleType.LeftTop:
                panBack.Cursor = Cursors.SizeNWSE;
                break;

            case HandleType.MiddleTop:
                panBack.Cursor = Cursors.SizeNS;
                break;

            case HandleType.RightTop:
                panBack.Cursor = Cursors.SizeNESW;
                break;

            case HandleType.RightMiddle:
                panBack.Cursor = Cursors.SizeWE;
                break;

            case HandleType.RightBottom:
                panBack.Cursor = Cursors.SizeNWSE;
                break;

            case HandleType.BottomMiddle:
                panBack.Cursor = Cursors.SizeNS;
                break;

            case HandleType.LeftBottom:
                panBack.Cursor = Cursors.SizeNESW;
                break;

            case HandleType.LeftMiddle:
                panBack.Cursor = Cursors.SizeWE;
                break;

            default:
                break;
            }
        }
Beispiel #40
0
        private static int ParseOperator(HandleType type, string @operator)
        {
            switch (type)
            {
                case HandleType.Volume:
                    return (int)Enum.Parse(typeof(VolumeOperate), @operator, true);

                case HandleType.Vibrate:
                    return (int)Enum.Parse(typeof(VibrateOperate), @operator, true);

                case HandleType.Waveform:
                    return (int)Enum.Parse(typeof(WaveformType), @operator, true);

                case HandleType.EditWaveform:
                    FMOperate fmo;
                    BasicWaveformOperate bwo;
                    StepWaveformOperate swo;
                    RandomNoiseOperate rno;

                    if (Enum.TryParse(@operator, true, out fmo))
                        return (int)fmo;
                    else if (Enum.TryParse(@operator, true, out bwo))
                        return (int)bwo;
                    else if (Enum.TryParse(@operator, true, out swo))
                        return (int)swo;
                    else if (Enum.TryParse(@operator, true, out rno))
                        return (int)rno;
                    else
                        goto case HandleType.Envelope;

                case HandleType.Envelope:
                    return (int)Enum.Parse(typeof(EnvelopeOperate), @operator, true);

                case HandleType.Portament:
                    return (int)Enum.Parse(typeof(PortamentOperate), @operator, true);

                default:
                    throw new ArgumentException();
            }
        }
        internal sealed override RuntimeTypeInfo GetTypeCoreCaseInsensitive(string fullName)
        {
            LowLevelDictionary <string, QHandle> dict = CaseInsensitiveTypeDictionary;
            QHandle qualifiedHandle;

            if (!dict.TryGetValue(fullName.ToLowerInvariant(), out qualifiedHandle))
            {
                return(null);
            }

            MetadataReader reader = qualifiedHandle.Reader;
            Handle         typeDefOrForwarderHandle = qualifiedHandle.Handle;

            HandleType handleType = typeDefOrForwarderHandle.HandleType;

            switch (handleType)
            {
            case HandleType.TypeDefinition:
            {
                TypeDefinitionHandle typeDefinitionHandle = typeDefOrForwarderHandle.ToTypeDefinitionHandle(reader);
                return(typeDefinitionHandle.ResolveTypeDefinition(reader));
            }

            case HandleType.TypeForwarder:
            {
                TypeForwarder        typeForwarder           = typeDefOrForwarderHandle.ToTypeForwarderHandle(reader).GetTypeForwarder(reader);
                ScopeReferenceHandle destinationScope        = typeForwarder.Scope;
                RuntimeAssemblyName  destinationAssemblyName = destinationScope.ToRuntimeAssemblyName(reader);
                RuntimeAssemblyInfo  destinationAssembly     = RuntimeAssemblyInfo.GetRuntimeAssemblyIfExists(destinationAssemblyName);
                if (destinationAssembly == null)
                {
                    return(null);
                }
                return(destinationAssembly.GetTypeCoreCaseInsensitive(fullName));
            }

            default:
                throw new InvalidOperationException();
            }
        }
Beispiel #42
0
		public virtual void SetFeedback(HandleType mouseHandleType)
		{
			if (Diagram == null) return;
			if (! (Diagram.Render is IRenderDesign)) return;
			if (! (Diagram is Diagram)) return;

			Diagram diagram = (Diagram) Diagram;
			IRenderDesign render = (IRenderDesign) Diagram.Render;
			
			if (render.Actions == null) return;

			foreach (Element element in render.Actions)
			{
				if (element.ActionElement == diagram.CurrentMouseElements.MouseStartElement)
				{
					System.Text.StringBuilder builder = new System.Text.StringBuilder();
					string abbrev = Units.Abbreviate(FeedbackUnit);

					if (element is Shape)
					{
						int decimals = Units.DecimalsFromUnit(FeedbackUnit);

						if (mouseHandleType == HandleType.Move)
						{
							PointF location = element.Rectangle.Location;

							//Check if must translate unit
							if (FeedbackUnit != DiagramUnit.Pixel)
							{
								location = Component.Instance.Units.ConvertPoint(location,FeedbackUnit);
							}

							//Round units
							location = new PointF(Convert.ToSingle(Math.Round(location.X,decimals)),Convert.ToSingle(Math.Round(location.Y,decimals)));

							builder.Append("x: ");
							builder.Append(location.X.ToString());
							builder.Append(" ");
							builder.Append(abbrev);
							builder.Append(" ");
							builder.Append(" y: ");
							builder.Append(location.Y.ToString());
							builder.Append(" ");
							builder.Append(abbrev);
						
							render.Feedback = builder.ToString();
						}
						else if (mouseHandleType == HandleType.Rotate)
						{
							ITransformable transform = (ITransformable) element;
							builder.Append(Convert.ToSingle(Math.Round(transform.Rotation,decimals)).ToString());
							builder.Append(" degrees");

							render.Feedback = builder.ToString();
						}
						else
						{
							SizeF size = element.Rectangle.Size;

							//Check if must translate unit
							if (FeedbackUnit != DiagramUnit.Pixel)
							{
								Graphics graphics = Component.Instance.CreateGraphics();
								size = Component.Instance.Units.ConvertSize(size,FeedbackUnit);
								graphics.Dispose();
							}

							//Round units
							size = new SizeF(Convert.ToSingle(Math.Round(size.Width,decimals)),Convert.ToSingle(Math.Round(size.Height,decimals)));

							builder.Append("w: ");
							builder.Append(size.Width.ToString());
							builder.Append(" ");
							builder.Append(abbrev);
							builder.Append(" ");
							builder.Append(" h: ");
							builder.Append(size.Height.ToString());
							builder.Append(" ");
							builder.Append(abbrev);

							render.Feedback = builder.ToString();
						}
					}
				}
			}
		}
 public Handle(HandleType type, int offset)
 {
     _value = (int)type << 24 | (int)offset;
 }
 public void Request(uint target_handle, HandleType handle_type, IDictionary <string, object> properties)
 {
     Request (target_handle, handle_type, properties, true);
 }
Beispiel #45
0
 public static int Size(HandleType type)
 {
     return uv_handle_size(type);
 }
Beispiel #46
0
 internal UVStream(Loop loop, HandleType type)
     : this(loop, Handle.Size(type))
 {
 }
Beispiel #47
0
 public int handle_size(HandleType handleType)
 {
     return _uv_handle_size(handleType);
 }
Beispiel #48
0
        private void initTypeAndName()
        {
            if (_typeAndNameAttempted)
                return;
            _typeAndNameAttempted = true;

            IntPtr sourceProcessHandle = IntPtr.Zero;
            IntPtr handleDuplicate = IntPtr.Zero;
            try
            {
                sourceProcessHandle = Kernel32.OpenProcess(0x40 /* dup_handle */, true, ProcessId);

                // To read info about a handle owned by another process we must duplicate it into ours
                // For simplicity, current process handles will also get duplicated; remember that process handles cannot be compared for equality
                if (!Kernel32.DuplicateHandle(sourceProcessHandle, (IntPtr)Handle, Kernel32.GetCurrentProcess(), out handleDuplicate, 0, false, 2 /* same_access */))
                    return;

                // Query the object type
                if (_rawTypeMap.ContainsKey(RawType))
                    _typeStr = _rawTypeMap[RawType];
                else
                {
                    int length;
                    NtDll.NtQueryObject(handleDuplicate, OBJECT_INFORMATION_CLASS.ObjectTypeInformation, IntPtr.Zero, 0, out length);
                    IntPtr ptr = IntPtr.Zero;
                    try
                    {
                        ptr = Marshal.AllocHGlobal(length);
                        if (NtDll.NtQueryObject(handleDuplicate, OBJECT_INFORMATION_CLASS.ObjectTypeInformation, ptr, length, out length) != NT_STATUS.STATUS_SUCCESS)
                            return;
                        _typeStr = Marshal.PtrToStringUni((IntPtr)((long)ptr + 0x58 + 2 * IntPtr.Size));
                        _rawTypeMap[RawType] = _typeStr;
                    }
                    finally
                    {
                        Marshal.FreeHGlobal(ptr);
                    }
                }
                _type = HandleTypeFromString(_typeStr);

                // Query the object name
                if (_typeStr != null && GrantedAccess != 0x0012019f && GrantedAccess != 0x00120189 && GrantedAccess != 0x120089) // dont query some objects that could get stuck
                {
                    int length;
                    NtDll.NtQueryObject(handleDuplicate, OBJECT_INFORMATION_CLASS.ObjectNameInformation, IntPtr.Zero, 0, out length);
                    IntPtr ptr = IntPtr.Zero;
                    try
                    {
                        ptr = Marshal.AllocHGlobal(length);
                        if (NtDll.NtQueryObject(handleDuplicate, OBJECT_INFORMATION_CLASS.ObjectNameInformation, ptr, length, out length) != NT_STATUS.STATUS_SUCCESS)
                            return;
                        _name = Marshal.PtrToStringUni((IntPtr)((long)ptr + 2 * IntPtr.Size));

                        if (_typeStr == "File" || _typeStr == "Directory")
                        {
                            _name = GetRegularFileNameFromDevice(_name);
                        }
                    }
                    finally
                    {
                        Marshal.FreeHGlobal(ptr);
                    }
                }
            }
            finally
            {
                Kernel32.CloseHandle(sourceProcessHandle);
                if (handleDuplicate != IntPtr.Zero)
                    Kernel32.CloseHandle(handleDuplicate);
            }
        }
        public virtual void Request(uint target_handle, 
                                     HandleType handle_type, 
                                     IDictionary <string, object> properties,
                                     bool replace)
        {
            IDictionary <string, object> channel_specs = new Dictionary <string, object> ();
            channel_specs.Add (Constants.CHANNEL_IFACE + ".ChannelType",
                               ChannelType);
            channel_specs.Add (Constants.CHANNEL_IFACE + ".TargetHandleType",
                               handle_type);
            channel_specs.Add (Constants.CHANNEL_IFACE + ".TargetHandle",
                               target_handle);

            if (VerifyRequest (target_handle, properties)) {

                if (replace) {
                    CleanUpIfClosed (target_handle, GetDispatchingKey (properties));
                }

                CopyRequestProperties (properties, channel_specs);

                ObjectPath object_path;
                Requests.CreateChannel (channel_specs, out object_path, out channel_properties);
            }
        }
Beispiel #50
0
 private void initType()
 {
     if (_rawTypeMap.ContainsKey(RawType))
     {
         _typeStr = _rawTypeMap[RawType];
         _type = HandleTypeFromString(_typeStr);
     }
     else
         initTypeAndName();
 }
Beispiel #51
0
            /// <summary>
            ///     Initializes a new instance of the <see cref="Handler" /> class.
            /// </summary>
            /// <param name="SpellInstance">
            ///     The spell instance.
            /// </param>
            /// <param name="Process">
            ///     The process.
            /// </param>
            /// <param name="Condition">
            ///     The condition.
            /// </param>
            /// <param name="Type">
            ///     The type.
            /// </param>
            public Handler(
                Spell SpellInstance, 
                OnGameUpdate Process, 
                OnSpellCheck Condition = null, 
                HandleType Type = HandleType.OnUpdate)
            {
                this.SpellInstance = SpellInstance;
                this.Type = Type;
                this.Process = Process;
                this.Condition = Condition;

                switch (Type)
                {
                    case HandleType.OnUpdate:
                        Game.OnUpdate += (EventArgs args) =>
                            {
                                if (Condition != null && Condition(SpellInstance))
                                {
                                    Process(SpellInstance);
                                }
                            };
                        break;
                }
            }
Beispiel #52
0
		internal static IntPtr Alloc(HandleType type)
		{
			return Alloc(Handle.Size(type));
		}
Beispiel #53
0
 public VkDescriptorSetLayout(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device = device;
     Handle = handle;
     Allocator = allocator;
 }
Beispiel #54
0
 internal static extern int uv_handle_size(HandleType type);
Beispiel #55
0
 public static extern int uv_handle_size(HandleType handleType);
		public Cursor GetCursor(HandleType type)
		{
			if (mCursors == null) CreateCursors();
			return mCursors[type] as Cursor;
		}
Beispiel #57
0
 protected UVStream(UVLoop loop, HandleType type)
     : base(loop, type)
 {
     _stream = (uv_stream_t*)(Handle.ToInt64() + GetSize(HandleType.UV_HANDLE));
 }
Beispiel #58
0
        /// <summary>
        /// Telepathy callback when new channels are created
        /// </summary>
        private void OnNewChannel(
						ObjectPath channelPath,
						string channelType,
						HandleType handleType,
						uint handle,
						bool suppressHandler)
        {
            Logger.Debug ("Account::OnNewChannel - called");
            Logger.Debug ("New Channel {0}", channelType);
            Logger.Debug ("Handle Type: {0}", handleType.ToString());
            Logger.Debug ("Handle: {0}", handle);
            Logger.Debug ("Suppress Handler: {0}", suppressHandler);

            if (suppressHandler == false)
                ConversationManager.ProcessNewChannel (
                    this,
                    channelPath,
                    channelType,
                    handleType,
                    handle,
                    suppressHandler);

            return;
        }
Beispiel #59
0
 public VkDisplayModeKHR(IVkInstance instance, HandleType handle)
 {
     Instance = instance;
     Handle = handle;
 }
Beispiel #60
0
 internal Handle(Loop loop, HandleType type)
     : this(loop, Handle.Size(type))
 {
 }