Methods Summary |
---|
private static void | addAzStyle(java.lang.String id, java.lang.String client)
// Used to register client information.
addAzStyle(id, client, VER_AZ_FOUR_DIGITS);
|
private static void | addAzStyle(java.lang.String id, java.lang.String client, java.lang.String version_style)
if (id.length() != 2) {throw new RuntimeException("not two chars long - " + id);}
az_style_code_map.put(id, client);
az_client_version_map.put(client, version_style);
|
private static void | addMainlineStyle(char id, java.lang.String client)
mainline_style_code_map.put("" + id, client);
|
private static void | addShadowStyle(char id, java.lang.String client)
addShadowStyle(id, client, VER_AZ_THREE_DIGITS);
|
private static void | addShadowStyle(char id, java.lang.String client, java.lang.String version_style)
shadow_style_code_map.put("" + id, client);
shadow_client_version_map.put(client, version_style);
|
private static com.aelitis.azureus.core.peermanager.utils.BTPeerIDByteDecoderDefinitions$ClientData | addSimpleClient(java.lang.String client_name, java.lang.String identifier)
return addSimpleClient(client_name, identifier, 0);
|
private static com.aelitis.azureus.core.peermanager.utils.BTPeerIDByteDecoderDefinitions$ClientData | addSimpleClient(java.lang.String client_name, java.lang.String identifier, int position)
ClientData result = new ClientData(client_name, identifier, position);
custom_style_client_list.add(result);
return result;
|
private static void | addVersionedClient(com.aelitis.azureus.core.peermanager.utils.BTPeerIDByteDecoderDefinitions$ClientData client, java.lang.String version_type, int length, int version_pos)
addVersionedClient(client, version_type, length, null, version_pos);
|
private static void | addVersionedClient(com.aelitis.azureus.core.peermanager.utils.BTPeerIDByteDecoderDefinitions$ClientData client, java.lang.String version_type, int length, java.lang.String format, int version_pos)
client.version_data = new VersionNumberData(version_type, length, format, version_pos);
|
private static void | addVersionedClient(com.aelitis.azureus.core.peermanager.utils.BTPeerIDByteDecoderDefinitions$ClientData client, java.lang.String version_type, int length)
addVersionedClient(client, version_type, length, null);
|
private static void | addVersionedClient(com.aelitis.azureus.core.peermanager.utils.BTPeerIDByteDecoderDefinitions$ClientData client, java.lang.String version_type, int length, java.lang.String format)
addVersionedClient(client, version_type, length, format, client.simple_string.length() + client.simple_string_pos);
|
public static java.lang.String | formatUnknownAzStyleClient(java.lang.String peer_id)
String version_string = peer_id.substring(3, 7);
try {
version_string = BTPeerIDByteDecoderUtils.decodeAzStyleVersionNumber(
version_string, VER_AZ_FOUR_DIGITS);
}
catch (Exception e) {/* Just use the unformatted string */}
return MessageText.getString("PeerSocket.unknown_az_style", new String[] {
peer_id.substring(1, 3), version_string
});
|
public static java.lang.String | formatUnknownShadowStyleClient(java.lang.String peer_id)
String version_string = BTPeerIDByteDecoderUtils.getShadowStyleVersionNumber(peer_id);
return MessageText.getString("PeerSocket.unknown_shadow_style", new String[] {
peer_id.substring(0, 1), version_string
});
|
public static java.lang.String | getAzStyleClientName(java.lang.String peer_id)
return (String)az_style_code_map.get(peer_id.substring(1, 3));
|
public static java.lang.String | getAzStyleClientVersion(java.lang.String client_name, java.lang.String peer_id)
String version_scheme = (String)az_client_version_map.get(client_name);
if (version_scheme == NO_VERSION) {return null;}
try {
return client_name + " " + BTPeerIDByteDecoderUtils.decodeAzStyleVersionNumber(
peer_id.substring(3, 7), version_scheme
);
}
catch (Exception e) {
BTPeerIDByteDecoder.logUnknownClient(peer_id);
return null;
}
|
public static java.lang.String | getMainlineStyleClientName(java.lang.String peer_id)
return (String)mainline_style_code_map.get(peer_id.substring(0, 1));
|
public static java.lang.String | getShadowStyleClientName(java.lang.String peer_id)
return (String)shadow_style_code_map.get(peer_id.substring(0, 1));
|
public static com.aelitis.azureus.core.peermanager.utils.BTPeerIDByteDecoderDefinitions$ClientData | getSubstringStyleClient(java.lang.String peer_id)
ClientData cd = null;
for (int i=0; i<custom_style_client_list.size(); i++) {
cd = (ClientData)custom_style_client_list.get(i);
if (peer_id.startsWith(cd.simple_string, cd.simple_string_pos)) {
return cd;
}
}
return null;
|
public static java.lang.String | getSubstringStyleClientVersion(com.aelitis.azureus.core.peermanager.utils.BTPeerIDByteDecoderDefinitions$ClientData client_data, java.lang.String peer_id, byte[] peer_id_bytes)
VersionNumberData verdata = client_data.version_data;
if (verdata == null) {return null;}
String version_scheme = verdata.type;
String version_string = null;
try {
if (version_scheme == VER_TWO_BYTE_THREE_PART) {
int start_byte_index = verdata.pos;
version_string = BTPeerIDByteDecoderUtils.getTwoByteThreePartVersion(peer_id_bytes[start_byte_index], peer_id_bytes[start_byte_index+1]);
}
else if (version_scheme == VER_BLOCK && verdata.length == -1) {
version_string = BTPeerIDByteDecoderUtils.extractReadableVersionSubstringFromPeerID(peer_id.substring(verdata.pos, peer_id.length()));
}
else {
version_string = BTPeerIDByteDecoderUtils.decodeCustomVersionNumber(
peer_id.substring(verdata.pos, verdata.pos + verdata.length), version_scheme
);
}
if (verdata.fmt == null) {return client_data.client_name + " " + version_string;}
else {return client_data.client_name + verdata.fmt.replaceFirst("%s", version_string);}
}
catch (Exception e) {
BTPeerIDByteDecoder.logUnknownClient(peer_id);
return null;
}
|