Пример #1
0
        private int HasKeys(IntPtr descriptor, IntPtr keyArray, ref bool value)
        {
#if DEBUG
            DebugUtils.Ping(DebugFlags.DescriptorParameters, string.Format("descriptor: 0x{0}", descriptor.ToHexString()));
#endif

            if (keyArray != IntPtr.Zero)
            {
                ScriptingParameters parameters = actionDescriptors[descriptor];
                bool result = true;
                unsafe
                {
                    uint *key = (uint *)keyArray.ToPointer();

                    while (*key != 0U)
                    {
                        if (!parameters.ContainsKey(*key))
                        {
                            result = false;
                            break;
                        }

                        key++;
                    }
                }
                value = result;
            }
            else
            {
                return(PSError.kSPBadParameterError);
            }

            return(PSError.kSPNoError);
        }
Пример #2
0
        private int GetCount(IntPtr descriptor, ref uint count)
        {
#if DEBUG
            DebugUtils.Ping(DebugFlags.DescriptorParameters, string.Format("descriptor: 0x{0}", descriptor.ToHexString()));
#endif
            ScriptingParameters parameters = actionDescriptors[descriptor];

            count = (uint)parameters.Count;

            return(PSError.kSPNoError);
        }
Пример #3
0
        private int GetKey(IntPtr descriptor, uint index, ref uint key)
        {
#if DEBUG
            DebugUtils.Ping(DebugFlags.DescriptorParameters, string.Format("index: {0}", index));
#endif
            ScriptingParameters parameters = actionDescriptors[descriptor];

            if (index < parameters.Count)
            {
                key = parameters.GetKeyAtIndex((int)index);

                return(PSError.kSPNoError);
            }

            return(PSError.errMissingParameter);
        }
Пример #4
0
        private int GetObject(IntPtr descriptor, uint key, ref uint retType, ref IntPtr outputDescriptor)
        {
#if DEBUG
            DebugUtils.Ping(DebugFlags.DescriptorParameters, string.Format("key: 0x{0:X4}({1})", key, DebugUtils.PropToString(key)));
#endif
            AETEValue item;
            if (actionDescriptors[descriptor].TryGetValue(key, out item))
            {
                uint type = item.Type;

                try
                {
                    retType = type;
                }
                catch (NullReferenceException)
                {
                    // ignore it
                }

                ScriptingParameters parameters = item.Value as ScriptingParameters;
                if (parameters != null)
                {
                    try
                    {
                        outputDescriptor = GenerateDictionaryKey();
                        actionDescriptors.Add(outputDescriptor, parameters);
                    }
                    catch (OutOfMemoryException)
                    {
                        return(PSError.memFullErr);
                    }

                    return(PSError.kSPNoError);
                }
            }

            return(PSError.errMissingParameter);
        }
Пример #5
0
 private ScriptingParameters(ScriptingParameters cloneMe)
 {
     parameters = new Dictionary <uint, AETEValue>(cloneMe.parameters);
     keys       = new List <uint>(cloneMe.keys);
 }