📄 aewin32accessimpl.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: AEWin32AccessImpl.java
package org.gudy.azureus2.platform.win32.access.impl;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
import org.gudy.azureus2.core3.util.Constants;
import org.gudy.azureus2.platform.PlatformManagerPingCallback;
import org.gudy.azureus2.platform.win32.access.*;
// Referenced classes of package org.gudy.azureus2.platform.win32.access.impl:
// AEWin32AccessCallback, AEWin32AccessInterface
public class AEWin32AccessImpl
implements AEWin32Access, AEWin32AccessCallback
{
protected class traceRouteCallback
implements AEWin32AccessCallback
{
private boolean ping_mode;
private PlatformManagerPingCallback cb;
final AEWin32AccessImpl this$0;
public long windowsMessage(int msg, int param1, long param2)
{
return 0L;
}
public long generalMessage(String msg)
{
StringTokenizer tok = new StringTokenizer(msg, ",");
int ttl = Integer.parseInt(tok.nextToken().trim());
int time = -1;
InetAddress address;
if (tok.hasMoreTokens())
{
int i_addr = Integer.parseInt(tok.nextToken().trim());
address = intToAddress(i_addr);
time = Integer.parseInt(tok.nextToken().trim());
} else
{
address = null;
}
return (long)(cb.reportNode(ping_mode ? -1 : ttl, address, time) ? 1 : 0);
}
protected traceRouteCallback(boolean _ping_mode, PlatformManagerPingCallback _cb)
{
this$0 = AEWin32AccessImpl.this;
super();
ping_mode = _ping_mode;
cb = _cb;
}
}
protected static AEWin32AccessImpl singleton;
private boolean fully_initialise;
private int trace_id_next;
private List listeners;
public static synchronized AEWin32Access getSingleton(boolean fully_initialise)
{
if (singleton == null)
singleton = new AEWin32AccessImpl(fully_initialise);
return singleton;
}
protected AEWin32AccessImpl(boolean _fully_initialise)
{
trace_id_next = (new Random()).nextInt();
listeners = new ArrayList();
fully_initialise = _fully_initialise;
if (isEnabled())
AEWin32AccessInterface.load(this, fully_initialise);
}
public boolean isEnabled()
{
return AEWin32AccessInterface.isEnabled(fully_initialise);
}
public long windowsMessage(int msg, int param1, long param2)
{
int type = -1;
if (msg == 22)
type = 1;
else
if (msg == 536)
if (param1 == 0)
type = 2;
else
if (param1 == 7)
type = 3;
if (type != -1)
{
for (int i = 0; i < listeners.size(); i++)
try
{
((AEWin32AccessListener)listeners.get(i)).eventOccurred(type);
}
catch (Throwable e)
{
e.printStackTrace();
}
}
return -1L;
}
public long generalMessage(String str)
{
return 0L;
}
public String getVersion()
{
return AEWin32AccessInterface.getVersion();
}
public String readStringValue(int type, String subkey, String value_name)
throws AEWin32AccessException
{
return AEWin32AccessInterface.readStringValue(type, subkey, value_name);
}
public void writeStringValue(int type, String subkey, String value_name, String value_value)
throws AEWin32AccessException
{
AEWin32AccessInterface.writeStringValue(type, subkey, value_name, value_value);
}
public int readWordValue(int type, String subkey, String value_name)
throws AEWin32AccessException
{
return AEWin32AccessInterface.readWordValue(type, subkey, value_name);
}
public void writeWordValue(int type, String subkey, String value_name, int value_value)
throws AEWin32AccessException
{
AEWin32AccessInterface.writeWordValue(type, subkey, value_name, value_value);
}
public void deleteKey(int type, String subkey)
throws AEWin32AccessException
{
deleteKey(type, subkey, false);
}
public void deleteKey(int type, String subkey, boolean recursive)
throws AEWin32AccessException
{
AEWin32AccessInterface.deleteKey(type, subkey, recursive);
}
public void deleteValue(int type, String subkey, String value_name)
throws AEWin32AccessException
{
AEWin32AccessInterface.deleteValue(type, subkey, value_name);
}
public String getUserAppData()
throws AEWin32AccessException
{
String app_data_key = "software\\microsoft\\windows\\currentversion\\explorer\\shell folders";
String app_data_name = "appdata";
return readStringValue(4, app_data_key, app_data_name);
}
public String getCommonAppData()
throws AEWin32AccessException
{
String app_data_key = "software\\microsoft\\windows\\currentversion\\explorer\\shell folders";
String app_data_name = "Common AppData";
return readStringValue(3, app_data_key, app_data_name);
}
public String getUserDocumentsDir()
throws AEWin32AccessException
{
String app_data_key = "software\\microsoft\\windows\\currentversion\\explorer\\shell folders";
String app_data_name = "personal";
return readStringValue(4, app_data_key, app_data_name);
}
public String getUserMusicDir()
throws AEWin32AccessException
{
String app_data_key;
String app_data_name;
app_data_key = "software\\microsoft\\windows\\currentversion\\explorer\\shell folders";
app_data_name = "my music";
return readStringValue(4, app_data_key, app_data_name);
AEWin32AccessException e;
e;
String s = getUserDocumentsDir();
if (s != null)
s = (new StringBuilder()).append(s).append("\\My Music").toString();
return s;
}
public String getUserVideoDir()
throws AEWin32AccessException
{
String app_data_key;
String app_data_name;
app_data_key = "software\\microsoft\\windows\\currentversion\\explorer\\shell folders";
app_data_name = "my video";
return readStringValue(4, app_data_key, app_data_name);
AEWin32AccessException e;
e;
String s = getUserDocumentsDir();
if (s != null)
s = (new StringBuilder()).append(s).append("\\My Video").toString();
return s;
}
public String getProgramFilesDir()
throws AEWin32AccessException
{
String app_data_key = "software\\microsoft\\windows\\currentversion";
String app_data_name = "ProgramFilesDir";
return readStringValue(3, app_data_key, app_data_name);
}
public String getApplicationInstallDir(String app_name)
throws AEWin32AccessException
{
String res = "";
try
{
res = readStringValue(4, (new StringBuilder()).append("software\\").append(app_name).toString(), null);
}
catch (AEWin32AccessException e)
{
res = readStringValue(3, (new StringBuilder()).append("software\\").append(app_name).toString(), null);
}
return res;
}
public void createProcess(String command_line, boolean inherit_handles)
throws AEWin32AccessException
{
AEWin32AccessInterface.createProcess(command_line, inherit_handles);
}
public void moveToRecycleBin(String file_name)
throws AEWin32AccessException
{
AEWin32AccessInterface.moveToRecycleBin(file_name);
}
public void copyFilePermissions(String from_file_name, String to_file_name)
throws AEWin32AccessException
{
AEWin32AccessInterface.copyPermission(from_file_name, to_file_name);
}
public boolean testNativeAvailability(String name)
throws AEWin32AccessException
{
return AEWin32AccessInterface.testNativeAvailability(name);
}
public int shellExecute(String operation, String file, String parameters, String directory, int SW_const)
throws AEWin32AccessException
{
return AEWin32AccessInterface.shellExecute(operation, file, parameters, directory, SW_const);
}
public int shellExecuteAndWait(String file, String params)
throws AEWin32AccessException
{
return AEWin32AccessInterface.shellExecuteAndWait(file, params);
}
public void traceRoute(InetAddress source_address, InetAddress target_address, PlatformManagerPingCallback callback)
throws AEWin32AccessException
{
traceRoute(source_address, target_address, false, callback);
}
public void ping(InetAddress source_address, InetAddress target_address, PlatformManagerPingCallback callback)
throws AEWin32AccessException
{
if (Constants.compareVersions(getVersion(), "1.15") < 0)
{
throw new AEWin32AccessException("Sorry, ping is broken in versions < 1.15");
} else
{
traceRoute(source_address, target_address, true, callback);
return;
}
}
protected void traceRoute(InetAddress source_address, InetAddress target_address, boolean ping_mode, PlatformManagerPingCallback callback)
throws AEWin32AccessException
{
int trace_id;
synchronized (this)
{
trace_id = trace_id_next++;
}
AEWin32AccessCallback cb = new traceRouteCallback(ping_mode, callback);
AEWin32AccessInterface.traceRoute(trace_id, addressToInt(source_address), addressToInt(target_address), ping_mode ? 1 : 0, cb);
}
private int addressToInt(InetAddress address)
{
byte bytes[] = address.getAddress();
int resp = bytes[0] << 24 & 0xff000000 | bytes[1] << 16 & 0xff0000 | bytes[2] << 8 & 0xff00 | bytes[3] & 0xff;
return resp;
}
private InetAddress intToAddress(int address)
{
byte bytes[] = {
(byte)(address >> 24), (byte)(address >> 16), (byte)(address >> 8), (byte)address
};
InetAddress res = InetAddress.getByAddress(bytes);
return res;
UnknownHostException e;
e;
return null;
}
public void addListener(AEWin32AccessListener listener)
{
listeners.add(listener);
}
public void removeListener(AEWin32AccessListener listener)
{
listeners.remove(listener);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -