项目结构优化和AI识别的支持
parent
4530a4ed8c
commit
db99318e28
@ -0,0 +1,28 @@
|
|||||||
|
package com.xypower.common;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class InetAddressUtils {
|
||||||
|
// String regex = "^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}$";
|
||||||
|
private static final Pattern IPV4_PATTERN = Pattern.compile("^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}$");
|
||||||
|
|
||||||
|
private static final Pattern IPV6_STD_PATTERN = Pattern.compile("^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$");
|
||||||
|
|
||||||
|
private static final Pattern IPV6_HEX_COMPRESSED_PATTERN = Pattern.compile("^((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)::((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)$");
|
||||||
|
|
||||||
|
public static boolean isIPv4Address(final String input) {
|
||||||
|
return IPV4_PATTERN.matcher(input).matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isIPv6StdAddress(final String input) {
|
||||||
|
return IPV6_STD_PATTERN.matcher(input).matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isIPv6HexCompressedAddress(final String input) {
|
||||||
|
return IPV6_HEX_COMPRESSED_PATTERN.matcher(input).matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isIPv6Address(final String input) {
|
||||||
|
return isIPv6StdAddress(input) || isIPv6HexCompressedAddress(input);
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,27 @@
|
|||||||
package com.xypower.common;
|
package com.xypower.common;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Environment;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class MicroPhotoContext {
|
public class MicroPhotoContext {
|
||||||
|
|
||||||
|
public static final String PACKAGE_NAME_MPAPP = "com.xypower.mpapp";
|
||||||
|
public static final String PACKAGE_NAME_MPMASTER = "com.xypower.mpmaster";
|
||||||
|
public final static String MASTER_URL = "http://180.166.218.222:40101/?cmdid=";
|
||||||
|
|
||||||
|
public static String buildAppDir(Context contxt) {
|
||||||
|
|
||||||
|
File path = new File(Environment.getExternalStorageDirectory(), contxt.getPackageName() + "/");
|
||||||
|
|
||||||
|
if (!path.exists() && !path.mkdirs()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String p = path.getAbsolutePath();
|
||||||
|
if (!p.endsWith(File.separator)) {
|
||||||
|
p += File.separator;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -0,0 +1,16 @@
|
|||||||
|
package com.xypower.mpmaster;
|
||||||
|
|
||||||
|
import android.app.Service;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.IBinder;
|
||||||
|
|
||||||
|
public class MicroPhotoService extends Service {
|
||||||
|
public MicroPhotoService() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBinder onBind(Intent intent) {
|
||||||
|
// TODO: Return the communication channel to the service.
|
||||||
|
throw new UnsupportedOperationException("Not yet implemented");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue