Exemplo n.º 1
0
        private int GetZString(IntPtr descriptor, uint key, ref IntPtr zstring)
        {
#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))
            {
                ActionDescriptorZString value = (ActionDescriptorZString)item.Value;

                try
                {
                    zstring = zstringSuite.CreateFromActionDescriptor(value);
                }
                catch (OutOfMemoryException)
                {
                    return(PSError.memFullErr);
                }

                return(PSError.kSPNoError);
            }

            return(PSError.errMissingParameter);
        }
Exemplo n.º 2
0
        private unsafe int GetZString(PIActionList list, uint index, ASZString *zstring)
        {
            if (zstring == null)
            {
                return(PSError.kSPBadParameterError);
            }

            ActionListItemCollection items = actionLists[list];

            if (index < items.Count)
            {
                ActionDescriptorZString value = (ActionDescriptorZString)items[(int)index].Value;

                try
                {
                    *zstring = zstringSuite.CreateFromActionDescriptor(value);
                }
                catch (OutOfMemoryException)
                {
                    return(PSError.memFullErr);
                }

                return(PSError.kSPNoError);
            }

            return(PSError.kSPBadParameterError);
        }
Exemplo n.º 3
0
        IntPtr IASZStringSuite.CreateFromActionDescriptor(ActionDescriptorZString descriptor)
        {
            IntPtr newZString = Empty;

            if (descriptor != null)
            {
                newZString = GenerateDictionaryKey();
                ZString zstring = new ZString(descriptor.Value);
                strings.Add(newZString, zstring);
            }

            return(newZString);
        }
Exemplo n.º 4
0
        bool IASZStringSuite.ConvertToActionDescriptor(IntPtr zstring, out ActionDescriptorZString descriptor)
        {
            descriptor = null;

            if (zstring != Empty)
            {
                ZString value;
                if (strings.TryGetValue(zstring, out value))
                {
                    descriptor = new ActionDescriptorZString(value.Data);
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }