// 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;
			String data = DatatypeConverter.printHexBinary(md.digest()).toLowerCase();
			dis.close();
			is.close();
			return data;
		}
		catch (NoSuchAlgorithmException | IOException e) {
			return "";
		}
	}
	
	public static double lastModificationTime(File directory_) {
		double max = 0.0;
		if (directory_.isDirectory()) {
			File[] list = directory_.listFiles();
			if (list != null) {
				for (File aFile : list) {
					double max1 = lastModificationTime(aFile);
					if (max1 > max) {
						max = max1;
					}
				}
			}
		}
		else if (directory_.isFile()) {
			return directory_.lastModified();
		}
		
		return max;
	}
	
// 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;

			String data = DatatypeConverter.printHexBinary(md.digest()).toLowerCase();
			dis.close();
			is.close();
			return data;
		}
		catch (NoSuchAlgorithmException | IOException e) {
			return "";
		}
	}
	
	public static double lastModificationTime(File directory_) {
		double max = 0.0;
		if (directory_.isDirectory()) {
			File[] list = directory_.listFiles();
			if (list != null) {
				for (File aFile : list) {
					double max1 = lastModificationTime(aFile);
					if (max1 > max) {
						max = max1;
					}
				}
			}
		}
		else if (directory_.isFile()) {
			return directory_.lastModified();
		}
		
		return max;
	}
	
	public static ServerCode statusIsOK(Document document_, String rootname_) {