Refactor and fixed and images downloading and paths loading:

- Added new images and symbols downloading;
 - Fixed user defined images path (now work for all images: cards, symbols, temp downloading);
 - Fixed not working cancel button at download window (it close window, but tasks is working, download and didn't save);
 - Fixed temp files trash all around images folder (on cancel button);
 - Fixed not saving new downloaded cards on cancel button (zip file didn't close on cancel);
This commit is contained in:
Oleg Agafonov 2017-11-27 08:09:52 +04:00
parent efee0b5328
commit c29bac08d8
13 changed files with 303 additions and 215 deletions

View file

@ -29,13 +29,14 @@ import mage.view.PermanentView;
import net.xeoh.plugins.base.PluginManager;
import net.xeoh.plugins.base.impl.PluginManagerFactory;
import org.apache.log4j.Logger;
import org.mage.card.arcane.ManaSymbols;
import org.mage.plugins.card.CardPluginImpl;
import org.mage.plugins.theme.ThemePluginImpl;
import static org.mage.plugins.card.utils.CardImageUtils.getImagesDir;
public enum Plugins implements MagePlugins {
instance;
public static final String PLUGINS_DIRECTORY = File.separator + "plugins";
public static final String PLUGINS_DIRECTORY = "plugins";
private static final Logger LOGGER = Logger.getLogger(Plugins.class);
private static PluginManager pm;
@ -49,6 +50,7 @@ public enum Plugins implements MagePlugins {
@Override
public void loadPlugins() {
LOGGER.info("Loading plugins...");
pm = PluginManagerFactory.createPluginManager();
pm.addPluginsFrom(new File(PLUGINS_DIRECTORY + File.separator).toURI());
@ -132,9 +134,8 @@ public enum Plugins implements MagePlugins {
@Override
public void downloadSymbols() {
String path = ManaSymbols.getImagesDir() + File.separator;
if (this.cardPlugin != null) {
this.cardPlugin.downloadSymbols(path);
this.cardPlugin.downloadSymbols(getImagesDir());
}
}