From d850ae95befbda302b7050ffbadd369d2e0e0a73 Mon Sep 17 00:00:00 2001 From: olivier Date: Fri, 24 Oct 2025 16:44:31 -0700 Subject: [PATCH] =?UTF-8?q?Supprimer=20le=20code=20inutilis=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/common/Device.java | 58 +++++++------------------------- 1 file changed, 13 insertions(+), 45 deletions(-) diff --git a/src/main/java/common/Device.java b/src/main/java/common/Device.java index 4e73718..e867056 100644 --- a/src/main/java/common/Device.java +++ b/src/main/java/common/Device.java @@ -79,19 +79,19 @@ public class Device private Path deviceFile; private Path deviceKeyFile; - + protected byte[] deviceKey = new byte[DEVICE_KEY_SIZE]; protected String deviceClass; protected String deviceSerial; protected String deviceName; protected String deviceType = "standalone"; protected String fingerprint; - + private Map versions = new HashMap<>(); // Stores device properties protected final Logger LOGGER = Logger.getLogger( Device.class.getName() ); protected Device() {} - + /** * Main Device constructor. * @@ -265,7 +265,7 @@ public class Device try { InetAddress localHost = InetAddress.getLocalHost(); - + // Get the hostname from the InetAddress object deviceName = localHost.getHostName(); } @@ -332,38 +332,6 @@ public class Device } } - /* * - * Static method to create and manage a common.Device instance, handling file existence. - * - * @param dirName Directory where to put files (.adept) - * @param hobbesVersion Hobbes (client version) to set - * @param randomSerial Create a random serial (new device each time) or not (serial computed from machine specs) - * @return A new or existing common.Device instance. - * @throws DeviceException if directory creation or file operations fail. - * @ param processor Instance of DRMProcessor - */ -// public static Device createDevice( String dirName, String hobbesVersion, boolean randomSerial ) -// throws NoSuchAlgorithmException, UnknownHostException -// { -// // TODO: this can probably be moved to the device constructor, eliminating the need for -// // a factory method. -// Path dirPath = Paths.get( dirName ); -// if (!Files.exists( dirPath )) -// { -// try -// { -// Files.createDirectories( dirPath ); // mkdir_p equivalent -// } -// catch (IOException e) -// { -// throw new DeviceException( DeviceException.DEV_MKPATH, "Unable to create directory: " + dirName, e ); -// } -// } -// return new Device( dirPath.resolve( "device.xml" ), -// dirPath.resolve( "devicesalt" ), -// hobbesVersion, randomSerial ); -// } - /** * Returns the device key. * @@ -413,7 +381,7 @@ public class Device deviceName = deviceInfo.getElementsByTagName( "adept:deviceName" ).item( 0 ).getTextContent(); deviceType = deviceInfo.getElementsByTagName( "adept:deviceType" ).item( 0 ).getTextContent(); fingerprint = deviceInfo.getElementsByTagName( "adept:fingerprint" ).item( 0 ).getTextContent(); - + NodeList elements = deviceInfo.getElementsByTagName( "adept:version" ); for (int i = 0; i < elements.getLength(); i++) { @@ -472,42 +440,42 @@ public class Device { return versions.get( "clientLocale" ); } - + public String getClientOS() { return versions.get( "clientOS" ); } - + public String getHobbes() { return versions.get( "hobbes" ); } - + String getDeviceSerial() { return deviceSerial; } - + String getDeviceName() { return deviceName; } - + public String getFingerprint() { return fingerprint; } - + public String getDeviceType() { return deviceType; } - + public String getDeviceClass() { return deviceClass; } - + public void updateDeviceFiles( Path deviceFile, Path deviceKeyFile ) throws NoSuchAlgorithmException {