Пример #1
0
        private int PutObject(PIActionList list, uint type, PIActionDescriptor 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.kSPOutOfMemoryError);
            }

            return(PSError.kSPNoError);
        }
        private int Register(IntPtr key, PIActionDescriptor descriptor, bool isPersistent)
        {
            try
            {
                string registryKey = StringUtil.FromCString(key);
                if (registryKey == null)
                {
                    return(PSError.kSPBadParameterError);
                }

                ReadOnlyDictionary <uint, AETEValue> values;

                if (actionDescriptorSuite.TryGetDescriptorValues(descriptor, out values))
                {
                    registry.AddOrUpdate(registryKey, new DescriptorRegistryItem(values, isPersistent));
                    if (isPersistent)
                    {
                        persistentValuesChanged = true;
                    }
                }
                else
                {
                    return(PSError.kSPBadParameterError);
                }
            }
            catch (OutOfMemoryException)
            {
                return(PSError.kSPOutOfMemoryError);
            }

            return(PSError.kSPNoError);
        }
Пример #3
0
 private int PutGlobalObject(PIActionList list, uint type, PIActionDescriptor descriptor)
 {
     return(PutObject(list, type, descriptor));
 }