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(); } }
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); }
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); }
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()); } }
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; }
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; }