Property_Import
Import custom properties defined in XML text into the project.
Call:
int iret = ac_request("elem_user_property", "Property_Import", string sXMLsource, int conflictResolutionPolicy);
Here:
sXMLsource - text in XML format describing imported custom properties,
conflictResolutionPolicy - a directive on how to act if there are properties with the same name:
0 - add a new property,
1 - replace the old property with the new one,
2 - skip adding the conflicting property.
Example:
Download from the site XML description of the properties and load them into the project:
int do_iButtonloadProperties()
{
cout << "load properties\n";
int iStringDescr;
object("create", "ts_string", iStringDescr);
// loading properties
string spropfname = "KSI properties";
int iret = ts_string(iStringDescr, "ReadFromURL", "http://www.labpp.ru/TSDownload/KSI/" + spropfname + ".txt");
object("read_simple_value", iStringDescr);
string sXMLsource = ac_getstrvalue();
ts_dialogcontrol(iProgressBar, "SetValue", 2);
if (iret == 0)
{
coutvar << sXMLsource;
iret = ac_request("elem_user_property", "Property_Import", sXMLsource, 1);
if (iret == 0)
{
tsalert(-3, "Message", "Properties loaded successfully", spropfname);
}
}
object("delete", iStringDescr);
}