SetReplyString(TEXT("403 CG ERROR\r\n"));\r
return false;\r
}\r
+\r
int layer = _ttoi(_parameters[1].c_str());\r
get_default_cg_producer(safe_ptr<core::video_channel>(GetChannel()), GetLayerIndex(cg_producer::DEFAULT_LAYER))->next(layer);\r
}\r
SetReplyString(TEXT("403 CG ERROR\r\n"));\r
return false;\r
}\r
+\r
int layer = _ttoi(_parameters[1].c_str());\r
get_default_cg_producer(safe_ptr<core::video_channel>(GetChannel()), GetLayerIndex(cg_producer::DEFAULT_LAYER))->remove(layer);\r
}\r
\r
bool CGCommand::DoExecuteUpdate() \r
{\r
- if(_parameters.size() > 2) \r
+ try\r
{\r
- if(!ValidateLayer(_parameters[1]))\r
+ if(!ValidateLayer(_parameters.at(1)))\r
{\r
SetReplyString(TEXT("403 CG ERROR\r\n"));\r
return false;\r
}\r
- int layer = _ttoi(_parameters[1].c_str());\r
- //TODO: Implement indirect data loading from file. Same as in Add\r
- get_default_cg_producer(safe_ptr<core::video_channel>(GetChannel()), GetLayerIndex(cg_producer::DEFAULT_LAYER))->update(layer, _parameters2[2]);\r
+ \r
+ std::wstring dataString = _parameters2.at(2); \r
+ if(dataString.at(0) != TEXT('<'))\r
+ {\r
+ //The data is not an XML-string, it must be a filename\r
+ std::wstring filename = env::data_folder();\r
+ filename.append(dataString);\r
+ filename.append(TEXT(".ftd"));\r
+\r
+ //open file\r
+ std::wifstream datafile(filename.c_str());\r
+ if(datafile) \r
+ {\r
+ std::wstringstream data;\r
+ //read all data\r
+ data << datafile.rdbuf();\r
+ datafile.close();\r
+\r
+ //extract data to _parameters\r
+ dataString = data.str();\r
+ }\r
+ } \r
+\r
+ int layer = _ttoi(_parameters.at(1).c_str());\r
+ get_default_cg_producer(safe_ptr<core::video_channel>(GetChannel()), GetLayerIndex(cg_producer::DEFAULT_LAYER))->update(layer, dataString);\r
}\r
- else \r
+ catch(...)\r
{\r
SetReplyString(TEXT("402 CG ERROR\r\n"));\r
return true;\r