|
|
@ -2,6 +2,7 @@ package com.fr.design.utils; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.FeedBackInfo; |
|
|
|
import com.fr.base.FeedBackInfo; |
|
|
|
import com.fr.base.ServerConfig; |
|
|
|
import com.fr.base.ServerConfig; |
|
|
|
|
|
|
|
import com.fr.concurrent.NamedThreadFactory; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
import com.fr.design.fun.DesignerEnvProcessor; |
|
|
|
import com.fr.design.fun.DesignerEnvProcessor; |
|
|
@ -116,7 +117,7 @@ public class DesignUtils { |
|
|
|
* @param suffixs 文件后缀 |
|
|
|
* @param suffixs 文件后缀 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static void createListeningServer(final int startPort, final String[] suffixs) { |
|
|
|
public static void createListeningServer(final int startPort, final String[] suffixs) { |
|
|
|
ExecutorService service = Executors.newSingleThreadExecutor(); |
|
|
|
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("DesignClientListener")); |
|
|
|
service.execute(new Runnable() { |
|
|
|
service.execute(new Runnable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
@ -129,7 +130,8 @@ public class DesignUtils { |
|
|
|
while (true) { |
|
|
|
while (true) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (serverSocket != null) { |
|
|
|
if (serverSocket != null) { |
|
|
|
Socket socket = serverSocket.accept(); // 接收客户连接
|
|
|
|
// 接收客户连接
|
|
|
|
|
|
|
|
Socket socket = serverSocket.accept(); |
|
|
|
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8)); |
|
|
|
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8)); |
|
|
|
String line; |
|
|
|
String line; |
|
|
|
while ((line = reader.readLine()) != null) { |
|
|
|
while ((line = reader.readLine()) != null) { |
|
|
@ -141,8 +143,8 @@ public class DesignUtils { |
|
|
|
String path = f.getAbsolutePath(); |
|
|
|
String path = f.getAbsolutePath(); |
|
|
|
|
|
|
|
|
|
|
|
boolean isMatch = false; |
|
|
|
boolean isMatch = false; |
|
|
|
for (int i = 0; i < suffixs.length; i++) { |
|
|
|
for (String suffix : suffixs) { |
|
|
|
isMatch = isMatch || path.endsWith(suffixs[i]); |
|
|
|
isMatch = isMatch || path.endsWith(suffix); |
|
|
|
} |
|
|
|
} |
|
|
|
if (isMatch) { |
|
|
|
if (isMatch) { |
|
|
|
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f)); |
|
|
|
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f)); |
|
|
|