|
@@ -61,5 +61,64 @@ const char* CSC::getBaseName(const char* s,const char split)
|
|
|
}
|
|
|
return s;
|
|
|
}
|
|
|
+const int CSC::parseScData(const char* scData)
|
|
|
+{
|
|
|
+ static char line[MAX_CONTEXT_LEN];
|
|
|
+ static char scName[MAX_NAME_LEN];
|
|
|
+ static char scValue[MAX_NAME_LEN];
|
|
|
+ int offset = 0;
|
|
|
+ int lineIndex = 0;
|
|
|
+ int count = 0;
|
|
|
+ while (TRUE) {
|
|
|
+ if (scData[offset] == 0x0a || scData[offset] == 0x0d || scData[offset] == 0x00) {
|
|
|
+ if (scData[offset] == 0x0d || scData[offset] == 0x0a) {
|
|
|
+ if (scData[offset + 1] == 0x0d || scData[offset + 1] == 0x0a) {
|
|
|
+ offset++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ line[lineIndex] = 0x00;
|
|
|
+ const char* ptrName = strstr(line, "name=");
|
|
|
+ if (ptrName != NULL) {
|
|
|
+ const char* ptrValue = strstr(ptrName, "value=");
|
|
|
+ if (ptrValue != NULL) {
|
|
|
+ int index = 6;
|
|
|
+ while (ptrName[index] != 0x00 && ptrName[index] != '"') {
|
|
|
+ scName[index - 6] = ptrName[index];
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ scName[index] = 0x00;
|
|
|
+ index = 7;
|
|
|
+ while (ptrValue[index] != 0x00 && ptrValue[index] != '"') {
|
|
|
+ scValue[index - 7] = ptrValue[index];
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ scValue[index] = 0x00;
|
|
|
+ if (strcmp_ignoreAa(scValue, "true") == 0) {
|
|
|
+ boolConfig.set(scName, TRUE);
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ else if (strcmp_ignoreAa(scValue, "false") == 0) {
|
|
|
+ boolConfig.set(scName, FALSE);
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ stringConfig.set(scName, scValue);
|
|
|
+ count++;
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ////
|
|
|
+ if (scData[offset] == 0x00) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ lineIndex = 0;
|
|
|
+ offset++;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ line[lineIndex++] = scData[offset++];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return count;
|
|
|
+}
|
|
|
CSC *SC;
|