Initial handling of configuration local cache files using onNext=Reload(dir) in INI file

git-svn-id: svn://10.0.0.236/trunk@45093 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
selmer%netscape.com
1999-08-29 23:42:43 +00:00
parent 5839838c75
commit 6e92de93b2
2 changed files with 42 additions and 1 deletions

View File

@@ -734,6 +734,36 @@ void CWizardMachineApp::ExecuteAction(char action)
}
}
CString CWizardMachineApp::replaceVars(char *str)
{
char buf[MIN_SIZE];
char *b = buf;
while (*str)
{
if (*str == '%')
{
char *n = ++str;
while (*str && *str != '%')
str++;
if (*str == '%')
{
*str = '\0';
WIDGET *w = findWidget(n);
strcpy(b, w->value);
b += strlen(w->value);
}
else
exit(12);
str++;
}
else
*b++ = *str++;
}
*b = '\0';
return CString(buf);
}
void CWizardMachineApp::GoToNextNode()
{
//check if it is a container node
@@ -745,8 +775,18 @@ void CWizardMachineApp::GoToNextNode()
//----------------------------------------------------------------------------------------------
if (CurrentNode->navControls->onNextAction)
{
if (strncmp(CurrentNode->navControls->onNextAction, "Reload", 6) == 0)
char buf[MIN_SIZE];
strcpy(buf, (char *)(LPCTSTR) CurrentNode->navControls->onNextAction);
char *pcmd = strtok(buf, "(");
if (pcmd)
{
char *parms = strtok(NULL, ")");
if (strcmp(pcmd, "Reload") == 0)
{
CString newDir = replaceVars(parms);
CachePath = Path + newDir + "\\" + CacheFile;
FillGlobalWidgetArray(CachePath);
}
}
}

View File

@@ -160,6 +160,7 @@ public:
char* GetBufferElement(const char *buffer, int index);
char* GetSectionBuffer(CString iniFile, CString section);
void ExecuteAction(char action);
CString replaceVars(char *str);
void GoToNextNode();
void GoToPrevNode();
void ExitApp();