Search in sources :

Example 1 with MultiMission

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());
            }
        }
    }
}
Also used : MultiMission(zlc.season.rxdownload2.entity.MultiMission) DownloadMission(zlc.season.rxdownload2.entity.DownloadMission) DownloadRecord(zlc.season.rxdownload2.entity.DownloadRecord)

Aggregations

DownloadMission (zlc.season.rxdownload2.entity.DownloadMission)1 DownloadRecord (zlc.season.rxdownload2.entity.DownloadRecord)1 MultiMission (zlc.season.rxdownload2.entity.MultiMission)1