Issue #45 Unicode character cannot save

Code formatting
This commit is contained in:
Jindra Petk
2013-03-30 16:43:26 +01:00
parent d3bd9b641d
commit be106cc34b
772 changed files with 84378 additions and 84353 deletions

View File

@@ -26,104 +26,104 @@ import javax.swing.JFrame;
*/
public class FlashPlayerPanel extends Panel {
private boolean executed = false;
private String flash;
private HANDLE pipe;
private static List<HANDLE> processes = new ArrayList<HANDLE>();
private static List<HANDLE> pipes = new ArrayList<HANDLE>();
private JFrame frame;
private boolean executed = false;
private String flash;
private HANDLE pipe;
private static List<HANDLE> processes = new ArrayList<HANDLE>();
private static List<HANDLE> pipes = new ArrayList<HANDLE>();
private JFrame frame;
private synchronized void resize() {
if (pipe != null) {
IntByReference ibr = new IntByReference();
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{2}, 1, ibr, null);
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{
(byte) (getWidth() / 256), (byte) (getWidth() % 256),
(byte) (getHeight() / 256), (byte) (getHeight() % 256),}, 4, ibr, null);
}
}
private synchronized void resize() {
if (pipe != null) {
IntByReference ibr = new IntByReference();
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{2}, 1, ibr, null);
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{
(byte) (getWidth() / 256), (byte) (getWidth() % 256),
(byte) (getHeight() / 256), (byte) (getHeight() % 256),}, 4, ibr, null);
}
}
public FlashPlayerPanel(JFrame frame) {
if (!Platform.isWindows()) {
throw new FlashUnsupportedException();
}
this.frame = frame;
addComponentListener(new ComponentListener() {
@Override
public void componentResized(ComponentEvent e) {
resize();
}
public FlashPlayerPanel(JFrame frame) {
if (!Platform.isWindows()) {
throw new FlashUnsupportedException();
}
this.frame = frame;
addComponentListener(new ComponentListener() {
@Override
public void componentResized(ComponentEvent e) {
resize();
}
@Override
public void componentMoved(ComponentEvent e) {
}
@Override
public void componentMoved(ComponentEvent e) {
}
@Override
public void componentShown(ComponentEvent e) {
componentResized(e);
}
@Override
public void componentShown(ComponentEvent e) {
componentResized(e);
}
@Override
public void componentHidden(ComponentEvent e) {
}
});
}
private WinDef.HWND hwndFrame;
@Override
public void componentHidden(ComponentEvent e) {
}
});
}
private WinDef.HWND hwndFrame;
private void execute() {
WinDef.HWND hwnd = new WinDef.HWND();
hwnd.setPointer(Native.getComponentPointer(this));
private void execute() {
WinDef.HWND hwnd = new WinDef.HWND();
hwnd.setPointer(Native.getComponentPointer(this));
hwndFrame = new WinDef.HWND();
hwndFrame.setPointer(Native.getComponentPointer(frame));
hwndFrame = new WinDef.HWND();
hwndFrame.setPointer(Native.getComponentPointer(frame));
pipe = Kernel32.INSTANCE.CreateNamedPipe("\\\\.\\pipe\\ffdec_flashplayer_" + hwnd.getPointer().hashCode(), Kernel32.PIPE_ACCESS_OUTBOUND, Kernel32.PIPE_TYPE_BYTE, 1, 0, 0, 0, null);
pipe = Kernel32.INSTANCE.CreateNamedPipe("\\\\.\\pipe\\ffdec_flashplayer_" + hwnd.getPointer().hashCode(), Kernel32.PIPE_ACCESS_OUTBOUND, Kernel32.PIPE_TYPE_BYTE, 1, 0, 0, 0, null);
SHELLEXECUTEINFO sei = new SHELLEXECUTEINFO();
sei.fMask = 0x00000040;
String path = new File(new File(".").getAbsolutePath()).getParentFile().getAbsolutePath();
sei.lpFile = new WString(path + "\\lib\\FlashPlayer.exe");
sei.lpParameters = new WString(hwnd.getPointer().hashCode() + " " + hwndFrame.getPointer().hashCode());
sei.nShow = WinUser.SW_NORMAL;
Shell32.INSTANCE.ShellExecuteEx(sei);
processes.add(sei.hProcess);
SHELLEXECUTEINFO sei = new SHELLEXECUTEINFO();
sei.fMask = 0x00000040;
String path = new File(new File(".").getAbsolutePath()).getParentFile().getAbsolutePath();
sei.lpFile = new WString(path + "\\lib\\FlashPlayer.exe");
sei.lpParameters = new WString(hwnd.getPointer().hashCode() + " " + hwndFrame.getPointer().hashCode());
sei.nShow = WinUser.SW_NORMAL;
Shell32.INSTANCE.ShellExecuteEx(sei);
processes.add(sei.hProcess);
Kernel32.INSTANCE.ConnectNamedPipe(pipe, null);
pipes.add(pipe);
executed = true;
}
Kernel32.INSTANCE.ConnectNamedPipe(pipe, null);
pipes.add(pipe);
executed = true;
}
public synchronized void displaySWF(String flash) {
this.flash = flash;
repaint();
if (!executed) {
execute();
}
if (pipe != null) {
IntByReference ibr = new IntByReference();
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{1}, 1, ibr, null);
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{(byte) flash.getBytes().length}, 1, ibr, null);
Kernel32.INSTANCE.WriteFile(pipe, flash.getBytes(), flash.getBytes().length, ibr, null);
}
}
public synchronized void displaySWF(String flash) {
this.flash = flash;
repaint();
if (!executed) {
execute();
}
if (pipe != null) {
IntByReference ibr = new IntByReference();
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{1}, 1, ibr, null);
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{(byte) flash.getBytes().length}, 1, ibr, null);
Kernel32.INSTANCE.WriteFile(pipe, flash.getBytes(), flash.getBytes().length, ibr, null);
}
}
public static void unload() {
if (Platform.isWindows()) {
for (int i = 0; i < processes.size(); i++) {
Kernel32.INSTANCE.CloseHandle(pipes.get(i));
Kernel32.INSTANCE.TerminateProcess(processes.get(i), 0);
}
}
}
public static void unload() {
if (Platform.isWindows()) {
for (int i = 0; i < processes.size(); i++) {
Kernel32.INSTANCE.CloseHandle(pipes.get(i));
Kernel32.INSTANCE.TerminateProcess(processes.get(i), 0);
}
}
}
@Override
public void paint(Graphics g) {
if ((!executed) && flash != null) {
execute();
}
super.paint(g);
}
@Override
public void paint(Graphics g) {
if ((!executed) && flash != null) {
execute();
}
super.paint(g);
}
}