├── .classpath ├── .gitignore ├── .project ├── .settings ├── .jsdtscope ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs ├── org.eclipse.wst.jsdt.ui.superType.container └── org.eclipse.wst.jsdt.ui.superType.name ├── ICE_JNIRegistry.dll ├── LICENSE ├── README.md ├── ext ├── egdownloader.jar └── egdownloader.jar.13 ├── libs ├── beautyeye_lnf.jar ├── c3p0.jar ├── commons-codec-1.3.jar ├── commons-httpclient-3.1.jar ├── commons-lang-2.5.jar ├── commons-logging-1.1.1.jar ├── dom4j-1.6.1.jar ├── jaxen-1.1.1.jar ├── registry.jar └── sqlite-jdbc-3.21.0.1.jar ├── msvcr71.dll ├── script ├── EhTagTranslator.wiki │ └── database │ │ ├── artist.md │ │ ├── character.md │ │ ├── female.md │ │ ├── group.md │ │ ├── language.md │ │ ├── male.md │ │ ├── misc.md │ │ ├── parody.md │ │ ├── reclass.md │ │ └── rows.md ├── collectPicture.js ├── createTask.js ├── download.js ├── egversion ├── exhentai │ ├── collectPicture.js │ ├── createTask.js │ ├── download.js │ └── search.js ├── search.js ├── search_bak.js ├── version ├── version.properties └── 说明.md ├── src ├── arong-db.properties ├── org │ └── arong │ │ ├── egdownloader │ │ ├── db │ │ │ ├── AbstractSqlDbTemplate.java │ │ │ ├── DbTemplate.java │ │ │ └── impl │ │ │ │ ├── PictureDom4jDbTemplate.java │ │ │ │ ├── PictureSqliteDbTemplate.java │ │ │ │ ├── SettingDom4jDbTemplate.java │ │ │ │ ├── TaskDom4jDbTemplate.java │ │ │ │ └── TaskSqliteDbTemplate.java │ │ ├── model │ │ │ ├── HentaiHome.java │ │ │ ├── ParseEngine.java │ │ │ ├── Picture.java │ │ │ ├── ScriptParser.java │ │ │ ├── SearchTask.java │ │ │ ├── ServerError.java │ │ │ ├── ServerException.java │ │ │ ├── Setting.java │ │ │ ├── Task.java │ │ │ ├── TaskList.java │ │ │ └── TaskStatus.java │ │ ├── spider │ │ │ ├── HttpDownloader.java │ │ │ ├── Proxy.java │ │ │ ├── Spider.java │ │ │ ├── SpiderException.java │ │ │ ├── WebClient.java │ │ │ └── WebClientException.java │ │ ├── ui │ │ │ ├── ComponentConst.java │ │ │ ├── ComponentUtil.java │ │ │ ├── CursorManager.java │ │ │ ├── FontConst.java │ │ │ ├── IconManager.java │ │ │ ├── Main.java │ │ │ ├── SwingPrintStream.java │ │ │ ├── list │ │ │ │ ├── GroupList.java │ │ │ │ ├── GroupListCellReader.java │ │ │ │ └── GroupListModel.java │ │ │ ├── listener │ │ │ │ ├── MenuItemActonListener.java │ │ │ │ ├── MenuMouseListener.java │ │ │ │ ├── MouseAction.java │ │ │ │ ├── OperaBtnMouseListener.java │ │ │ │ ├── WindowFocusListener.java │ │ │ │ └── WindowMouseListener.java │ │ │ ├── menuitem │ │ │ │ ├── AddTaskGroupMenuItem.java │ │ │ │ ├── AllTagsMenuItem.java │ │ │ │ ├── ChangeViewMenuItem.java │ │ │ │ ├── ChangeViewSizeMenuItem.java │ │ │ │ ├── ClearConsoleMenuItem.java │ │ │ │ ├── OpenLogMenuItem.java │ │ │ │ ├── OpenRootMenuItem.java │ │ │ │ ├── ReBuildAllTaskMenuItem.java │ │ │ │ ├── ResetMenuItem.java │ │ │ │ ├── RestartMenuItem.java │ │ │ │ ├── SearchComicMenuItem.java │ │ │ │ ├── StartAllTaskMenuItem.java │ │ │ │ ├── StopAllTaskMenuItem.java │ │ │ │ └── UpdateAllNullTagsMenuItem.java │ │ │ ├── panel │ │ │ │ ├── ConsolePanel.java │ │ │ │ ├── InfoTabbedPane.java │ │ │ │ ├── LocalSearchAndSortPanel.java │ │ │ │ ├── PicturesInfoPanel.java │ │ │ │ ├── SearchImagePanel.java │ │ │ │ ├── TaskImagePanel.java │ │ │ │ ├── TaskInfoPanel.java │ │ │ │ └── TaskTagsPanel.java │ │ │ ├── popmenu │ │ │ │ ├── MainPopupMenu.java │ │ │ │ ├── PicturesPopMenu.java │ │ │ │ └── SearchWindowPopMenu.java │ │ │ ├── swing │ │ │ │ ├── AJBrowser.java │ │ │ │ ├── AJButton.java │ │ │ │ ├── AJCheckBox.java │ │ │ │ ├── AJComboBox.java │ │ │ │ ├── AJDialog.java │ │ │ │ ├── AJLabel.java │ │ │ │ ├── AJMenu.java │ │ │ │ ├── AJMenuBar.java │ │ │ │ ├── AJMenuItem.java │ │ │ │ ├── AJPager.java │ │ │ │ ├── AJPager2.java │ │ │ │ ├── AJPanel.java │ │ │ │ ├── AJPopupMenu.java │ │ │ │ ├── AJProgressBar.java │ │ │ │ ├── AJScrollPane.java │ │ │ │ ├── AJTextArea.java │ │ │ │ ├── AJTextField.java │ │ │ │ ├── AJTextPane.java │ │ │ │ └── HTMLDocumentEditor.java │ │ │ ├── table │ │ │ │ ├── PictureTable.java │ │ │ │ ├── PictureTableCellRenderer.java │ │ │ │ ├── PictureTableModel.java │ │ │ │ ├── SearchTaskTableModel.java │ │ │ │ ├── SearchTasksTable.java │ │ │ │ ├── TaskTableCellRenderer.java │ │ │ │ ├── TaskTableHeaderRenderer.java │ │ │ │ ├── TaskTableModel.java │ │ │ │ └── TaskingTable.java │ │ │ ├── window │ │ │ │ ├── AboutMenuWindow.java │ │ │ │ ├── AllTagsWindow.java │ │ │ │ ├── CheckingWindow.java │ │ │ │ ├── CountWindow.java │ │ │ │ ├── CoverWindow.java │ │ │ │ ├── CreatingWindow.java │ │ │ │ ├── DeletingWindow.java │ │ │ │ ├── EditWindow.java │ │ │ │ ├── EgDownloaderWindow.java │ │ │ │ ├── GroupWindow.java │ │ │ │ ├── InitWindow.java │ │ │ │ ├── LoginWindow.java │ │ │ │ ├── MergeWindow.java │ │ │ │ ├── ResetAllTaskWindow.java │ │ │ │ ├── RestartTipsWindow.java │ │ │ │ ├── SearchComicWindow.java │ │ │ │ ├── SearchComicWindowOLD.java │ │ │ │ ├── SearchCoverWindow.java │ │ │ │ ├── SearchDetailInfoWindow.java │ │ │ │ ├── SearchHistoryWindow.java │ │ │ │ ├── SearchTagWindow.java │ │ │ │ ├── SearchTagsWindow.java │ │ │ │ ├── SettingWindow.java │ │ │ │ ├── TestProxyWindow.java │ │ │ │ ├── TestScriptWindow.java │ │ │ │ ├── ZiptingWindow.java │ │ │ │ └── form │ │ │ │ │ ├── AddFormDialog.java │ │ │ │ │ └── AddGroupDialog.java │ │ │ └── work │ │ │ │ ├── CommonSwingWorker.java │ │ │ │ ├── CreateWorker.java │ │ │ │ ├── DeleteWorker.java │ │ │ │ ├── DownloadCacheCoverWorker.java │ │ │ │ ├── DownloadSinglePicWorker.java │ │ │ │ ├── DownloadWorker.java │ │ │ │ ├── JarUpdateWorker.java │ │ │ │ ├── ReBuildAllTaskWorker.java │ │ │ │ ├── ReCreateWorker.java │ │ │ │ ├── SearchComicWorker.java │ │ │ │ ├── UpdateScriptWorker.java │ │ │ │ ├── ZIPWorker.java │ │ │ │ ├── interfaces │ │ │ │ ├── IListenerTask.java │ │ │ │ └── IMenuListenerTask.java │ │ │ │ └── listenerWork │ │ │ │ ├── ChangeReadedWork.java │ │ │ │ ├── CheckResetWork.java │ │ │ │ ├── ConsoleWork.java │ │ │ │ ├── DeleteTaskWork.java │ │ │ │ ├── DownloadCoverWork.java │ │ │ │ ├── OpenFolderTaskWork.java │ │ │ │ ├── OpenPicWork.java │ │ │ │ ├── OpenWebPageWork.java │ │ │ │ ├── ResetTaskWork.java │ │ │ │ ├── ShowEditWork.java │ │ │ │ ├── StartTaskWork.java │ │ │ │ └── StopTaskWork.java │ │ └── version │ │ │ └── Version.java │ │ └── util │ │ ├── ArrayUtil.java │ │ ├── BeanUtil.java │ │ ├── CodeUtil.java │ │ ├── DateUtil.java │ │ ├── Dom4jUtil2.java │ │ ├── DynamicODBC.java │ │ ├── EmojiFilter.java │ │ ├── FileUtil2.java │ │ ├── HtmlUtils.java │ │ ├── JsonUtil.java │ │ ├── NumberUtil.java │ │ ├── SimpleImageInfo.java │ │ ├── StringUtil.java │ │ ├── Tracker.java │ │ ├── UnicodeUtil.java │ │ ├── https │ │ ├── HttpsUtils.java │ │ ├── IgnoreHostnameVerifier.java │ │ ├── InstallCert.java │ │ ├── MyX509TrustManager.java │ │ ├── SslUtils.java │ │ └── X509TrustManager4None.java │ │ └── jdbc │ │ ├── JdbcSqlExecutor.java │ │ └── JdbcUtil.java └── resources │ ├── count.html │ ├── icon │ ├── 1_add.png │ ├── 1_browse.png │ ├── 1_change.png │ ├── 1_check.png │ ├── 1_clear.png │ ├── 1_copy.png │ ├── 1_count.png │ ├── 1_cut.png │ ├── 1_delete.png │ ├── 1_detail.png │ ├── 1_download.png │ ├── 1_folder.png │ ├── 1_group.png │ ├── 1_ok.png │ ├── 1_openpic.png │ ├── 1_opera.png │ ├── 1_paste.png │ ├── 1_picture.png │ ├── 1_reset.png │ ├── 1_save.png │ ├── 1_select.png │ ├── 1_setting.png │ ├── 1_size.png │ ├── 1_start.png │ ├── 1_stop.png │ ├── 1_task.png │ ├── 1_tool.png │ ├── 1_user.png │ ├── 1_zip.png │ ├── 2_add.png │ ├── 2_browse.png │ ├── 2_change.png │ ├── 2_check.png │ ├── 2_clear.png │ ├── 2_copy.png │ ├── 2_count.png │ ├── 2_cut.png │ ├── 2_delete.png │ ├── 2_detail.png │ ├── 2_download.png │ ├── 2_folder.png │ ├── 2_group.png │ ├── 2_ok.png │ ├── 2_openpic.png │ ├── 2_opera.png │ ├── 2_paste.png │ ├── 2_picture.png │ ├── 2_reset.png │ ├── 2_save.png │ ├── 2_select.png │ ├── 2_setting.png │ ├── 2_size.png │ ├── 2_start.png │ ├── 2_stop.png │ ├── 2_task.png │ ├── 2_tool.png │ ├── 2_user.png │ ├── 2_zip.png │ ├── ARTISTCG.png │ ├── ASIANPORN.png │ ├── COSPLAY.png │ ├── DOUJINSHI.png │ ├── GAMECG.png │ ├── IMAGESET.png │ ├── MANGA.png │ ├── MISC.png │ ├── NON-H.png │ ├── WESTERN.png │ ├── eh.png │ ├── fail.png │ ├── init.jpg │ ├── left.png │ ├── loading.gif │ ├── right.png │ └── t.png │ └── taskinfo.html └── ui.png /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | *.db 3 | *classpath 4 | # Mobile Tools for Java (J2ME) 5 | .mtj.tmp/ 6 | 7 | # Package Files # 8 | #*.jar 9 | *.war 10 | *.ear 11 | 12 | # bin dir 13 | bin/ 14 | 15 | #db 16 | data/ 17 | save/ 18 | saveDir/ 19 | source/ 20 | cache/ 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | console.log* 25 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | egdownloader 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.wst.jsdt.core.jsNature 22 | 23 | 24 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.7 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.source=1.7 13 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /ICE_JNIRegistry.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/ICE_JNIRegistry.dll -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | egdownloader 2 | ============ 3 | org.arong.egdownloader.ui.Main 4 | 5 | 支持里站/表站; 6 | 7 | 百度网盘 8 | 9 | [egdownloader0.95-64.exe](https://pan.baidu.com/s/1Za_diYdowWLzZmybEcSkjA) 提取码:jww2。 10 | 11 | [egdownloader0.95-32.exe](https://pan.baidu.com/s/1Mr7riX12LqjRw4cFxPWLxg) 提取码:neq5。 12 | 13 | 下载完首次打开需要确保能够正常更新脚本及jar版本,如果失败则打开【配置】-【代理】设置好代理重新启动。 14 | -------------------------------------------------------------------------------- /ext/egdownloader.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/ext/egdownloader.jar -------------------------------------------------------------------------------- /ext/egdownloader.jar.13: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/ext/egdownloader.jar.13 -------------------------------------------------------------------------------- /libs/beautyeye_lnf.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/libs/beautyeye_lnf.jar -------------------------------------------------------------------------------- /libs/c3p0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/libs/c3p0.jar -------------------------------------------------------------------------------- /libs/commons-codec-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/libs/commons-codec-1.3.jar -------------------------------------------------------------------------------- /libs/commons-httpclient-3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/libs/commons-httpclient-3.1.jar -------------------------------------------------------------------------------- /libs/commons-lang-2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/libs/commons-lang-2.5.jar -------------------------------------------------------------------------------- /libs/commons-logging-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/libs/commons-logging-1.1.1.jar -------------------------------------------------------------------------------- /libs/dom4j-1.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/libs/dom4j-1.6.1.jar -------------------------------------------------------------------------------- /libs/jaxen-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/libs/jaxen-1.1.1.jar -------------------------------------------------------------------------------- /libs/registry.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/libs/registry.jar -------------------------------------------------------------------------------- /libs/sqlite-jdbc-3.21.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/libs/sqlite-jdbc-3.21.0.1.jar -------------------------------------------------------------------------------- /msvcr71.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/msvcr71.dll -------------------------------------------------------------------------------- /script/EhTagTranslator.wiki/database/reclass.md: -------------------------------------------------------------------------------- 1 | 本页储存标签列表的重新分类(reclass)翻译。 2 | 3 | 版权声明 4 | --------------- 5 | 除有特殊说明外,本文的简介文本翻译自 [EHWiki](https://ehwiki.org/),遵循原始许可协议(即 [GNU 自由文档许可证](http://www.gnu.org/licenses/fdl.html))进行二次分发。 6 | 7 | Copyright (c) 2017 EhTagTranslator-Wiki. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". 8 | 9 | 本文的其他内容,遵循[知识共享(Creative Commons) 署名-非商业性使用-相同方式共享 3.0 协议](https://creativecommons.org/licenses/by-nc-sa/3.0/)提供。 10 | 11 | 条目内容 12 | ---------------- 13 | 14 | | 英文原名 | 中文名 | 简介 | 外部链接 | 15 | | -------- | ---------------------- | ---------------------------------------- | ---- | 16 | | doujinshi | 同人志 | 任何自费出版或自行发布(例如通过 pixiv)的 H 漫画或亚洲漫画(comics),通常包含格子和文本。经常涉及到模仿现有的动画、漫画、游戏和其他可识别的角色或吉祥物 (例如 Vocaloid)。 | | 17 | | manga | 漫画 | H 漫画(或在本网站使用的上下文中简称为“Manga”)是由亚洲艺术家作画并由第三方出版色情漫画。通常只包含原创内容。这一类多数是单行本(tankoubon)和选集(anthology)。 | | 18 | | artistcg | 画师图集 | 电脑作画的画师作品集,往往是单独的全彩图像,很少有手工绘制的,并有更复杂的背景。不适用于从一个艺术家各个作品中抽出的零散作品,图像必须是一个特定的被出售或分发的集合,尤其是为了叙述一系列事件。 | | 19 | | gamecg | 游戏CG集 | 计算机生成的作品,往往从色情游戏(エロゲー)提取。一般有大量图像。不适用于游戏中的角色图像或游戏截图。 | | 20 | | western | 西方的 | 所有西方色情艺术,包括图像、CG 和漫画。 | | 21 | | non-h | 无H | 亚洲起源不是色情性质的图像(单个图像具有性内容自动不具备画廊资格)。如果非色情性质,允许少量的裸体。西方的这类是杂项(misc)类别。不允许任何协议禁止的内容。 | | 22 | | imageset | 图片集 | 图片集是一个通用的画廊。他们大多是日本人绘制的内容,但不属于漫画或同人志。这些画廊内的图像通常具有单个主题(例如特定艺术家,特定系列的人物,或一个特定恋物癖)。 | | 23 | | cosplay | Cosplay | 真人装扮成动画、漫画或游戏中的角色,用于一般表演(非裸体也是可以接受的)或专门为性目的拍摄。打扮为一般普通护士或女佣等,而不是特定角色的不算。 | | 24 | | misc | 杂项 | 不符合任何其他类别的画廊。包含 3D(3d) 画廊、非色情的西方画廊、手办(figure)画廊、纸片人(paperchild)画廊、充气娃娃(real doll)画廊等。从这些画廊获得的 GP 数量减少到上传者通常会收到的 25%。 | | 25 | | private | 私人的 | 私人画廊是一个非正式的类别,允许用户不与 E-Hentai 社区其他成员分享他们的内容。他们往往是想要将其作为自己的个人用户画廊,或只是希望自己的朋友前来参观。从私人画廊获得的GP数量减少到上传者通常会收到的金额的10%。要创建私人图库,用户必须拥有铜星或更高星级。 | | 26 | | asianporn | 亚洲色情 | 将被淘汰的老分类,2012-02-15 开始禁止使用,会逐渐删除。 | | 27 | -------------------------------------------------------------------------------- /script/EhTagTranslator.wiki/database/rows.md: -------------------------------------------------------------------------------- 1 | 数据库内容索引 2 | ==================== 3 | 本页储存标签列表的行名。 4 | 5 | 条目内容 6 | ---------------- 7 | | 英文原名 | 中文名 | 简介 | 外部链接 | 8 | | -------- | --------------- | ------ | ----------- | 9 | | artist | 艺术家 | 绘画作者 / Coser | [数据库页面](https://github.com/Mapaler/EhTagTranslator/wiki/artist) | 10 | | female | 女性 | 女性角色相关的恋物标签 | [数据库页面](https://github.com/Mapaler/EhTagTranslator/wiki/female) | 11 | | male | 男性 | 男性角色相关的恋物标签 | [数据库页面](https://github.com/Mapaler/EhTagTranslator/wiki/male) | 12 | | parody | 原作 | 同人作品模仿的原始作品 | [数据库页面](https://github.com/Mapaler/EhTagTranslator/wiki/parody) | 13 | | character | 角色 | 作品中出现的角色 | [数据库页面](https://github.com/Mapaler/EhTagTranslator/wiki/character) | 14 | | group | 团队 | 制作社团或公司 | [数据库页面](https://github.com/Mapaler/EhTagTranslator/wiki/group) | 15 | | language | 语言 | 作品的语言 | [数据库页面](https://github.com/Mapaler/EhTagTranslator/wiki/language) | 16 | | reclass | 重新分类 | 用于分类出错的画廊,当某个重新分类标签权重达到 100,将移动画廊至对应分类 | [数据库页面](https://github.com/Mapaler/EhTagTranslator/wiki/reclass) | 17 | | misc | 杂项 | 两性/中性的恋物标签或没有具体分类的标签,可以[在论坛](https://forums.e-hentai.org/index.php?showtopic=199295)发帖请求管理员添加新的标签或将标签移动到正确分类 | [数据库页面](https://github.com/Mapaler/EhTagTranslator/wiki/misc) | 18 | -------------------------------------------------------------------------------- /script/collectPicture.js: -------------------------------------------------------------------------------- 1 | var mark = {// 2 | listSource : ['
'],// 3 | intercept : ['style="width', '>
Download original'], 3 | original : ['exhentai.org/fullimg/', 'e-hentai.org/fullimg/', '">Download original'], 4 | realUrl : ['', '
'],// 3 | intercept : ['style="height', "class=\"gdt"],// 4 | showUrl : ['">],//
 5 | 	name : [', 'Parent'], 3 | name : ['

', '

', '

'], 5 | uploader : ['://exhentai.org/uploader/', '
', '">'], 6 | type : ["document.location='https://exhentai.org/", 'div>
', '">', '
'], 8 | total : ['Length:', ' pages', 'BLength', ' ', '  File Size:', '  ', '
0){ 71 | task.language = task.language.substr(0, task.language.indexOf(mark.language[3])); 72 | } 73 | task.tags = parseTags(source); 74 | return parseJson(task); 75 | } 76 | function parseTags(source){ 77 | var tagsources = interceptFromSource(source, mark.tagsource[0], mark.tagsource[1]); 78 | if(tagsources){ 79 | var tags = ''; 80 | while(tagsources.indexOf(mark.tags[0]) != -1){ 81 | var tag = interceptFromSource(tagsources, mark.tags[0], mark.tags[1]); 82 | if(!tag) break; 83 | tags += tag + ";"; 84 | tagsources = subFromSource(tagsources, mark.tags[2]); 85 | } 86 | return tags; 87 | } 88 | return ''; 89 | } 90 | var openhttps = ("undefined" != typeof version && "undefined" != typeof https && https); 91 | parse(htmlSource, openhttps); -------------------------------------------------------------------------------- /script/exhentai/download.js: -------------------------------------------------------------------------------- 1 | var mark = { 2 | original : ['https://exhentai.org/fullimg.php', '">Download original'], 3 | realUrl : [' implements DbTemplate{ 9 | public Object queryBySQL(String sql, JdbcSqlExecutor.CallBack callback){ 10 | try { 11 | return JdbcSqlExecutor.getInstance().executeQuery(sql, JdbcUtil.getConnection(), callback); 12 | } catch (SQLException e) { 13 | e.printStackTrace(); 14 | } 15 | return null; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/db/DbTemplate.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.db; 2 | 3 | import java.util.List; 4 | /** 5 | * 数据存取模板接口 6 | * @author 阿荣 7 | * @since 2014-05-29 8 | * @param 9 | */ 10 | public interface DbTemplate { 11 | public boolean store(T t); 12 | public boolean store(List list); 13 | public boolean update(T t); 14 | public boolean update(List t); 15 | public boolean delete(T t); 16 | public boolean delete(String name, String value); 17 | public boolean delete(List list); 18 | public List query(); 19 | public List query(Object id); 20 | public List query(String name, String value); 21 | public T get(Object id); 22 | public boolean exsits(String name, String value); 23 | } 24 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/model/HentaiHome.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.model; 2 | /** 3 | * Hentai@Home 下载的配置信息 4 | * @author Administrator 5 | * 6 | */ 7 | public class HentaiHome { 8 | private String uri = "/hathdler.php";//路径 9 | private String firstParameterName = "gid";//画廊id参数名,一般是task url的第一个参数名 10 | private String secondParameterName = "t";//不详,一般是task url的第二个参数名 11 | public HentaiHome(){} 12 | public HentaiHome(String url, String firstParameterName, String secondParameterName){ 13 | this.uri = url; 14 | this.firstParameterName = firstParameterName; 15 | this.secondParameterName = secondParameterName; 16 | } 17 | public String getUri() { 18 | return uri; 19 | } 20 | public void setUri(String uri) { 21 | this.uri = uri; 22 | } 23 | public String getFirstParameterName() { 24 | return firstParameterName; 25 | } 26 | public void setFirstParameterName(String firstParameterName) { 27 | this.firstParameterName = firstParameterName; 28 | } 29 | public String getSecondParameterName() { 30 | return secondParameterName; 31 | } 32 | public void setSecondParameterName(String secondParameterName) { 33 | this.secondParameterName = secondParameterName; 34 | } 35 | public String toString() { 36 | return "HentaiHome [uri=" + uri + ", firstParameterName=" 37 | + firstParameterName + ", secondParameterName=" 38 | + secondParameterName + "]"; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/model/ParseEngine.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.model; 2 | 3 | 4 | /** 5 | * Task分析引擎(废弃) 6 | * @author 阿荣 7 | * @since 2014-05-25 8 | */ 9 | public final class ParseEngine { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/model/Picture.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.model; 2 | 3 | /** 4 | * 图片模型 5 | * @author 阿荣 6 | * @since 2014-05-22 7 | */ 8 | public class Picture { 9 | private String tid; 10 | private String id;//uuid 11 | private String num;//序号 12 | private String name;//真实名称 13 | private String url;//浏览地址 14 | private String oldurl;//旧版本地址 15 | private String realUrl;//真实下载地址 16 | private int size;//大小 17 | private String ppi;//分辨率 18 | private String time;//下载时间 19 | private boolean saveAsName = true;//是否以真实名称保存,否则以人物名+num保存 20 | private boolean isCompleted;//是否下载完成 21 | private boolean isRunning;//是否正在下载 22 | 23 | private long totalSize; 24 | 25 | public String getNum() { 26 | return num; 27 | } 28 | public void setNum(String num) { 29 | this.num = num; 30 | } 31 | public String getName() { 32 | return name; 33 | } 34 | public void setName(String name) { 35 | this.name = name; 36 | } 37 | public String getUrl() { 38 | return url; 39 | } 40 | public void setUrl(String url) { 41 | this.url = url; 42 | } 43 | public int getSize() { 44 | return size; 45 | } 46 | public void setSize(int size) { 47 | this.size = size; 48 | } 49 | public String getTime() { 50 | return time; 51 | } 52 | public void setTime(String time) { 53 | this.time = time; 54 | } 55 | public boolean isSaveAsName() { 56 | return saveAsName; 57 | } 58 | public void setSaveAsName(boolean saveAsName) { 59 | this.saveAsName = saveAsName; 60 | } 61 | public boolean isCompleted() { 62 | return isCompleted; 63 | } 64 | public void setCompleted(boolean isCompleted) { 65 | this.isCompleted = isCompleted; 66 | } 67 | public boolean isRunning() { 68 | return isRunning; 69 | } 70 | public void setRunning(boolean isRunning) { 71 | this.isRunning = isRunning; 72 | } 73 | 74 | public String toString() { 75 | return "Picture [tid=" + tid + ", id=" + id + ", num=" + num 76 | + ", name=" + name + ", url=" + url + ", realUrl=" + realUrl 77 | + ", size=" + size + ", time=" + time + ", saveAsName=" 78 | + saveAsName + ", isCompleted=" + isCompleted + ", isRunning=" 79 | + isRunning + "]"; 80 | } 81 | public String getRealUrl() { 82 | return realUrl; 83 | } 84 | public void setRealUrl(String realUrl) { 85 | this.realUrl = realUrl; 86 | } 87 | public String getId() { 88 | return id; 89 | } 90 | public void setId(String id) { 91 | this.id = id; 92 | } 93 | public String getTid() { 94 | return tid; 95 | } 96 | public void setTid(String tid) { 97 | this.tid = tid; 98 | } 99 | public String getPpi() { 100 | return ppi; 101 | } 102 | public void setPpi(String ppi) { 103 | this.ppi = ppi; 104 | } 105 | public long getTotalSize() { 106 | return totalSize; 107 | } 108 | public void setTotalSize(long totalSize) { 109 | this.totalSize = totalSize; 110 | } 111 | public String getOldurl() { 112 | return oldurl; 113 | } 114 | public void setOldurl(String oldurl) { 115 | this.oldurl = oldurl; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/model/ServerError.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.model; 2 | /** 3 | * 服务器错误 4 | * @author dipoo 5 | * @since 2019-08-12 6 | */ 7 | public enum ServerError { 8 | IP_BANED("Your IP address has been temporarily banned"), 9 | GALLERY_REMOVED("removed"), 10 | ONLY_VISIBLE_EXH("This gallery is pining for the fjords"), 11 | QUOTA_EXCEEDED("exceeded your image viewing limits"); 12 | private String error; 13 | public String getEerror(){ 14 | return error; 15 | } 16 | private ServerError(String error){ 17 | this.error = error; 18 | } 19 | public static String parseServerError(ServerError error){ 20 | if(IP_BANED == error){ 21 | return "你的IP已被屏蔽"; 22 | }else if(GALLERY_REMOVED == error){ 23 | return "本子已删除"; 24 | }else if(ONLY_VISIBLE_EXH == error){ 25 | return "只能在里站访问"; 26 | }else if(QUOTA_EXCEEDED == error){ 27 | return "超出限额"; 28 | } 29 | return null; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/model/ServerException.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.model; 2 | 3 | public class ServerException extends Exception { 4 | public ServerException(String message){ 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/model/TaskStatus.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.model; 2 | /** 3 | * 任务状态枚举类 4 | * @author 阿荣 5 | * @since 2014-05-23 6 | */ 7 | public enum TaskStatus { 8 | UNCREATED("未创建"), 9 | UNSTARTED("未开始"), 10 | STOPED("已暂停"), 11 | STARTED("下载中"), 12 | COMPLETED("已完成"), 13 | DELETED("已删除"), 14 | WAITING("排队等待"); 15 | private String status; 16 | public String getStatus(){ 17 | return status; 18 | } 19 | private TaskStatus(String status){ 20 | this.status = status; 21 | } 22 | public static TaskStatus parseTaskStatus(String status){ 23 | if(TaskStatus.UNCREATED.getStatus().equals(status)){ 24 | return TaskStatus.UNCREATED; 25 | }else if(TaskStatus.UNSTARTED.getStatus().equals(status)){ 26 | return TaskStatus.UNSTARTED; 27 | }else if(TaskStatus.STOPED.getStatus().equals(status)){ 28 | return TaskStatus.STOPED; 29 | }else if(TaskStatus.STARTED.getStatus().equals(status)){ 30 | return TaskStatus.STARTED; 31 | }else if(TaskStatus.COMPLETED.getStatus().equals(status)){ 32 | return TaskStatus.COMPLETED; 33 | }else if(TaskStatus.DELETED.getStatus().equals(status)){ 34 | return TaskStatus.DELETED; 35 | }else if(TaskStatus.WAITING.getStatus().equals(status)){ 36 | return TaskStatus.WAITING; 37 | } 38 | return null; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/spider/SpiderException.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.spider; 2 | 3 | public class SpiderException extends Exception{ 4 | private static final long serialVersionUID = -4969885113130258910L; 5 | 6 | public SpiderException(String url, String message, String identify){ 7 | super(url + message + identify); 8 | } 9 | public SpiderException(String message, String identify){ 10 | super("html源码中" + message + identify); 11 | } 12 | public SpiderException(String message){ 13 | super(message); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/spider/WebClientException.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.spider; 2 | 3 | public class WebClientException extends Exception { 4 | 5 | private static final long serialVersionUID = 532072201026322216L; 6 | 7 | public WebClientException(String message){ 8 | super(message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/ComponentUtil.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui; 2 | 3 | import java.awt.Component; 4 | import java.awt.Container; 5 | import java.awt.Window; 6 | 7 | public final class ComponentUtil { 8 | 9 | /** 10 | * 将若干组件依次添加到容器中 11 | * @param container 12 | * @param components 13 | */ 14 | public static void addComponents(Container container , Component ...components){ 15 | if (container != null && components != null) { 16 | for (Component comp : components) { 17 | if(comp != null){ 18 | container.add(comp); 19 | } 20 | } 21 | } 22 | } 23 | 24 | /** 25 | * 释放所有窗口 26 | * @param windows 27 | */ 28 | public static void disposeAll(Window...windows){ 29 | if(windows != null && windows.length > 0){ 30 | for(int i = 0; i < windows.length; i ++){ 31 | if(windows[i] != null){ 32 | windows[i].dispose(); 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/CursorManager.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui; 2 | 3 | import java.awt.Cursor; 4 | /** 5 | * 光标管理器 6 | * @author 阿荣 7 | * @since 2013-8-25 8 | * 9 | */ 10 | public final class CursorManager { 11 | private static Cursor pointerCursor; 12 | public static Cursor getPointerCursor(){ 13 | if(pointerCursor == null){ 14 | //手形光标 15 | pointerCursor = new Cursor(Cursor.HAND_CURSOR); 16 | } 17 | return pointerCursor; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/FontConst.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui; 2 | 3 | import java.awt.Font; 4 | 5 | /** 6 | * 用于将所有组件的字体改变 7 | * @author 阿荣 8 | * @since 2013-8-18 9 | */ 10 | public class FontConst { 11 | public static String[] DEFAULT_FONT = new String[] { "Table.font", 12 | "TableHeader.font", "CheckBox.font", "Tree.font", "Viewport.font", 13 | "ProgressBar.font", "RadioButtonMenuItem.font", 14 | "ToolBar.font", 15 | "ColorChooser.font", 16 | "ToggleButton.font", 17 | "Panel.font", 18 | "Label.font", 19 | "MenuItem.font", 20 | "Button.font", 21 | "Menu.font", 22 | "TextField.font", 23 | "OptionPane.font", 24 | /*"TextArea.font"*,/ 25 | "TableHeader.font" 26 | "MenuBar.font", 27 | "PasswordField.font", "ScrollPane.font", 28 | /*"ToolTip.font",*/ "List.font", "EditorPane.font", "Table.font", 29 | "TabbedPane.font", "RadioButton.font", "CheckBoxMenuItem.font", 30 | "TextPane.font", "PopupMenu.font", "TitledBorder.font", 31 | "ComboBox.font" }; 32 | // 调整默认字体 33 | /*for (int i = 0; i < FontConst.DEFAULT_FONT.length; i++) { 34 | UIManager.put(FontConst.DEFAULT_FONT[i], new Font("微软雅黑", 35 | Font.BOLD, 13)); 36 | }*/ 37 | 38 | public final static Font Comic_Sans_MS_BOLD_12 = new Font("Comic Sans MS", Font.BOLD, 12); 39 | public final static Font Comic_Sans_MS_BOLD_11 = new Font("Comic Sans MS", Font.BOLD, 11); 40 | public final static Font Georgia_BOLD_12 = new Font("Georgia", Font.BOLD, 12); 41 | public final static Font Songti_PLAIN_11 = new Font("宋体", Font.PLAIN, 11); 42 | public final static Font Songti_BOLD_12 = new Font("宋体", Font.BOLD, 12); 43 | public final static Font Songti_BOLD_13 = new Font("宋体", Font.BOLD, 13); 44 | public final static Font Microsoft_PLAIN_11 = new Font("微软雅黑", Font.PLAIN, 11); 45 | public final static Font Microsoft_BOLD_11 = new Font("微软雅黑", Font.BOLD, 11); 46 | public final static Font Microsoft_BOLD_12 = new Font("微软雅黑", Font.BOLD, 12); 47 | public final static Font Microsoft_BOLD_13 = new Font("微软雅黑", Font.BOLD, 13); 48 | } 49 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/Main.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui; 2 | 3 | import java.awt.Font; 4 | import java.io.File; 5 | import java.net.ServerSocket; 6 | import java.net.Socket; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import javax.swing.JOptionPane; 11 | import javax.swing.UIManager; 12 | 13 | import org.arong.egdownloader.ui.window.GroupWindow; 14 | import org.arong.egdownloader.ui.window.InitWindow; 15 | import org.arong.egdownloader.version.Version; 16 | 17 | 18 | /** 19 | * 启动程序的唯一入口 20 | * 21 | * @author 阿荣 22 | * @since 2013-8-25 23 | */ 24 | public class Main { 25 | /** 端口号 */ 26 | private static int iPort = 50009; 27 | 28 | public static void main(String[] args) { 29 | try{ 30 | //删除windows计划任务 31 | Runtime.getRuntime().exec(String.format("cmd.exe /c schtasks /delete /tn %s /F", ComponentConst.RESTART_PLAN_TASK_NAME)); 32 | }catch(Exception e){} 33 | 34 | 35 | Thread thread = null; // 启动服务器的线程 36 | try { 37 | // 连接服务器 38 | // 如果服务器未启动则抛异常 39 | (new Socket("localhost", iPort)).close(); 40 | if(ComponentConst.mainWindow != null){ 41 | ComponentConst.mainWindow.setVisible(true); 42 | }else{ 43 | JOptionPane.showMessageDialog(null, "本程序不允许多开", Version.NAME, JOptionPane.ERROR_MESSAGE); 44 | } 45 | // 如果服务器已经启动则退出系统 46 | System.exit(0); 47 | } catch (Exception e) { 48 | }// 未做处理 49 | 50 | // 如果服务器未启动则在新的线程中启动服务器 51 | (thread = new Thread(new Server())).setDaemon(true); 52 | // 开始线程 53 | thread.start(); 54 | 55 | // 调整默认字体 56 | for (int i = 0; i < FontConst.DEFAULT_FONT.length; i++) 57 | UIManager.put(FontConst.DEFAULT_FONT[i], new Font("微软雅黑", 58 | Font.BOLD, 12)); 59 | File dataFile = new File(ComponentConst.ROOT_DATA_PATH); 60 | if (!dataFile.exists()) { 61 | dataFile.mkdirs(); 62 | new InitWindow(); 63 | } else { 64 | File[] files = dataFile.listFiles(); 65 | List groups = new ArrayList(); 66 | for (File file : files) { 67 | if (file.isDirectory()) { 68 | groups.add(file); 69 | } 70 | } 71 | if (groups.size() > 0) { 72 | new GroupWindow(groups, null); 73 | } else { 74 | new InitWindow(); 75 | } 76 | } 77 | 78 | // 异步执行 79 | /* 80 | * SwingUtilities.invokeLater(new Runnable() { public void run() { new 81 | * InitWindow(); } }); 82 | */ 83 | } 84 | 85 | /** 86 | * 端口监听服务器端运行 87 | * 88 | * @author hiswing 89 | */ 90 | static class Server implements Runnable { 91 | public final void run() { 92 | ServerSocket serversocket = null; 93 | 94 | // 查找没有占用的端口 95 | while (iPort < 60000) { 96 | try { 97 | serversocket = new ServerSocket(iPort); 98 | } catch (Exception ex) { 99 | iPort++; 100 | } 101 | break; 102 | } 103 | try { 104 | do { 105 | // 监听客户端是否有连接 106 | serversocket.accept(); 107 | if(ComponentConst.mainWindow != null){ 108 | ComponentConst.mainWindow.setVisible(true); 109 | // 窗口在任务栏闪动 110 | if (ComponentConst.mainWindow.getExtendedState() == 1) { 111 | ComponentConst.mainWindow.setExtendedState(0); 112 | } 113 | if (ComponentConst.mainWindow.getExtendedState() != 1) { 114 | ComponentConst.mainWindow.toFront(); 115 | ComponentConst.mainWindow.requestFocus(); 116 | ComponentConst.mainWindow.repaint(); 117 | } 118 | } 119 | } while (true); 120 | } catch (Exception ex) { 121 | // 不做处理 122 | } 123 | } 124 | } 125 | } -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/list/GroupListCellReader.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.list; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | 6 | import javax.swing.DefaultListCellRenderer; 7 | import javax.swing.JLabel; 8 | import javax.swing.JList; 9 | 10 | import org.arong.egdownloader.ui.ComponentConst; 11 | import org.arong.egdownloader.ui.IconManager; 12 | import org.arong.egdownloader.ui.swing.AJLabel; 13 | /** 14 | * 任务组列表渲染器 15 | * @author dipoo 16 | * @since 2015-01-07 17 | */ 18 | public class GroupListCellReader extends DefaultListCellRenderer { 19 | 20 | private static final long serialVersionUID = 4933882053356977723L; 21 | 22 | public Component getListCellRendererComponent(JList list, Object value, 23 | int index, boolean isSelected, boolean cellHasFocus) { 24 | if (isSelected) { 25 | setBackground(Color.BLACK); 26 | setForeground(Color.WHITE); 27 | } else { 28 | // 设置选取与取消选取的前景与背景颜色. 29 | setBackground(Color.BLUE); 30 | setForeground(Color.DARK_GRAY); 31 | } 32 | return new AJLabel(value.toString(), IconManager.getIcon("folder"), value.toString().equals(ComponentConst.groupName) ? Color.RED : Color.BLUE, JLabel.LEFT); 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/list/GroupListModel.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.list; 2 | 3 | import java.io.File; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | import java.util.List; 7 | 8 | import javax.swing.DefaultListModel; 9 | /** 10 | * 任务组列表模型 11 | * @author dipoo 12 | * @since 2015-01-07 13 | */ 14 | public class GroupListModel extends DefaultListModel { 15 | 16 | private static final long serialVersionUID = 7983446371650239938L; 17 | 18 | public List groups; 19 | 20 | private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 21 | 22 | public GroupListModel(List groups){ 23 | this.groups = groups; 24 | } 25 | 26 | public Object getElementAt(int index) { 27 | String text; 28 | if(index == 0){ 29 | text = sdf.format(new Date(groups.get(0).getParentFile().lastModified())) + " | " + "默认空间" ; 30 | }else{ 31 | text = sdf.format(new Date(groups.get(index - 1).lastModified())) + " | " + groups.get(index - 1).getName(); 32 | } 33 | return text; 34 | } 35 | 36 | public int getSize() { 37 | return groups.size() + 1; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/listener/MenuItemActonListener.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.listener; 2 | 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | 6 | import javax.swing.JFrame; 7 | 8 | import org.arong.egdownloader.ui.work.interfaces.IMenuListenerTask; 9 | /** 10 | * 用于监听菜单子项的鼠标监听器(没用,监听不到) 11 | * @author 阿荣 12 | * @since 2013-9-1 13 | */ 14 | public class MenuItemActonListener implements ActionListener{ 15 | 16 | private JFrame mainWindow; 17 | 18 | private IMenuListenerTask task; 19 | 20 | public MenuItemActonListener(JFrame mainWindow, IMenuListenerTask task){ 21 | this.mainWindow = mainWindow; 22 | this.task = task; 23 | } 24 | 25 | public void actionPerformed(ActionEvent e) { 26 | task.doWork(mainWindow, e); 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/listener/MenuMouseListener.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.listener; 2 | 3 | import java.awt.Component; 4 | import java.awt.event.MouseEvent; 5 | import java.awt.event.MouseListener; 6 | 7 | import org.arong.egdownloader.ui.ComponentConst; 8 | import org.arong.egdownloader.ui.window.AboutMenuWindow; 9 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 10 | import org.arong.egdownloader.ui.window.SettingWindow; 11 | 12 | /** 13 | * 用于监听菜单的鼠标事件,主要是菜单单击事件
14 | * 请带上主窗口的实例,这是为了使主菜单中的弹出窗口位于主窗口的中央 15 | * 16 | * @author 阿荣 17 | * @since 2013-8-25 18 | * 19 | */ 20 | public class MenuMouseListener implements MouseListener { 21 | private EgDownloaderWindow mainWindow; 22 | 23 | public MenuMouseListener() { 24 | 25 | } 26 | 27 | public MenuMouseListener(EgDownloaderWindow mainWindow) { 28 | this.mainWindow = mainWindow; 29 | } 30 | 31 | public void mouseClicked(MouseEvent e) { 32 | if (e.getSource() instanceof Component) { 33 | Component menu = (Component) e.getSource(); 34 | String menuName = menu.getName(); 35 | // 如果点击的是工具菜单,则将关于窗口显示出来,倘若关于窗口为null就先实例化 36 | if (ComponentConst.SETTING_MENU_NAME.equals(menuName)) { 37 | if (mainWindow.settingWindow == null) { 38 | SettingWindow settingWindow = new SettingWindow(mainWindow); 39 | mainWindow.settingWindow = settingWindow; 40 | } 41 | mainWindow.settingWindow.setLocationRelativeTo(mainWindow); 42 | // 设置关于窗口置于最顶层 43 | mainWindow.settingWindow.setVisible(true); 44 | mainWindow.settingWindow.toFront(); 45 | } 46 | // 如果点击的是关于菜单,则将关于窗口显示出来,倘若关于窗口为null就先实例化 47 | else if (ComponentConst.ABOUT_MENU_NAME.equals(menuName)) { 48 | if (mainWindow.aboutWindow == null) { 49 | AboutMenuWindow aboutWindow = new AboutMenuWindow(mainWindow); 50 | mainWindow.aboutWindow = aboutWindow; 51 | } 52 | mainWindow.aboutWindow.setLocationRelativeTo(mainWindow); 53 | // 设置关于窗口置于最顶层 54 | mainWindow.aboutWindow.setVisible(true); 55 | mainWindow.aboutWindow.toFront(); 56 | } 57 | } 58 | 59 | } 60 | 61 | public void mousePressed(MouseEvent e) { 62 | 63 | } 64 | 65 | public void mouseReleased(MouseEvent e) { 66 | 67 | } 68 | 69 | public void mouseEntered(MouseEvent e) { 70 | 71 | } 72 | 73 | public void mouseExited(MouseEvent e) { 74 | 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/listener/MouseAction.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.listener; 2 | /** 3 | * 鼠标动作枚举类 4 | * @author 阿荣 5 | * @since 2014-05-22 6 | */ 7 | public enum MouseAction { 8 | CLICK,PRESS,RELEASE,ENTER,EXIT 9 | } 10 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/listener/OperaBtnMouseListener.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.listener; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.MouseEvent; 5 | import java.awt.event.MouseListener; 6 | 7 | import org.arong.egdownloader.ui.work.interfaces.IListenerTask; 8 | /** 9 | * 按钮鼠标操作监听类 10 | * @author 阿荣 11 | * @since 2014-05-22 12 | */ 13 | public class OperaBtnMouseListener implements MouseListener { 14 | private Window mainWindow; 15 | private IListenerTask task; 16 | private MouseAction action; 17 | public OperaBtnMouseListener(Window mainWindow, MouseAction action, IListenerTask task){ 18 | this.mainWindow = mainWindow; 19 | this.task = task; 20 | this.action = action; 21 | } 22 | public void mouseClicked(MouseEvent e) { 23 | if(action == MouseAction.CLICK){ 24 | task.doWork(mainWindow, e); 25 | } 26 | } 27 | 28 | public void mousePressed(MouseEvent e) { 29 | if(action == MouseAction.PRESS){ 30 | task.doWork(mainWindow, e); 31 | } 32 | } 33 | 34 | public void mouseReleased(MouseEvent e) { 35 | if(action == MouseAction.RELEASE){ 36 | task.doWork(mainWindow, e); 37 | } 38 | } 39 | 40 | public void mouseEntered(MouseEvent e) { 41 | if(action == MouseAction.ENTER){ 42 | task.doWork(mainWindow, e); 43 | } 44 | } 45 | 46 | public void mouseExited(MouseEvent e) { 47 | if(action == MouseAction.EXIT){ 48 | task.doWork(mainWindow, e); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/listener/WindowFocusListener.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.listener; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.WindowEvent; 5 | 6 | /** 7 | * 窗口焦点监听器
8 | * 当窗口失去焦点,隐藏此窗口
9 | * 10 | * @author 阿荣 11 | * @since 2013-8-25 12 | * 13 | */ 14 | public class WindowFocusListener implements java.awt.event.WindowFocusListener { 15 | private Window window; 16 | 17 | public WindowFocusListener(Window window){ 18 | this.window = window; 19 | } 20 | 21 | public void windowGainedFocus(WindowEvent e) { 22 | } 23 | //窗口失去焦点,隐藏 24 | public void windowLostFocus(WindowEvent e) { 25 | window.setVisible(false); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/listener/WindowMouseListener.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.listener; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.MouseEvent; 5 | import java.awt.event.MouseListener; 6 | /** 7 | * 窗口鼠标监听器
8 | * 当鼠标单击窗口,隐藏此窗口
9 | * 10 | * @author 阿荣 11 | * @since 2013-9-1 12 | * 13 | */ 14 | public class WindowMouseListener implements MouseListener { 15 | 16 | private Window window; 17 | public WindowMouseListener(Window window){ 18 | this.window = window; 19 | } 20 | //鼠标单击,释放此窗口 21 | public void mouseClicked(MouseEvent e) { 22 | this.window.dispose(); 23 | } 24 | 25 | public void mousePressed(MouseEvent e) { 26 | } 27 | 28 | public void mouseReleased(MouseEvent e) { 29 | } 30 | 31 | public void mouseEntered(MouseEvent e) { 32 | } 33 | 34 | public void mouseExited(MouseEvent e) { 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/AddTaskGroupMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.io.File; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import javax.swing.JMenuItem; 11 | import javax.swing.JOptionPane; 12 | 13 | import org.arong.egdownloader.ui.ComponentConst; 14 | import org.arong.egdownloader.ui.IconManager; 15 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 16 | import org.arong.egdownloader.ui.window.GroupWindow; 17 | import org.arong.egdownloader.ui.window.form.AddGroupDialog; 18 | /** 19 | * 新建/切换任务组菜单项 20 | * @author dipoo 21 | * @since 2015-01-08 22 | */ 23 | public class AddTaskGroupMenuItem extends JMenuItem { 24 | 25 | private static final long serialVersionUID = 2616082975789594278L; 26 | 27 | public static final int ADDACTION = 1; 28 | public static final int CHANGEACTION = 2; 29 | 30 | public AddTaskGroupMenuItem(String text, final EgDownloaderWindow window, final int action){ 31 | super(text); 32 | this.setIcon(IconManager.getIcon(action == ADDACTION ? "add" : "change")); 33 | this.setForeground(new Color(0,0,85)); 34 | this.addActionListener(new ActionListener() { 35 | public void actionPerformed(ActionEvent ae) { 36 | EgDownloaderWindow mainWindow = window; 37 | if(action == ADDACTION){//新增 38 | new AddGroupDialog(null, mainWindow); 39 | }else if(action == CHANGEACTION){//切换 40 | File dataFile = new File(ComponentConst.ROOT_DATA_PATH); 41 | if(!dataFile.exists()){ 42 | dataFile.mkdirs(); 43 | JOptionPane.showMessageDialog(mainWindow, "不存在其他任务组"); 44 | }else{ 45 | File[] files = dataFile.listFiles(); 46 | List groups = new ArrayList(); 47 | for(File file : files){ 48 | if(file.isDirectory()){ 49 | groups.add(file); 50 | } 51 | } 52 | if(groups.size() > 0){ 53 | new GroupWindow(groups, mainWindow); 54 | }else{ 55 | JOptionPane.showMessageDialog(mainWindow, "不存在其他任务组"); 56 | } 57 | } 58 | } 59 | 60 | } 61 | }); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/AllTagsMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | 7 | import javax.swing.JMenuItem; 8 | 9 | import org.arong.egdownloader.ui.IconManager; 10 | import org.arong.egdownloader.ui.window.AllTagsWindow; 11 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 12 | /** 13 | * 所有标签菜单项 14 | * @author dipoo 15 | * @since 2019-06-11 16 | */ 17 | public class AllTagsMenuItem extends JMenuItem { 18 | 19 | public boolean istask;//是否为已建任务中所包含的标签 20 | 21 | public AllTagsMenuItem(String text, final EgDownloaderWindow mainWindow, boolean istask_){ 22 | super(text); 23 | this.istask = istask_; 24 | this.setIcon(IconManager.getIcon("openpic")); 25 | this.setForeground(new Color(0,0,85)); 26 | this.addActionListener(new ActionListener() { 27 | public void actionPerformed(ActionEvent ae) { 28 | if(mainWindow.allTagsWindow == null){ 29 | mainWindow.allTagsWindow = new AllTagsWindow(mainWindow); 30 | } 31 | mainWindow.allTagsWindow.istask = istask; 32 | mainWindow.allTagsWindow.searchBtn.doClick(); 33 | } 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/ChangeViewSizeMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | 8 | import javax.swing.JMenuItem; 9 | 10 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 11 | /** 12 | * 切换封面视图大小 13 | * @author dipoo 14 | * @since 2014-12-07 15 | */ 16 | public class ChangeViewSizeMenuItem extends JMenuItem { 17 | 18 | private static final long serialVersionUID = 8033742031776192264L; 19 | public ChangeViewSizeMenuItem(String text, final EgDownloaderWindow window, final int model){ 20 | super(text); 21 | this.setForeground(new Color(0,0,85)); 22 | final JMenuItem this_ = this; 23 | this.addActionListener(new ActionListener() { 24 | public void actionPerformed(ActionEvent ae) { 25 | Component[] comps = this_.getParent().getComponents(); 26 | for(Component c : comps){ 27 | if(c instanceof JMenuItem){ 28 | JMenuItem item = (JMenuItem)c; 29 | item.setText(item.getText().replace("√", "")); 30 | } 31 | } 32 | if(model == 2){ 33 | window.setting.setCoverWidth(150); 34 | window.setting.setCoverHeight(216); 35 | }else if(model == 3){ 36 | window.setting.setCoverWidth(100); 37 | window.setting.setCoverHeight(144); 38 | }else{ 39 | window.setting.setCoverWidth(350); 40 | window.setting.setCoverHeight(480); 41 | } 42 | this_.setText(this_.getText() + "√"); 43 | if(window.taskImagePanel != null){ 44 | window.taskImagePanel.changeViewSize(); 45 | } 46 | window.tablePane.repaint(); 47 | window.tablePane.updateUI(); 48 | window.repaint(); 49 | } 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/ClearConsoleMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | 7 | import javax.swing.JMenuItem; 8 | 9 | import org.arong.egdownloader.ui.IconManager; 10 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 11 | /** 12 | * 清空控制台菜单项 13 | * @author dipoo 14 | * @since 2015-01-09 15 | */ 16 | public class ClearConsoleMenuItem extends JMenuItem { 17 | 18 | private static final long serialVersionUID = -2951780178305327150L; 19 | 20 | public ClearConsoleMenuItem(String text, final EgDownloaderWindow mainWindow){ 21 | super(text); 22 | this.setIcon(IconManager.getIcon("clear")); 23 | this.setForeground(new Color(0,0,85)); 24 | this.addActionListener(new ActionListener() { 25 | public void actionPerformed(ActionEvent ae) { 26 | mainWindow.consolePanel.getTextPane().clear(); 27 | } 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/OpenLogMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.Desktop; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | import java.io.File; 8 | import java.io.IOException; 9 | 10 | import javax.swing.JMenuItem; 11 | 12 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 13 | import org.arong.util.FileUtil2; 14 | import org.arong.util.Tracker; 15 | /** 16 | * 打开日志文件 17 | * @author dipoo 18 | * @since 2018-08-28 19 | */ 20 | public class OpenLogMenuItem extends JMenuItem { 21 | 22 | private static final long serialVersionUID = -2951780178305327150L; 23 | 24 | public OpenLogMenuItem(String text, final EgDownloaderWindow mainWindow){ 25 | super(text); 26 | this.setForeground(new Color(0,0,85)); 27 | this.addActionListener(new ActionListener() { 28 | public void actionPerformed(ActionEvent ae) { 29 | try { 30 | String binPath = FileUtil2.getAppPath(getClass()); 31 | if(binPath.endsWith("bin")){ 32 | binPath = binPath.substring(0, binPath.length() - 3); 33 | }else{ 34 | String defaultSavePath = mainWindow.setting.getDefaultSaveDir(); 35 | FileUtil2.ifNotExistsThenCreate(defaultSavePath); 36 | File f = new File(defaultSavePath); 37 | binPath = f.getAbsolutePath().replaceAll(defaultSavePath, ""); 38 | } 39 | String logfile = binPath + File.separator + "console.log"; 40 | System.out.println("打开日志文件" + logfile); 41 | Desktop.getDesktop().open(new File(logfile));//去掉bin 42 | } catch (IOException e) { 43 | e.printStackTrace(); 44 | Tracker.println("打开日志文件出错"); 45 | } 46 | } 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/OpenRootMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.Desktop; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | import java.io.File; 8 | import java.io.IOException; 9 | 10 | import javax.swing.JMenuItem; 11 | 12 | import org.arong.egdownloader.ui.IconManager; 13 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 14 | import org.arong.util.FileUtil2; 15 | import org.arong.util.Tracker; 16 | /** 17 | * 打开根目录 18 | * @author dipoo 19 | * @since 2014-12-07 20 | */ 21 | public class OpenRootMenuItem extends JMenuItem { 22 | private static final long serialVersionUID = -3015271666943997829L; 23 | 24 | public OpenRootMenuItem(String text, final EgDownloaderWindow window){ 25 | super(text); 26 | this.setIcon(IconManager.getIcon("folder")); 27 | this.setForeground(new Color(0,0,85)); 28 | this.addActionListener(new ActionListener() { 29 | public void actionPerformed(ActionEvent ae) { 30 | try { 31 | String binPath = FileUtil2.getAppPath(getClass()); 32 | if(binPath.endsWith("bin")){ 33 | binPath = binPath.substring(0, binPath.length() - 3); 34 | }else{ 35 | String defaultSavePath = window.setting.getDefaultSaveDir(); 36 | FileUtil2.ifNotExistsThenCreate(defaultSavePath); 37 | File f = new File(defaultSavePath); 38 | binPath = f.getAbsolutePath().replaceAll(defaultSavePath, ""); 39 | } 40 | Desktop.getDesktop().open(new File(binPath));//去掉bin 41 | } catch (IOException e) { 42 | e.printStackTrace(); 43 | Tracker.println("打开根目录出错"); 44 | } 45 | } 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/ReBuildAllTaskMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | 7 | import javax.swing.JMenuItem; 8 | import javax.swing.JOptionPane; 9 | 10 | import org.arong.egdownloader.ui.table.TaskingTable; 11 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 12 | import org.arong.egdownloader.ui.work.ReBuildAllTaskWorker; 13 | /** 14 | * 重建所有任务信息 15 | * @author dipoo 16 | * @since 2015-01-02 17 | */ 18 | public class ReBuildAllTaskMenuItem extends JMenuItem { 19 | 20 | private static final long serialVersionUID = -3444488661732450828L; 21 | public ReBuildAllTaskMenuItem(String text, final EgDownloaderWindow window){ 22 | super(text); 23 | this.setForeground(new Color(0,0,85)); 24 | this.addActionListener(new ActionListener() { 25 | public void actionPerformed(ActionEvent ae) { 26 | //询问是否重建任务 27 | int result = JOptionPane.showConfirmDialog(window, "重建任务需要暂停正在进行的任务,是否确定重建?"); 28 | if(result == JOptionPane.OK_OPTION){//确定 29 | EgDownloaderWindow mainWindow = window; 30 | TaskingTable table = (TaskingTable) mainWindow.runningTable; 31 | //暂停所有任务 32 | table.stopAllTasks(); 33 | new ReBuildAllTaskWorker(mainWindow).execute(); 34 | } 35 | } 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/ResetMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.util.List; 7 | 8 | import javax.swing.JMenuItem; 9 | 10 | import org.arong.egdownloader.model.Task; 11 | import org.arong.egdownloader.ui.IconManager; 12 | import org.arong.egdownloader.ui.table.TaskingTable; 13 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 14 | import org.arong.egdownloader.ui.work.listenerWork.ResetTaskWork; 15 | /** 16 | * 重置任务菜单项 17 | * @author dipoo 18 | * @since 2014-11-18 19 | */ 20 | public class ResetMenuItem extends JMenuItem{ 21 | 22 | private static final long serialVersionUID = -1668277828521783250L; 23 | 24 | public ResetMenuItem(String text, final EgDownloaderWindow window){ 25 | super(text); 26 | this.setIcon(IconManager.getIcon("reset")); 27 | this.setForeground(new Color(0,0,85)); 28 | this.addActionListener(new ActionListener() { 29 | public void actionPerformed(ActionEvent ae) { 30 | EgDownloaderWindow mainWindow = window; 31 | TaskingTable table = (TaskingTable) mainWindow.runningTable; 32 | List tasks = table.getTasks(); 33 | new ResetTaskWork(window, tasks, "重置后将无法还原,确定要重置所有任务到初始状态吗?(正在下载的任务不能重置)"); 34 | } 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/RestartMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.io.IOException; 7 | import java.text.SimpleDateFormat; 8 | import java.util.Calendar; 9 | 10 | import javax.swing.JMenuItem; 11 | 12 | import org.apache.commons.lang.StringUtils; 13 | import org.arong.egdownloader.ui.ComponentConst; 14 | import org.arong.egdownloader.ui.IconManager; 15 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 16 | import org.arong.egdownloader.ui.window.RestartTipsWindow; 17 | import org.arong.egdownloader.ui.work.CommonSwingWorker; 18 | import org.arong.util.FileUtil2; 19 | /** 20 | * 重启 21 | * @author dipoo 22 | * @since 2019-08-14 23 | */ 24 | public class RestartMenuItem extends JMenuItem { 25 | private static final long serialVersionUID = -3015271666943997829L; 26 | 27 | public RestartMenuItem(String text, final EgDownloaderWindow window){ 28 | super(text); 29 | this.setIcon(IconManager.getIcon("task")); 30 | this.setForeground(new Color(0,0,85)); 31 | this.addActionListener(new ActionListener() { 32 | public void actionPerformed(ActionEvent ae) { 33 | if(StringUtils.isNotBlank(ComponentConst.runExe4jLaunchName)){ 34 | try { 35 | window.setVisible(false); 36 | new RestartTipsWindow(); 37 | Calendar calendar = Calendar.getInstance(); 38 | calendar.add(Calendar.MINUTE, 1); //十秒之后重启 39 | String task_create = String.format("cmd.exe /c schtasks /create /tn %s /tr \"%s\" /sc once /st \"%s\"", ComponentConst.RESTART_PLAN_TASK_NAME, 40 | ComponentConst.runExe4jLaunchName, new SimpleDateFormat("HH:mm:ss").format(calendar.getTime())); 41 | Process proc = Runtime.getRuntime().exec(task_create); 42 | System.out.println("重启下载器:" + task_create); 43 | FileUtil2.storeStream("data", "restart.log", proc.getInputStream()); 44 | final int se = 60 - calendar.get(Calendar.SECOND); 45 | if(se > 5){ 46 | new CommonSwingWorker(new Runnable() { 47 | public void run() { 48 | try { 49 | Thread.sleep((se - 3) * 1000); 50 | } catch (InterruptedException e) { 51 | e.printStackTrace(); 52 | } finally{ 53 | System.exit(0); 54 | } 55 | } 56 | }).execute(); 57 | }else{ 58 | System.exit(0); 59 | } 60 | } catch (IOException e) { 61 | e.printStackTrace(); 62 | System.out.println("重启失败:" + e.getMessage()); 63 | System.exit(0); 64 | } 65 | }else{ 66 | System.out.println("当前环境不支持重启。"); 67 | } 68 | } 69 | }); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/SearchComicMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.Image; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | 8 | import javax.swing.ImageIcon; 9 | import javax.swing.JMenuItem; 10 | 11 | import org.arong.egdownloader.ui.IconManager; 12 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 13 | import org.arong.egdownloader.ui.window.SearchComicWindow; 14 | /** 15 | * 搜索绅士站漫画菜单项 16 | * @author dipoo 17 | * @since 2015-03-11 18 | */ 19 | public class SearchComicMenuItem extends JMenuItem { 20 | 21 | private static final long serialVersionUID = -833758755097678427L; 22 | 23 | public SearchComicMenuItem(String text, final EgDownloaderWindow mainWindow){ 24 | super(text); 25 | this.setForeground(new Color(0,0,85)); 26 | ImageIcon icon = IconManager.getIcon("eh"); 27 | icon.setImage(icon.getImage().getScaledInstance(16, 16, Image.SCALE_DEFAULT)); 28 | this.setIcon(icon); 29 | this.addActionListener(new ActionListener() { 30 | public void actionPerformed(ActionEvent ae) { 31 | if(mainWindow.searchComicWindow == null){ 32 | mainWindow.searchComicWindow = new SearchComicWindow(mainWindow); 33 | } 34 | SearchComicWindow scw = (SearchComicWindow) mainWindow.searchComicWindow; 35 | scw.setVisible(true); 36 | mainWindow.settingWindow.toFront(); 37 | } 38 | }); 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/StartAllTaskMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.util.List; 7 | 8 | import javax.swing.JMenuItem; 9 | 10 | import org.arong.egdownloader.model.Task; 11 | import org.arong.egdownloader.model.TaskStatus; 12 | import org.arong.egdownloader.ui.IconManager; 13 | import org.arong.egdownloader.ui.table.TaskingTable; 14 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 15 | import org.arong.util.Tracker; 16 | /** 17 | * 开始所有任务 18 | * @author dipoo 19 | * @since 2014-12-07 20 | */ 21 | public class StartAllTaskMenuItem extends JMenuItem { 22 | 23 | private static final long serialVersionUID = -2960067609351359632L; 24 | public StartAllTaskMenuItem(String text, final EgDownloaderWindow window){ 25 | super(text); 26 | this.setIcon(IconManager.getIcon("start")); 27 | this.setForeground(new Color(0,0,85)); 28 | this.addActionListener(new ActionListener() { 29 | public void actionPerformed(ActionEvent ae) { 30 | //获取所有未完成、未开始的任务 31 | TaskingTable table = (TaskingTable) window.runningTable; 32 | //如果正在重建,则不下载 33 | if(table.isRebuild()){ 34 | Tracker.println(StartAllTaskMenuItem.class, "正在重建任务"); 35 | return; 36 | } 37 | List tasks = table.getTasks(); 38 | for(int i = 0; i < tasks.size(); i ++){ 39 | if(tasks.get(i).getStatus() == TaskStatus.UNSTARTED 40 | || tasks.get(i).getStatus() == TaskStatus.UNCREATED 41 | || tasks.get(i).getStatus() == TaskStatus.STOPED){ 42 | //开启任务 43 | table.startTask(tasks.get(i)); 44 | } 45 | } 46 | Tracker.println(getClass(), "【所有任务已开启】"); 47 | } 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/StopAllTaskMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.util.List; 7 | 8 | import javax.swing.JMenuItem; 9 | 10 | import org.arong.egdownloader.model.Task; 11 | import org.arong.egdownloader.model.TaskStatus; 12 | import org.arong.egdownloader.ui.IconManager; 13 | import org.arong.egdownloader.ui.table.TaskingTable; 14 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 15 | import org.arong.util.Tracker; 16 | /** 17 | * 暂停所有任务 18 | * @author dipoo 19 | * @since 2014-12-07 20 | */ 21 | public class StopAllTaskMenuItem extends JMenuItem { 22 | 23 | private static final long serialVersionUID = 8033742031776192264L; 24 | public StopAllTaskMenuItem(String text, final EgDownloaderWindow window){ 25 | super(text); 26 | this.setIcon(IconManager.getIcon("stop")); 27 | this.setForeground(new Color(0,0,85)); 28 | this.addActionListener(new ActionListener() { 29 | public void actionPerformed(ActionEvent ae) { 30 | //获取所有未完成、未开始的任务 31 | TaskingTable table = (TaskingTable) window.runningTable; 32 | //如果正在重建,则不执行 33 | if(table.isRebuild()){ 34 | Tracker.println(StartAllTaskMenuItem.class, "正在重建任务"); 35 | return; 36 | } 37 | List tasks = table.getTasks(); 38 | Task task = null; 39 | for(int i = 0; i < tasks.size(); i ++){ 40 | if(tasks.get(i).getStatus() == TaskStatus.STARTED 41 | || tasks.get(i).getStatus() == TaskStatus.WAITING){ 42 | task = tasks.get(i); 43 | task.setStatus(TaskStatus.STOPED); 44 | if(task.getDownloadWorker() != null){ 45 | task.getDownloadWorker().cancel(true); 46 | task.setDownloadWorker(null);//swingworker不能复用,需要重新建立 47 | //更新任务数据 48 | window.taskDbTemplate.update(task); 49 | } 50 | } 51 | } 52 | //清空排队等待列表 53 | if(table.getWaitingTasks() != null){ 54 | table.getWaitingTasks().clear(); 55 | } 56 | //清空正在下载数 57 | table.setRunningNum(0); 58 | Tracker.println(getClass(), "【所有任务已暂停】"); 59 | } 60 | }); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/menuitem/UpdateAllNullTagsMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.menuitem; 2 | 3 | import java.awt.Color; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | import javax.swing.JMenuItem; 10 | import javax.swing.SwingUtilities; 11 | 12 | import org.apache.commons.lang.StringUtils; 13 | import org.arong.egdownloader.model.ScriptParser; 14 | import org.arong.egdownloader.model.Task; 15 | import org.arong.egdownloader.ui.IconManager; 16 | import org.arong.egdownloader.ui.table.TaskingTable; 17 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 18 | import org.arong.egdownloader.ui.work.CommonSwingWorker; 19 | import org.arong.util.Tracker; 20 | /** 21 | * 更新所有未包含标签组任务的标签 22 | * @author dipoo 23 | * @since 2019-05-10 24 | */ 25 | public class UpdateAllNullTagsMenuItem extends JMenuItem { 26 | 27 | private static final long serialVersionUID = -2960067609351359632L; 28 | public UpdateAllNullTagsMenuItem(String text, final EgDownloaderWindow window){ 29 | super(text); 30 | this.setIcon(IconManager.getIcon("")); 31 | this.setForeground(new Color(0, 0, 85)); 32 | this.addActionListener(new ActionListener() { 33 | public void actionPerformed(ActionEvent ae) { 34 | //获取所有未完成、未开始的任务 35 | TaskingTable table = (TaskingTable) window.runningTable; 36 | //如果正在重建,则不下载 37 | if(table.isRebuild()){ 38 | Tracker.println(UpdateAllNullTagsMenuItem.class, "正在重建任务"); 39 | return; 40 | } 41 | Tracker.println(getClass(), "开始更新所有未包含标签组的任务"); 42 | List tasks = table.getTasks(); 43 | final List tasks2 = new ArrayList(); 44 | for(int i = 0; i < tasks.size(); i ++){ 45 | if(StringUtils.isBlank(tasks.get(i).getTags())){ 46 | tasks2.add(tasks.get(i)); 47 | } 48 | } 49 | Tracker.println(getClass(), String.format("共检测到%s个未包含标签组的任务", tasks2.size())); 50 | SwingUtilities.invokeLater(new Runnable() { 51 | public void run() { 52 | new CommonSwingWorker(new Runnable() { 53 | public void run() { 54 | for(int i = 0; i < tasks2.size(); i ++){ 55 | try { 56 | Task task = ScriptParser.getTaskByUrl(tasks2.get(i).getUrl(), window.setting); 57 | if(task != null &&StringUtils.isNotBlank(task.getTags())){ 58 | tasks2.get(i).setTags(task.getTags()); 59 | window.taskDbTemplate.update(tasks2.get(i)); 60 | } 61 | Tracker.println(getClass(), String.format("已更新%s/%s个未包含标签组的任务", (i + 1), tasks2.size())); 62 | } catch (Exception e) { 63 | e.printStackTrace(); 64 | } 65 | } 66 | Tracker.println(getClass(), "【所有未包含标签组的任务已更新标签组】"); 67 | } 68 | }).execute(); 69 | } 70 | }); 71 | } 72 | }); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/panel/ConsolePanel.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.panel; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | import java.awt.event.MouseAdapter; 8 | import java.awt.event.MouseEvent; 9 | 10 | import javax.swing.JMenuItem; 11 | import javax.swing.JPopupMenu; 12 | import javax.swing.JScrollPane; 13 | import javax.swing.ScrollPaneConstants; 14 | 15 | import org.arong.egdownloader.ui.menuitem.ClearConsoleMenuItem; 16 | import org.arong.egdownloader.ui.menuitem.OpenLogMenuItem; 17 | import org.arong.egdownloader.ui.swing.AJMenuItem; 18 | import org.arong.egdownloader.ui.swing.AJPopupMenu; 19 | import org.arong.egdownloader.ui.swing.AJTextPane; 20 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 21 | import org.arong.util.HtmlUtils; 22 | 23 | public class ConsolePanel extends JScrollPane { 24 | 25 | private AJTextPane textPane; 26 | public JPopupMenu consolePopupMenu; 27 | public boolean locked;//是否锁屏 28 | 29 | public ConsolePanel(final EgDownloaderWindow mainWindow) { 30 | this.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); 31 | this.setBorder(null); 32 | this.setAutoscrolls(false); 33 | textPane = new AJTextPane(true); 34 | textPane.setBorder(null); 35 | textPane.setEditable(false); 36 | textPane.setAutoscrolls(true); 37 | 38 | this.setViewportView(textPane); 39 | 40 | final JMenuItem clearItemPopup = new ClearConsoleMenuItem("清空控制台", mainWindow); 41 | final JMenuItem lockItemPopup = new AJMenuItem("", new Color(0, 0, 85), new ActionListener() { 42 | public void actionPerformed(ActionEvent e) { 43 | mainWindow.consolePanel.locked = !mainWindow.consolePanel.locked; 44 | } 45 | }); 46 | final JMenuItem openLogItemPopup = new OpenLogMenuItem("打开日志文件", mainWindow); 47 | textPane.addMouseListener(new MouseAdapter() { 48 | public void mouseClicked(MouseEvent e) { 49 | //右键 50 | if(e.getButton() == MouseEvent.BUTTON3){ 51 | if(consolePopupMenu == null){ 52 | consolePopupMenu = new AJPopupMenu(clearItemPopup, lockItemPopup, openLogItemPopup); 53 | } 54 | if(mainWindow.consolePanel.locked){ 55 | lockItemPopup.setText("开启自动滚屏"); 56 | }else{ 57 | lockItemPopup.setText("锁定自动滚屏"); 58 | } 59 | consolePopupMenu.show((Component) e.getSource(), e.getPoint().x, e.getPoint().y); 60 | } 61 | } 62 | }); 63 | } 64 | public AJTextPane getTextPane() { 65 | return textPane; 66 | } 67 | 68 | public void showLog(String msg) { 69 | try{ 70 | textPane.appendBHtml("" + HtmlUtils.filterEmoji2SegoeUISymbolFont(msg) + ""); 71 | }catch(Exception e){ 72 | e.printStackTrace(); 73 | } 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/panel/InfoTabbedPane.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.panel; 2 | 3 | import javax.swing.JTabbedPane; 4 | import javax.swing.event.ChangeEvent; 5 | import javax.swing.event.ChangeListener; 6 | 7 | import org.arong.egdownloader.model.Task; 8 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 9 | 10 | public class InfoTabbedPane extends JTabbedPane { 11 | public EgDownloaderWindow mainWindow; 12 | public InfoTabbedPane(final EgDownloaderWindow mainWindow) { 13 | this.mainWindow = mainWindow; 14 | this.addChangeListener(new ChangeListener() { 15 | public void stateChanged(ChangeEvent e) { 16 | int index = mainWindow.runningTable.getSelectedRow(); 17 | if(index >= 0){ 18 | Task t = mainWindow.tasks.get(index); 19 | flushTab(t); 20 | } 21 | } 22 | }); 23 | } 24 | public void flushTab(Task t){ 25 | if(this.getSelectedComponent() instanceof TaskInfoPanel){ 26 | mainWindow.taskInfoPanel.parseTask(t); 27 | }else if(this.getSelectedComponent() instanceof TaskTagsPanel){ 28 | TaskTagsPanel p = (TaskTagsPanel) this.getSelectedComponent(); 29 | p.showTagGroup(t); 30 | } 31 | else if(this.getSelectedComponent() instanceof PicturesInfoPanel){ 32 | PicturesInfoPanel p = (PicturesInfoPanel) this.getSelectedComponent(); 33 | p.showPictures(t); 34 | } 35 | if(mainWindow.infoTabbedPane.indexOfComponent(mainWindow.taskTagsPanel) != -1){ 36 | mainWindow.infoTabbedPane.setTitleAt(mainWindow.infoTabbedPane.indexOfComponent(mainWindow.taskTagsPanel), "标签组"); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/panel/PicturesInfoPanel.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.panel; 2 | 3 | import java.awt.Color; 4 | 5 | import javax.swing.JScrollPane; 6 | 7 | import org.arong.egdownloader.model.Task; 8 | import org.arong.egdownloader.ui.table.PictureTable; 9 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 10 | 11 | public class PicturesInfoPanel extends JScrollPane { 12 | 13 | private EgDownloaderWindow mainWindow; 14 | public PictureTable pictureTable; 15 | 16 | public PicturesInfoPanel(final EgDownloaderWindow mainWindow) { 17 | this.mainWindow = mainWindow; 18 | this.setAutoscrolls(true); 19 | this.setBorder(null); 20 | this.getViewport().setBackground(new Color(254,254,254)); 21 | this.setBounds(5, 5, mainWindow.getWidth() - 20, 200); 22 | } 23 | 24 | public void showPictures(Task t){ 25 | if(pictureTable == null){ 26 | pictureTable = new PictureTable(5, 5, mainWindow.getWidth() - 20, 180, t, mainWindow); 27 | this.setViewportView(pictureTable); 28 | }else{ 29 | pictureTable.changeModel(t); 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJBrowser.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | public class AJBrowser{ 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJCheckBox.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Font; 5 | import java.awt.event.ItemListener; 6 | 7 | import javax.swing.JCheckBox; 8 | /** 9 | * 封装JCheckBox 10 | * @author dipoo 11 | * @since 2015-03-13 12 | */ 13 | public class AJCheckBox extends JCheckBox { 14 | 15 | private static final long serialVersionUID = 5733291772113186219L; 16 | 17 | public AJCheckBox(String text, Color color, Font font, boolean selected) { 18 | this.setText(text); 19 | this.setForeground(color); 20 | this.setFont(font); 21 | this.setSelected(selected); 22 | } 23 | public AJCheckBox(String name, String text, Color color, Font font, boolean selected) { 24 | this.setName(name); 25 | this.setText(text); 26 | this.setForeground(color); 27 | this.setFont(font); 28 | this.setSelected(selected); 29 | } 30 | public AJCheckBox(String name, String text, Color color, Font font, boolean selected, ItemListener itemListener) { 31 | this.setName(name); 32 | this.setText(text); 33 | this.setForeground(color); 34 | this.setFont(font); 35 | this.setSelected(selected); 36 | this.addItemListener(itemListener); 37 | } 38 | public AJCheckBox(String text, Color color, boolean selected) { 39 | this.setText(text); 40 | this.setForeground(color); 41 | this.setSelected(selected); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJComboBox.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import java.awt.Font; 4 | import java.awt.event.ActionListener; 5 | 6 | import javax.swing.JComboBox; 7 | 8 | import org.arong.egdownloader.ui.CursorManager; 9 | import org.arong.egdownloader.ui.FontConst; 10 | import org.jb2011.lnf.beautyeye.ch14_combox.BEComboBoxUI; 11 | 12 | /** 13 | * 封装JcomboBox,使构造函数可以设置是否监听,组件name值,坐标,大小,选项最多显示个数(指不产生滚动条时)及下拉选项 14 | * 15 | * @author 阿荣 16 | * @since 2013-8-25 17 | * 18 | */ 19 | public class AJComboBox extends JComboBox { 20 | 21 | private static final long serialVersionUID = 4326625694595881489L; 22 | 23 | /** 24 | * 封装JcomboBox,使构造函数可以设置是否监听,组件name值,坐标,大小,选项最多显示个数(指不产生滚动条时)及下拉选项 25 | * 26 | * @param listen 27 | * @param actionListener 28 | * @param name 29 | * @param x 30 | * @param y 31 | * @param width 32 | * @param height 33 | * @param maximumRowCount 34 | * @param items 35 | */ 36 | public AJComboBox(boolean listen, ActionListener actionListener, 37 | String name, int x, int y, int width, int height, 38 | int maximumRowCount, String... items) {//此处的items参数不能为String[],不然会显示异常,不知道为什么? 39 | super(items); 40 | this.setBounds(x, y, width, height); 41 | this.setName(name); 42 | BEComboBoxUI.createUI(this); 43 | this.setMaximumRowCount(maximumRowCount); 44 | this.setCursor(CursorManager.getPointerCursor()); 45 | this.setFont(FontConst.Microsoft_BOLD_12); 46 | if (listen && actionListener != null) { 47 | this.addActionListener(actionListener); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJDialog.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import javax.swing.JDialog; 4 | 5 | public class AJDialog extends JDialog { 6 | 7 | private static final long serialVersionUID = 5426248558277662928L; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJLabel.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Font; 5 | import java.awt.Graphics; 6 | import java.awt.Graphics2D; 7 | import java.awt.RenderingHints; 8 | 9 | import javax.swing.ImageIcon; 10 | import javax.swing.JLabel; 11 | 12 | import org.arong.egdownloader.ui.ComponentConst; 13 | 14 | /** 15 | * 封装JLabel,使构造函数可以设置文本,坐标,大小及字体颜色 16 | * 17 | * @author 阿荣 18 | * @since 2012-8-25 19 | * 20 | */ 21 | public class AJLabel extends JLabel { 22 | private static final long serialVersionUID = 4435841561097728806L; 23 | public AJLabel() { 24 | } 25 | public AJLabel(String text, Color color) { 26 | super(text); 27 | if(color != null) 28 | this.setForeground(color); 29 | } 30 | /** 31 | * 封装JLabel,使构造函数可以设置文本,坐标,大小及字体颜色 32 | * 33 | * @param text 34 | * @param color 35 | * @param x 36 | * @param y 37 | * @param width 38 | * @param height 39 | */ 40 | public AJLabel(String text, Color color, int x, int y, int width, int height) { 41 | this(text, color); 42 | this.setBounds(x, y, width, height); 43 | } 44 | 45 | public AJLabel(String text, Color color, int align){ 46 | this(text, color); 47 | this.setHorizontalAlignment(align); 48 | } 49 | 50 | public AJLabel(String text, String icon, Color color, int align){ 51 | this(text, color, align); 52 | if(icon != null && !"".equals(icon.trim())){ 53 | try{ 54 | this.setIcon(new ImageIcon(getClass().getResource(ComponentConst.ICON_PATH + icon))); 55 | }catch (Exception e) { 56 | 57 | } 58 | } 59 | } 60 | 61 | public AJLabel(String text, ImageIcon icon, Color color, int align){ 62 | this(text, color, align); 63 | if(icon != null){ 64 | try{ 65 | this.setIcon(icon); 66 | }catch (Exception e) { 67 | 68 | } 69 | } 70 | } 71 | 72 | public AJLabel(String text, Color color, Font font, int align){ 73 | this(text, color); 74 | this.setFont(font); 75 | this.setHorizontalAlignment(align); 76 | } 77 | 78 | private ImageIcon image; 79 | public void paintComponent(Graphics g){ 80 | super.paintComponent(g); 81 | if(image != null){ 82 | Graphics2D g2 = (Graphics2D)g; 83 | g2.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 84 | g2.getRenderingHints().put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); 85 | g2.getRenderingHints().put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED); 86 | //g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); 87 | int w = getWidth(); 88 | int h = getHeight(); 89 | int iw = image.getIconWidth(); 90 | int ih = image.getIconHeight(); 91 | double xScale = (double)w / iw; 92 | double yScale = (double)h / ih; 93 | double scale = Math.min(xScale, yScale); // scale to fit 94 | int width = (int)(scale * iw); 95 | int height = (int)(scale * ih); 96 | int x = (w - width) / 2; 97 | int y = (h - height) / 2; 98 | g2.drawImage(image.getImage(), x, y, width, height, this); 99 | /*count ++; 100 | if(count > 3) { 101 | count = 0; 102 | imageRendered = true; 103 | }*/ 104 | } 105 | } 106 | public ImageIcon getImage() { 107 | return image; 108 | } 109 | public void setImage(ImageIcon image) { 110 | this.image = image; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJMenu.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | import java.awt.event.ActionListener; 6 | import java.awt.event.MouseListener; 7 | 8 | import javax.swing.ImageIcon; 9 | import javax.swing.JMenu; 10 | 11 | import org.arong.egdownloader.ui.ComponentConst; 12 | import org.arong.egdownloader.ui.CursorManager; 13 | /** 14 | * 封装JMenu,使构造函数可以设置text值,name值,鼠标监听器,大小及位置 15 | * @author 阿荣 16 | * @since 2013-8-27 17 | * 18 | */ 19 | public class AJMenu extends JMenu { 20 | 21 | private static final long serialVersionUID = 4174281127843821355L; 22 | 23 | public AJMenu(String text, String name, MouseListener listener, int x, int y, int width, int height){ 24 | super(text); 25 | this.setBounds(x, y, width, height); 26 | this.setName(name); 27 | this.setCursor(CursorManager.getPointerCursor()); 28 | this.addMouseListener(listener); 29 | } 30 | public AJMenu(String text, String name, MouseListener listener){ 31 | super(text); 32 | this.setName(name); 33 | this.setForeground(Color.DARK_GRAY); 34 | this.setCursor(CursorManager.getPointerCursor()); 35 | this.addMouseListener(listener); 36 | } 37 | public AJMenu(String text, String name, String icon, MouseListener listener){ 38 | this(text, name, listener); 39 | if(icon != null) 40 | //设置图标 41 | this.setIcon(new ImageIcon(getClass().getResource(ComponentConst.ICON_PATH + icon))); 42 | } 43 | public AJMenu(String text, String name, ImageIcon icon){ 44 | this(text, name); 45 | if(icon != null) 46 | //设置图标 47 | this.setIcon(icon); 48 | } 49 | public AJMenu(String text, String name, ImageIcon icon, MouseListener listener){ 50 | this(text, name, listener); 51 | if(icon != null) 52 | //设置图标 53 | this.setIcon(icon); 54 | } 55 | public AJMenu(String text, String name, ImageIcon icon, ActionListener listener){ 56 | super(text); 57 | this.setName(name); 58 | this.setForeground(Color.DARK_GRAY); 59 | this.setCursor(CursorManager.getPointerCursor()); 60 | this.addActionListener(listener); 61 | if(icon != null) 62 | //设置图标 63 | this.setIcon(icon); 64 | } 65 | public AJMenu(String text, Color color, MouseListener listener){ 66 | this(text, "", listener); 67 | this.setForeground(color); 68 | 69 | } 70 | /** 71 | * 用于带有下拉项的菜单,这样的菜单没有添加鼠标监听,而是由其子项来各自监听
72 | * 默认每个子项间由分割线 73 | * @param text 74 | * @param name 75 | * @param components 76 | */ 77 | public AJMenu(String text, String name, Component... components){ 78 | super(text); 79 | this.setName(name); 80 | this.setCursor(CursorManager.getPointerCursor()); 81 | for (int i = 0; i < components.length; i++) { 82 | this.add(components[i]); 83 | if(i != components.length - 1){ 84 | this.addSeparator(); 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJMenuBar.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import java.awt.Component; 4 | 5 | import javax.swing.JMenuBar; 6 | /** 7 | * 封装JMenuBar,使构造函数可以设置大小及位置
8 | * 可以添加多个组件 9 | * @author 阿荣 10 | * @since 2013-8-27 11 | * 12 | */ 13 | public class AJMenuBar extends JMenuBar { 14 | 15 | private static final long serialVersionUID = 9023750560413748220L; 16 | 17 | public AJMenuBar(int x, int y, int width, int height, Component... components){ 18 | this.setBounds(x, y, width, height); 19 | for (Component component : components) { 20 | this.add(component); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJMenuItem.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | import java.awt.event.MouseListener; 8 | import java.net.URL; 9 | 10 | import javax.swing.ImageIcon; 11 | import javax.swing.JMenuItem; 12 | import javax.swing.JSeparator; 13 | 14 | import org.arong.egdownloader.ui.ComponentConst; 15 | import org.arong.egdownloader.ui.CursorManager; 16 | /** 17 | * 封装JMenuItem,使构造函数可以设置文本,name值,鼠标监听或者添加其他子项
18 | * 如果有子项,则子项之间默认设有分割线 19 | * @author 阿荣 20 | * @since 2013-9-1 21 | * 22 | */ 23 | public class AJMenuItem extends JMenuItem implements ActionListener{ 24 | 25 | private static final long serialVersionUID = -1883326507604845312L; 26 | 27 | public AJMenuItem(String text, String icon){ 28 | this.setText(text); 29 | this.setCursor(CursorManager.getPointerCursor()); 30 | if(icon != null && !"".equals(icon)){ 31 | URL url = getClass().getResource(ComponentConst.ICON_PATH + icon); 32 | if(url != null){ 33 | this.setIcon(new ImageIcon(url)); 34 | } 35 | } 36 | } 37 | 38 | public AJMenuItem(String text, String name, String icon, ActionListener listener){ 39 | this.setText(text); 40 | this.setName(name); 41 | this.setCursor(CursorManager.getPointerCursor()); 42 | if(icon != null && !"".equals(icon)){ 43 | URL url = getClass().getResource(ComponentConst.ICON_PATH + icon); 44 | if(url != null){ 45 | this.setIcon(new ImageIcon(url)); 46 | } 47 | } 48 | this.addActionListener(listener); 49 | } 50 | 51 | public AJMenuItem(String text, String name, Component... components){ 52 | super(text); 53 | this.setName(name); 54 | this.setCursor(CursorManager.getPointerCursor()); 55 | for (int i = 0; i < components.length; i++) { 56 | this.add(components[i]); 57 | if(i != components.length - 1){ 58 | this.add(new JSeparator()); 59 | } 60 | } 61 | } 62 | 63 | public AJMenuItem (String text, String icon, MouseListener listener){ 64 | this(text, icon); 65 | this.addMouseListener(listener); 66 | } 67 | public AJMenuItem (String text, ImageIcon icon, MouseListener listener){ 68 | this.setText(text); 69 | this.setCursor(CursorManager.getPointerCursor()); 70 | if(icon != null){ 71 | /*URL url = getClass().getResource(ComponentConst.ICON_PATH + icon); 72 | if(url != null){ 73 | this.setIcon(new ImageIcon(url)); 74 | }*/ 75 | this.setIcon(icon); 76 | } 77 | this.addMouseListener(listener); 78 | } 79 | 80 | public AJMenuItem (String text, Color color, String icon, ActionListener listener){ 81 | this(text, icon); 82 | this.setForeground(color); 83 | this.addActionListener(listener); 84 | } 85 | 86 | public AJMenuItem (String text, Color color, ImageIcon icon, ActionListener listener){ 87 | this(text, null); 88 | if(icon != null){ 89 | this.setIcon(icon); 90 | } 91 | this.setForeground(color); 92 | this.addActionListener(listener); 93 | } 94 | 95 | public AJMenuItem (String text, Color color, ActionListener listener){ 96 | this.setText(text); 97 | this.setForeground(color); 98 | this.addActionListener(listener); 99 | } 100 | 101 | public void actionPerformed(ActionEvent e) { 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJPager2.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import java.awt.FlowLayout; 4 | import java.awt.event.ActionListener; 5 | 6 | import javax.swing.JButton; 7 | import javax.swing.JComponent; 8 | import javax.swing.JPanel; 9 | /** 10 | * 分页组件(针对里站非常规分页算法设计) 11 | * @author dipoo 12 | * @since 2022-12-21 13 | */ 14 | public class AJPager2 extends JPanel { 15 | 16 | private Integer total;//数据总数 17 | 18 | private Integer next;//下一页 19 | 20 | private Integer prev;//上一页 21 | 22 | 23 | private Object data; 24 | 25 | private JComponent[] ext; 26 | 27 | private ActionListener pageListener; 28 | 29 | public AJPager2(int x, int y, int width, int height, ActionListener pageListener){ 30 | this.setBounds(x, y, width, height); 31 | this.pageListener = pageListener; 32 | this.setLayout(new FlowLayout()); 33 | } 34 | 35 | public void change( Integer next, Integer prev){ 36 | this.next = next; 37 | this.prev = prev; 38 | 39 | this.removeAll(); 40 | JButton fbtn = new AJButton("首页"); 41 | fbtn.setName(""); 42 | fbtn.setToolTipText("1"); 43 | if(pageListener != null){ 44 | fbtn.addActionListener(pageListener); 45 | } 46 | this.add(fbtn); 47 | 48 | if(prev != null){ 49 | JButton btn = new AJButton(String.format("上一页(%s)", prev)); 50 | btn.setName("prev=" + prev); 51 | btn.setToolTipText(prev + ""); 52 | if(pageListener != null){ 53 | btn.addActionListener(pageListener); 54 | } 55 | this.add(btn); 56 | } 57 | 58 | if(next != null){ 59 | JButton btn = new AJButton(String.format("下一页(%s)", next)); 60 | btn.setToolTipText(next + ""); 61 | btn.setName("next=" + next); 62 | if(pageListener != null){ 63 | btn.addActionListener(pageListener); 64 | } 65 | this.add(btn); 66 | } 67 | 68 | JButton lbtn = new AJButton("尾页"); 69 | lbtn.setName("prev=1"); 70 | lbtn.setToolTipText("prev=1"); 71 | if(pageListener != null){ 72 | lbtn.addActionListener(pageListener); 73 | } 74 | this.add(lbtn); 75 | 76 | //添加扩展组件 77 | if(ext != null){ 78 | for(JComponent e : ext){ 79 | this.add(e); 80 | } 81 | } 82 | } 83 | 84 | 85 | 86 | public void setPageListener(ActionListener pageListener) { 87 | this.pageListener = pageListener; 88 | } 89 | 90 | 91 | public ActionListener getPageListener() { 92 | return pageListener; 93 | } 94 | 95 | 96 | public Integer getNext() { 97 | return next; 98 | } 99 | 100 | public Integer getPrev() { 101 | return prev; 102 | } 103 | 104 | public void setData(Object data) { 105 | this.data = data; 106 | } 107 | 108 | public Object getData() { 109 | return data; 110 | } 111 | 112 | public Integer getTotal() { 113 | return total; 114 | } 115 | 116 | public void setTotal(Integer total) { 117 | this.total = total; 118 | } 119 | 120 | public JComponent[] getExt() { 121 | return ext; 122 | } 123 | 124 | public void setExt(JComponent[] ext) { 125 | this.ext = ext; 126 | } 127 | 128 | } 129 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJPanel.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import java.awt.Component; 4 | 5 | import javax.swing.JPanel; 6 | /** 7 | * JPanel封装类 8 | * @author 阿荣 9 | * @since 2014-06-12 10 | */ 11 | public class AJPanel extends JPanel { 12 | 13 | private static final long serialVersionUID = -1284563325238310955L; 14 | 15 | public AJPanel(Component...components){ 16 | this.setLayout(null); 17 | if(components.length > 0){ 18 | for(int i= 0; i < components.length; i++){ 19 | if(components[i] != null){ 20 | this.add(components[i]); 21 | } 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJPopupMenu.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import javax.swing.JMenuItem; 4 | import javax.swing.JPopupMenu; 5 | /** 6 | * 封装右键菜单 7 | * @author 阿荣 8 | * @since 2014-05-26 9 | */ 10 | public class AJPopupMenu extends JPopupMenu { 11 | 12 | private static final long serialVersionUID = 5991402381842102636L; 13 | 14 | public AJPopupMenu(JMenuItem... menuItems){ 15 | if(menuItems != null){ 16 | for (JMenuItem jMenuItem : menuItems) { 17 | this.add(jMenuItem); 18 | } 19 | } 20 | } 21 | 22 | public void add(JMenuItem... menuItems){ 23 | if(menuItems != null){ 24 | for (JMenuItem jMenuItem : menuItems) { 25 | this.add(jMenuItem); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJProgressBar.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import javax.swing.JProgressBar; 4 | /** 5 | * 进度条封装,实现进度条+文本显示 6 | * @author Administrator 7 | * 8 | */ 9 | public class AJProgressBar extends JProgressBar { 10 | 11 | private static final long serialVersionUID = 8982790542840735278L; 12 | public AJProgressBar(int x, int y, int width, int height, int min, int max){ 13 | super(min, max); 14 | this.setBounds(x, y, width, height); 15 | } 16 | public AJProgressBar(int min, int max){ 17 | super(min, max); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJScrollPane.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import java.awt.Component; 4 | 5 | import javax.swing.BorderFactory; 6 | import javax.swing.JScrollPane; 7 | import javax.swing.border.Border; 8 | /** 9 | * 封装JScrollPane,使构造函数可以设置边框标题,大小及位置
10 | * 可以添加多个组件,默认使用虚线带标题边框 11 | * @author 阿荣 12 | * @since 2013-8-27 13 | */ 14 | public class AJScrollPane extends JScrollPane { 15 | 16 | private static final long serialVersionUID = 2812087034031177881L; 17 | /** 18 | * 封装JScrollPane,使构造函数可以设置边框标题,大小及位置
19 | * 可以添加多个组件,默认使用虚线带标题边框 20 | * @param borderTitle 21 | * @param x 22 | * @param y 23 | * @param width 24 | * @param height 25 | * @param components 26 | */ 27 | public AJScrollPane(String borderTitle, int x, int y, int width, int height, Component... components){ 28 | this.setBounds(x, y, width, height); 29 | Border border = BorderFactory.createTitledBorder(borderTitle); 30 | this.setBorder(border); 31 | this.setAutoscrolls(true); 32 | for (Component component : components) { 33 | this.add(component); 34 | } 35 | } 36 | /** 37 | * 可以设置坐标及大小
38 | * 添加多个组件,无边框,可滚动 39 | * @param x 40 | * @param y 41 | * @param width 42 | * @param height 43 | * @param components 44 | */ 45 | public AJScrollPane(int x, int y, int width, int height, Component... components){ 46 | this.setBounds(x, y, width, height); 47 | this.setBorder(null); 48 | this.setAutoscrolls(true); 49 | for (Component component : components) { 50 | this.add(component); 51 | } 52 | } 53 | public AJScrollPane(Component... components){ 54 | for (Component component : components) { 55 | this.add(component); 56 | component.setVisible(true); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/swing/AJTextPane.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | import java.awt.Desktop; 6 | import java.io.IOException; 7 | import java.net.URI; 8 | import java.net.URISyntaxException; 9 | 10 | import javax.swing.JTextPane; 11 | import javax.swing.border.Border; 12 | import javax.swing.border.EmptyBorder; 13 | import javax.swing.event.HyperlinkEvent; 14 | import javax.swing.event.HyperlinkListener; 15 | import javax.swing.text.html.HTML; 16 | import javax.swing.text.html.HTMLDocument; 17 | import javax.swing.text.html.HTMLEditorKit; 18 | 19 | /** 20 | * 用于多行文本显示
21 | * 封装JTextPane,使构造函数可以设置text值,文本颜色
22 | * 默认外边距为10,20,20,10;文本不能编辑
23 | * 默认支持html格式文本显示 24 | * 25 | * @author 阿荣 26 | * @since 2013-8-25 27 | * 28 | */ 29 | public class AJTextPane extends JTextPane { 30 | 31 | private HTMLEditorKit htmlEditorKit; 32 | private HTMLDocument htmlDoc; 33 | private Component com; 34 | public AJTextPane(){ 35 | this(true); 36 | } 37 | public AJTextPane(boolean html){ 38 | htmlEditorKit = new HTMLEditorKit(); 39 | htmlDoc = (HTMLDocument) htmlEditorKit.createDefaultDocument(); 40 | Border border = new EmptyBorder(10, 20, 20, 10); 41 | this.setBorder(border); 42 | this.setEditorKit(htmlEditorKit); 43 | this.setContentType("text/html"); 44 | this.setDocument(htmlDoc); 45 | this.setEditable(false); 46 | 47 | //点击超链接打开浏览器事件 48 | this.addHyperlinkListener(new HyperlinkListener() { 49 | public void hyperlinkUpdate(HyperlinkEvent e) { 50 | if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { 51 | if(e.getURL() == null || "#".equals(e.getURL().toString())) 52 | return; 53 | try { 54 | Desktop.getDesktop().browse(new URI(e.getURL().toString())); 55 | } catch (IOException e1) { 56 | try { 57 | Runtime.getRuntime().exec("cmd.exe /c start " + e.getURL().toString()); 58 | } catch (IOException e2) { 59 | 60 | } 61 | } catch (URISyntaxException e1) { 62 | try { 63 | Runtime.getRuntime().exec("cmd.exe /c start " + e.getURL().toString()); 64 | } catch (IOException e2) { 65 | 66 | } 67 | } 68 | } 69 | } 70 | }); 71 | } 72 | public AJTextPane(String text, Color color) { 73 | this(); 74 | if(color != null) 75 | this.setForeground(color); 76 | this.setText(text); 77 | } 78 | 79 | public void appendBHtml(String html){ 80 | if(htmlEditorKit != null && htmlDoc != null){ 81 | try { 82 | htmlEditorKit.insertHTML(htmlDoc, htmlDoc.getLength(), html, 0, 0, HTML.Tag.B); 83 | htmlEditorKit.insertHTML(htmlDoc, htmlDoc.getLength(), "
", 0, 0, HTML.Tag.BR); 84 | }catch (Exception e) { 85 | this.setText(this.getText() + "======exception:" + e.getMessage()); 86 | } 87 | }else{ 88 | this.setText(this.getText() + html); 89 | } 90 | } 91 | 92 | public void clear(){ 93 | this.setText(null); 94 | } 95 | public HTMLEditorKit getHtmlEditorKit() { 96 | return htmlEditorKit; 97 | } 98 | public HTMLDocument getHtmlDoc() { 99 | return htmlDoc; 100 | } 101 | public Component getCom() { 102 | return com; 103 | } 104 | public void setCom(Component com) { 105 | this.com = com; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/table/PictureTableCellRenderer.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.table; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | 6 | import javax.swing.JLabel; 7 | import javax.swing.JTable; 8 | import javax.swing.table.DefaultTableCellRenderer; 9 | import javax.swing.table.TableColumn; 10 | 11 | import org.arong.egdownloader.ui.FontConst; 12 | import org.arong.egdownloader.ui.IconManager; 13 | import org.arong.egdownloader.ui.swing.AJLabel; 14 | import org.arong.util.FileUtil2; 15 | /** 16 | * 图片表格单元格渲染器 17 | * @author 阿荣 18 | * @since 2014-06-06 19 | */ 20 | public class PictureTableCellRenderer extends DefaultTableCellRenderer { 21 | 22 | private static final long serialVersionUID = 5170655726223645364L; 23 | 24 | private Color fontColor; 25 | 26 | public Component getTableCellRendererComponent(JTable table, Object value, 27 | boolean isSelected, boolean hasFocus, final int row, int column) { 28 | // final PictureTable pt = (PictureTable) table; 29 | if(isSelected){ 30 | fontColor = Color.BLUE; 31 | }else{ 32 | fontColor = Color.DARK_GRAY; 33 | } 34 | String val = value == null ? "" : value.toString(); 35 | if(column == 0){//第一列:序号 36 | TableColumn tc = table.getColumnModel().getColumn(column); 37 | tc.setPreferredWidth(40); 38 | tc.setMaxWidth(40); 39 | return new JLabel(value.toString(), JLabel.LEFT); 40 | }else if(column == 1){//名称 41 | TableColumn tc = table.getColumnModel().getColumn(column); 42 | tc.setPreferredWidth(180); 43 | tc.setMaxWidth(250); 44 | }else if(column == 2){//存储名称 45 | TableColumn tc = table.getColumnModel().getColumn(column); 46 | tc.setPreferredWidth(180); 47 | tc.setMaxWidth(250); 48 | }else if(column == 3){//大小 49 | TableColumn tc = table.getColumnModel().getColumn(column); 50 | tc.setPreferredWidth(60); 51 | tc.setMaxWidth(80); 52 | val = FileUtil2.showSizeStr(Long.parseLong(val)); 53 | }else if(column == 4){//分别率 54 | TableColumn tc = table.getColumnModel().getColumn(column); 55 | tc.setPreferredWidth(60); 56 | tc.setMaxWidth(80); 57 | }else if(column == 5){//状态 58 | TableColumn tc = table.getColumnModel().getColumn(column); 59 | tc.setPreferredWidth(50); 60 | tc.setMaxWidth(120); 61 | }else if(column == 6){//地址 62 | TableColumn tc = table.getColumnModel().getColumn(column); 63 | tc.setPreferredWidth(320); 64 | tc.setMaxWidth(320); 65 | }else if(column == 7){//时间 66 | TableColumn tc = table.getColumnModel().getColumn(column); 67 | tc.setPreferredWidth(120); 68 | tc.setMaxWidth(140); 69 | }else if(column == 8){//查看 70 | TableColumn tc = table.getColumnModel().getColumn(column); 71 | tc.setPreferredWidth(40); 72 | tc.setMaxWidth(60); 73 | AJLabel aj = new AJLabel("", IconManager.getIcon("openpic"), fontColor, JLabel.LEFT); 74 | return aj; 75 | } 76 | if(isSelected){ 77 | return new AJLabel(val, fontColor, FontConst.Songti_BOLD_12, JLabel.LEFT); 78 | } 79 | return new AJLabel(val, fontColor, FontConst.Songti_PLAIN_11, JLabel.LEFT); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/table/PictureTableModel.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.table; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import javax.swing.table.DefaultTableModel; 7 | 8 | import org.arong.egdownloader.model.Picture; 9 | import org.arong.egdownloader.ui.ComponentConst; 10 | /** 11 | * 任务详细面板图片表格数据模型 12 | * @author 阿荣 13 | * @since 2014-06-05 14 | */ 15 | public class PictureTableModel extends DefaultTableModel { 16 | 17 | private static final long serialVersionUID = -4476733049330297521L; 18 | 19 | private static List emptyPictures = new ArrayList(); 20 | 21 | private List pictures; 22 | 23 | public PictureTableModel(List pictures){ 24 | if(pictures == null){ 25 | this.pictures = emptyPictures; 26 | }else{ 27 | this.pictures = pictures; 28 | } 29 | } 30 | 31 | public int getColumnCount() { 32 | return ComponentConst.PICTURE_TABLE_HEADER.length;//6列 33 | } 34 | 35 | public String getColumnName(int column) { 36 | return ComponentConst.PICTURE_TABLE_HEADER[column]; 37 | } 38 | 39 | public int getRowCount() { 40 | return pictures == null ? 0 : pictures.size(); 41 | } 42 | private static final String COMPLETED_VALUE = "已完成"; 43 | private static final String UNCOMPLETED_VALUE = "未下载"; 44 | public Object getValueAt(int row, int column) { 45 | Picture pic = pictures.get(row); 46 | switch (column) { 47 | case 0: 48 | return pic.getNum(); 49 | case 1: 50 | return pic.getName(); 51 | case 2: 52 | if(!pic.isSaveAsName()){ 53 | if(pic.getName().indexOf(".") != -1){ 54 | return pic.getNum() + pic.getName().substring(pic.getName().lastIndexOf("."), pic.getName().length()); 55 | }else{ 56 | return pic.getNum() + ".jpg"; 57 | } 58 | }else{ 59 | return pic.getName(); 60 | } 61 | case 3: 62 | return pic.getSize(); 63 | case 4: 64 | return pic.getPpi(); 65 | case 5: 66 | return pic.isCompleted() ? COMPLETED_VALUE : UNCOMPLETED_VALUE; 67 | case 6: 68 | return pic.getUrl(); 69 | case 7: 70 | return pic.getTime(); 71 | case 8: 72 | return ""; 73 | default: 74 | return ""; 75 | } 76 | } 77 | 78 | public Class getColumnClass(int columnIndex) { 79 | return java.lang.String.class; 80 | } 81 | 82 | public void setPictures(List pictures) { 83 | this.pictures = pictures; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/table/SearchTaskTableModel.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.table; 2 | 3 | import java.util.List; 4 | 5 | import javax.swing.table.AbstractTableModel; 6 | 7 | import org.arong.egdownloader.model.SearchTask; 8 | /** 9 | * 搜索任务表格数据模型 10 | * @author 阿荣 11 | * @since 2015-03-11 12 | */ 13 | public class SearchTaskTableModel extends AbstractTableModel { 14 | private static final long serialVersionUID = -7062795869810088466L; 15 | private List tasks; 16 | 17 | public SearchTaskTableModel(List tasks){ 18 | this.tasks = tasks; 19 | } 20 | 21 | public int getRowCount() { 22 | return tasks == null ? 0 : tasks.size(); 23 | } 24 | 25 | public int getColumnCount() { 26 | return 6; 27 | } 28 | 29 | public Class getColumnClass(int columnIndex) { 30 | return java.lang.String.class; 31 | } 32 | 33 | //数据显示 34 | public Object getValueAt(int rowIndex, int columnIndex) { 35 | switch(columnIndex){ 36 | case 0 : 37 | return tasks.get(rowIndex).getType(); 38 | case 1 : 39 | return tasks.get(rowIndex).getName(); 40 | case 2 : 41 | return tasks.get(rowIndex).getFilenum() == null ? "" : tasks.get(rowIndex).getFilenum(); 42 | case 3 : 43 | return tasks.get(rowIndex).getRating() == null ? "" : tasks.get(rowIndex).getRating(); 44 | case 4 : 45 | return tasks.get(rowIndex).getUploader() == null ? "" : tasks.get(rowIndex).getUploader(); 46 | case 5 : 47 | return tasks.get(rowIndex).getDate() == null ? "" : tasks.get(rowIndex).getDate(); 48 | default : 49 | return ""; 50 | } 51 | } 52 | 53 | //表头显示 54 | public String getColumnName(int column) { 55 | if(column == 0){ 56 | return "类型"; 57 | }else if(column == 1){ 58 | return "名称"; 59 | }else if(column == 2){ 60 | return "图片个数"; 61 | }else if(column == 3){ 62 | return "评分"; 63 | }else if(column == 4){ 64 | return "上传者"; 65 | }else if(column == 5){ 66 | return "发布时间"; 67 | }else{ 68 | return ""; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/table/TaskTableHeaderRenderer.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.table; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | 6 | import javax.swing.JLabel; 7 | import javax.swing.JTable; 8 | import javax.swing.table.TableCellRenderer; 9 | 10 | import org.arong.egdownloader.ui.ComponentConst; 11 | import org.arong.egdownloader.ui.FontConst; 12 | import org.arong.egdownloader.ui.swing.AJLabel; 13 | 14 | /** 15 | * 表头渲染器 16 | * @author 阿荣 17 | * @since 2014-05-24 18 | */ 19 | public class TaskTableHeaderRenderer implements TableCellRenderer { 20 | private Color color = (1 == ComponentConst.SKIN_NUM ? new Color(25, 12, 47) : new Color(0, 0, 0)); 21 | public Component getTableCellRendererComponent(JTable table, Object value, 22 | boolean isSelected, boolean hasFocus, int row, int column) { 23 | JLabel l = null; 24 | TaskingTable t = (TaskingTable)table; 25 | switch (column){ 26 | case 0://类别 27 | l = new AJLabel(t.getTasks().size() + "", "", color, JLabel.CENTER); 28 | l.setFont(FontConst.Georgia_BOLD_12); 29 | l.setToolTipText("漫画总数(按照阅读状态排序)"); 30 | return l; 31 | case 1://名称 32 | l = new AJLabel(value.toString() + "", "", color, JLabel.LEFT); 33 | l.setToolTipText("切换排序(名称/创建时间)"); 34 | return l; 35 | case 2://图片数 36 | l = new AJLabel(value.toString(), "", color, JLabel.LEFT); 37 | l.setToolTipText("按照漫画总数降序排序"); 38 | return l; 39 | case 3://语言 40 | l = new AJLabel(value.toString(), "", color, JLabel.LEFT); 41 | l.setToolTipText("按照漫画语言排序"); 42 | return l; 43 | case 4://下载进度 44 | l = new AJLabel(value.toString(), "", color, JLabel.CENTER); 45 | l.setToolTipText("按照漫画进度降序排序"); 46 | return l; 47 | case 5://状态 48 | l = new AJLabel(value.toString(), "", color, JLabel.CENTER); 49 | l.setToolTipText("按照漫画下载状态排序"); 50 | return l; 51 | default: 52 | return new AJLabel(value.toString(), color); 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/table/TaskTableModel.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.table; 2 | 3 | import java.util.List; 4 | 5 | import javax.swing.table.AbstractTableModel; 6 | 7 | import org.arong.egdownloader.model.Task; 8 | import org.arong.egdownloader.ui.ComponentConst; 9 | /** 10 | * 任务表格数据模型 11 | * @author 阿荣 12 | * @since 2014-05-23 13 | */ 14 | public class TaskTableModel extends AbstractTableModel{ 15 | private static final long serialVersionUID = -7062795869810088466L; 16 | private List tasks; 17 | 18 | public TaskTableModel(List tasks){ 19 | this.tasks = tasks; 20 | } 21 | 22 | public int getRowCount() { 23 | return tasks == null ? 0 : tasks.size(); 24 | } 25 | 26 | public int getColumnCount() { 27 | return ComponentConst.TASK_TABLE_HEADER.length; 28 | } 29 | 30 | public Class getColumnClass(int columnIndex) { 31 | return java.lang.String.class; 32 | } 33 | 34 | //数据显示 35 | public Object getValueAt(int rowIndex, int columnIndex) { 36 | switch(columnIndex){ 37 | case 0 : 38 | return ""; 39 | case 1 : 40 | return tasks.get(rowIndex).getName(); 41 | case 2 : 42 | return String.format("%s%s(%s)", tasks.get(rowIndex).getTotal(), showxx(tasks.get(rowIndex).getTotal()), tasks.get(rowIndex).getSize()); 43 | case 3 : 44 | return String.format("%s", "Chinese".equals(tasks.get(rowIndex).getLanguage()) ? String.format("%s", tasks.get(rowIndex).getLanguage()) : tasks.get(rowIndex).getLanguage()); 45 | case 4 : 46 | return tasks.get(rowIndex).getCurrent(); 47 | case 5 : 48 | return tasks.get(rowIndex).getStatus().getStatus(); 49 | default : 50 | return ""; 51 | } 52 | } 53 | 54 | //表头显示 55 | public String getColumnName(int column) { 56 | if(column == 0){ 57 | return tasks.size() + ""; 58 | } 59 | return ComponentConst.TASK_TABLE_HEADER[column]; 60 | } 61 | 62 | public void setTasks(List tasks) { 63 | this.tasks = tasks; 64 | } 65 | 66 | public List getTasks() { 67 | return tasks; 68 | } 69 | 70 | private String showxx(int num){ 71 | if(num >= 1000){ 72 | return ""; 73 | }else if(num >= 100){ 74 | return "0"; 75 | }else if(num >= 10){ 76 | return "00"; 77 | }else{ 78 | return "000"; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/window/CheckingWindow.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.window; 2 | 3 | import java.awt.Color; 4 | 5 | import javax.swing.JDialog; 6 | import javax.swing.JLabel; 7 | 8 | import org.arong.egdownloader.ui.swing.AJLabel; 9 | 10 | /** 11 | * 查漏补缺任务的提示窗口 12 | * @author 阿荣 13 | * @since 2014-06-21 14 | */ 15 | public class CheckingWindow extends JDialog { 16 | 17 | private static final long serialVersionUID = -7059657779735889925L; 18 | public CheckingWindow(){ 19 | this.setTitle(""); 20 | this.setSize(200, 100); 21 | this.setLayout(null); 22 | this.setResizable(false); 23 | this.setLocationRelativeTo(null); 24 | JLabel tips = new AJLabel("查漏补缺中……", Color.BLUE); 25 | getContentPane().add(tips); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/window/CoverWindow.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.window; 2 | 3 | import java.awt.event.WindowAdapter; 4 | import java.awt.event.WindowEvent; 5 | import java.io.File; 6 | 7 | import javax.swing.ImageIcon; 8 | import javax.swing.JButton; 9 | import javax.swing.JDialog; 10 | import javax.swing.JLabel; 11 | 12 | import org.arong.egdownloader.model.Task; 13 | import org.arong.egdownloader.ui.ComponentUtil; 14 | import org.arong.egdownloader.ui.listener.MenuItemActonListener; 15 | import org.arong.egdownloader.ui.swing.AJButton; 16 | import org.arong.egdownloader.ui.work.listenerWork.DownloadCoverWork; 17 | /** 18 | * 漫画封面窗口 19 | * @author 阿荣 20 | * @since 2014-09-06 21 | */ 22 | public class CoverWindow extends JDialog { 23 | private static final long serialVersionUID = 6624222157904971813L; 24 | private JLabel coverLabel = null; 25 | private JButton downBtn = null; 26 | private EgDownloaderWindow mainWindow; 27 | public CoverWindow(Task task, EgDownloaderWindow mainWindow) { 28 | this.mainWindow = mainWindow; 29 | this.setTitle("漫画封面"); 30 | this.getContentPane().setLayout(null); 31 | this.setLocationRelativeTo(mainWindow); 32 | this.setResizable(false); 33 | coverLabel = new JLabel(); 34 | showCover(task); 35 | ComponentUtil.addComponents(getContentPane(),coverLabel); 36 | 37 | this.addWindowListener(new WindowAdapter() { 38 | public void windowClosing(WindowEvent e) { 39 | CoverWindow this_ = (CoverWindow) e.getSource(); 40 | this_.dispose(); 41 | } 42 | }); 43 | } 44 | public void showCover(Task task){ 45 | String path = task.getSaveDir() + "/cover.jpg"; 46 | File cover = new File(path); 47 | //不存在封面 48 | if(cover == null || !cover.exists()){ 49 | this.setSize(200, 80); 50 | coverLabel.setText("还没下载封面"); 51 | coverLabel.setBounds(5, 5, 100, 30); 52 | coverLabel.setIcon(null); 53 | if(downBtn == null){ 54 | downBtn = new AJButton("下载", "", new MenuItemActonListener(mainWindow, new DownloadCoverWork()), 120, 5, 60, 30); 55 | this.getContentPane().add(downBtn); 56 | }else{ 57 | downBtn.setVisible(true); 58 | } 59 | }else{ 60 | ImageIcon icon = new ImageIcon(path); 61 | if(icon.getIconWidth() == -1){ 62 | this.setSize(200, 80); 63 | coverLabel.setText("封面文件格式错误"); 64 | coverLabel.setBounds(50, 5, 150, 30); 65 | coverLabel.setIcon(null); 66 | }else{ 67 | this.setSize(icon.getIconWidth() + 20, icon.getIconHeight() + 45); 68 | coverLabel.setBounds(5, 5, icon.getIconWidth(), icon.getIconHeight()); 69 | coverLabel.setIcon(icon); 70 | } 71 | if(downBtn != null){ 72 | downBtn.setVisible(false); 73 | } 74 | } 75 | this.setLocationRelativeTo(null); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/window/DeletingWindow.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.window; 2 | 3 | import java.awt.Color; 4 | 5 | import javax.swing.JDialog; 6 | import javax.swing.JFrame; 7 | import javax.swing.JLabel; 8 | 9 | import org.arong.egdownloader.ui.ComponentUtil; 10 | import org.arong.egdownloader.ui.swing.AJLabel; 11 | /** 12 | * 删除任务进度显示窗口 13 | * @author 阿荣 14 | * @since 2014-09-19 15 | */ 16 | public class DeletingWindow extends JDialog { 17 | 18 | private static final long serialVersionUID = -2544191890083257820L; 19 | 20 | public JFrame mainWindow; 21 | public JLabel dataLabel; 22 | public JLabel infoLabel; 23 | 24 | public DeletingWindow(JFrame window){ 25 | this.mainWindow = window; 26 | this.setTitle("正在删除任务"); 27 | this.setSize(400, 120); 28 | this.setLayout(null); 29 | this.setResizable(false); 30 | this.setLocationRelativeTo(this.mainWindow); 31 | this.setBackground(Color.WHITE); 32 | 33 | dataLabel = new AJLabel("", Color.BLACK, 160, 10, 80, 30); 34 | infoLabel = new AJLabel("", Color.BLACK, 10, 50, 380, 30); 35 | ComponentUtil.addComponents(getContentPane(), dataLabel, infoLabel); 36 | } 37 | 38 | public void setData(String data){ 39 | dataLabel.setText(data); 40 | } 41 | public void setInfo(String info){ 42 | infoLabel.setText(info); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/window/GroupWindow.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.window; 2 | 3 | import java.awt.Color; 4 | import java.awt.Rectangle; 5 | import java.awt.Window; 6 | import java.awt.event.MouseEvent; 7 | import java.io.File; 8 | import java.util.List; 9 | 10 | import javax.swing.JButton; 11 | import javax.swing.JFrame; 12 | import javax.swing.JLabel; 13 | import javax.swing.JList; 14 | import javax.swing.JScrollPane; 15 | 16 | import org.arong.egdownloader.ui.ComponentUtil; 17 | import org.arong.egdownloader.ui.IconManager; 18 | import org.arong.egdownloader.ui.list.GroupList; 19 | import org.arong.egdownloader.ui.listener.MouseAction; 20 | import org.arong.egdownloader.ui.listener.OperaBtnMouseListener; 21 | import org.arong.egdownloader.ui.swing.AJButton; 22 | import org.arong.egdownloader.ui.swing.AJLabel; 23 | import org.arong.egdownloader.ui.window.form.AddGroupDialog; 24 | import org.arong.egdownloader.ui.work.interfaces.IListenerTask; 25 | import org.arong.egdownloader.version.Version; 26 | /** 27 | * 任务组窗口 28 | * @author dipoo 29 | * @since 2015-01-07 30 | */ 31 | public class GroupWindow extends JFrame { 32 | 33 | private static final long serialVersionUID = 3500270648971377551L; 34 | 35 | public EgDownloaderWindow mainWindow; 36 | 37 | public GroupWindow(List groups, final EgDownloaderWindow mainWindow){ 38 | super(Version.NAME + "任务组列表"); 39 | this.mainWindow = mainWindow; 40 | this.setSize(300, 400); 41 | this.setResizable(false); 42 | this.setIconImage(IconManager.getIcon("group").getImage()); 43 | this.setLocationRelativeTo(null); 44 | this.getContentPane().setLayout(null); 45 | this.setDefaultCloseOperation(mainWindow == null ? EXIT_ON_CLOSE : DISPOSE_ON_CLOSE); 46 | JLabel tipLabel = new AJLabel("双击选择任务组", new Color(67,44,1), 15, 15, 100, 30); 47 | JButton addGroupBtn = new AJButton("新建", IconManager.getIcon("add"), new OperaBtnMouseListener(this, MouseAction.CLICK, new IListenerTask() { 48 | public void doWork(Window window, MouseEvent e) { 49 | new AddGroupDialog((GroupWindow) window, mainWindow); 50 | } 51 | }) , 215, 15, 62, 30); 52 | addGroupBtn.setUI(AJButton.blueBtnUi); 53 | JList list = new GroupList(groups, this, mainWindow); 54 | list.setSelectedIndex(0); 55 | JScrollPane listPane = new JScrollPane(list); 56 | listPane.setBounds(new Rectangle(10, 50, 270, 300)); 57 | listPane.setAutoscrolls(true); 58 | listPane.getViewport().setBackground(new Color(254,254,254)); 59 | ComponentUtil.addComponents(this.getContentPane(), tipLabel, addGroupBtn, listPane); 60 | 61 | this.setVisible(true); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/window/ResetAllTaskWindow.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.window; 2 | 3 | import java.awt.Color; 4 | import java.awt.event.WindowAdapter; 5 | import java.awt.event.WindowEvent; 6 | import java.util.List; 7 | 8 | import javax.swing.JDialog; 9 | import javax.swing.JFrame; 10 | import javax.swing.JLabel; 11 | 12 | import org.arong.egdownloader.model.Task; 13 | import org.arong.egdownloader.ui.ComponentUtil; 14 | import org.arong.egdownloader.ui.swing.AJLabel; 15 | /** 16 | * 重置所有任务状态进度窗口 17 | * @author dipoo 18 | * @since 2014-11-18 19 | */ 20 | public class ResetAllTaskWindow extends JDialog { 21 | 22 | private static final long serialVersionUID = 6439757790773454972L; 23 | 24 | public JFrame mainWindow; 25 | public JLabel infoLabel; 26 | List tasks; 27 | public ResetAllTaskWindow(JFrame window, List tasks) { 28 | this.mainWindow = window; 29 | this.tasks = tasks; 30 | this.setTitle("正在重置任务"); 31 | this.setSize(400, 80); 32 | this.setLayout(null); 33 | this.setResizable(false); 34 | this.setLocationRelativeTo(this.mainWindow); 35 | this.setBackground(Color.WHITE); 36 | //关闭监听,释放窗口资源,否则消耗大量CPU 37 | this.addWindowListener(new WindowAdapter() { 38 | public void windowClosing(WindowEvent e) { 39 | ResetAllTaskWindow window = (ResetAllTaskWindow) e.getSource(); 40 | window.mainWindow.setEnabled(true); 41 | window.mainWindow.setVisible(true); 42 | window.dispose(); 43 | } 44 | //窗体由激活状态变成非激活状态 45 | /*public void windowDeactivated(WindowEvent e) { 46 | mainWindow.setVisible(true); 47 | mainWindow.setEnabled(true); 48 | ResetAllTaskWindow window = (ResetAllTaskWindow) e.getSource(); 49 | window.dispose(); 50 | }*/ 51 | public void windowActivated(WindowEvent e) { 52 | mainWindow.setEnabled(false); 53 | } 54 | }); 55 | 56 | infoLabel = new AJLabel("", Color.BLACK, 120, 10, 150, 30); 57 | ComponentUtil.addComponents(getContentPane(), infoLabel); 58 | } 59 | 60 | @Override 61 | protected void processWindowEvent(WindowEvent e) { 62 | //关闭事件 63 | if(e.getID() == WindowEvent.WINDOW_CLOSING){ 64 | //do nothing 65 | }else{ 66 | super.processWindowEvent(e); 67 | } 68 | } 69 | public void dispose() { 70 | mainWindow.setEnabled(true); 71 | mainWindow.setVisible(true); 72 | super.dispose(); 73 | } 74 | public void setInfoLabel(String text) { 75 | infoLabel.setText(text + "/" + tasks.size()); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/window/RestartTipsWindow.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.window; 2 | 3 | import java.awt.Color; 4 | 5 | import javax.swing.JLabel; 6 | import javax.swing.JWindow; 7 | 8 | import org.arong.egdownloader.ui.swing.AJLabel; 9 | /** 10 | * 重启提示窗口 11 | * @author dipoo 12 | * @since 2019-10-11 13 | */ 14 | public class RestartTipsWindow extends JWindow { 15 | private static final long serialVersionUID = 8239859673602520213L; 16 | public JLabel textLabel; 17 | 18 | public RestartTipsWindow(){ 19 | this.setSize(200, 60); 20 | this.getContentPane().setBackground(Color.BLACK); 21 | this.setLocationRelativeTo(null); 22 | this.getContentPane().setLayout(null); 23 | textLabel = new AJLabel("正在重启中,请耐心等候", Color.WHITE); 24 | textLabel.setBackground(Color.BLACK); 25 | textLabel.setBounds(30, 15, 190, 30); 26 | this.getContentPane().add(textLabel); 27 | this.setVisible(true); 28 | this.toFront(); 29 | this.setAlwaysOnTop(true); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/window/SearchDetailInfoWindow.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.window; 2 | 3 | import java.awt.Color; 4 | import java.awt.Point; 5 | import java.awt.Window; 6 | import java.awt.event.MouseAdapter; 7 | import java.awt.event.MouseEvent; 8 | import java.awt.event.WindowAdapter; 9 | import java.awt.event.WindowEvent; 10 | 11 | import javax.swing.BorderFactory; 12 | import javax.swing.JWindow; 13 | 14 | import org.arong.egdownloader.model.SearchTask; 15 | import org.arong.egdownloader.ui.ComponentUtil; 16 | import org.arong.egdownloader.ui.panel.TaskTagsPanel; 17 | 18 | /** 19 | * 显示搜索漫画详细信息窗口 20 | * @author dipoo 21 | * @date 2019-05-10 22 | */ 23 | public class SearchDetailInfoWindow extends JWindow { 24 | public SearchComicWindow searchComicWindow; 25 | public TaskTagsPanel taskTagsPanel; 26 | 27 | public SearchDetailInfoWindow(final SearchComicWindow searchComicWindow){ 28 | 29 | this.searchComicWindow = searchComicWindow; 30 | this.setSize(720, 180); 31 | this.setLocationRelativeTo(searchComicWindow); 32 | this.setVisible(false); 33 | 34 | taskTagsPanel = new TaskTagsPanel(searchComicWindow.mainWindow, this); 35 | taskTagsPanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 4)); 36 | taskTagsPanel.searchTags = true; 37 | //taskTagsPanel.excludePanel.setVisible(false); 38 | 39 | ComponentUtil.addComponents(getContentPane(), taskTagsPanel); 40 | 41 | this.addWindowListener(new WindowAdapter() { 42 | //窗体由激活状态变成非激活状态 43 | public void windowDeactivated(WindowEvent e) { 44 | //关闭后显示主界面 45 | Window this_ = (Window) e.getSource(); 46 | this_.dispose(); 47 | } 48 | }); 49 | final SearchDetailInfoWindow this_ = this; 50 | taskTagsPanel.addMouseListener(new MouseAdapter() { 51 | public void mouseClicked(MouseEvent e) { 52 | //点击自身隐藏 53 | this_.setVisible(false); 54 | } 55 | 56 | }); 57 | } 58 | /** 59 | * 搜索窗口使用 60 | */ 61 | public void showDetail(SearchTask task, Point p){ 62 | //重设高度 63 | this.setSize(this.getWidth(), 250); 64 | //渲染面板 65 | taskTagsPanel.showSearchTagGroup(task); 66 | this.setLocationRelativeTo(searchComicWindow); 67 | this.setLocation((int)p.getX(), (int)p.getY()); 68 | this.setVisible(true); 69 | if(taskTagsPanel.getVerticalScrollBar().isVisible()){ 70 | //重设高度 71 | this.setSize(this.getWidth(), this.getHeight() + 30); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/window/SearchTagsWindow.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.window; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.WindowAdapter; 5 | import java.awt.event.WindowEvent; 6 | 7 | import javax.swing.JDialog; 8 | 9 | import org.arong.egdownloader.ui.ComponentConst; 10 | import org.arong.egdownloader.ui.ComponentUtil; 11 | import org.arong.egdownloader.ui.panel.TaskTagsPanel; 12 | 13 | /** 14 | * 显示我收藏的标签 15 | * @author dipoo 16 | * @date 2019-05-10 17 | */ 18 | public class SearchTagsWindow extends JDialog { 19 | public SearchComicWindow searchComicWindow; 20 | public TaskTagsPanel taskTagsPanel; 21 | 22 | public SearchTagsWindow(final SearchComicWindow searchComicWindow){ 23 | 24 | this.searchComicWindow = searchComicWindow; 25 | this.setSize(ComponentConst.CLIENT_WIDTH - 200, 300); 26 | this.setTitle("标签组"); 27 | this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); 28 | this.setLocationRelativeTo(searchComicWindow); 29 | 30 | taskTagsPanel = new TaskTagsPanel(searchComicWindow.mainWindow, this); 31 | taskTagsPanel.searchTags = true; 32 | 33 | ComponentUtil.addComponents(getContentPane(), taskTagsPanel); 34 | 35 | this.addWindowListener(new WindowAdapter() { 36 | public void windowClosing(WindowEvent e) { 37 | Window this_ = (Window) e.getSource(); 38 | this_.dispose(); 39 | searchComicWindow.toFront(); 40 | } 41 | //窗体由激活状态变成非激活状态 42 | public void windowDeactivated(WindowEvent e) { 43 | //关闭后显示主界面 44 | Window this_ = (Window) e.getSource(); 45 | this_.dispose(); 46 | } 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/window/ZiptingWindow.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.window; 2 | 3 | import java.awt.Color; 4 | import java.awt.event.WindowAdapter; 5 | import java.awt.event.WindowEvent; 6 | 7 | import javax.swing.JDialog; 8 | import javax.swing.JFrame; 9 | import javax.swing.JLabel; 10 | import javax.swing.JProgressBar; 11 | 12 | import org.arong.egdownloader.ui.ComponentUtil; 13 | import org.arong.egdownloader.ui.swing.AJLabel; 14 | import org.arong.egdownloader.ui.swing.AJProgressBar; 15 | /** 16 | * 打包zip细节显示窗口 17 | * @author dipoo 18 | * @since 2016-03-30 19 | */ 20 | public class ZiptingWindow extends JDialog { 21 | 22 | private static final long serialVersionUID = -2544191890083257820L; 23 | 24 | public JFrame mainWindow; 25 | public JProgressBar bar; 26 | public JLabel totalLabel; 27 | public JLabel nameLabel; 28 | 29 | public ZiptingWindow(JFrame window){ 30 | this.mainWindow = window; 31 | this.setTitle("正在打包为ZIP文件"); 32 | this.setSize(400, 150); 33 | this.setLayout(null); 34 | this.setResizable(false); 35 | this.setLocationRelativeTo(this.mainWindow); 36 | this.setBackground(Color.WHITE); 37 | 38 | //关闭监听,释放窗口资源,否则消耗大量CPU 39 | this.addWindowListener(new WindowAdapter() { 40 | public void windowClosing(WindowEvent e) { 41 | ZiptingWindow window = (ZiptingWindow) e.getSource(); 42 | window.dispose(); 43 | } 44 | //窗体由激活状态变成非激活状态 45 | /*public void windowDeactivated(WindowEvent e) { 46 | mainWindow.setVisible(true); 47 | mainWindow.setEnabled(true); 48 | CreatingWindow window = (CreatingWindow) e.getSource(); 49 | window.dispose(); 50 | }*/ 51 | public void windowActivated(WindowEvent e) { 52 | //mainWindow.setEnabled(false); 53 | } 54 | }); 55 | 56 | nameLabel = new AJLabel("名称:", Color.BLACK, 10, 5, 380, 20); 57 | totalLabel = new AJLabel("数目:", Color.BLACK, 10, 35, 100, 20); 58 | bar = new AJProgressBar(40, 65, 310, 20, 0, 100); 59 | bar.setStringPainted(true); 60 | ComponentUtil.addComponents(getContentPane(), nameLabel, 61 | totalLabel, bar); 62 | } 63 | 64 | @Override 65 | protected void processWindowEvent(WindowEvent e) { 66 | /*//关闭事件 67 | if(e.getID() == WindowEvent.WINDOW_CLOSING){ 68 | //do nothing 69 | }else{ 70 | super.processWindowEvent(e); 71 | }*/ 72 | super.processWindowEvent(e); 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/CommonSwingWorker.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work; 2 | 3 | import javax.swing.SwingWorker; 4 | /** 5 | * 公共耗时任务类 6 | * @author Administrator 7 | * 8 | */ 9 | public class CommonSwingWorker extends SwingWorker { 10 | Runnable action; 11 | public CommonSwingWorker(Runnable action) { 12 | this.action = action; 13 | } 14 | protected Void doInBackground() throws Exception { 15 | action.run(); 16 | return null; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/DeleteWorker.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work; 2 | 3 | import java.io.File; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import javax.swing.SwingWorker; 8 | 9 | import org.arong.egdownloader.model.Task; 10 | import org.arong.egdownloader.ui.table.TaskingTable; 11 | import org.arong.egdownloader.ui.window.DeletingWindow; 12 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 13 | import org.arong.util.FileUtil2; 14 | import org.arong.util.Tracker; 15 | /** 16 | * 删除任务线程类 17 | * @author 阿荣 18 | * @since 2014-09-19 19 | */ 20 | public class DeleteWorker extends SwingWorker{ 21 | 22 | private EgDownloaderWindow mainWindow; 23 | private TaskingTable table; 24 | private DeletingWindow w; 25 | private int[] rows; 26 | private boolean deleteFile; 27 | public DeleteWorker(EgDownloaderWindow mainWindow, TaskingTable table, DeletingWindow w, int[] rows, boolean deleteFile){ 28 | this.mainWindow = mainWindow; 29 | this.table = table; 30 | this.rows = rows; 31 | this.w = w; 32 | this.deleteFile = deleteFile; 33 | } 34 | 35 | protected Void doInBackground() throws Exception { 36 | try{ 37 | Task task; 38 | List tasks = new ArrayList(); 39 | for(int i = 0; i < rows.length; i ++){ 40 | if(table.getTasks().size() >= (rows[i])){ 41 | task = table.getTasks().get(rows[i]); 42 | tasks.add(task); 43 | w.setData((i + 1) + "/" + rows.length); 44 | w.setInfo("收集:" + task.getName()); 45 | Tracker.println("待删除:" + task.getName()); 46 | } 47 | } 48 | //操作数据库 49 | if(tasks.size() > 0){ 50 | for(Task t : tasks){ 51 | if(t.getPictures() != null && t.getPictures().size() > 0){ 52 | w.setInfo("正在删除任务图片"); 53 | mainWindow.pictureDbTemplate.delete("tid", t.getId()); 54 | if(deleteFile){ 55 | //删除文件 56 | FileUtil2.deleteFile(new File(t.getSaveDir())); 57 | } 58 | } 59 | w.setInfo(String.format("正在删除任务【%s】-%s", t.getDisplayName(), t.getUrl())); 60 | mainWindow.taskDbTemplate.delete(t);//删除任务 61 | //更新内存 62 | table.getTasks().remove(t); 63 | if(table.getTasks().size() > 0){ 64 | table.setRowSelectionInterval(0, 0); 65 | table.scrollRectToVisible(table.getCellRect(0, 0, true)); 66 | } 67 | t.flushTagsCount(false); 68 | if(mainWindow.taskImagePanel != null){ 69 | mainWindow.taskImagePanel.init(); 70 | } 71 | } 72 | Tracker.println("删除" + tasks.size() + "个任务完成"); 73 | } 74 | table.clearSelection();//使之不选中任何行 75 | if(table.getTasks().size() == 0){ 76 | mainWindow.tablePane.setVisible(false);//将任务panel隐藏 77 | mainWindow.emptyPanel.setVisible(true);//将空任务label显示 78 | } 79 | }catch(Exception e){ 80 | e.printStackTrace(); 81 | }finally{ 82 | mainWindow.setEnabled(true); 83 | mainWindow.toFront(); 84 | w.dispose(); 85 | } 86 | return null; 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/JarUpdateWorker.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work; 2 | 3 | import java.io.File; 4 | import java.io.InputStream; 5 | import java.util.Map; 6 | 7 | import javax.swing.JOptionPane; 8 | import javax.swing.SwingWorker; 9 | 10 | import org.arong.egdownloader.spider.WebClient; 11 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 12 | import org.arong.egdownloader.version.Version; 13 | import org.arong.util.FileUtil2; 14 | /** 15 | * Jar包更新任务线程类 16 | * @author dipoo 17 | * @since 2019-03-22 18 | */ 19 | public class JarUpdateWorker extends SwingWorker{ 20 | 21 | private EgDownloaderWindow mainWindow; 22 | private Map version; 23 | private String binPath; 24 | public JarUpdateWorker(EgDownloaderWindow mainWindow, Map version, String binPath){ 25 | this.mainWindow = mainWindow; 26 | this.version = version; 27 | this.binPath = binPath; 28 | } 29 | 30 | protected Void doInBackground() throws Exception { 31 | String jarName = "egdownloader.jar"; 32 | String tmpjarName = "egdownloader.jar_tmp"; 33 | InputStream is = null; 34 | System.out.println("开始下载jar文件..."); 35 | String bakPath = binPath + File.separator + "bak" + File.separator + Version.JARVERSION + File.separator; 36 | File oldjar = null; 37 | try { 38 | //检测是否为支持jar更新的类型 39 | oldjar = new File(binPath + File.separator + "jre" + File.separator 40 | + "lib" + File.separator + "ext" + File.separator + jarName); 41 | if(!oldjar.exists()){ 42 | JOptionPane.showMessageDialog(null, "当前模式不支持jar文件更新"); 43 | return null; 44 | } 45 | 46 | String url = version.get("jarUrl"); 47 | Object[] o = WebClient.getStreamAndLengthUseJavaWithCookie(url, null); 48 | is = (InputStream) o[0]; 49 | int totalLength = (Integer) o[1]; 50 | System.out.println("jar文件大小:" + FileUtil2.showSizeStr((long)totalLength)); 51 | 52 | if(is == null){ 53 | JOptionPane.showMessageDialog(null, "jar文件更新失败"); 54 | }else{ 55 | //备份 56 | FileUtil2.ifNotExistsThenCreate(bakPath); 57 | System.out.println(String.format("备份文件%s至%s", oldjar.getPath(), bakPath + jarName)); 58 | FileUtil2.copyFile(oldjar.getPath(), bakPath + jarName); 59 | System.out.println(String.format("下载文件至%s", oldjar.getParent() + File.separator + tmpjarName)); 60 | System.out.println("请耐心等候..."); 61 | //保存 62 | int fsize = FileUtil2.storeStream(oldjar.getParent(), tmpjarName, is); 63 | if(fsize != totalLength){ 64 | JOptionPane.showMessageDialog(null, "更新失败,jar文件下载不完整(" + FileUtil2.showSizeStr((long)fsize) + "),请重试"); 65 | }else{ 66 | File tmpfile = new File(oldjar.getParent() + File.separator + tmpjarName); 67 | System.out.println(String.format("重命名文件%s为%s", tmpjarName, jarName)); 68 | FileUtil2.copyByte(tmpfile, oldjar); 69 | System.out.println(String.format("删除临时文件%s", tmpjarName)); 70 | FileUtil2.deleteFile(tmpfile); 71 | int r = JOptionPane.showConfirmDialog(null, "jar文件更新成功,重启后下载器后生效,是否立即重启?", "更新完成", JOptionPane.YES_NO_OPTION); 72 | if(r == JOptionPane.OK_OPTION){ 73 | mainWindow.restartMenuItem.doClick(); 74 | } 75 | } 76 | } 77 | }catch(Exception e1) { 78 | JOptionPane.showMessageDialog(null, "jar文件更新失败," + e1.getMessage()); 79 | //还原 80 | System.out.println(String.format("还原文件%s至%s", bakPath + jarName, oldjar.getPath())); 81 | FileUtil2.copyFile(bakPath + jarName, oldjar.getPath()); 82 | e1.printStackTrace(); 83 | }finally{ 84 | if(is != null){ 85 | try{is.close();}catch(Exception e){} 86 | } 87 | mainWindow.aboutWindow.jarUpdateWorker = null; 88 | } 89 | 90 | return null; 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/ReBuildAllTaskWorker.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work; 2 | 3 | import java.util.List; 4 | 5 | import javax.swing.SwingWorker; 6 | 7 | import org.arong.egdownloader.model.ScriptParser; 8 | import org.arong.egdownloader.model.Setting; 9 | import org.arong.egdownloader.model.Task; 10 | import org.arong.egdownloader.ui.table.TaskingTable; 11 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 12 | import org.arong.util.Tracker; 13 | /** 14 | * 重建所有任务。(采集缺失的任务信息,用于低版本数据库文件升级) 15 | * @author dipoo 16 | * @since 2015-01-02 17 | */ 18 | public class ReBuildAllTaskWorker extends SwingWorker { 19 | public EgDownloaderWindow window; 20 | public ReBuildAllTaskWorker(EgDownloaderWindow window) { 21 | this.window = window; 22 | } 23 | 24 | protected Void doInBackground() throws Exception { 25 | TaskingTable table = (TaskingTable) window.runningTable; 26 | List tasks = table.getTasks(); 27 | Setting setting = window.setting; 28 | //设置重建状态 29 | table.setRebuild(true); 30 | int i = 0; 31 | long t = System.currentTimeMillis(); 32 | for(Task task : tasks){ 33 | i ++; 34 | ScriptParser.rebuildTask(task, setting); 35 | if(task.getPictures() != null){ 36 | //保存数据 37 | window.taskDbTemplate.update(task); 38 | //删除原来的图片 39 | window.pictureDbTemplate.delete("tid", task.getId()); 40 | //添加新采集的图片 41 | window.pictureDbTemplate.store(task.getPictures()); 42 | Tracker.println(ReBuildAllTaskWorker.class, "重建任务-" + i + "/" + tasks.size() + ", 成功"); 43 | }else{ 44 | Tracker.println(ReBuildAllTaskWorker.class, "重建任务-" + i + "/" + tasks.size() + ", 失败"); 45 | } 46 | } 47 | table.setRebuild(false); 48 | Tracker.println(ReBuildAllTaskWorker.class, "重建任务完成!耗时:" + (System.currentTimeMillis() - t) / 1000L + " 秒"); 49 | return null; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/interfaces/IListenerTask.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.interfaces; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.MouseEvent; 5 | 6 | /** 7 | * 监听任务接口 8 | * @author 阿荣 9 | * @since 2014-05-22 10 | */ 11 | public interface IListenerTask { 12 | public void doWork(Window window, MouseEvent e); 13 | } 14 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/interfaces/IMenuListenerTask.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.interfaces; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.ActionEvent; 5 | /** 6 | * 监听菜单项任务接口 7 | * @author 阿荣 8 | * @since 2014-12-19 9 | */ 10 | public interface IMenuListenerTask { 11 | public void doWork(Window window, ActionEvent e); 12 | } 13 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/listenerWork/ChangeReadedWork.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.listenerWork; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.ActionEvent; 5 | 6 | import org.arong.egdownloader.model.Task; 7 | import org.arong.egdownloader.ui.table.TaskingTable; 8 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 9 | import org.arong.egdownloader.ui.work.interfaces.IMenuListenerTask; 10 | /** 11 | * 更改阅读状态任务 12 | * @author 阿荣 13 | * @since 2014-09-18 14 | */ 15 | public class ChangeReadedWork implements IMenuListenerTask { 16 | 17 | public void doWork(Window window, ActionEvent e) { 18 | EgDownloaderWindow mainWindow = (EgDownloaderWindow)window; 19 | TaskingTable table = (TaskingTable) mainWindow.runningTable; 20 | int index = table.getSelectedRow(); 21 | Task task = table.getTasks().get(index); 22 | task.setReaded(! task.isReaded()); 23 | mainWindow.taskDbTemplate.update(task); 24 | //隐藏tablePopupMenu 25 | mainWindow.tablePopupMenu.setVisible(false); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/listenerWork/ConsoleWork.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.listenerWork; 2 | 3 | import java.awt.Font; 4 | import java.awt.Window; 5 | import java.awt.event.MouseEvent; 6 | import java.io.FileNotFoundException; 7 | 8 | import javax.swing.BorderFactory; 9 | import javax.swing.JOptionPane; 10 | import javax.swing.JScrollPane; 11 | import javax.swing.JTextArea; 12 | import javax.swing.border.TitledBorder; 13 | import javax.swing.plaf.BorderUIResource; 14 | 15 | import org.arong.egdownloader.ui.ComponentConst; 16 | import org.arong.egdownloader.ui.SwingPrintStream; 17 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 18 | import org.arong.egdownloader.ui.work.interfaces.IListenerTask; 19 | /** 20 | * 打开/关闭控制台任务监听 21 | * @author 阿荣 22 | * @since 2014-06-22 23 | */ 24 | public class ConsoleWork implements IListenerTask { 25 | public JTextArea consoleTextArea; 26 | 27 | public void doWork(Window window, MouseEvent e) { 28 | /*final EgDownloaderWindow mainWindow = (EgDownloaderWindow)window; 29 | if(mainWindow.consolePane == null){ 30 | JTextArea jea = new JTextArea(); 31 | jea.setEditable(false); 32 | jea.setAutoscrolls(true); 33 | jea.setLineWrap(true); 34 | jea.setBorder(null); 35 | jea.setFont(new Font("宋体", Font.PLAIN, 12)); 36 | this.consoleTextArea = jea; 37 | JScrollPane consolePane = new JScrollPane(jea); 38 | TitledBorder border = BorderFactory.createTitledBorder(BorderUIResource.getEtchedBorderUIResource(), "控制台"); 39 | consolePane.setBounds(5, 450, ComponentConst.CLIENT_WIDTH - 20, 190); 40 | consolePane.setAutoscrolls(true); 41 | consolePane.setBorder(border); 42 | consolePane.setVisible(false); 43 | 44 | mainWindow.getContentPane().add(consolePane); 45 | mainWindow.consolePane = consolePane; 46 | try { 47 | //将syso信息推送到控制台 48 | new SwingPrintStream(System.out, jea); 49 | } catch (FileNotFoundException e1) { 50 | JOptionPane.showMessageDialog(window, "控制台初始化错误!"); 51 | } 52 | } 53 | //如果控制台是显示的,则隐藏 54 | if(mainWindow.consolePane.isVisible()){ 55 | mainWindow.consolePane.setVisible(false); 56 | //重设主窗口大小 57 | mainWindow.setSize(ComponentConst.CLIENT_WIDTH, mainWindow.getHeight() - 200); 58 | } 59 | //如果控制台是隐藏的,则显示 60 | else{ 61 | mainWindow.consolePane.setVisible(true); 62 | //重设主窗口大小 63 | mainWindow.setSize(ComponentConst.CLIENT_WIDTH, mainWindow.getHeight() + 200); 64 | } 65 | mainWindow.setLocationRelativeTo(null);//使窗口居中 66 | */ } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/listenerWork/DeleteTaskWork.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.listenerWork; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.MouseEvent; 5 | 6 | import javax.swing.JOptionPane; 7 | import javax.swing.SwingUtilities; 8 | 9 | import org.arong.egdownloader.ui.table.TaskingTable; 10 | import org.arong.egdownloader.ui.window.DeletingWindow; 11 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 12 | import org.arong.egdownloader.ui.work.DeleteWorker; 13 | import org.arong.egdownloader.ui.work.interfaces.IListenerTask; 14 | 15 | /** 16 | * 删除任务操作 17 | * @author 阿荣 18 | * @since 2014-05-24 19 | */ 20 | public class DeleteTaskWork implements IListenerTask { 21 | 22 | public void doWork(Window window, MouseEvent e) { 23 | final EgDownloaderWindow mainWindow = (EgDownloaderWindow)window; 24 | final TaskingTable table = (TaskingTable) mainWindow.runningTable; 25 | final int[] rows = table.getSelectedRows(); 26 | SwingUtilities.invokeLater(new Runnable(){ 27 | public void run() { 28 | if(rows.length == 0){ 29 | JOptionPane.showMessageDialog(mainWindow, "请选择至少一个任务"); 30 | return; 31 | } 32 | int option = JOptionPane.showConfirmDialog(mainWindow, "确定要删除" + (rows.length > 1 ? "这" + rows.length + "个" : "这个【" + table.getTasks().get(rows[0]).getDisplayName() + "】") + "任务吗"); 33 | if(option == JOptionPane.OK_OPTION){ 34 | //mainWindow.setEnabled(false); 35 | DeletingWindow w = (DeletingWindow) mainWindow.deletingWindow; 36 | if(w == null){ 37 | mainWindow.deletingWindow = new DeletingWindow(mainWindow); 38 | } 39 | w = (DeletingWindow) mainWindow.deletingWindow; 40 | w.setData(" 0/" + rows.length); 41 | w.setInfo("正在收集任务图片"); 42 | int o = JOptionPane.showConfirmDialog(mainWindow, "是否删除下载的文件?"); 43 | w.setVisible(true); 44 | //执行删除线程 45 | new DeleteWorker(mainWindow, table, w, rows, o == 0).execute(); 46 | 47 | } 48 | } 49 | }); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/listenerWork/DownloadCoverWork.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.listenerWork; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.ActionEvent; 5 | import java.io.InputStream; 6 | import java.net.SocketTimeoutException; 7 | 8 | import javax.swing.JOptionPane; 9 | import javax.swing.SwingUtilities; 10 | 11 | import org.apache.commons.httpclient.ConnectTimeoutException; 12 | import org.arong.egdownloader.model.ScriptParser; 13 | import org.arong.egdownloader.model.Task; 14 | import org.arong.egdownloader.spider.WebClient; 15 | import org.arong.egdownloader.ui.table.TaskingTable; 16 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 17 | import org.arong.egdownloader.ui.work.CommonSwingWorker; 18 | import org.arong.egdownloader.ui.work.interfaces.IMenuListenerTask; 19 | import org.arong.util.FileUtil2; 20 | /** 21 | * 下载漫画封面(先检测是否存在,不存在才去下载) 22 | * @author 阿荣 23 | * @since 2014-09-07 24 | */ 25 | public class DownloadCoverWork implements IMenuListenerTask { 26 | 27 | public void doWork(Window window, ActionEvent e2) { 28 | final EgDownloaderWindow mainWindow = (EgDownloaderWindow)window; 29 | TaskingTable table = (TaskingTable) mainWindow.runningTable; 30 | int index = table.getSelectedRow(); 31 | final Task task = table.getTasks().get(index); 32 | //File cover = new File(ComponentConst.getSavePathPreffix() + task.getSaveDir() + "/cover.jpg"); 33 | //不存在封面则下载 34 | //if(cover == null || !cover.exists()){ 35 | SwingUtilities.invokeLater(new Runnable() { 36 | public void run() { 37 | new CommonSwingWorker(new Runnable() { 38 | public void run() { 39 | InputStream is = null; 40 | try { 41 | if(task.getCoverUrl() == null){ 42 | ScriptParser.rebuildTask(task, mainWindow.setting); 43 | } 44 | //下载封面 45 | is = WebClient.getStreamUseJavaWithCookie(task.getDownloadCoverUrl(mainWindow.setting.isUseCoverReplaceDomain()), mainWindow.setting.getCookieInfo());//getStreamUseJava(task.getCoverUrl()); 46 | int size = FileUtil2.storeStream(task.getSaveDir(), "cover.jpg", is);//保存到目录 47 | if(size == 0){ 48 | JOptionPane.showMessageDialog(mainWindow, "下载失败,地址错误或者地址不可访问"); 49 | }else{ 50 | if(mainWindow.coverWindow2 != null && mainWindow.coverWindow2.isVisible()){ 51 | mainWindow.coverWindow2.dispose(); 52 | } 53 | JOptionPane.showMessageDialog(mainWindow, "下载成功"); 54 | if(mainWindow.taskImagePanel != null){ 55 | mainWindow.taskImagePanel.flush(task, true); 56 | } 57 | } 58 | } catch (SocketTimeoutException e){ 59 | JOptionPane.showMessageDialog(mainWindow, "读取文件超时,请检查网络后重试"); 60 | } catch (ConnectTimeoutException e){ 61 | JOptionPane.showMessageDialog(mainWindow, "连接超时,请检查网络后重试"); 62 | } catch (Exception e) { 63 | JOptionPane.showMessageDialog(mainWindow, e.getMessage()); 64 | }finally{ 65 | mainWindow.tablePopupMenu.setVisible(false); 66 | if(is != null){ 67 | try{is.close();}catch(Exception e){} 68 | } 69 | } 70 | } 71 | }).execute(); 72 | } 73 | }); 74 | /*}else{ 75 | JOptionPane.showMessageDialog(mainWindow, "封面已存在"); 76 | mainWindow.tablePopupMenu.setVisible(false); 77 | }*/ 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/listenerWork/OpenFolderTaskWork.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.listenerWork; 2 | 3 | import java.awt.Desktop; 4 | import java.awt.Window; 5 | import java.awt.event.ActionEvent; 6 | import java.io.File; 7 | 8 | import javax.swing.JOptionPane; 9 | 10 | import org.arong.egdownloader.model.Task; 11 | import org.arong.egdownloader.model.TaskStatus; 12 | import org.arong.egdownloader.ui.table.TaskingTable; 13 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 14 | import org.arong.egdownloader.ui.work.interfaces.IMenuListenerTask; 15 | /** 16 | * 打开文件夹的操作任务类 17 | * @author 阿荣 18 | * @since 2014-06-05 19 | */ 20 | public class OpenFolderTaskWork implements IMenuListenerTask { 21 | 22 | public void doWork(Window window, ActionEvent e) { 23 | EgDownloaderWindow mainWindow = (EgDownloaderWindow)window; 24 | TaskingTable table = (TaskingTable) mainWindow.runningTable; 25 | int rowIndex = table.getSelectedRow(); 26 | Task task = table.getTasks().get(rowIndex); 27 | if(TaskStatus.UNCREATED != task.getStatus()){ 28 | try { 29 | Desktop.getDesktop().open(new File(task.getSaveDir())); 30 | } catch (Exception e1) { 31 | //e1.printStackTrace(); 32 | JOptionPane.showMessageDialog(mainWindow, "文件夹已被删除"); 33 | mainWindow.tablePopupMenu.setVisible(false); 34 | } 35 | }else{ 36 | JOptionPane.showMessageDialog(mainWindow, "文件夹还未生成"); 37 | } 38 | mainWindow.tablePopupMenu.setVisible(false); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/listenerWork/OpenPicWork.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.listenerWork; 2 | 3 | import java.awt.Desktop; 4 | import java.awt.Window; 5 | import java.awt.event.ActionEvent; 6 | import java.io.File; 7 | import java.util.List; 8 | 9 | import javax.swing.JOptionPane; 10 | 11 | import org.arong.egdownloader.model.Picture; 12 | import org.arong.egdownloader.model.Task; 13 | import org.arong.egdownloader.ui.menuitem.StartAllTaskMenuItem; 14 | import org.arong.egdownloader.ui.table.TaskingTable; 15 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 16 | import org.arong.egdownloader.ui.work.interfaces.IMenuListenerTask; 17 | import org.arong.util.Tracker; 18 | 19 | public class OpenPicWork implements IMenuListenerTask{ 20 | 21 | public void doWork(Window window, ActionEvent e) { 22 | EgDownloaderWindow mainWindow = (EgDownloaderWindow)window; 23 | TaskingTable table = (TaskingTable) mainWindow.runningTable; 24 | //如果正在重建,则不打开 25 | if(table.isRebuild()){ 26 | Tracker.println(StartAllTaskMenuItem.class, "正在重建任务"); 27 | return; 28 | } 29 | int index = table.getSelectedRow(); 30 | Task task = table.getTasks().get(index); 31 | if(task.getCurrent() > 0){ 32 | List pics = task.getPictures(); 33 | int c = 0; 34 | for (Picture pic : pics) { 35 | if(pic.isCompleted()){ 36 | try { 37 | String name = pic.getName(); 38 | if(name.indexOf(".") != -1){ 39 | name = pic.getNum() + name.substring(name.lastIndexOf("."), name.length()); 40 | }else{ 41 | name = pic.getNum() + ".jpg"; 42 | } 43 | Desktop.getDesktop().open(new File(task.getSaveDir() + File.separator + name)); 44 | break; 45 | } catch (Exception e1) { 46 | try { 47 | Desktop.getDesktop().open(new File(task.getSaveDir() + File.separator + pic.getName())); 48 | break; 49 | } catch (Exception e2) { 50 | if(c < 1){ 51 | c ++; 52 | JOptionPane.showMessageDialog(mainWindow, "图片不存在"); 53 | } 54 | } 55 | } 56 | } 57 | } 58 | }else{ 59 | JOptionPane.showMessageDialog(mainWindow, "没有图片"); 60 | } 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/listenerWork/OpenWebPageWork.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.listenerWork; 2 | 3 | import java.awt.Desktop; 4 | import java.awt.Window; 5 | import java.awt.event.ActionEvent; 6 | import java.io.IOException; 7 | import java.net.URI; 8 | import java.net.URISyntaxException; 9 | 10 | import javax.swing.JOptionPane; 11 | 12 | import org.arong.egdownloader.model.Task; 13 | import org.arong.egdownloader.ui.table.TaskingTable; 14 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 15 | import org.arong.egdownloader.ui.work.interfaces.IMenuListenerTask; 16 | /** 17 | * 打开任务下载网页任务 18 | * @author 阿荣 19 | * @since 2014-06-18 20 | */ 21 | public class OpenWebPageWork implements IMenuListenerTask { 22 | 23 | public void doWork(Window window, ActionEvent e) { 24 | EgDownloaderWindow mainWindow = (EgDownloaderWindow)window; 25 | TaskingTable table = (TaskingTable) mainWindow.runningTable; 26 | int index = table.getSelectedRow(); 27 | Task task = table.getTasks().get(index); 28 | try { 29 | Desktop.getDesktop().browse(new URI(task.getUrl())); 30 | } catch (IOException e1) { 31 | try { 32 | Runtime.getRuntime().exec("cmd.exe /c start " + task.getUrl()); 33 | } catch (IOException e2) { 34 | JOptionPane.showMessageDialog(mainWindow, "不支持此功能"); 35 | } 36 | } catch (URISyntaxException e1) { 37 | try { 38 | Runtime.getRuntime().exec("cmd.exe /c start " + task.getUrl()); 39 | } catch (IOException e2) { 40 | JOptionPane.showMessageDialog(mainWindow, "不支持此功能"); 41 | } 42 | }finally{ 43 | //隐藏tablePopupMenu 44 | mainWindow.tablePopupMenu.setVisible(false); 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/listenerWork/ResetTaskWork.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.listenerWork; 2 | 3 | import java.util.List; 4 | 5 | import javax.swing.JOptionPane; 6 | 7 | import org.arong.egdownloader.model.Task; 8 | import org.arong.egdownloader.model.TaskStatus; 9 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 10 | import org.arong.egdownloader.ui.window.ResetAllTaskWindow; 11 | import org.arong.egdownloader.ui.work.CommonSwingWorker; 12 | /** 13 | * 重置任务 14 | * @author dipoo 15 | * @since 2014-11-18 16 | */ 17 | public class ResetTaskWork { 18 | public ResetTaskWork(final EgDownloaderWindow mainWindow, final List tasks, String message) { 19 | //询问是否重置任务 20 | int result = JOptionPane.showConfirmDialog(mainWindow, message); 21 | if(result == JOptionPane.OK_OPTION){//确定 22 | new CommonSwingWorker(new Runnable() { 23 | public void run() { 24 | //mainWindow.setEnabled(false); 25 | ResetAllTaskWindow w = (ResetAllTaskWindow) mainWindow.resetAllTaskWindow; 26 | if(w == null){ 27 | mainWindow.resetAllTaskWindow = new ResetAllTaskWindow(mainWindow, tasks); 28 | } 29 | w = (ResetAllTaskWindow) mainWindow.resetAllTaskWindow; 30 | w.setInfoLabel(" 0"); 31 | w.setVisible(true); 32 | Task task = null; 33 | for(int i = 0; i < tasks.size(); i ++){ 34 | task = tasks.get(i); 35 | if(task.getStatus() != TaskStatus.STARTED//正在下载 36 | && task.getStatus() != TaskStatus.UNCREATED//未创建 37 | && task.getStatus() != TaskStatus.UNSTARTED){//未开始 38 | //重置图片状态 39 | for(int j = 0; j < task.getPictures().size(); j ++){ 40 | task.getPictures().get(j).setCompleted(false); 41 | } 42 | task.setCurrent(0);//进度未0 43 | task.setStatus(TaskStatus.UNSTARTED);//状态未开始 44 | task.setCompletedTime("");//完成时间置空 45 | task.setReaded(false);//未阅读 46 | } 47 | w.setInfoLabel(" " + (i + 1)); 48 | mainWindow.pictureDbTemplate.update(task.getPictures()); 49 | } 50 | //保存数据 51 | mainWindow.taskDbTemplate.update(tasks); 52 | w.dispose(); 53 | JOptionPane.showMessageDialog(mainWindow, "重置任务完成!"); 54 | } 55 | }).execute(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/listenerWork/ShowEditWork.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.listenerWork; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.ActionEvent; 5 | 6 | import org.arong.egdownloader.model.Task; 7 | import org.arong.egdownloader.ui.table.TaskingTable; 8 | import org.arong.egdownloader.ui.window.EditWindow; 9 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 10 | import org.arong.egdownloader.ui.work.interfaces.IMenuListenerTask; 11 | /** 12 | * 编辑任务信息窗口 13 | * @author 阿荣 14 | * @since 2014-09-18 15 | */ 16 | public class ShowEditWork implements IMenuListenerTask { 17 | 18 | public void doWork(Window window, ActionEvent e) { 19 | EgDownloaderWindow mainWindow = (EgDownloaderWindow)window; 20 | TaskingTable table = (TaskingTable) mainWindow.runningTable; 21 | int index = table.getSelectedRow(); 22 | Task task = table.getTasks().get(index); 23 | EditWindow ew = (EditWindow) mainWindow.editWindow; 24 | if(ew == null){ 25 | mainWindow.editWindow = new EditWindow(mainWindow, task); 26 | } 27 | ew = (EditWindow) mainWindow.editWindow; 28 | ew.setTask(task); 29 | ew.initInfo(); 30 | mainWindow.setEnabled(false); 31 | ew.setVisible(true); 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/listenerWork/StartTaskWork.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.listenerWork; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.MouseEvent; 5 | 6 | import javax.swing.JOptionPane; 7 | 8 | import org.arong.egdownloader.ui.menuitem.StartAllTaskMenuItem; 9 | import org.arong.egdownloader.ui.table.TaskingTable; 10 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 11 | import org.arong.egdownloader.ui.work.interfaces.IListenerTask; 12 | import org.arong.util.Tracker; 13 | /** 14 | * 开始任务操作 15 | * @author dipoo 16 | * @since 2014-12-30 17 | */ 18 | public class StartTaskWork implements IListenerTask { 19 | 20 | public void doWork(Window window, MouseEvent e) { 21 | EgDownloaderWindow mainWindow = (EgDownloaderWindow)window; 22 | TaskingTable table = (TaskingTable) mainWindow.runningTable; 23 | //如果正在重建,则不下载 24 | if(table.isRebuild()){ 25 | Tracker.println(StartAllTaskMenuItem.class, "正在重建任务"); 26 | return; 27 | } 28 | int[] rows = table.getSelectedRows(); 29 | if(rows.length == 0){ 30 | JOptionPane.showMessageDialog(mainWindow, "请选择至少一个任务"); 31 | return; 32 | } 33 | for(int i = 0; i < rows.length; i++){ 34 | table.startTask(table.getTasks().get(rows[i])); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/ui/work/listenerWork/StopTaskWork.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.ui.work.listenerWork; 2 | 3 | import java.awt.Window; 4 | import java.awt.event.MouseEvent; 5 | 6 | import javax.swing.JOptionPane; 7 | 8 | import org.arong.egdownloader.ui.menuitem.StartAllTaskMenuItem; 9 | import org.arong.egdownloader.ui.table.TaskingTable; 10 | import org.arong.egdownloader.ui.window.EgDownloaderWindow; 11 | import org.arong.egdownloader.ui.work.interfaces.IListenerTask; 12 | import org.arong.util.Tracker; 13 | /** 14 | * 暂停任务操作 15 | * @author dipoo 16 | * @since 2014-12-30 17 | */ 18 | public class StopTaskWork implements IListenerTask { 19 | 20 | public void doWork(Window window, MouseEvent e) { 21 | EgDownloaderWindow mainWindow = (EgDownloaderWindow)window; 22 | TaskingTable table = (TaskingTable) mainWindow.runningTable; 23 | //如果正在重建,则不下载 24 | if(table.isRebuild()){ 25 | Tracker.println(StartAllTaskMenuItem.class, "正在重建任务"); 26 | return; 27 | } 28 | int[] rows = table.getSelectedRows(); 29 | if(rows.length == 0){ 30 | JOptionPane.showMessageDialog(mainWindow, "请选择至少一个任务"); 31 | return; 32 | } 33 | for(int i = 0; i < rows.length; i++){ 34 | table.stopTask(table.getTasks().get(rows[i])); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/org/arong/egdownloader/version/Version.java: -------------------------------------------------------------------------------- 1 | package org.arong.egdownloader.version; 2 | /** 3 | * 程序基本信息 4 | * @author 阿荣 5 | * @since 2014-05-21 6 | */ 7 | public final class Version { 8 | // 程序名 9 | public final static String NAME = "EG下载器"; 10 | // 程序版本号 11 | public final static String VERSION = "0.95"; 12 | // jar版本号 13 | public final static String JARVERSION = "14"; 14 | // 程序作者 15 | public final static String AUTHOR = "dipoo"; 16 | // 程序最后修改时间 17 | public final static String MODIFLIED = "2023-07-05"; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/org/arong/util/CodeUtil.java: -------------------------------------------------------------------------------- 1 | package org.arong.util; 2 | 3 | import java.security.MessageDigest; 4 | import java.util.Random; 5 | 6 | public class CodeUtil { 7 | // 定义分隔符常量 8 | public static final String DIVIDE_CHAR = "%"; 9 | private static final int DIS1 = 18500; 10 | private static final int DIS2 = -222; 11 | private static final int RANDOM_NUM = 12345; 12 | 13 | /** 14 | * 返回中文(所有字符)字符串的unicode码 15 | * 16 | * @param s 17 | * @return 18 | */ 19 | public static String myEncode(String s) { 20 | String str = null; 21 | // 如果待转化的字符串不为空 22 | if (s != null && s.trim().length() > 0) { 23 | // 创建字符串缓冲区 24 | StringBuffer sb = new StringBuffer(); 25 | // 将待转化的字符串转成字符数组 26 | // 创建一个随机数对象 27 | Random random = new Random(); 28 | int start = random.nextInt(RANDOM_NUM); 29 | int end = random.nextInt(RANDOM_NUM); 30 | sb.append(start + DIVIDE_CHAR); 31 | char[] chars = s.toCharArray(); 32 | // 遍历此字符数组 33 | for (int i = 0; i < chars.length; i++) { 34 | char ch = chars[i]; 35 | sb.append((int) ch + DIS1 + i + DIS2 + start - end 36 | + DIVIDE_CHAR); 37 | } 38 | sb.append(end); 39 | // 转化为字符串 40 | str = sb.toString(); 41 | } 42 | return str; 43 | } 44 | 45 | /** 46 | * 解码 47 | * 48 | * @param codeStr 49 | * @return 50 | */ 51 | public static String myDecode(String codeStr) { 52 | String str = null; 53 | // 待反编码的字符串不为空 54 | if (codeStr != null && codeStr.trim().length() > 0) { 55 | // 将字符串以逗号分隔成字符串数组 56 | String[] codes = codeStr.split("" + DIVIDE_CHAR + ""); 57 | int start = Integer.parseInt(codes[0]); 58 | int end = Integer.parseInt(codes[codes.length - 1]); 59 | // 建立字符串缓冲区 60 | StringBuffer sb = new StringBuffer(); 61 | // 定义一个初始ASCII码变量 62 | int code = 0; 63 | // 遍历字符串数组 64 | for (int i = 1; i < codes.length - 1; i++) { 65 | try { 66 | code = Integer.parseInt(codes[i]) - DIS1 - i + 1 - DIS2 67 | - start + end; 68 | } catch (NumberFormatException e) { 69 | e.printStackTrace(); 70 | throw new RuntimeException("这个字符串不符合规格,请传入形如:“1" 71 | + DIVIDE_CHAR + "2" + DIVIDE_CHAR + "3" 72 | + DIVIDE_CHAR + "4”之类的字符串"); 73 | } 74 | sb.append((char) code); 75 | } 76 | str = sb.toString(); 77 | } 78 | return str; 79 | } 80 | 81 | /** 82 | * MD5加密相关 83 | */ 84 | private static String[] hex = { "0", "1", "2", "3", "4", "5", "6", "7", 85 | "8", "9", "A", "B", "C", "D", "E", "F" }; 86 | 87 | private static String byteArrayToHexString(byte[] byteArray) { 88 | StringBuffer sb = new StringBuffer(); 89 | for (byte b : byteArray) { 90 | // 将每一个byte转换十六进制数 91 | sb.append(byteToHexChar(b)); 92 | } 93 | return sb.toString(); 94 | } 95 | 96 | // 核心 97 | private static Object byteToHexChar(byte b) {// -128到+127之间 98 | int n = b;// n=110 99 | // 如果n为负数 100 | if (n < 0) { 101 | // 转正 102 | n = 256 + n; 103 | } 104 | // 第一位是商 105 | int d1 = n / 16;// d1 = 6 106 | // 第二位是余数 107 | int d2 = n % 16;// d2 = 14 108 | // 拼接字符串 109 | return hex[d1] + hex[d2]; 110 | } 111 | /** 112 | * MD5加密 113 | * @param password 114 | * @return 115 | * @throws Exception 116 | */ 117 | public static String md5Encode(String password) throws Exception { 118 | if (password == null) { 119 | throw new Exception(); 120 | } 121 | // 创建密码生成器(MD5或SHA) 122 | MessageDigest md5 = MessageDigest.getInstance("MD5"); 123 | // 将明文转成byte[] 124 | byte[] byteArray = md5.digest(password.getBytes()); 125 | // 将byte[]转成十六进制的字符串 126 | String passwordMD5 = byteArrayToHexString(byteArray); 127 | return passwordMD5; 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /src/org/arong/util/DateUtil.java: -------------------------------------------------------------------------------- 1 | package org.arong.util; 2 | 3 | import java.text.DateFormat; 4 | import java.text.ParseException; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | import java.util.Locale; 8 | import java.util.regex.Pattern; 9 | 10 | public class DateUtil { 11 | public final static String YYYY_MM_DD = "yyyy-MM-dd"; 12 | public final static String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm"; 13 | public final static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; 14 | public final static SimpleDateFormat YYYY_MM_DD_FORMAT = new SimpleDateFormat(YYYY_MM_DD); 15 | public final static SimpleDateFormat YYYY_MM_DD_HH_MM_FORMAT = new SimpleDateFormat(YYYY_MM_DD_HH_MM); 16 | public final static SimpleDateFormat YYYY_MM_DD_HH_MM_SS_FORMAT = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS); 17 | /** 18 | * 返回当前年份(年) 19 | * @return String 20 | */ 21 | public static String getStringYear() { 22 | return showDate("yyyy"); 23 | } 24 | /** 25 | * 返回当前日期(年月日形式) 26 | * @return String 27 | */ 28 | public static String getStringToday() { 29 | return showDate("yyyy-MM-dd"); 30 | } 31 | /** 32 | * 返回当前日期(年月日时分秒形式) 33 | * @return String 34 | */ 35 | public static String getStringTime() { 36 | return showDate("yyyy-MM-dd HH:mm:ss"); 37 | } 38 | /** 39 | * 根据参数pattern返回相应的日期格式 40 | * @param pattern 41 | * @return 42 | */ 43 | public static String showDate(String pattern){ 44 | SimpleDateFormat formatter = new SimpleDateFormat(pattern); 45 | String dateString = formatter.format(new Date()); 46 | return dateString; 47 | } 48 | /** 49 | * 将日期形式的字符串转换为Date 50 | * 51 | * @param s 52 | * @return 53 | */ 54 | public static Date String2Date(String s) { 55 | Date date = null; 56 | Locale locale = Locale.CHINA; 57 | DateFormat format = null; 58 | if (Pattern.matches("\\d{4}.\\d{1,2}.\\d{1,2}", s)) { 59 | format = DateFormat.getDateInstance(DateFormat.MEDIUM, locale); 60 | } else if (Pattern.matches("\\d{2}.\\d{2}.\\d{2}", s)) { 61 | format = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale); 62 | } else if (Pattern.matches( 63 | "\\d{4}.\\d{1,2}.\\d{1,2}[ ]\\d{1,2}.\\d{1,2}.\\d{1,2}", s)) { 64 | format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, 65 | DateFormat.MEDIUM, locale); 66 | } else { 67 | format = new SimpleDateFormat("yyyy-MM-dd"); 68 | } 69 | try { 70 | date = format.parse(s); 71 | } catch (ParseException e) { 72 | e.printStackTrace(); 73 | } 74 | return date; 75 | } 76 | } -------------------------------------------------------------------------------- /src/org/arong/util/Dom4jUtil2.java: -------------------------------------------------------------------------------- 1 | package org.arong.util; 2 | 3 | import java.io.File; 4 | import java.io.FileOutputStream; 5 | import java.io.OutputStreamWriter; 6 | 7 | import org.dom4j.Document; 8 | import org.dom4j.Element; 9 | import org.dom4j.io.OutputFormat; 10 | import org.dom4j.io.SAXReader; 11 | import org.dom4j.io.XMLWriter; 12 | 13 | /** 14 | * dom4j工具类 15 | * @author 阿荣 16 | * @since 2014-05-29 17 | */ 18 | public final class Dom4jUtil2 { 19 | public static boolean locked; 20 | public Dom4jUtil2(){} 21 | 22 | public static Document getDOM(File file) throws Exception{ 23 | return new SAXReader().read(file); 24 | } 25 | 26 | public static Document getDOM(String filePath) throws Exception{ 27 | return new SAXReader().read(new File(filePath)); 28 | } 29 | 30 | public static void createElement(Document doc, String ele){ 31 | doc.addElement(ele); 32 | } 33 | 34 | public static void appendElement(Element parent, Element ele){ 35 | parent.add(ele); 36 | } 37 | 38 | public static void deleteElement(Element parent, Element ele){ 39 | parent.remove(ele); 40 | } 41 | 42 | public static void writeDOM2XML(String file_path, Document doc) throws Exception{ 43 | FileUtil2.ifNotExistsThenCreate(file_path.substring(0, file_path.lastIndexOf("/"))); 44 | writeDOM2XML(new File(file_path), doc); 45 | } 46 | 47 | public static void writeDOM2XML(File file, Document doc) throws Exception{ 48 | OutputFormat format = OutputFormat.createPrettyPrint(); 49 | XMLWriter writer = new XMLWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"), format); 50 | writer.write(doc); 51 | writer.close(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/org/arong/util/EmojiFilter.java: -------------------------------------------------------------------------------- 1 | package org.arong.util; 2 | 3 | import org.apache.commons.lang.StringUtils; 4 | 5 | public class EmojiFilter { 6 | /** 7 | * 检测是否有emoji字符 8 | * @param source 9 | * @return 一旦含有就抛出 10 | */ 11 | public static boolean containsEmoji(String source) { 12 | if (StringUtils.isBlank(source)) { 13 | return false; 14 | } 15 | 16 | int len = source.length(); 17 | 18 | for (int i = 0; i < len; i++) { 19 | char codePoint = source.charAt(i); 20 | 21 | if (isEmojiCharacter(codePoint)) { 22 | //do nothing,判断到了这里表明,确认有表情字符 23 | return true; 24 | } 25 | } 26 | 27 | return false; 28 | } 29 | 30 | public static boolean isEmojiCharacter(char codePoint) { 31 | return (codePoint == 0x0) || 32 | (codePoint == 0x9) || 33 | (codePoint == 0xA) || 34 | (codePoint == 0xD) || 35 | ((codePoint >= 0x20) && (codePoint <= 0xD7FF)) || 36 | ((codePoint >= 0xE000) && (codePoint <= 0xFFFD)) || 37 | ((codePoint >= 0x10000) && (codePoint <= 0x10FFFF)); 38 | } 39 | 40 | public static final String[] filterChars = {"\\\\ud83e\\\\udddb\\\\u200d\\\\u2640\\\\ufe0f", 41 | "\\\\ud83e\\\\udddf\\\\u200d\\\\u2640\\\\ufe0f", "\\\\u26be\\\\ud83d\\\\udc08", 42 | "\\\\ud83d\\\\udc7b", "\\\\ud83e\\\\udd16", "\\\\ud83d\\\\udc3b", "\\\\ud83d\\\\udc7d", 43 | "\\\\ud83d\\\\udc2a", "\\\\ud83d\\\\udc08", "\\\\ud83d\\\\udc04", "\\\\ud83e\\\\udd80", 44 | "\\\\ud83e\\\\udd95", "\\\\ud83d\\\\udc29", "\\\\ud83d\\\\udc2c", "\\\\ud83d\\\\udc09", 45 | "\\\\ud83d\\\\udc18", "\\\\ud83d\\\\udc1f", "\\\\ud83d\\\\udc51", "\\\\ud83d\\\\udc53", 46 | "\\\\ud83d\\\\udc8b", "\\\\ud83d\\\\udc8f", "\\\\ud83d\\\\udeac", "\\\\ud83d\\\\udcaa", 47 | "\\\\ud83d\\\\udc59", "\\\\ud83e\\\\udd36", "\\\\ud83d\\\\udc58", "\\\\ud83d\\\\udca9", 48 | "\\\\u270f\\\\ufe0f", "\\\\ud83d\\\\udc6a", "\\\\ud83c\\\\udf20", "\\\\ud83d\\\\udcd6", 49 | "\\\\ud83d\\\\udd2a", "\\\\ud83c\\\\udfc0", "\\\\ud83c\\\\udfae", "\\\\ud83c\\\\udf74", 50 | "\\\\u26a2"/*, "\\\\u270f", "\\\\u2744", "\\\\u2200", "\\\\u2764", 51 | "\\\\u2642"*/, "\\\\u26e9", "\\\\ufe0f"}; 52 | 53 | /** 54 | * 过滤emoji 或者 其他非文字类型的字符 55 | * @param source 56 | * @return 57 | */ 58 | public static String filterEmoji(String source) { 59 | if(StringUtils.isBlank(source)){ 60 | return source; 61 | } 62 | 63 | String tmp = UnicodeUtil.stringToUnicode(source); 64 | for(String c : filterChars){ 65 | tmp = tmp.replaceAll(c, ""); 66 | } 67 | tmp = UnicodeUtil.unicodeToString(tmp); 68 | tmp = tmp.replaceAll("[\\ud800\\udc00-\\udbff\\udfff\\ud800-\\udfff]", "*"); 69 | if (!containsEmoji(tmp)) { 70 | return tmp;//如果不包含,直接返回 71 | } 72 | //到这里铁定包含 73 | StringBuilder buf = null; 74 | int len = tmp.length(); 75 | for (int i = 0; i < len; i++) { 76 | char codePoint = tmp.charAt(i); 77 | 78 | if (isEmojiCharacter(codePoint)) { 79 | if (buf == null) { 80 | buf = new StringBuilder(tmp.length()); 81 | } 82 | buf.append(codePoint); 83 | } else { 84 | buf.append("*"); 85 | } 86 | } 87 | 88 | if (buf == null) { 89 | return tmp;//如果没有找到 emoji表情,则返回源字符串 90 | } else { 91 | if (buf.length() == len) {//这里的意义在于尽可能少的toString,因为会重新生成字符串 92 | buf = null; 93 | return tmp; 94 | } else { 95 | return buf.toString(); 96 | } 97 | } 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /src/org/arong/util/NumberUtil.java: -------------------------------------------------------------------------------- 1 | package org.arong.util; 2 | /** 3 | * int整型工具类 4 | * @author arong 5 | * @since 1.0.5 6 | */ 7 | import java.util.regex.Pattern; 8 | 9 | public class NumberUtil { 10 | /** 11 | * 判断一个字符串是否可以转换成int 12 | * @param str 13 | * @return 14 | */ 15 | public static boolean can2Int(String str){ 16 | if(str == null || "".equals(str)) 17 | return false; 18 | if(str.startsWith("-")){ 19 | String str2 = str.substring(1, str.length()); 20 | return Pattern.matches("[0]||[1-9][0-9]{0,9}", str2) && Long.parseLong(str2) < Long.parseLong("2147483649"); 21 | } 22 | else 23 | return Pattern.matches("[0]||[1-9][0-9]{0,9}", str) && Long.parseLong(str) < Long.parseLong("2147483648"); 24 | } 25 | /** 26 | * 判断一个long是否可以转换成int 27 | * @param lon 28 | * @return 29 | */ 30 | public static boolean can2Int(long lon){ 31 | return lon < 2147483647 && lon > -2147483648; 32 | } 33 | /** 34 | * 判断一个字符串是否可以转换为long 35 | * @param str 36 | * @return 37 | */ 38 | public static boolean can2Long(String str){ 39 | if(str == null && "".equals(str)) 40 | return false; 41 | if(str.startsWith("-")){ 42 | String str2 = str.substring(1, str.length()); 43 | return Pattern.matches("[0]||[1-9][0-9]{0,18}", str2); 44 | } 45 | else 46 | return Pattern.matches("[0]||[1-9][0-9]{0,18}", str); 47 | } 48 | /** 49 | * 将一个字符串数组转换成int数组 50 | * @param strs 51 | * @return 52 | */ 53 | public static int[] parseInt(String[] strs){ 54 | int[] strs_int = new int[strs.length]; 55 | for (int i = 0; i < strs_int.length; i++) { 56 | if(can2Int(strs[i])){ 57 | strs_int[i] = Integer.parseInt(strs[i]); 58 | } 59 | } 60 | return strs_int; 61 | } 62 | /** 63 | * 把int数组转换成long数组 64 | * @param ints 65 | * @return 66 | */ 67 | public static long[] parseLong(int[] ints){ 68 | long[] longs = new long[ints.length]; 69 | for (int i = 0; i < longs.length; i++) { 70 | longs[i] = (long)ints[i]; 71 | } 72 | return longs; 73 | } 74 | /** 75 | * 把long数组转换成int数组 76 | * @param longs 77 | * @return 78 | */ 79 | public static int[] parseInt(long[] longs){ 80 | int[] strs_int = new int[longs.length]; 81 | for (int i = 0; i < strs_int.length; i++) { 82 | if(can2Int(longs[i])){ 83 | strs_int[i] = (int)longs[i]; 84 | } 85 | } 86 | return strs_int; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/org/arong/util/StringUtil.java: -------------------------------------------------------------------------------- 1 | package org.arong.util; 2 | 3 | 4 | public class StringUtil extends org.apache.commons.lang.StringUtils{ 5 | /** 6 | * 转义正则特殊字符 ($()*+.[]?\^{},|) 7 | * 8 | * @param keyword 9 | * @return 10 | */ 11 | public static String escapeExprSpecialWord(String keyword) { 12 | if (isNotBlank(keyword)) { 13 | String[] fbsArr = { "\\", "$", "(", ")", "*", "+", ".", "[", "]", "?", "^", "{", "}", "|" }; 14 | for (String key : fbsArr) { 15 | if (keyword.contains(key)) { 16 | keyword = keyword.replace(key, "\\" + key); 17 | } 18 | } 19 | } 20 | return keyword; 21 | } 22 | private static int compare(String str, String target) { 23 | int d[][]; // 矩阵 24 | int n = str.length(); 25 | int m = target.length(); 26 | int i; // 遍历str的 27 | int j; // 遍历target的 28 | char ch1; // str的 29 | char ch2; // target的 30 | int temp; // 记录相同字符,在某个矩阵位置值的增量,不是0就是1 31 | 32 | if (n == 0) { 33 | return m; 34 | } 35 | 36 | if (m == 0) { 37 | return n; 38 | } 39 | 40 | d = new int[n + 1][m + 1]; 41 | 42 | for (i = 0; i <= n; i++) { // 初始化第一列 43 | d[i][0] = i; 44 | } 45 | 46 | for (j = 0; j <= m; j++) { // 初始化第一行 47 | d[0][j] = j; 48 | } 49 | 50 | for (i = 1; i <= n; i++) { // 遍历str 51 | ch1 = str.charAt(i - 1); 52 | // 去匹配target 53 | for (j = 1; j <= m; j++) { 54 | ch2 = target.charAt(j - 1); 55 | if (ch1 == ch2) { 56 | temp = 0; 57 | } else { 58 | temp = 1; 59 | } 60 | 61 | // 左边+1,上边+1, 左上角+temp取最小 62 | d[i][j] = min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + temp); 63 | } 64 | } 65 | 66 | return d[n][m]; 67 | } 68 | 69 | private static int min(int one, int two, int three) { 70 | return (one = one < two ? one : two) < three ? one : three; 71 | } 72 | 73 | /** 74 | * 获取两字符串的相似度 75 | * 76 | * @param str 77 | * @param target 78 | * 79 | * @return 80 | */ 81 | 82 | public static float getSimilarityRatio(String str, String target) { 83 | return 1 - (float) compare(str, target) / Math.max(str.length(), target.length()); 84 | 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/org/arong/util/Tracker.java: -------------------------------------------------------------------------------- 1 | package org.arong.util; 2 | 3 | /** 4 | * 控制台追踪 5 | * @author 阿荣 6 | * @since 2014-05-27 7 | */ 8 | public final class Tracker { 9 | public static void println(Class clazz, String message){ 10 | System.out.println(clazz.getSimpleName() + "-" + message); 11 | } 12 | public static void println(String message){ 13 | System.out.println(message); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/org/arong/util/UnicodeUtil.java: -------------------------------------------------------------------------------- 1 | package org.arong.util; 2 | 3 | public class UnicodeUtil { 4 | //字符串转换unicode 5 | public static String stringToUnicode(String string) { 6 | StringBuffer unicode = new StringBuffer(); 7 | String u = null; 8 | for (int i = 0; i < string.length(); i++) { 9 | char c = string.charAt(i); // 取出每一个字符 10 | u = Integer.toHexString(c); 11 | if (u.length() <= 2) { 12 | u = "00" + u; 13 | } 14 | unicode.append("\\u" + u);// 转换为unicode 15 | } 16 | return unicode.toString(); 17 | } 18 | //unicode 转字符串 19 | public static String unicodeToString(String unicode) { 20 | StringBuffer string = new StringBuffer(); 21 | String[] hex = unicode.split("\\\\u"); 22 | for (int i = 1; i < hex.length; i++) { 23 | int data = Integer.parseInt(hex[i], 16);// 转换出每一个代码点 24 | string.append((char) data);// 追加成string 25 | } 26 | return string.toString(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/org/arong/util/https/HttpsUtils.java: -------------------------------------------------------------------------------- 1 | package org.arong.util.https; 2 | 3 | import java.io.IOException; 4 | import java.net.HttpURLConnection; 5 | import java.net.MalformedURLException; 6 | import java.net.Proxy; 7 | import java.net.URL; 8 | import java.security.KeyManagementException; 9 | import java.security.NoSuchAlgorithmException; 10 | 11 | import javax.net.ssl.HttpsURLConnection; 12 | import javax.net.ssl.SSLContext; 13 | import javax.net.ssl.SSLSocketFactory; 14 | import javax.net.ssl.TrustManager; 15 | 16 | public class HttpsUtils { 17 | 18 | public static HttpURLConnection getConnection(String urlStr, Proxy proxy) throws MalformedURLException, IOException, KeyManagementException, NoSuchAlgorithmException { 19 | HttpURLConnection conn = null; 20 | if (urlStr.toLowerCase().startsWith("https")) 21 | conn = getHttpsConnection(urlStr, proxy); 22 | else 23 | conn = getHttpConnection(urlStr, proxy); 24 | return conn; 25 | } 26 | private static HttpURLConnection getHttpConnection(String urlStr, Proxy proxy) throws MalformedURLException, IOException { 27 | URL url = new URL(urlStr); 28 | System.out.println(urlStr + ",proxy:" + proxy); 29 | HttpURLConnection conn = null; 30 | if(proxy != null){ 31 | conn = (HttpURLConnection) url.openConnection(proxy); 32 | }else{ 33 | conn = (HttpURLConnection) url.openConnection(); 34 | } 35 | return conn; 36 | } 37 | 38 | private static HttpsURLConnection getHttpsConnection(String urlStr, Proxy proxy) throws IOException { 39 | URL url = new URL(urlStr); 40 | System.out.println(urlStr + ",proxy:" + proxy); 41 | System.setProperty("https.protocols", "TLSv1.2,TLSv1.1,TLSv1,SSLv3"); 42 | System.setProperty("jsse.enableSNIExtension", proxy == null ? "false" : "true"); 43 | HttpsURLConnection conn = null; 44 | if(proxy != null){ 45 | conn = (HttpsURLConnection) url.openConnection(proxy); 46 | }else{ 47 | conn = (HttpsURLConnection) url.openConnection(); 48 | } 49 | /*try { 50 | SslUtils.ignoreSsl(); 51 | } catch (Exception e) { 52 | e.printStackTrace(); 53 | }*/ 54 | try{ 55 | // 不验证服务器主机名和证书 56 | conn.setHostnameVerifier(new IgnoreHostnameVerifier()); 57 | TrustManager[] tm = { new X509TrustManager4None() }; 58 | SSLContext sslContext = SSLContext.getInstance("TLS"); 59 | sslContext.init(null, tm, new java.security.SecureRandom()); 60 | 61 | SSLSocketFactory ssf = sslContext.getSocketFactory(); 62 | /*for(String cs : ssf.getSupportedCipherSuites()){ 63 | System.out.println(cs); 64 | }*/ 65 | 66 | conn.setSSLSocketFactory(ssf); 67 | }catch (Exception e){ 68 | System.out.println("java版本:" + System.getProperty("java.version") + ",当前版本无法支持Https协议,建议使用JDK(JRE)1.7及以上版本:" + e.getMessage()); 69 | e.printStackTrace(); 70 | } 71 | return conn; 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /src/org/arong/util/https/IgnoreHostnameVerifier.java: -------------------------------------------------------------------------------- 1 | package org.arong.util.https; 2 | 3 | import javax.net.ssl.HostnameVerifier; 4 | import javax.net.ssl.SSLSession; 5 | 6 | public class IgnoreHostnameVerifier implements HostnameVerifier { 7 | 8 | @Override 9 | public boolean verify(String arg0, SSLSession arg1) { 10 | // TODO Auto-generated method stub 11 | return true; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/org/arong/util/https/MyX509TrustManager.java: -------------------------------------------------------------------------------- 1 | package org.arong.util.https; 2 | 3 | import java.io.FileInputStream; 4 | import java.io.FileNotFoundException; 5 | import java.io.IOException; 6 | import java.security.KeyStore; 7 | import java.security.KeyStoreException; 8 | import java.security.NoSuchAlgorithmException; 9 | import java.security.NoSuchProviderException; 10 | import java.security.cert.CertificateException; 11 | import java.security.cert.X509Certificate; 12 | 13 | import javax.net.ssl.TrustManager; 14 | import javax.net.ssl.TrustManagerFactory; 15 | import javax.net.ssl.X509TrustManager; 16 | 17 | public class MyX509TrustManager implements X509TrustManager{ 18 | /* 19 | * The default X509TrustManager returned by SunX509. We'll delegate 20 | * decisions to it, and fall back to the logic in this class if the 21 | * default X509TrustManager doesn't trust it. 22 | */ 23 | X509TrustManager sunJSSEX509TrustManager; 24 | MyX509TrustManager() throws NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException, KeyStoreException, NoSuchProviderException { 25 | // create a "default" JSSE X509TrustManager. 26 | KeyStore ks = KeyStore.getInstance("JKS"); 27 | ks.load(new FileInputStream("cacerts"), 28 | "passphrase".toCharArray()); 29 | TrustManagerFactory tmf = 30 | TrustManagerFactory.getInstance("SunX509", "SunJSSE"); 31 | tmf.init(ks); 32 | TrustManager tms [] = tmf.getTrustManagers(); 33 | /* 34 | * Iterate over the returned trustmanagers, look 35 | * for an instance of X509TrustManager. If found, 36 | * use that as our "default" trust manager. 37 | */ 38 | for (int i = 0; i < tms.length; i++) { 39 | if (tms[i] instanceof X509TrustManager) { 40 | sunJSSEX509TrustManager = (X509TrustManager) tms[i]; 41 | return; 42 | } 43 | } 44 | /* 45 | * Find some other way to initialize, or else we have to fail the 46 | * constructor. 47 | */ 48 | //throw new Exception("Couldn't initialize"); 49 | } 50 | /* 51 | * Delegate to the default trust manager. 52 | */ 53 | public void checkClientTrusted(X509Certificate[] chain, String authType) 54 | throws CertificateException { 55 | try { 56 | sunJSSEX509TrustManager.checkClientTrusted(chain, authType); 57 | } catch (CertificateException excep) { 58 | // do any special handling here, or rethrow exception. 59 | } 60 | } 61 | /* 62 | * Delegate to the default trust manager. 63 | */ 64 | public void checkServerTrusted(X509Certificate[] chain, String authType) 65 | throws CertificateException { 66 | try { 67 | sunJSSEX509TrustManager.checkServerTrusted(chain, authType); 68 | } catch (CertificateException excep) { 69 | /* 70 | * Possibly pop up a dialog box asking whether to trust the 71 | * cert chain. 72 | */ 73 | } 74 | } 75 | /* 76 | * Merely pass this through. 77 | */ 78 | public X509Certificate[] getAcceptedIssuers() { 79 | return sunJSSEX509TrustManager.getAcceptedIssuers(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/org/arong/util/https/SslUtils.java: -------------------------------------------------------------------------------- 1 | package org.arong.util.https; 2 | 3 | import java.security.cert.CertificateException; 4 | import java.security.cert.X509Certificate; 5 | 6 | import javax.net.ssl.HostnameVerifier; 7 | import javax.net.ssl.HttpsURLConnection; 8 | import javax.net.ssl.SSLContext; 9 | import javax.net.ssl.SSLSession; 10 | import javax.net.ssl.TrustManager; 11 | import javax.net.ssl.X509TrustManager; 12 | 13 | public class SslUtils { 14 | 15 | private static void trustAllHttpsCertificates() throws Exception { 16 | TrustManager[] trustAllCerts = new TrustManager[1]; 17 | TrustManager tm = new miTM(); 18 | trustAllCerts[0] = tm; 19 | SSLContext sc = SSLContext.getInstance("SSL"); 20 | sc.init(null, trustAllCerts, null); 21 | HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); 22 | } 23 | 24 | static class miTM implements TrustManager,X509TrustManager { 25 | public X509Certificate[] getAcceptedIssuers() { 26 | return null; 27 | } 28 | 29 | public boolean isServerTrusted(X509Certificate[] certs) { 30 | return true; 31 | } 32 | 33 | public boolean isClientTrusted(X509Certificate[] certs) { 34 | return true; 35 | } 36 | 37 | public void checkServerTrusted(X509Certificate[] certs, String authType) 38 | throws CertificateException { 39 | return; 40 | } 41 | 42 | public void checkClientTrusted(X509Certificate[] certs, String authType) 43 | throws CertificateException { 44 | return; 45 | } 46 | } 47 | 48 | /** 49 | * 忽略HTTPS请求的SSL证书,必须在openConnection之前调用 50 | * @throws Exception 51 | */ 52 | public static void ignoreSsl() throws Exception{ 53 | HostnameVerifier hv = new HostnameVerifier() { 54 | public boolean verify(String urlHostName, SSLSession session) { 55 | return true; 56 | } 57 | }; 58 | trustAllHttpsCertificates(); 59 | HttpsURLConnection.setDefaultHostnameVerifier(hv); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/org/arong/util/https/X509TrustManager4None.java: -------------------------------------------------------------------------------- 1 | package org.arong.util.https; 2 | 3 | import java.security.cert.CertificateException; 4 | import java.security.cert.X509Certificate; 5 | 6 | import javax.net.ssl.X509TrustManager; 7 | 8 | public class X509TrustManager4None implements X509TrustManager { 9 | 10 | private X509Certificate[] certificates; 11 | 12 | 13 | public void checkClientTrusted(X509Certificate[] chain, String authType) 14 | throws CertificateException { 15 | if (this.certificates == null) { 16 | this.certificates = chain; 17 | } 18 | } 19 | /* 20 | * Delegate to the default trust manager. 21 | */ 22 | public void checkServerTrusted(X509Certificate[] chain, String authType) 23 | throws CertificateException { 24 | if (this.certificates == null) { 25 | this.certificates = chain; 26 | } 27 | } 28 | 29 | public X509Certificate[] getAcceptedIssuers() { 30 | return null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/org/arong/util/jdbc/JdbcSqlExecutor.java: -------------------------------------------------------------------------------- 1 | package org.arong.util.jdbc; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.sql.Statement; 8 | /** 9 | * 减少jdbc执行产生的代码量 10 | */ 11 | public class JdbcSqlExecutor { 12 | private static JdbcSqlExecutor executor = null; 13 | private JdbcSqlExecutor(){} 14 | public final static String BAT_SPLIT = "@<;>@"; 15 | public static JdbcSqlExecutor getInstance(){ 16 | if(executor == null){ 17 | executor = new JdbcSqlExecutor(); 18 | } 19 | return executor; 20 | } 21 | public T executeQuery(String sql, Connection conn, CallBack callback) throws SQLException{ 22 | 23 | PreparedStatement pst = null; 24 | ResultSet rs = null; 25 | try { 26 | pst = conn.prepareStatement(sql); 27 | rs = pst.executeQuery(); 28 | return callback.action(rs); 29 | 30 | } catch (SQLException e) { 31 | throw e; 32 | } finally{ 33 | if(conn != null){ 34 | try { 35 | conn.close(); 36 | } catch (SQLException e) { 37 | e.printStackTrace(); 38 | } 39 | } 40 | if(pst != null){ 41 | try { 42 | pst.close(); 43 | } catch (SQLException e) { 44 | e.printStackTrace(); 45 | } 46 | } 47 | if(rs != null){ 48 | try { 49 | rs.close(); 50 | } catch (SQLException e) { 51 | e.printStackTrace(); 52 | } 53 | } 54 | } 55 | } 56 | 57 | public int executeUpdate(String sql, Connection conn) throws SQLException{ 58 | return executeUpdate(sql, false, conn); 59 | } 60 | 61 | public int executeUpdate(String sql, boolean batUpdate, Connection conn) throws SQLException{ 62 | 63 | PreparedStatement pst = null; 64 | Statement st = null; 65 | ResultSet rs = null; 66 | int result = 0; 67 | try { 68 | if(batUpdate){ 69 | st = conn.createStatement(); 70 | String[] sqls = sql.split(BAT_SPLIT); 71 | for(int i = 0; i < sqls.length; i ++){ 72 | st.addBatch(sqls[i]); 73 | } 74 | result = st.executeBatch()[0]; 75 | }else{ 76 | pst = conn.prepareStatement(sql.replaceAll(BAT_SPLIT, "")); 77 | result = pst.executeUpdate(); 78 | } 79 | return result; 80 | } catch (SQLException e) { 81 | throw e; 82 | } finally{ 83 | if(conn != null){ 84 | try { 85 | conn.close(); 86 | } catch (SQLException e) { 87 | e.printStackTrace(); 88 | } 89 | } 90 | if(pst != null){ 91 | try { 92 | pst.close(); 93 | } catch (SQLException e) { 94 | e.printStackTrace(); 95 | } 96 | } 97 | if(st != null){ 98 | try { 99 | st.close(); 100 | } catch (SQLException e) { 101 | e.printStackTrace(); 102 | } 103 | } 104 | if(rs != null){ 105 | try { 106 | rs.close(); 107 | } catch (SQLException e) { 108 | e.printStackTrace(); 109 | } 110 | } 111 | } 112 | } 113 | 114 | public interface CallBack{ 115 | T action(ResultSet rs) throws SQLException; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/resources/count.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
任 务任务个数:%s历史总数:%s已完成:%s未完成:%s
图 片图片个数:%s历史总数:%s已下载:%s未下载:%s
完成率任务:%s%图片:%s%
资 源总大小:%s已下载大小:%s
标 签标签库总数:%s任务覆盖数:%s
时 间最后创建时间:%s最后下载时间:%s
37 | -------------------------------------------------------------------------------- /src/resources/icon/1_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_add.png -------------------------------------------------------------------------------- /src/resources/icon/1_browse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_browse.png -------------------------------------------------------------------------------- /src/resources/icon/1_change.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_change.png -------------------------------------------------------------------------------- /src/resources/icon/1_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_check.png -------------------------------------------------------------------------------- /src/resources/icon/1_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_clear.png -------------------------------------------------------------------------------- /src/resources/icon/1_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_copy.png -------------------------------------------------------------------------------- /src/resources/icon/1_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_count.png -------------------------------------------------------------------------------- /src/resources/icon/1_cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_cut.png -------------------------------------------------------------------------------- /src/resources/icon/1_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_delete.png -------------------------------------------------------------------------------- /src/resources/icon/1_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_detail.png -------------------------------------------------------------------------------- /src/resources/icon/1_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_download.png -------------------------------------------------------------------------------- /src/resources/icon/1_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_folder.png -------------------------------------------------------------------------------- /src/resources/icon/1_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_group.png -------------------------------------------------------------------------------- /src/resources/icon/1_ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_ok.png -------------------------------------------------------------------------------- /src/resources/icon/1_openpic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_openpic.png -------------------------------------------------------------------------------- /src/resources/icon/1_opera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_opera.png -------------------------------------------------------------------------------- /src/resources/icon/1_paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_paste.png -------------------------------------------------------------------------------- /src/resources/icon/1_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_picture.png -------------------------------------------------------------------------------- /src/resources/icon/1_reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_reset.png -------------------------------------------------------------------------------- /src/resources/icon/1_save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_save.png -------------------------------------------------------------------------------- /src/resources/icon/1_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_select.png -------------------------------------------------------------------------------- /src/resources/icon/1_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_setting.png -------------------------------------------------------------------------------- /src/resources/icon/1_size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_size.png -------------------------------------------------------------------------------- /src/resources/icon/1_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_start.png -------------------------------------------------------------------------------- /src/resources/icon/1_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_stop.png -------------------------------------------------------------------------------- /src/resources/icon/1_task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_task.png -------------------------------------------------------------------------------- /src/resources/icon/1_tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_tool.png -------------------------------------------------------------------------------- /src/resources/icon/1_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_user.png -------------------------------------------------------------------------------- /src/resources/icon/1_zip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/1_zip.png -------------------------------------------------------------------------------- /src/resources/icon/2_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_add.png -------------------------------------------------------------------------------- /src/resources/icon/2_browse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_browse.png -------------------------------------------------------------------------------- /src/resources/icon/2_change.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_change.png -------------------------------------------------------------------------------- /src/resources/icon/2_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_check.png -------------------------------------------------------------------------------- /src/resources/icon/2_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_clear.png -------------------------------------------------------------------------------- /src/resources/icon/2_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_copy.png -------------------------------------------------------------------------------- /src/resources/icon/2_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_count.png -------------------------------------------------------------------------------- /src/resources/icon/2_cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_cut.png -------------------------------------------------------------------------------- /src/resources/icon/2_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_delete.png -------------------------------------------------------------------------------- /src/resources/icon/2_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_detail.png -------------------------------------------------------------------------------- /src/resources/icon/2_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_download.png -------------------------------------------------------------------------------- /src/resources/icon/2_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_folder.png -------------------------------------------------------------------------------- /src/resources/icon/2_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_group.png -------------------------------------------------------------------------------- /src/resources/icon/2_ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_ok.png -------------------------------------------------------------------------------- /src/resources/icon/2_openpic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_openpic.png -------------------------------------------------------------------------------- /src/resources/icon/2_opera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_opera.png -------------------------------------------------------------------------------- /src/resources/icon/2_paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_paste.png -------------------------------------------------------------------------------- /src/resources/icon/2_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_picture.png -------------------------------------------------------------------------------- /src/resources/icon/2_reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_reset.png -------------------------------------------------------------------------------- /src/resources/icon/2_save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_save.png -------------------------------------------------------------------------------- /src/resources/icon/2_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_select.png -------------------------------------------------------------------------------- /src/resources/icon/2_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_setting.png -------------------------------------------------------------------------------- /src/resources/icon/2_size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_size.png -------------------------------------------------------------------------------- /src/resources/icon/2_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_start.png -------------------------------------------------------------------------------- /src/resources/icon/2_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_stop.png -------------------------------------------------------------------------------- /src/resources/icon/2_task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_task.png -------------------------------------------------------------------------------- /src/resources/icon/2_tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_tool.png -------------------------------------------------------------------------------- /src/resources/icon/2_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_user.png -------------------------------------------------------------------------------- /src/resources/icon/2_zip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/2_zip.png -------------------------------------------------------------------------------- /src/resources/icon/ARTISTCG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/ARTISTCG.png -------------------------------------------------------------------------------- /src/resources/icon/ASIANPORN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/ASIANPORN.png -------------------------------------------------------------------------------- /src/resources/icon/COSPLAY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/COSPLAY.png -------------------------------------------------------------------------------- /src/resources/icon/DOUJINSHI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/DOUJINSHI.png -------------------------------------------------------------------------------- /src/resources/icon/GAMECG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/GAMECG.png -------------------------------------------------------------------------------- /src/resources/icon/IMAGESET.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/IMAGESET.png -------------------------------------------------------------------------------- /src/resources/icon/MANGA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/MANGA.png -------------------------------------------------------------------------------- /src/resources/icon/MISC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/MISC.png -------------------------------------------------------------------------------- /src/resources/icon/NON-H.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/NON-H.png -------------------------------------------------------------------------------- /src/resources/icon/WESTERN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/WESTERN.png -------------------------------------------------------------------------------- /src/resources/icon/eh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/eh.png -------------------------------------------------------------------------------- /src/resources/icon/fail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/fail.png -------------------------------------------------------------------------------- /src/resources/icon/init.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/init.jpg -------------------------------------------------------------------------------- /src/resources/icon/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/left.png -------------------------------------------------------------------------------- /src/resources/icon/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/loading.gif -------------------------------------------------------------------------------- /src/resources/icon/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/right.png -------------------------------------------------------------------------------- /src/resources/icon/t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/src/resources/icon/t.png -------------------------------------------------------------------------------- /src/resources/taskinfo.html: -------------------------------------------------------------------------------- 1 |
2 | 名称%s
3 | 子标题%s
4 | 漫画地址%s         5 | 封面地址%s
6 | 语言%s         7 | 数目%s         8 | 大小%s         9 | 类别%s         10 | 上传者%s         11 | 发布时间%s
12 | 状态%s         13 | 已下载数目%s         14 | 已下载大小%s(%s/P)         15 | 完成率%s         16 | 创建时间%s         17 | 同步时间%s         18 | 完成时间%s
19 | 开始索引%s         20 | 结束索引%s         21 | 是否已读%s         22 | 是否下载原图%s         23 | 以子名称作为保存目录%s         24 | 本地标签%s
25 | 任务组%s         26 | 保存目录%s
27 | %s 28 |
29 | -------------------------------------------------------------------------------- /ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipoo/egdownloader/f581c95407a8c295a474e06b112c9923b07c2625/ui.png --------------------------------------------------------------------------------