Esempio n. 1
0
        private unsafe int GetEnumerated(PIActionReference reference, uint *type, uint *enumValue)
        {
            if (enumValue == null)
            {
                return(PSError.kSPBadParameterError);
            }

            ActionReferenceContainer container;

            if (actionReferences.TryGetValue(reference, out container))
            {
                ActionReferenceItem item = container.GetReference();
                if (item != null)
                {
                    EnumeratedValue enumerated = (EnumeratedValue)item.Value;
                    if (type != null)
                    {
                        *type = enumerated.Type;
                    }
                    *enumValue = enumerated.Value;

                    return(PSError.kSPNoError);
                }
            }

            return(PSError.kSPBadParameterError);
        }
Esempio n. 2
0
        private int GetName(PIActionReference reference, IntPtr cstrValue, uint maxLength)
        {
            if (cstrValue != IntPtr.Zero)
            {
                ActionReferenceContainer container;
                if (actionReferences.TryGetValue(reference, out container))
                {
                    ActionReferenceItem item = container.GetReference();
                    if (item != null)
                    {
                        if (maxLength > 0)
                        {
                            byte[] bytes = (byte[])item.Value;

                            // Ensure that the buffer has room for the null terminator.
                            int length = (int)Math.Min(bytes.Length, maxLength - 1);

                            Marshal.Copy(bytes, 0, cstrValue, length);
                            Marshal.WriteByte(cstrValue, length, 0);
                        }

                        return(PSError.kSPNoError);
                    }
                }
            }

            return(PSError.kSPBadParameterError);
        }
Esempio n. 3
0
        private unsafe int GetProperty(PIActionReference reference, uint *value)
        {
            if (value == null)
            {
                return(PSError.kSPBadParameterError);
            }

            ActionReferenceContainer container;

            if (actionReferences.TryGetValue(reference, out container))
            {
                ActionReferenceItem item = container.GetReference();
                if (item != null)
                {
                    *value = (uint)item.Value;

                    return(PSError.kSPNoError);
                }
            }

            return(PSError.kSPBadParameterError);
        }
Esempio n. 4
0
        private unsafe int GetNameLength(PIActionReference reference, uint *stringLength)
        {
            if (stringLength == null)
            {
                return(PSError.kSPBadParameterError);
            }

            ActionReferenceContainer container;

            if (actionReferences.TryGetValue(reference, out container))
            {
                ActionReferenceItem item = container.GetReference();
                if (item != null)
                {
                    byte[] bytes        = (byte[])item.Value;
                    *      stringLength = (uint)bytes.Length;

                    return(PSError.kSPNoError);
                }
            }

            return(PSError.kSPBadParameterError);
        }
Esempio n. 5
0
 public void Add(ActionReferenceItem item)
 {
     references.Add(item);
 }