예제 #1
0
        private unsafe int Get(IntPtr key, PIActionDescriptor *descriptor)
        {
            if (key == IntPtr.Zero || descriptor == null)
            {
                return(PSError.kSPBadParameterError);
            }

            try
            {
                string registryKey = StringUtil.FromCString(key);
                if (registryKey == null)
                {
                    return(PSError.kSPBadParameterError);
                }

                PluginSettingsRegistryItem item;

                if (registry.TryGetValue(registryKey, out item))
                {
                    *descriptor = actionDescriptorSuite.CreateDescriptor(item.Values);
                }
                else
                {
                    *descriptor = PIActionDescriptor.Null;
                }
            }
            catch (OutOfMemoryException)
            {
                return(PSError.memFullErr);
            }

            return(PSError.kSPNoError);
        }
예제 #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.kSPOutOfMemoryError);
                }

                return(PSError.kSPNoError);
            }

            return(PSError.kSPBadParameterError);
        }
예제 #3
0
 private unsafe int GetGlobalObject(PIActionList list, uint index, uint *retType, PIActionDescriptor *descriptor)
 {
     return(GetObject(list, index, retType, descriptor));
 }