Package me.mabra.hellonzb.util

Source Code of me.mabra.hellonzb.util.ParserContentSaver

/*******************************************************************************
* HelloNzb -- The Binary Usenet Tool
* Copyright (C) 2010-2013 Matthias F. Brandstetter
* https://sourceforge.net/projects/hellonzb/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/

package me.mabra.hellonzb.util;

import me.mabra.hellonzb.HelloNzbCradle;
import me.mabra.hellonzb.HelloNzbToolkit;
import me.mabra.hellonzb.parser.DownloadFile;
import me.mabra.hellonzb.parser.NzbParser;

import java.io.File;
import java.util.List;



public class ParserContentSaver extends Thread
{
  private HelloNzbCradle mainApp;
  private List<NzbParser> parserList;
  private List<DownloadFile> first;
 
 
  public ParserContentSaver(HelloNzbCradle mainApp, List<NzbParser> parserList, List<DownloadFile> first)
  {
    this.mainApp = mainApp;
    this.parserList = parserList;
    this.first = first;
  }
 
  public void run()
  {
    boolean success = false;

    HelloNzbToolkit.emptyDir(new File(System.getProperty("user.home") + File.separator + ".HelloNzb" + File.separator));

    for(int i = 0; i < parserList.size(); i++)
    {
      NzbParser nzbFile = parserList.get(i);
      String nzbFileName = HelloNzbToolkit.getLastFilename(nzbFile.getName());
     
      if(i == 0)
        success = NzbParser.saveParserData(mainApp.getLogger(), i, nzbFileName, first);
      else
        success = NzbParser.saveParserData(mainApp.getLogger(), i, nzbFileName, nzbFile.getFiles());

/*      if(success == false)
      {
        String msg = localer.getBundleText("PopupCantSaveNzbFile");
        String title = localer.getBundleText("PopupErrorTitle");
        JOptionPane.showMessageDialog(mainApp.getJFrame(), msg, title, JOptionPane.ERROR_MESSAGE);
       
        return;
      }
*/    }
   
    mainApp.contentSaverDone();
  }
}








































 
TOP

Related Classes of me.mabra.hellonzb.util.ParserContentSaver

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.