|
17 | 17 | package com.hippo.ehviewer.spider;
|
18 | 18 |
|
19 | 19 | import static com.hippo.ehviewer.spider.SpiderDen.getGalleryDownloadDir;
|
20 |
| -import static com.hippo.ehviewer.spider.SpiderQueen.SPIDER_INFO_BACKUP_FILENAME; |
21 | 20 | import static com.hippo.ehviewer.spider.SpiderQueen.SPIDER_INFO_FILENAME;
|
22 | 21 |
|
23 | 22 | import android.content.Context;
|
@@ -269,48 +268,48 @@ public static SpiderInfo getSpiderInfo(GalleryInfo info) {
|
269 | 268 | return null;
|
270 | 269 | }
|
271 | 270 |
|
272 |
| - public static SpiderInfo createBackupSpiderInfo(GalleryInfo info) { |
273 |
| - UniFile mDownloadDir = getGalleryDownloadDir(info); |
274 |
| - if (mDownloadDir != null && mDownloadDir.isDirectory()) { |
275 |
| - UniFile file = mDownloadDir.findFile(SPIDER_INFO_FILENAME); |
276 |
| - if (file==null){ |
277 |
| - return null; |
278 |
| - } |
279 |
| - UniFile backupFile = mDownloadDir.findFile(SPIDER_INFO_BACKUP_FILENAME); |
280 |
| - if (backupFile!=null){ |
281 |
| - backupFile.delete(); |
282 |
| - } |
283 |
| - backupFile = mDownloadDir.createFile(SPIDER_INFO_BACKUP_FILENAME); |
284 |
| - InputStream is; |
285 |
| - OutputStream os = null; |
286 |
| - |
287 |
| - try { |
288 |
| - is = file.openInputStream(); |
289 |
| - os = backupFile.openOutputStream(); |
290 |
| - |
291 |
| - byte[] bytes = new byte[1024]; |
292 |
| - int l; |
293 |
| - while((l=is.read(bytes))>0){ |
294 |
| - os.write(bytes,0,l); |
295 |
| - } |
296 |
| - os.flush(); |
297 |
| - IOUtils.closeQuietly(is); |
298 |
| - SpiderInfo spiderInfo; |
299 |
| - spiderInfo = SpiderInfo.read(file); |
300 |
| - if (spiderInfo != null && spiderInfo.gid == info.gid && |
301 |
| - spiderInfo.token.equals(info.token)) { |
302 |
| - return spiderInfo; |
303 |
| - } |
304 |
| - return null; |
305 |
| - } catch (IOException e) { |
306 |
| - return null; |
307 |
| - } finally { |
308 |
| - IOUtils.closeQuietly(os); |
309 |
| - } |
310 |
| - |
311 |
| - } |
312 |
| - return null; |
313 |
| - } |
| 271 | +// public static SpiderInfo createBackupSpiderInfo(GalleryInfo info) { |
| 272 | +// UniFile mDownloadDir = getGalleryDownloadDir(info); |
| 273 | +// if (mDownloadDir != null && mDownloadDir.isDirectory()) { |
| 274 | +// UniFile file = mDownloadDir.findFile(SPIDER_INFO_FILENAME); |
| 275 | +// if (file==null){ |
| 276 | +// return null; |
| 277 | +// } |
| 278 | +// UniFile backupFile = mDownloadDir.findFile(SPIDER_INFO_BACKUP_FILENAME); |
| 279 | +// if (backupFile!=null){ |
| 280 | +// backupFile.delete(); |
| 281 | +// } |
| 282 | +// backupFile = mDownloadDir.createFile(SPIDER_INFO_BACKUP_FILENAME); |
| 283 | +// InputStream is; |
| 284 | +// OutputStream os = null; |
| 285 | +// |
| 286 | +// try { |
| 287 | +// is = file.openInputStream(); |
| 288 | +// os = backupFile.openOutputStream(); |
| 289 | +// |
| 290 | +// byte[] bytes = new byte[1024]; |
| 291 | +// int l; |
| 292 | +// while((l=is.read(bytes))>0){ |
| 293 | +// os.write(bytes,0,l); |
| 294 | +// } |
| 295 | +// os.flush(); |
| 296 | +// IOUtils.closeQuietly(is); |
| 297 | +// SpiderInfo spiderInfo; |
| 298 | +// spiderInfo = SpiderInfo.read(file); |
| 299 | +// if (spiderInfo != null && spiderInfo.gid == info.gid && |
| 300 | +// spiderInfo.token.equals(info.token)) { |
| 301 | +// return spiderInfo; |
| 302 | +// } |
| 303 | +// return null; |
| 304 | +// } catch (IOException e) { |
| 305 | +// return null; |
| 306 | +// } finally { |
| 307 | +// IOUtils.closeQuietly(os); |
| 308 | +// } |
| 309 | +// |
| 310 | +// } |
| 311 | +// return null; |
| 312 | +// } |
314 | 313 |
|
315 | 314 | public static SpiderInfo getSpiderInfo(GalleryDetail info) {
|
316 | 315 | try {
|
|
0 commit comments