Пример #1
0
            public AttributeList(Attribute a)
            {
                IntPtr nameAnsi  = Utility.StringToAnsiIntPtr(a.GetName());
                IntPtr valueAnsi = Utility.StringToAnsiIntPtr(a.GetValue());

                cAttrList = UnmanagedNewFromAttribute(Attribute.UnmanagedNew(nameAnsi, valueAnsi, a.GetWeight()));

                Memory.LocalFree(nameAnsi);
                Memory.LocalFree(valueAnsi);

                if (cAttrList == IntPtr.Zero)
                {
                    throw new AttributeNullPtrException();
                }
            }
Пример #2
0
            public ulong Add(Attribute a)
            {
                Debug.WriteLine("Adding new attribute:" + a.ToString());

                IntPtr nameAnsi  = Utility.StringToAnsiIntPtr(a.GetName());
                IntPtr valueAnsi = Utility.StringToAnsiIntPtr(a.GetValue());

                UInt32 size = UnmanagedAddAttribute(cAttrList, Attribute.UnmanagedNew(nameAnsi, valueAnsi, a.GetWeight()));

                Memory.LocalFree(nameAnsi);
                Memory.LocalFree(valueAnsi);

                Debug.WriteLine("Added attribute " + a.ToString() + ". New size=" + size);

                return(size);
            }
Пример #3
0
        public bool AddAttribute(Attribute a)
        {
            IntPtr nameAnsi  = Utility.StringToAnsiIntPtr(a.GetName());
            IntPtr valueAnsi = Utility.StringToAnsiIntPtr(a.GetValue());

            int ret = UnmanagedAddAttribute(this.cDataObject, nameAnsi, valueAnsi);

            Memory.LocalFree(nameAnsi);
            Memory.LocalFree(valueAnsi);

            if (ret > 0)
            {
                return(true);
            }

            return(false);
        }
Пример #4
0
        public void PrintAttributes()
        {
            UInt32 i = 0;

            while (true)
            {
                IntPtr           a;
                Haggle.Attribute attr;

                a = UnmanagedGetAttributeN(this.cDataObject, i++);

                if (a == IntPtr.Zero)
                {
                    //Debug.WriteLine("UnmanagedAttribute zero pointer");
                    break;
                }

                attr = new Attribute(a, false);

                Debug.WriteLine("Attribute" + attr.GetName() + ":" + attr.GetValue());
            }
        }
Пример #5
0
        public void PrintAttributes()
        {
            UInt32 i = 0;

                        while (true)
                        {
                                IntPtr a;
                                Haggle.Attribute attr;

                                a = UnmanagedGetAttributeN(this.cDataObject, i++);

                                if (a == IntPtr.Zero)
                                {
                                        //Debug.WriteLine("UnmanagedAttribute zero pointer");
                                        break;
                                }

                                attr = new Attribute(a, false);

                                Debug.WriteLine("Attribute" + attr.GetName() + ":" + attr.GetValue());
                        }
        }
Пример #6
0
        public bool AddAttribute(Attribute a)
        {
            IntPtr nameAnsi = Utility.StringToAnsiIntPtr(a.GetName());
                        IntPtr valueAnsi = Utility.StringToAnsiIntPtr(a.GetValue());

                        int ret = UnmanagedAddAttribute(this.cDataObject, nameAnsi, valueAnsi);

                        Memory.LocalFree(nameAnsi);
                        Memory.LocalFree(valueAnsi);

                        if (ret > 0)
                                return true;

                        return false;
        }
Пример #7
0
            public ulong Add(Attribute a)
            {
                Debug.WriteLine("Adding new attribute:" + a.ToString());

                                IntPtr nameAnsi = Utility.StringToAnsiIntPtr(a.GetName());
                                IntPtr valueAnsi = Utility.StringToAnsiIntPtr(a.GetValue());

                                UInt32 size = UnmanagedAddAttribute(cAttrList, Attribute.UnmanagedNew(nameAnsi, valueAnsi, a.GetWeight()));

                                Memory.LocalFree(nameAnsi);
                                Memory.LocalFree(valueAnsi);

                                Debug.WriteLine("Added attribute " + a.ToString() + ". New size=" + size);

                                return size;
            }
Пример #8
0
            public AttributeList(Attribute a)
            {
                IntPtr nameAnsi = Utility.StringToAnsiIntPtr(a.GetName());
                                IntPtr valueAnsi = Utility.StringToAnsiIntPtr(a.GetValue());

                                cAttrList = UnmanagedNewFromAttribute(Attribute.UnmanagedNew(nameAnsi, valueAnsi, a.GetWeight()));

                                Memory.LocalFree(nameAnsi);
                                Memory.LocalFree(valueAnsi);

                                if (cAttrList == IntPtr.Zero)
                                {
                                        throw new AttributeNullPtrException();
                                }
            }