// Path: src/com/sheepit/client/Error.java
// public enum ServerCode {
// 	OK(0),
// 	UNKNOWN(999),
// 		
// 	CONFIGURATION_ERROR_NO_CLIENT_VERSION_GIVEN(100),
// 	CONFIGURATION_ERROR_CLIENT_TOO_OLD(101),
// 	CONFIGURATION_ERROR_AUTH_FAILED(102),
// 	CONFIGURATION_ERROR_WEB_SESSION_EXPIRED(103),
// 	CONFIGURATION_ERROR_MISSING_PARAMETER(104),
// 		
// 	JOB_REQUEST_NOJOB(200),
// 	JOB_REQUEST_ERROR_NO_RENDERING_RIGHT(201),
// 	JOB_REQUEST_ERROR_DEAD_SESSION(202),
// 	JOB_REQUEST_ERROR_SESSION_DISABLED(203),
// 	JOB_REQUEST_ERROR_INTERNAL_ERROR(204),
// 	JOB_REQUEST_ERROR_RENDERER_NOT_AVAILABLE(205),
// 	JOB_REQUEST_SERVER_IN_MAINTENANCE(206),
// 	JOB_REQUEST_SERVER_OVERLOADED(207),
// 		
// 	JOB_VALIDATION_ERROR_MISSING_PARAMETER(300),
// 	JOB_VALIDATION_ERROR_BROKEN_MACHINE(301), // in GPU the generated frame is black
// 	JOB_VALIDATION_ERROR_FRAME_IS_NOT_IMAGE(302),
// 	JOB_VALIDATION_ERROR_UPLOAD_FAILED(303),
// 	JOB_VALIDATION_ERROR_SESSION_DISABLED(304), // missing heartbeat or broken machine
// 	JOB_VALIDATION_IMAGE_TOO_LARGE(306),
// 	JOB_VALIDATION_ERROR_IMAGE_WRONG_DIMENSION(308),
// 		
// 	KEEPMEALIVE_STOP_RENDERING(400),
// 		
// 	// internal error handling
// 	ERROR_NO_ROOT(2), ERROR_BAD_RESPONSE(3), ERROR_REQUEST_FAILED(5);
// 		
// 	private final int id;
// 		
// 	private ServerCode(int id) {
// 		this.id = id;
// 	}
// 		
// 	public int getValue() {
// 		return id;
// 	}
// 		
// 	public static ServerCode fromInt(int val) {
// 		ServerCode[] As = ServerCode.values();
// 		for (ServerCode A : As) {
// 			if (A.getValue() == val) {
// 				return A;
// 			}
// 		}
// 		return ServerCode.UNKNOWN;
// 	}
// }
// 
// Path: src/com/sheepit/client/exception/FermeExceptionNoSpaceLeftOnDevice.java
// public class FermeExceptionNoSpaceLeftOnDevice extends FermeException {
// 	public FermeExceptionNoSpaceLeftOnDevice() {
// 		super();
// 	}
// 	
// 	public FermeExceptionNoSpaceLeftOnDevice(String message_) {
// 		super(message_);
// 	}
// }


import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.bind.DatatypeConverter;
import net.lingala.zip4j.model.UnzipParameters;
import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import com.sheepit.client.Error.ServerCode;
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
/*
 * Copyright (C) 2010-2014 Laurent CLOUET
 * Author Laurent CLOUET <laurent.clouet@nopnop.net>
 *
 * 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; version 2
 * of the License.
 *
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package com.sheepit.client;






public class Utils {
	public static int unzipFileIntoDirectory(String zipFileName_, String destinationDirectory, String password, Log log)
// Path: src/com/sheepit/client/Error.java
// public enum ServerCode {
// 	OK(0),
// 	UNKNOWN(999),
// 		
// 	CONFIGURATION_ERROR_NO_CLIENT_VERSION_GIVEN(100),
// 	CONFIGURATION_ERROR_CLIENT_TOO_OLD(101),
// 	CONFIGURATION_ERROR_AUTH_FAILED(102),
// 	CONFIGURATION_ERROR_WEB_SESSION_EXPIRED(103),
// 	CONFIGURATION_ERROR_MISSING_PARAMETER(104),
// 		
// 	JOB_REQUEST_NOJOB(200),
// 	JOB_REQUEST_ERROR_NO_RENDERING_RIGHT(201),
// 	JOB_REQUEST_ERROR_DEAD_SESSION(202),
// 	JOB_REQUEST_ERROR_SESSION_DISABLED(203),
// 	JOB_REQUEST_ERROR_INTERNAL_ERROR(204),
// 	JOB_REQUEST_ERROR_RENDERER_NOT_AVAILABLE(205),
// 	JOB_REQUEST_SERVER_IN_MAINTENANCE(206),
// 	JOB_REQUEST_SERVER_OVERLOADED(207),
// 		
// 	JOB_VALIDATION_ERROR_MISSING_PARAMETER(300),
// 	JOB_VALIDATION_ERROR_BROKEN_MACHINE(301), // in GPU the generated frame is black
// 	JOB_VALIDATION_ERROR_FRAME_IS_NOT_IMAGE(302),
// 	JOB_VALIDATION_ERROR_UPLOAD_FAILED(303),
// 	JOB_VALIDATION_ERROR_SESSION_DISABLED(304), // missing heartbeat or broken machine
// 	JOB_VALIDATION_IMAGE_TOO_LARGE(306),
// 	JOB_VALIDATION_ERROR_IMAGE_WRONG_DIMENSION(308),
// 		
// 	KEEPMEALIVE_STOP_RENDERING(400),
// 		
// 	// internal error handling
// 	ERROR_NO_ROOT(2), ERROR_BAD_RESPONSE(3), ERROR_REQUEST_FAILED(5);
// 		
// 	private final int id;
// 		
// 	private ServerCode(int id) {
// 		this.id = id;
// 	}
// 		
// 	public int getValue() {
// 		return id;
// 	}
// 		
// 	public static ServerCode fromInt(int val) {
// 		ServerCode[] As = ServerCode.values();
// 		for (ServerCode A : As) {
// 			if (A.getValue() == val) {
// 				return A;
// 			}
// 		}
// 		return ServerCode.UNKNOWN;
// 	}
// }
// 
// Path: src/com/sheepit/client/exception/FermeExceptionNoSpaceLeftOnDevice.java
// public class FermeExceptionNoSpaceLeftOnDevice extends FermeException {
// 	public FermeExceptionNoSpaceLeftOnDevice() {
// 		super();
// 	}
// 	
// 	public FermeExceptionNoSpaceLeftOnDevice(String message_) {
// 		super(message_);
// 	}
// }


// Path: src/com/sheepit/client/Utils.java
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.bind.DatatypeConverter;
import net.lingala.zip4j.model.UnzipParameters;
import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import com.sheepit.client.Error.ServerCode;
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;

/*
 * Copyright (C) 2010-2014 Laurent CLOUET
 * Author Laurent CLOUET <laurent.clouet@nopnop.net>
 *
 * 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; version 2
 * of the License.
 *
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package com.sheepit.client;






public class Utils {
	public static int unzipFileIntoDirectory(String zipFileName_, String destinationDirectory, String password, Log log)
			throws FermeExceptionNoSpaceLeftOnDevice {