The changes to the ProjectLoadingHooks are in trunk/master now.
There is also new scripting api for modifying the extensions. It is a lot more capable.
Here is an example what is possible now. You can uncomment some parts to test different functions:
function doListAll(project, extension)
{
print(" " + extension + "\n");
local listAttrs = project.ExtensionListNodeAttributes(extension);
for (local jj=0; jj<listAttrs.GetCount(); ++jj)
{
local value = project.ExtensionGetNodeAttribute(extension, listAttrs.Item(jj));
print(_T(" attr -> ") + listAttrs.Item(jj) + _T(" : ") + value + _T("\n"));
}
local list = project.ExtensionListNodes(extension);
for (local ii=0; ii<list.GetCount(); ++ii)
{
doListAll(project, list.Item(ii));
}
}
function listAll(project, extension)
{
print("\n=== listAll for " + extension + "!\n");
doListAll(project, extension);
print("=== listAll end.\n");
}
function test_dbg()
{
print("Started testing script!\n");
local pm = GetProjectManager();
local project = pm.GetActiveProject();
if (!project)
return;
/*
listAll(project, _T("debugger"));
listAll(project, _T("debugger/remote_debugging"));
listAll(project, _T("debugger/remote_debugging[1]"));
listAll(project, _T("debugger/remote_debugging(target=Debug)"));
print("\n\nSetting attribute - ip_address\n");
print("---> project modified: " + project.GetModified() + "\n");
local modifyExtension = _T("debugger/remote_debugging(target=Debug)/options[0]");
project.ExtensionSetNodeAttribute(modifyExtension, _T("ip_address"), _T("192.168.0.2"));
local newValue = project.ExtensionGetNodeAttribute(modifyExtension, _T("ip_address"));
listAll(project, _T("debugger/remote_debugging(target=Debug)"));
print("---> new value read: " + newValue + "\n");
print("---> project modified: " + project.GetModified() + "\n");
print("\n\nAdding node - debugger/test\n");
project.SetModified(false); // just reset modified flag to test if mutating function really change it!
project.ExtensionAddNode(_T("debugger"), _T("test"));
listAll(project, _T("debugger/test"));
print("---> project modified: " + project.GetModified() + "\n");
project.ExtensionSetNodeAttribute(_T("debugger/test"), _T("testAttr"), _T("testValue"));
listAll(project, _T("debugger/test"));
print("\n\nRemoving node - debugger/test\n");
project.SetModified(false); // just reset modified flag to test if mutating function really change it!
project.ExtensionRemoveNode(_T("debugger/test"));
listAll(project, _T("debugger"));
print("---> project modified: " + project.GetModified() + "\n");
print("\n\nRemoving node - debugger/test\n");
project.SetModified(false); // just reset modified flag to test if mutating function really change it!
local modifiedExtension = _T("debugger/remote_debugging[2]/options[0]");
project.ExtensionRemoveNodeAttribute(modifiedExtension, _T("additional_cmds"));
listAll(project, modifiedExtension);
print("---> project modified: " + project.GetModified() + "\n");
*/
/*
print("\n\nRemoving node - debugger\n");
project.SetModified(false); // just reset modified flag to test if mutating function really change it!
project.ExtensionRemoveNode(_T("debugger"));
project.ExtensionAddNode(_T(""), _T("debugger"));
local extRD0 = project.ExtensionAddNode(_T("debugger"), _T("remote_debugging"));
print("extRD0 = " + extRD0 + "\n");
local extRD0Options = project.ExtensionAddNode(extRD0, _T("options"));
print("extRD0Options = " + extRD0Options + "\n");
project.ExtensionSetNodeAttribute(extRD0Options, _T("conn_type"), _T("1"));
local extRD1 = project.ExtensionAddNode(_T("debugger"), _T("remote_debugging"));
print("extRD1 = " + extRD1 + "\n");
project.ExtensionSetNodeAttribute(extRD1, _T("target"), _T("Debug"));
local extRD1Options = project.ExtensionAddNode(extRD1, _T("options"));
print("extRD1Options = " + extRD1Options + "\n");
project.ExtensionSetNodeAttribute(extRD1Options, _T("conn_type"), _T("0"));
listAll(project, _T("debugger"));
print("---> project modified: " + project.GetModified() + "\n");
print("--> conn_type: " + project.ExtensionGetNodeAttribute(extRD0Options, _T("conn_type")) + "\n");
project.ExtensionSetNodeAttribute(extRD0Options, _T("conn_type"), _T("0"));
print("--> modified conn_type: " + project.ExtensionGetNodeAttribute(extRD0Options, _T("conn_type")) + "\n");
listAll(project, _T("debugger"));
*/
for (local ii = 0; ii < 500; ++ii)
{
local name = _T("Debug" + ii);
print("Duplicate: " + name + "\n");
project.DuplicateBuildTarget(0, name);
}
project.ExtensionRemoveNode(_T("debugger"));
project.ExtensionAddNode(_T(""), _T("debugger"));
for (local ii = 0; ii < 500; ++ii)
{
local name = _T("Debug" + ii);
local rd = project.ExtensionAddNode(_T("debugger"), _T("remote_debugging"));
project.ExtensionSetNodeAttribute(rd, _T("target"), name);
local rdOpt = project.ExtensionAddNode(rd, _T("options"));
project.ExtensionSetNodeAttribute(rdOpt, _T("conn_type"), _T("0"));
project.ExtensionSetNodeAttribute(rdOpt, _T("ip_address"), _T("192.168.0.12"));
project.ExtensionSetNodeAttribute(rdOpt, _T("ip_port"), _T("1223"));
project.ExtensionSetNodeAttribute(rdOpt, _T("additional_cmds"), _T("asdf"));
project.ExtensionSetNodeAttribute(rdOpt, _T("additional_cmds_before"), _T("asdf"));
project.ExtensionSetNodeAttribute(rdOpt, _T("extended_remote"), _T("1"));
}
//project.ExtensionRemoveNode(_T("debugger"));
//project.ExtensionAddNode(_T(""), _T("debugger"));
for (local ii = 0; ii < 1000; ++ii)
{
local path = project.ExtensionAddNode(_T("debugger"), _T("search_path"));
project.ExtensionSetNodeAttribute(path, _T("add"), _T("some strange path" + ii));
}
//listAll(project, _T("debugger"));
}
test_dbg();
// print(GetProjectManager().GetActiveProject().ExtensionGetNodeAttribute(_T("debugger[0]remote_debugging[1]"), _T("target")));
Note: that this version could create many targets in your project, which is quite slow currently... So you could lower the limit values of the for loops.