75230: CCK should be updated to a new release (r=tao)

Parsing the new format of the Comfig.ini file.
This commit is contained in:
shrutiv%netscape.com 2001-05-03 23:29:43 +00:00
parent 6048f77b96
commit 111027b902
3 changed files with 63 additions and 34 deletions

View File

@ -17,21 +17,49 @@ extern CString scriptPath;
extern CString nscpxpiPath; extern CString nscpxpiPath;
extern COMPONENT Components[100]; extern COMPONENT Components[100];
extern int numComponents; extern int numComponents;
extern CString compString;
extern "C" __declspec(dllexport) extern "C" __declspec(dllexport)
int BuildComponentList(COMPONENT *comps, int *compNum, CString iniSrcPath,int invisibleCount) int BuildComponentList(COMPONENT *comps, CString compString, int& compNum, CString iniSrcPath,int invisibleCount)
{ {
*compNum = 0; CString configcompString[50];
int invNum = *compNum; compNum=0;
configcompString[0]="XPCOM";
configcompString[1]="Navigator";
configcompString[2]="Java";
configcompString[3]="MailNews";
configcompString[4]="Instant Messenger";
configcompString[5]="QFA";
configcompString[6]="PSM";
configcompString[7]="Spell Checker";
configcompString[8]="AOL Art";
configcompString[9]="Net2Phone";
configcompString[10]="Flash";
configcompString[11]="Uninstaller";
configcompString[12]="AOD";
configcompString[13]="RealPlayer";
configcompString[14]="US English Profile Defaults";
configcompString[15]="HP Printer Plugin";
configcompString[16]="Classic Skin";
configcompString[17]="En US lang pack";
configcompString[18]="US region pack";
configcompString[19]=" ";
int arrayindex=compNum;
compString = configcompString[compNum];
CString invNum = compString;
// Get all the component info from each component section // Get all the component info from each component section
CString component; CString component;
char archive[MAX_SIZE]; char archive[MAX_SIZE];
char name[MAX_SIZE]; char name[MAX_SIZE];
char desc[MAX_SIZE]; char desc[MAX_SIZE];
char attr[MAX_SIZE]; char attr[MAX_SIZE];
component.Format("Component%d", *compNum);
component.Format("Component %s", compString);
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath); GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath);
while (*archive) while (*archive)
{ {
@ -42,31 +70,32 @@ int BuildComponentList(COMPONENT *comps, int *compNum, CString iniSrcPath,int in
GetPrivateProfileString(component, "Attributes", "", GetPrivateProfileString(component, "Attributes", "",
attr, MAX_SIZE, iniSrcPath); attr, MAX_SIZE, iniSrcPath);
comps[*compNum].archive = CString(archive); comps[compNum].archive = CString(archive);
comps[*compNum].compname = component; comps[compNum].compname = component;
comps[*compNum].name = CString(name); comps[compNum].name = CString(name);
comps[*compNum].desc = CString(desc); comps[compNum].desc = CString(desc);
comps[*compNum].selected = (strstr(attr, "SELECTED") != NULL); comps[compNum].selected = (strstr(attr, "SELECTED") != NULL);
comps[*compNum].invisible = (strstr(attr, "INVISIBLE") != NULL); comps[compNum].invisible = (strstr(attr, "INVISIBLE") != NULL);
comps[*compNum].launchapp = (strstr(attr, "LAUNCHAPP") != NULL); comps[compNum].launchapp = (strstr(attr, "LAUNCHAPP") != NULL);
comps[*compNum].additional = (strstr(attr, "ADDITIONAL") != NULL); comps[compNum].additional = (strstr(attr, "ADDITIONAL") != NULL);
if (!(comps[compNum].selected && comps[compNum].invisible && invisibleCount))
if (!(comps[*compNum].selected && comps[*compNum].invisible && invisibleCount)) {
{ compNum++;
(*compNum)++; compString = configcompString[compNum];
invNum++; arrayindex++;
component.Format("Component%d", invNum); invNum = configcompString[arrayindex];
} component.Format("Component %s", invNum);
else }
{ else
invNum++; {
component.Format("Component%d", invNum); arrayindex++;
invNum=configcompString[arrayindex];
component.Format("Component %s", invNum);
} }
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath); GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath);
} }
return TRUE; return TRUE;
} }
@ -84,8 +113,8 @@ int GenerateComponentList(CString parms, WIDGET *curWidget)
nscpxpiPath = rootPath + "NSCPXPI"; nscpxpiPath = rootPath + "NSCPXPI";
iniSrcPath = nscpxpiPath + "\\config.ini"; iniSrcPath = nscpxpiPath + "\\config.ini";
BuildComponentList(Components, &numComponents, iniSrcPath, 1); BuildComponentList(Components, compString, numComponents, iniSrcPath, 1);
int i; int i;
CString WidgetValue(""); CString WidgetValue("");
for (i=0; i<numComponents; i++) for (i=0; i<numComponents; i++)

View File

@ -10,4 +10,4 @@ typedef struct s_component {
} COMPONENT; } COMPONENT;
extern "C" __declspec(dllexport) extern "C" __declspec(dllexport)
int BuildComponentList(COMPONENT *comps, int *compNum, CString iniSrcPath,int invisibleCount); int BuildComponentList(COMPONENT *comps, CString compString, int& compNum, CString iniSrcPath,int invisibleCount);

View File

@ -43,6 +43,7 @@ BOOL prefDoesntExist = TRUE;
COMPONENT Components[100]; COMPONENT Components[100];
int numComponents; int numComponents;
int componentOrder; int componentOrder;
CString compString=" ";
int findXPI(CString xpiname, CString filename) int findXPI(CString xpiname, CString filename)
{ {
@ -541,8 +542,7 @@ void init_components()
{ {
int i; int i;
WIDGET *w = findWidget("SelectedComponents"); WIDGET *w = findWidget("SelectedComponents");
BuildComponentList(Components, &numComponents, iniSrcPath,0); BuildComponentList(Components, compString, numComponents, iniSrcPath,0);
// Turn off components that aren't selected // Turn off components that aren't selected
for (i=0; i<numComponents; i++) for (i=0; i<numComponents; i++)
{ {
@ -669,7 +669,7 @@ void AddThirdParty()
if ((firstSix.CompareNoCase("Please") != 0) && !(tpCompPath1.IsEmpty())) if ((firstSix.CompareNoCase("Please") != 0) && !(tpCompPath1.IsEmpty()))
{ {
componentName.Format("Component%d", (numComponents)); componentName.Format("Component %s", (compString));
cName.Format("C%d", componentOrder); cName.Format("C%d", componentOrder);
componentOrder++; componentOrder++;
@ -685,7 +685,7 @@ void AddThirdParty()
firstSix = tpCompPath2.Left(6); firstSix = tpCompPath2.Left(6);
if ((firstSix.CompareNoCase("Please") != 0) && !(tpCompPath2.IsEmpty())) if ((firstSix.CompareNoCase("Please") != 0) && !(tpCompPath2.IsEmpty()))
{ {
componentName.Format("Component%d", (numComponents)); componentName.Format("Component %s", (compString));
cName.Format("C%d", componentOrder); cName.Format("C%d", componentOrder);
WritePrivateProfileString("Setup Type0", cName, componentName, iniDstPath); WritePrivateProfileString("Setup Type0", cName, componentName, iniDstPath);