use of zlc.season.rxdownload2.entity.MultiMission in project RxDownload by ssseasonnn.
the class DownloadService method deleteAll.
/**
* Delete all mission which associate with missionId.
*
* @param missionId missionId
* @param deleteFile deleteFile?
*/
public void deleteAll(String missionId, boolean deleteFile) {
DownloadMission mission = missionMap.get(missionId);
if (mission != null && mission instanceof MultiMission) {
mission.delete(dataBaseHelper, deleteFile);
missionMap.remove(missionId);
} else {
createProcessor(missionId, processorMap).onNext(normal(null));
if (deleteFile) {
List<DownloadRecord> list = dataBaseHelper.readMissionsRecord(missionId);
for (DownloadRecord each : list) {
deleteFiles(getFiles(each.getSaveName(), each.getSavePath()));
dataBaseHelper.deleteRecord(each.getUrl());
}
}
}
}
Aggregations