[RAPPS] now /INSTALL option use PkgName instead of software name

currently, PkgName is the name of ini file in DB (without suffix)
This commit is contained in:
赫杨 2020-08-17 03:04:45 +08:00 committed by Mark Jansen
parent da8810ab88
commit a4ac3c84b2
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
3 changed files with 13 additions and 14 deletions

View file

@ -530,7 +530,7 @@ int CAvailableApps::GetSelectedCount()
return m_SelectedList.GetCount();
}
CAvailableApplicationInfo* CAvailableApps::FindInfo(const ATL::CStringW& szAppName) const
CAvailableApplicationInfo* CAvailableApps::FindAppByPkgName(const ATL::CStringW& szPkgName) const
{
if (m_InfoList.IsEmpty())
{
@ -543,7 +543,7 @@ CAvailableApplicationInfo* CAvailableApps::FindInfo(const ATL::CStringW& szAppNa
while (CurrentListPosition != NULL)
{
info = m_InfoList.GetNext(CurrentListPosition);
if (info->m_szName.CompareNoCase(szAppName) == 0)
if (info->m_szPkgName.CompareNoCase(szPkgName) == 0)
{
return info;
}
@ -551,12 +551,12 @@ CAvailableApplicationInfo* CAvailableApps::FindInfo(const ATL::CStringW& szAppNa
return NULL;
}
ATL::CSimpleArray<CAvailableApplicationInfo> CAvailableApps::FindInfoList(const ATL::CSimpleArray<ATL::CStringW> &arrAppsNames) const
ATL::CSimpleArray<CAvailableApplicationInfo> CAvailableApps::FindAppsByPkgNameList(const ATL::CSimpleArray<ATL::CStringW> &PkgNameList) const
{
ATL::CSimpleArray<CAvailableApplicationInfo> result;
for (INT i = 0; i < arrAppsNames.GetSize(); ++i)
for (INT i = 0; i < PkgNameList.GetSize(); ++i)
{
CAvailableApplicationInfo* Info = FindInfo(arrAppsNames[i]);
CAvailableApplicationInfo* Info = FindAppByPkgName(PkgNameList[i]);
if (Info)
{
result.Add(*Info);

View file

@ -125,8 +125,8 @@ public:
VOID RemoveAllSelected();
int GetSelectedCount();
CAvailableApplicationInfo* FindInfo(const ATL::CStringW& szAppName) const;
ATL::CSimpleArray<CAvailableApplicationInfo> FindInfoList(const ATL::CSimpleArray<ATL::CStringW> &arrAppsNames) const;
CAvailableApplicationInfo* FindAppByPkgName(const ATL::CStringW& szPkgName) const;
ATL::CSimpleArray<CAvailableApplicationInfo> FindAppsByPkgNameList(const ATL::CSimpleArray<ATL::CStringW> &arrAppsNames) const;
//ATL::CSimpleArray<CAvailableApplicationInfo> GetSelected() const;
const ATL::CStringW& GetFolderPath() const;

View file

@ -22,13 +22,12 @@ BOOL UseCmdParameters(LPWSTR lpCmdLine)
return FALSE;
}
// TODO: use DB filenames as names because they're shorter
ATL::CSimpleArray<ATL::CStringW> arrNames;
ATL::CSimpleArray<ATL::CStringW> PkgNameList;
if (!StrCmpIW(argv[1], CMD_KEY_INSTALL))
{
for (INT i = 2; i < argc; ++i)
{
arrNames.Add(argv[i]);
PkgNameList.Add(argv[i]);
}
}
else
@ -43,12 +42,12 @@ BOOL UseCmdParameters(LPWSTR lpCmdLine)
INFCONTEXT Context;
if (SetupFindFirstLineW(InfHandle, L"RAPPS", L"Install", &Context))
{
WCHAR szName[MAX_PATH];
WCHAR szPkgName[MAX_PATH];
do
{
if (SetupGetStringFieldW(&Context, 1, szName, _countof(szName), NULL))
if (SetupGetStringFieldW(&Context, 1, szPkgName, _countof(szPkgName), NULL))
{
arrNames.Add(szName);
PkgNameList.Add(szPkgName);
}
} while (SetupFindNextLine(&Context, &Context));
}
@ -63,7 +62,7 @@ BOOL UseCmdParameters(LPWSTR lpCmdLine)
apps.UpdateAppsDB();
apps.Enum(ENUM_ALL_AVAILABLE, NULL, NULL);
ATL::CSimpleArray<CAvailableApplicationInfo> arrAppInfo = apps.FindInfoList(arrNames);
ATL::CSimpleArray<CAvailableApplicationInfo> arrAppInfo = apps.FindAppsByPkgNameList(PkgNameList);
if (arrAppInfo.GetSize() > 0)
{
DownloadListOfApplications(arrAppInfo, TRUE);