Ejemplo n.º 1
0
        private int PutObject(IntPtr list, uint type, IntPtr descriptor)
        {
            if (actionDescriptorSuite == null)
            {
                // The plug-in called this method before acquiring the Action Descriptor suite.
                return(PSError.kSPLogicError);
            }

            try
            {
                ReadOnlyDictionary <uint, AETEValue> descriptorValues;
                if (actionDescriptorSuite.TryGetDescriptorValues(descriptor, out descriptorValues))
                {
                    ActionListDescriptor item = new ActionListDescriptor(type, descriptorValues);
                    actionLists[list].Add(new ActionListItem(DescriptorTypes.Object, item));
                }
                else
                {
                    return(PSError.kSPBadParameterError);
                }
            }
            catch (OutOfMemoryException)
            {
                return(PSError.memFullErr);
            }

            return(PSError.kSPNoError);
        }
Ejemplo n.º 2
0
        private unsafe int GetObject(PIActionList list, uint index, uint *retType, PIActionDescriptor *descriptor)
        {
            if (actionDescriptorSuite == null)
            {
                // The plug-in called this method before acquiring the Action Descriptor suite.
                return(PSError.kSPLogicError);
            }

            if (descriptor == null)
            {
                return(PSError.kSPBadParameterError);
            }

            ActionListItemCollection items = actionLists[list];

            if (index < items.Count)
            {
                ActionListDescriptor item = (ActionListDescriptor)items[(int)index].Value;

                if (retType != null)
                {
                    *retType = item.Type;
                }

                try
                {
                    *descriptor = actionDescriptorSuite.CreateDescriptor(item.DescriptorValues);
                }
                catch (OutOfMemoryException)
                {
                    return(PSError.memFullErr);
                }

                return(PSError.kSPNoError);
            }

            return(PSError.kSPBadParameterError);
        }
Ejemplo n.º 3
0
        private int GetObject(IntPtr list, uint index, ref uint retType, ref IntPtr descriptor)
        {
            if (actionDescriptorSuite == null)
            {
                // The plug-in called this method before acquiring the Action Descriptor suite.
                return(PSError.kSPLogicError);
            }

            ActionListItemCollection items = actionLists[list];

            if (index < items.Count)
            {
                ActionListDescriptor item = (ActionListDescriptor)items[(int)index].Value;

                try
                {
                    retType = item.Type;
                }
                catch (NullReferenceException)
                {
                    // ignore it
                }

                try
                {
                    descriptor = actionDescriptorSuite.CreateDescriptor(item.DescriptorValues);
                }
                catch (OutOfMemoryException)
                {
                    return(PSError.memFullErr);
                }

                return(PSError.kSPNoError);
            }

            return(PSError.kSPBadParameterError);
        }