bool CDeviceXml::Serialize(const CDevice& record, TiXmlElement* pElement) { pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_NAME, record.Name()); pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_PROVIDER, record.Provider()); if (record.IsVidPidKnown()) { pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_VID, CStorageUtils::FormatHexString(record.VendorID())); pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_PID, CStorageUtils::FormatHexString(record.ProductID())); } if (record.ButtonCount() != 0) pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_BUTTONCOUNT, record.ButtonCount()); if (record.HatCount() != 0) pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_HATCOUNT, record.HatCount()); if (record.AxisCount() != 0) pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_AXISCOUNT, record.AxisCount()); if (record.Index() != 0) pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_INDEX, record.Index()); return true; }