add ensping
This commit is contained in:
parent
e133b12fcf
commit
5eb408ddd9
|
|
@ -0,0 +1,21 @@
|
|||
# pointgaming
|
||||
### 1、项目说明
|
||||
总体思路:TSP求解仿真仿真项目开发的总体思路如图1.1示意,旅行商问题求解仿真项目拟实现一个仿真系统。具体功能描述:(1)能够让读者产生一个问题规模为n的TSP,可以手工添加节点、边及权值来产生,也可以由程序自动产生,并在屏幕上显示;(2)能够以遍历算法和贪心算法自动求解该TSP,并将问题的解以可视化的方式显示;(3)能够支持用户手动标记一条路径,然后系统判断该路径是否是贪心算法路径;(4)能够获取地图中的城市相关数据,构造TSP并进行求解。
|
||||
图1.1 项目开发的总体思路图
|
||||
<img src="figs/overall.png" width=80% /></center>
|
||||
|
||||
|
||||
### 2、开发环境说明
|
||||
(1)系统版本:OpenHarmony 4.0 Release
|
||||
(2)SDK版本:API 10
|
||||
(3)Model类型:Stage
|
||||
(4)DevEco Studio版本:Deveco Studio 4.0 release
|
||||
(5)硬件环境:Unionpi Whale、RK3566开发板
|
||||
(6)预览器参数:(1)DeviceType:default;(2)Resolution:560-1280;(3)DPI:240;其余参数自定。
|
||||
### 3、项目主要函数调用关系图与项目输出界面演进图
|
||||
图3.1 项目主要函数调用关系图
|
||||
<img src="figs/relation.png" width=80% /></center>
|
||||
|
||||
|
||||
图3.2 项目输出界面演进图
|
||||
<img src="figs/evolution.png" width=80% /></center>
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"ohos-module-entry": {
|
||||
"SELECT_TARGET": "default",
|
||||
"MODULE_BUILD_DIR": "F:\\jiaocai\\ensp13\\entry\\build",
|
||||
"TARGETS": {
|
||||
"default": {
|
||||
"SOURCE_ROOT": "F:\\jiaocai\\ensp13\\entry\\src\\main",
|
||||
"RESOURCES_PATH": [
|
||||
"F:\\jiaocai\\ensp13\\entry\\src\\main\\resources"
|
||||
],
|
||||
"BUILD_PATH": {
|
||||
"OUTPUT_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\outputs\\default",
|
||||
"INTERMEDIA_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates",
|
||||
"JS_ASSETS_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\loader_out\\default",
|
||||
"JS_LITE_ASSETS_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\loader_out_lite\\default",
|
||||
"RES_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\res\\default",
|
||||
"RES_PROFILE_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\res\\default\\resources\\base\\profile",
|
||||
"ETS_SUPER_VISUAL_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\cache\\default\\default@CompileArkTS\\esmodule",
|
||||
"JS_SUPER_VISUAL_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\cache\\default\\default@CompileJS\\jsbundle",
|
||||
"WORKER_LOADER": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\loader\\default\\loader.json",
|
||||
"MANIFEST_JSON": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\manifest\\default",
|
||||
"OUTPUT_METADATA_JSON": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\hap_metadata\\default\\output_metadata.json"
|
||||
},
|
||||
"BUILD_OPTION": {
|
||||
"debuggable": true
|
||||
}
|
||||
},
|
||||
"ohosTest": {
|
||||
"SOURCE_ROOT": "F:\\jiaocai\\ensp13\\entry\\src\\ohosTest",
|
||||
"RESOURCES_PATH": [
|
||||
"F:\\jiaocai\\ensp13\\entry\\src\\ohosTest\\resources"
|
||||
],
|
||||
"BUILD_PATH": {
|
||||
"OUTPUT_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\outputs\\ohosTest",
|
||||
"INTERMEDIA_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates",
|
||||
"JS_ASSETS_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\loader_out\\ohosTest",
|
||||
"JS_LITE_ASSETS_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\loader_out_lite\\ohosTest",
|
||||
"RES_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\res\\ohosTest",
|
||||
"RES_PROFILE_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\res\\ohosTest\\resources\\base\\profile",
|
||||
"ETS_SUPER_VISUAL_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\cache\\ohosTest\\ohosTest@OhosTestCompileArkTS\\esmodule",
|
||||
"JS_SUPER_VISUAL_PATH": "F:\\jiaocai\\ensp13\\entry\\build\\default\\cache\\ohosTest\\ohosTest@OhosTestCompileJS\\jsbundle",
|
||||
"WORKER_LOADER": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\loader\\ohosTest\\loader.json",
|
||||
"MANIFEST_JSON": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\manifest\\ohosTest",
|
||||
"OUTPUT_METADATA_JSON": "F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\hap_metadata\\ohosTest\\output_metadata.json"
|
||||
},
|
||||
"BUILD_OPTION": {
|
||||
"debuggable": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ohos-project": {
|
||||
"SELECT_PRODUCT_NAME": "default",
|
||||
"MODULE_BUILD_DIR": "F:\\jiaocai\\ensp13\\build",
|
||||
"BUNDLE_NAME": "com.example.ensp2",
|
||||
"BUILD_PATH": {
|
||||
"OUTPUT_PATH": "F:\\jiaocai\\ensp13\\build\\outputs\\default"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"CommonInfo":{
|
||||
"current.select.target":"default"
|
||||
},
|
||||
"BuildOptions":{
|
||||
"SELECT_BUILD_TARGET":"default",
|
||||
"BUILD_PATH":{
|
||||
"OUTPUT_METADATA_JSON":"F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\hap_metadata\\default\\output_metadata.json",
|
||||
"OUTPUT_PATH":"F:\\jiaocai\\ensp13\\entry\\build\\default\\outputs\\default",
|
||||
"RES_PATH":"F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\res\\default",
|
||||
"ETS_SUPER_VISUAL_PATH":"F:\\jiaocai\\ensp13\\entry\\build\\default\\cache\\default\\default@CompileArkTS\\esmodule",
|
||||
"JS_ASSETS_PATH":"F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\loader_out\\default",
|
||||
"INTERMEDIA_PATH":"F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates",
|
||||
"RES_PROFILE_PATH":"F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\res\\default\\resources\\base\\profile",
|
||||
"WORKER_LOADER":"F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\loader\\default\\loader.json",
|
||||
"MANIFEST_JSON":"F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\manifest\\default",
|
||||
"JS_LITE_ASSETS_PATH":"F:\\jiaocai\\ensp13\\entry\\build\\default\\intermediates\\loader_out_lite\\default",
|
||||
"JS_SUPER_VISUAL_PATH":"F:\\jiaocai\\ensp13\\entry\\build\\default\\cache\\default\\default@CompileJS\\jsbundle"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"CommonInfo":{
|
||||
"crossplatform.projectType":"",
|
||||
"project.ide.version":"4.0.0.600",
|
||||
"current.select.product":"default",
|
||||
"current.select.buildMode":""
|
||||
},
|
||||
"BuildOptions":{
|
||||
"BUNDLE_NAME":"com.example.ensp2",
|
||||
"SELECT_BUILD_MODE":"",
|
||||
"BUILD_PATH":{
|
||||
"OUTPUT_PATH":"F:\\jiaocai\\ensp13\\build\\outputs\\default"
|
||||
},
|
||||
"SELECT_BUILD_PRODUCT":"default"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/ensp13.iml" filepath="$PROJECT_DIR$/.idea/modules/ensp13.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/entry/entry.iml" filepath="$PROJECT_DIR$/.idea/modules/entry/entry.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="EMPTY_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$/../.." />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="EMPTY_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$/../../../entry" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"app": {
|
||||
"bundleName": "com.example.ensp2",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:app_name"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "ENSP2"
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"app": {
|
||||
"signingConfigs": [
|
||||
{
|
||||
"name": "default",
|
||||
"material": {
|
||||
"certpath": "C:\\Users\\zijie\\.ohos\\config\\openharmony\\auto_ohos_default_ensp_com.example.ensp2.cer",
|
||||
"storePassword": "0000001AA2B2DDC1A35AD76D290AE6FC8D7C97F724C6E1EFC0AED7508C812BE7B63A2CDE4D2083DB9E3E",
|
||||
"keyAlias": "debugKey",
|
||||
"keyPassword": "0000001ACCA96D793A7443266856A64E03F1C41835DF5512FFD109DE9C6CC216F19B5A83DFCA2DF68EC3",
|
||||
"profile": "C:\\Users\\zijie\\.ohos\\config\\openharmony\\auto_ohos_default_ensp_com.example.ensp2.p7b",
|
||||
"signAlg": "SHA256withECDSA",
|
||||
"storeFile": "C:\\Users\\zijie\\.ohos\\config\\openharmony\\auto_ohos_default_ensp_com.example.ensp2.p12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"products": [
|
||||
{
|
||||
"name": "default",
|
||||
"signingConfig": "default",
|
||||
"compileSdkVersion": 10,
|
||||
"compatibleSdkVersion": 9,
|
||||
"runtimeOS": "OpenHarmony",
|
||||
}
|
||||
],
|
||||
"buildModeSet": [
|
||||
{
|
||||
"name": "debug",
|
||||
},
|
||||
{
|
||||
"name": "release"
|
||||
}
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"name": "entry",
|
||||
"srcPath": "./entry",
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"applyToProducts": [
|
||||
"default"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"APP_RESOURCES":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\AppScope\\resources","MODULE_RESOURCES":"{\"D:\\\\computer_programing\\\\Deveco_Studio\\\\openharmony_program\\\\ENSP_thirteen\\\\entry\\\\src\\\\main\\\\resources\":\"module_compiled\"}","HAR_RESOURCES":"{}","PREVIEW_GENERATE_SOURCE_DIR":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\default\\generated\\r\\default","PREVIEW_COMPILE_MODULE_NAMES":"entry"}
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/.default/compiler.cache.msgpack
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/.default/compiler.cache.msgpack
vendored
Normal file
Binary file not shown.
|
|
@ -0,0 +1 @@
|
|||
[]
|
||||
|
|
@ -0,0 +1,952 @@
|
|||
[
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 15,
|
||||
"character": 3,
|
||||
"messageText": "Property 'level' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 46,
|
||||
"character": 23,
|
||||
"messageText": "Property 'configCorrect' is used before being assigned."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 56,
|
||||
"character": 7,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 56,
|
||||
"character": 28,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 57,
|
||||
"character": 9,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 57,
|
||||
"character": 30,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 62,
|
||||
"character": 9,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 62,
|
||||
"character": 27,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 62,
|
||||
"character": 44,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 62,
|
||||
"character": 62,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 69,
|
||||
"character": 53,
|
||||
"messageText": "Function lacks ending return statement and return type does not include 'undefined'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 71,
|
||||
"character": 7,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 78,
|
||||
"character": 5,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 78,
|
||||
"character": 41,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 79,
|
||||
"character": 5,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 79,
|
||||
"character": 41,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 83,
|
||||
"character": 5,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 84,
|
||||
"character": 5,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 89,
|
||||
"character": 24,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 90,
|
||||
"character": 24,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 91,
|
||||
"character": 14,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 91,
|
||||
"character": 46,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 99,
|
||||
"character": 3,
|
||||
"messageText": "Property 'RPacket' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 124,
|
||||
"character": 32,
|
||||
"messageText": {
|
||||
"messageText": "Argument of type 'string | null' is not assignable to parameter of type 'string'.",
|
||||
"category": 1,
|
||||
"code": 2345,
|
||||
"next": [
|
||||
{
|
||||
"messageText": "Type 'null' is not assignable to type 'string'.",
|
||||
"category": 1,
|
||||
"code": 2322
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 137,
|
||||
"character": 7,
|
||||
"messageText": "Object is possibly 'undefined'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 141,
|
||||
"character": 31,
|
||||
"messageText": "Function lacks ending return statement and return type does not include 'undefined'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 146,
|
||||
"character": 7,
|
||||
"messageText": "Type 'undefined' is not assignable to type 'boolean'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 196,
|
||||
"character": 37,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 202,
|
||||
"character": 11,
|
||||
"messageText": "Object is possibly 'undefined'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 212,
|
||||
"character": 53,
|
||||
"messageText": {
|
||||
"messageText": "Argument of type 'string | null' is not assignable to parameter of type 'string'.",
|
||||
"category": 1,
|
||||
"code": 2345,
|
||||
"next": [
|
||||
{
|
||||
"messageText": "Type 'null' is not assignable to type 'string'.",
|
||||
"category": 1,
|
||||
"code": 2322
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 222,
|
||||
"character": 24,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 232,
|
||||
"character": 3,
|
||||
"messageText": "Property 'macTable' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 254,
|
||||
"character": 37,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 260,
|
||||
"character": 11,
|
||||
"messageText": "Object is possibly 'undefined'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 309,
|
||||
"character": 11,
|
||||
"messageText": "Object is possibly 'undefined'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 10,
|
||||
"character": 11,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 11,
|
||||
"character": 7,
|
||||
"messageText": "\"Symbol()\" API is not supported (arkts-no-symbol)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 27,
|
||||
"character": 15,
|
||||
"messageText": "\"Symbol()\" API is not supported (arkts-no-symbol)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 87,
|
||||
"character": 17,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 102,
|
||||
"character": 45,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 154,
|
||||
"character": 45,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 173,
|
||||
"character": 11,
|
||||
"messageText": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 181,
|
||||
"character": 14,
|
||||
"messageText": "Usage of standard library is restricted (arkts-limited-stdlib)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 181,
|
||||
"character": 31,
|
||||
"messageText": "Usage of standard library is restricted (arkts-limited-stdlib)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 223,
|
||||
"character": 22,
|
||||
"messageText": "Indexed access is not supported for fields (arkts-no-props-by-index)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 224,
|
||||
"character": 22,
|
||||
"messageText": "Indexed access is not supported for fields (arkts-no-props-by-index)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 234,
|
||||
"character": 45,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 285,
|
||||
"character": 45,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/OtherSimObjects.ets",
|
||||
"line": 327,
|
||||
"character": 7,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 14,
|
||||
"character": 3,
|
||||
"messageText": "Property 'Ip' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 15,
|
||||
"character": 3,
|
||||
"messageText": "Property 'Mac' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 16,
|
||||
"character": 3,
|
||||
"messageText": "Property 'routerTable' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 17,
|
||||
"character": 3,
|
||||
"messageText": "Property 'switchTable' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 18,
|
||||
"character": 3,
|
||||
"messageText": "Property 'objLabel' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 22,
|
||||
"character": 3,
|
||||
"messageText": "Property 'img' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 23,
|
||||
"character": 3,
|
||||
"messageText": "Property 'imgTm' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 24,
|
||||
"character": 3,
|
||||
"messageText": "Property 'interface' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 25,
|
||||
"character": 3,
|
||||
"messageText": "Property 'connections' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 24,
|
||||
"character": 20,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 25,
|
||||
"character": 22,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/classes/SimBase.ets",
|
||||
"line": 31,
|
||||
"character": 18,
|
||||
"messageText": "\"Symbol()\" API is not supported (arkts-no-symbol)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/functions/functions.ets",
|
||||
"line": 46,
|
||||
"character": 33,
|
||||
"messageText": {
|
||||
"messageText": "Argument of type 'string | null' is not assignable to parameter of type 'string'.",
|
||||
"category": 1,
|
||||
"code": 2345,
|
||||
"next": [
|
||||
{
|
||||
"messageText": "Type 'null' is not assignable to type 'string'.",
|
||||
"category": 1,
|
||||
"code": 2322
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/functions/functions.ets",
|
||||
"line": 5,
|
||||
"character": 29,
|
||||
"messageText": "RegExp literals are not supported (arkts-no-regexp-literals)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/functions/functions.ets",
|
||||
"line": 6,
|
||||
"character": 32,
|
||||
"messageText": "RegExp literals are not supported (arkts-no-regexp-literals)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/functions/functions.ets",
|
||||
"line": 15,
|
||||
"character": 21,
|
||||
"messageText": "Usage of standard library is restricted (arkts-limited-stdlib)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/functions/functions.ets",
|
||||
"line": 21,
|
||||
"character": 24,
|
||||
"messageText": "Usage of standard library is restricted (arkts-limited-stdlib)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/functions/functions.ets",
|
||||
"line": 30,
|
||||
"character": 21,
|
||||
"messageText": "Usage of standard library is restricted (arkts-limited-stdlib)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 68,
|
||||
"character": 37,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 68,
|
||||
"character": 79,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 70,
|
||||
"character": 78,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 70,
|
||||
"character": 97,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 70,
|
||||
"character": 119,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 156,
|
||||
"character": 17,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 157,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 159,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 160,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 179,
|
||||
"character": 17,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 180,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 182,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 183,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 202,
|
||||
"character": 17,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 203,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 205,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 206,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 225,
|
||||
"character": 17,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 226,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 228,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 229,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 265,
|
||||
"character": 17,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 266,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 268,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 269,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 288,
|
||||
"character": 17,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 289,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 291,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 292,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 311,
|
||||
"character": 17,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 312,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 314,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 315,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 334,
|
||||
"character": 17,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 335,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 337,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 338,
|
||||
"character": 15,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 420,
|
||||
"character": 19,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/Dialog.ets",
|
||||
"line": 468,
|
||||
"character": 34,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 11,
|
||||
"character": 51,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 15,
|
||||
"character": 50,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 19,
|
||||
"character": 53,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 23,
|
||||
"character": 57,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 27,
|
||||
"character": 57,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 31,
|
||||
"character": 49,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 35,
|
||||
"character": 54,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 68,
|
||||
"character": 29,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 68,
|
||||
"character": 56,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 68,
|
||||
"character": 91,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 68,
|
||||
"character": 118,
|
||||
"messageText": "Object is possibly 'null'."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/TopMenuBar.ets",
|
||||
"line": 177,
|
||||
"character": 22,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/MiddleContent.ets",
|
||||
"line": 40,
|
||||
"character": 26,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/MiddleContent.ets",
|
||||
"line": 41,
|
||||
"character": 26,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/MiddleContent.ets",
|
||||
"line": 42,
|
||||
"character": 26,
|
||||
"messageText": "Type 'null' cannot be used as an index type."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/MiddleContent.ets",
|
||||
"line": 182,
|
||||
"character": 3,
|
||||
"messageText": "Property 'thisIndex' has no initializer and is not definitely assigned in the constructor."
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/MiddleContent.ets",
|
||||
"line": 10,
|
||||
"character": 22,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/MiddleContent.ets",
|
||||
"line": 142,
|
||||
"character": 12,
|
||||
"messageText": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/MiddleContent.ets",
|
||||
"line": 150,
|
||||
"character": 12,
|
||||
"messageText": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/MiddleContent.ets",
|
||||
"line": 176,
|
||||
"character": 22,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/MiddleContent.ets",
|
||||
"line": 187,
|
||||
"character": 39,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/components/ButtomMenuBar.ets",
|
||||
"line": 37,
|
||||
"character": 22,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/pages/Index.ets",
|
||||
"line": 8,
|
||||
"character": 23,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/pages/Index.ets",
|
||||
"line": 9,
|
||||
"character": 24,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
},
|
||||
{
|
||||
"categoryInfo": "Error",
|
||||
"fileName": "D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/src/main/ets/pages/Index.ets",
|
||||
"line": 10,
|
||||
"character": 22,
|
||||
"messageText": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)"
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
string EntryAbility_desc 0x01000002
|
||||
string EntryAbility_label 0x01000003
|
||||
string app_name 0x01000001
|
||||
string module_desc 0x01000004
|
||||
color start_window_background 0x01000006
|
||||
media app_icon 0x01000000
|
||||
media icon 0x0100000f
|
||||
media jiaohuanji 0x01000011
|
||||
media jiaohuanji_tm 0x0100000e
|
||||
media jixianqi 0x0100000b
|
||||
media jixianqi_tm 0x0100000a
|
||||
media luyouqi 0x01000005
|
||||
media luyouqi_tm 0x0100000c
|
||||
media packet 0x01000007
|
||||
media startIcon 0x01000009
|
||||
media zhuji 0x01000008
|
||||
media zhuji_tm 0x0100000d
|
||||
profile main_pages 0x01000010
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/OtherSimObjects.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/OtherSimObjects.protoBin
vendored
Normal file
Binary file not shown.
293
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/OtherSimObjects.ts
vendored
Normal file
293
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/OtherSimObjects.ts
vendored
Normal file
|
|
@ -0,0 +1,293 @@
|
|||
import { SimBase } from "@bundle:com.example.ensp2/entry/ets/classes/SimBase";
|
||||
@Observed
|
||||
export class SimPacket {
|
||||
sourceMac: string; // 源主机mac地址
|
||||
sourceIp: string; // 源主机ip地址
|
||||
destinationMac: string; // 目的主机mac地址
|
||||
destinationIp: string; // 目的主机ip地址
|
||||
message: string;
|
||||
upJump: any; // 可以根据具体类型定义
|
||||
id: symbol;
|
||||
points: number[][]; // 路径点
|
||||
allSimObj: SimBase[];
|
||||
allSimPacket: SimPacket[];
|
||||
level: number; // 数据包展示优先级
|
||||
constructor(sourceIp: string, sourceMac: string, destinationIp: string, destinationMac: string, message: string, allSimObj: SimBase[], allSimPacket: SimPacket[]) {
|
||||
this.sourceMac = sourceMac;
|
||||
this.sourceIp = sourceIp;
|
||||
this.destinationMac = destinationMac;
|
||||
this.destinationIp = destinationIp;
|
||||
this.message = message;
|
||||
this.allSimObj = allSimObj;
|
||||
this.allSimPacket = allSimPacket;
|
||||
this.upJump = null; // 上一跳连接对象
|
||||
this.points = [];
|
||||
this.id = Symbol();
|
||||
}
|
||||
}
|
||||
@Observed
|
||||
export class SimConnect {
|
||||
nObjS: SimBase | null; // 线一端节点S
|
||||
ifsS: number; // 线一端节点S的端口
|
||||
nObjE: SimBase | null; // 线一端节点E
|
||||
ifsE: number; // 线一端节点E的端口
|
||||
width: number; // 线的粗细
|
||||
configCorrect: boolean; // 配置正确与否
|
||||
constructor(nobjs: SimBase | null, ifss: number, nobje: SimBase | null, ifse: number) {
|
||||
this.nObjS = nobjs;
|
||||
this.ifsS = ifss;
|
||||
this.nObjE = nobje;
|
||||
this.ifsE = ifse;
|
||||
this.width = this.configCorrect === false ? 1 : 4;
|
||||
if (nobjs != null && nobje != null) {
|
||||
this.configCorrect = true;
|
||||
}
|
||||
else {
|
||||
this.configCorrect = false;
|
||||
}
|
||||
}
|
||||
isConnectedTo(other: SimConnect): boolean {
|
||||
return (this.nObjS.objID === other.nObjS.objID &&
|
||||
this.nObjE.objID === other.nObjE.objID);
|
||||
} // 判断两个连接对象是否已经连接
|
||||
checkConfig() {
|
||||
if (this.nObjS.Mac && this.nObjS.Ip && this.nObjE.Mac && this.nObjE.Ip) {
|
||||
this.width = 4;
|
||||
}
|
||||
else {
|
||||
this.width = 1;
|
||||
}
|
||||
} // 检查两边节点配置是否正确
|
||||
transfer(sourceNode: SimBase, packet: SimPacket): boolean {
|
||||
if (sourceNode === this.nObjS) {
|
||||
this.nObjE.receive(packet);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
} // 传输数据
|
||||
updateObjConn() {
|
||||
this.nObjS.interface[this.ifsS - 1] = this.nObjE.objID;
|
||||
this.nObjE.interface[this.ifsE - 1] = this.nObjS.objID;
|
||||
} // 更新虚拟对象的接口信息
|
||||
deleteObjConn() {
|
||||
this.nObjS.interface[this.ifsS - 1] = null;
|
||||
this.nObjE.interface[this.ifsE - 1] = null;
|
||||
} // 删除虚拟对象的接口信息
|
||||
equals(other: any): boolean {
|
||||
if (other instanceof SimConnect) {
|
||||
const otherIds = other.nObjS.objID;
|
||||
const otherIde = other.nObjE.objID;
|
||||
return this.nObjS.objID == otherIds && this.nObjE.objID == otherIde;
|
||||
}
|
||||
return false;
|
||||
} // 判断两个连接对象是否相同
|
||||
}
|
||||
@Observed
|
||||
export class SimHost extends SimBase {
|
||||
RPacket: SimPacket; // 主机获取到的正确数据包
|
||||
isOnline: boolean = false; // 主机联网状态
|
||||
constructor(x: number, y: number, config: any = null) {
|
||||
super(x, y, config);
|
||||
this.objType = 1;
|
||||
this.objLabel = this.setDefaultName();
|
||||
this.interface = [null]; // 主机只有一个接口
|
||||
this.connections = [null]; // 一个接口对应一根连接线
|
||||
this.img = { "id": 16777224, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" }; // 主机图片
|
||||
this.imgTm = { "id": 16777229, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" }; // 主机配置成功图片
|
||||
this.Ip = "";
|
||||
this.Mac = "";
|
||||
}
|
||||
setDefaultName() {
|
||||
return `SHO${++SimBase.flag}`;
|
||||
} // 生成组件默认名称
|
||||
onlineSwitch() {
|
||||
this.isOnline = !this.isOnline;
|
||||
} // 切换联网状态
|
||||
createPacket(ip: string, mac: string, message: string, allSimObj: SimBase[], allSimPacket: SimPacket[]) {
|
||||
let objArr = allSimObj;
|
||||
let packet = new SimPacket(this.Ip, this.Mac, ip, mac, message, objArr, allSimPacket);
|
||||
packet.allSimPacket.push(packet);
|
||||
packet.level = 1;
|
||||
packet.points.push([this.objX, this.objY]);
|
||||
updatePacketLog(`${this.objLabel}创建数据包,信息为[${packet.message}]`);
|
||||
this.send(packet);
|
||||
} // 创建数据包
|
||||
send(packet: SimPacket) {
|
||||
const connObj: Symbol = this.objID;
|
||||
packet.upJump = connObj;
|
||||
updatePacketLog(`${this.objLabel}发送数据包,信息为[${packet.message}]`);
|
||||
if (packet.allSimObj.find(item => item.objID === this.interface[0]) != undefined) {
|
||||
packet.allSimObj.find(item => item.objID === this.interface[0]).receive(packet);
|
||||
}
|
||||
} // 发送数据包
|
||||
receive(packet: SimPacket): boolean {
|
||||
if (packet.destinationIp == this.Ip) {
|
||||
packet.points.push([this.objX, this.objY]);
|
||||
updatePacketLog(`${this.objLabel}成功获取到信息[${packet.message}]!`);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
} // 收到数据包
|
||||
}
|
||||
@Observed
|
||||
export class SimRouter extends SimBase {
|
||||
constructor(x: number, y: number, config: any = null) {
|
||||
super(x, y, config);
|
||||
this.objType = 2;
|
||||
this.objLabel = this.setDefaultName();
|
||||
this.interface = [null, null, null, null]; // 路由器有四个接口
|
||||
this.connections = [null, null, null, null]; // 四个接口对应四根连接线
|
||||
this.img = { "id": 16777221, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" }; // 路由器图片
|
||||
this.imgTm = { "id": 16777228, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" }; // 路由器配置成功图片
|
||||
this.Ip = "";
|
||||
this.Mac = "";
|
||||
this.routerTable = [];
|
||||
}
|
||||
setDefaultName() {
|
||||
return `SRO${++SimBase.flag}`;
|
||||
} // 生成组件默认名称
|
||||
checkDestinationIp(destinationIp: string, network: string): boolean {
|
||||
// 解析目标 IP 和网络地址
|
||||
const [networkAddress, subnetMask] = network.split('/');
|
||||
// 分解目标 IP 地址和网络地址为数组
|
||||
const destinationIpParts = destinationIp.split('.');
|
||||
const networkAddressParts = networkAddress.split('.');
|
||||
// 计算目标 IP 的网络地址(根据子网掩码)
|
||||
const calculatedNetworkAddressParts = destinationIpParts.map((part, index) => {
|
||||
return parseInt(part) & parseInt(networkAddressParts[index]);
|
||||
});
|
||||
// 构建目标 IP 的网络地址和网络地址的比较字符串
|
||||
const calculatedNetworkAddress = calculatedNetworkAddressParts.join('.');
|
||||
const inputNetworkAddress = networkAddressParts.join('.');
|
||||
// 比较目标 IP 的网络地址和给定的网络地址是否相同,并检查是否在同一网络范围内
|
||||
return calculatedNetworkAddress === inputNetworkAddress && subnetMask === '24';
|
||||
} // 检查目标ip是否属于指定的网段范围内
|
||||
transmit(packet: SimPacket) {
|
||||
this.interface.forEach((item: Symbol) => {
|
||||
let obj = packet.allSimObj.find(obj => obj.objID === item);
|
||||
if (item != null) {
|
||||
if (item != packet.upJump && this.routerTable.some(table => table.net === packet.destinationIp)) {
|
||||
const pac = new SimPacket(packet.sourceIp, packet.sourceMac, packet.destinationIp, packet.destinationMac, packet.message, packet.allSimObj, packet.allSimPacket);
|
||||
pac.level = packet.level + 1;
|
||||
pac.upJump = this.objID;
|
||||
pac.points.push([this.objX, this.objY]);
|
||||
packet.allSimPacket.push(pac);
|
||||
obj.receive(pac);
|
||||
}
|
||||
}
|
||||
});
|
||||
} // 路由器转发数据包
|
||||
receive(packet: SimPacket) {
|
||||
updatePacketLog(`路由器-${this.objLabel}接受到数据,将进行转发!`);
|
||||
packet.points.push([this.objX, this.objY]);
|
||||
try {
|
||||
this.checkDestinationIp(packet.destinationIp, this.Ip);
|
||||
}
|
||||
catch (e) {
|
||||
console.log('packet router err:' + JSON.stringify(e));
|
||||
}
|
||||
this.transmit(packet);
|
||||
} // 收到数据包
|
||||
getTableConfig(): string {
|
||||
let str = "";
|
||||
const routerTables = this.routerTable;
|
||||
for (let router of routerTables) {
|
||||
str += `接口号: ${router['node_ifs']}\n`;
|
||||
str += `网段号: ${router['segment']}\n`;
|
||||
}
|
||||
return str;
|
||||
} // 获取路由表配置信息用于展示
|
||||
}
|
||||
@Observed
|
||||
export class SimSwitch extends SimBase {
|
||||
macTable: object[];
|
||||
constructor(x: number, y: number, config: any = null) {
|
||||
super(x, y, config);
|
||||
this.objType = 3;
|
||||
this.objLabel = this.setDefaultName();
|
||||
this.interface = [null, null, null, null]; // 路由器有四个接口
|
||||
this.connections = [null, null, null, null]; // 四个接口对应四根连接线
|
||||
this.img = { "id": 16777233, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" }; // 交换机图片
|
||||
this.imgTm = { "id": 16777230, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" }; // 交换机配置成功图片
|
||||
this.Mac = "";
|
||||
this.switchTable = [];
|
||||
}
|
||||
setDefaultName() {
|
||||
return `SSW${++SimBase.flag}`;
|
||||
} // 生成组件默认名称
|
||||
transmit(packet: SimPacket) {
|
||||
this.interface.forEach((item: Symbol) => {
|
||||
let obj = packet.allSimObj.find(obj => obj.objID === item);
|
||||
if (item != null) {
|
||||
if (item != packet.upJump && this.switchTable.some(table => table.net === packet.destinationMac)) {
|
||||
const pac = new SimPacket(packet.sourceIp, packet.sourceMac, packet.destinationIp, packet.destinationMac, packet.message, packet.allSimObj, packet.allSimPacket);
|
||||
pac.level = packet.level + 1;
|
||||
pac.upJump = this.objID;
|
||||
pac.points.push([this.objX, this.objY]);
|
||||
packet.allSimPacket.push(pac);
|
||||
obj.receive(pac);
|
||||
}
|
||||
}
|
||||
});
|
||||
} // 交换机转发数据包
|
||||
receive(packet: SimPacket) {
|
||||
updatePacketLog(`交换机-${this.objLabel}接受到数据,将进行转发!`);
|
||||
packet.points.push([this.objX, this.objY]);
|
||||
this.transmit(packet);
|
||||
} // 收到数据包
|
||||
getTableConfig(): string {
|
||||
let str = "";
|
||||
const macTables = this.macTable;
|
||||
for (const router of macTables) {
|
||||
str += `接口号: ${router['node_ifs']}\n`;
|
||||
str += `网段号: ${router['mac']}\n`;
|
||||
}
|
||||
return str;
|
||||
} // 获取交换机表配置信息用于展示
|
||||
}
|
||||
@Observed
|
||||
export class SimHub extends SimBase {
|
||||
constructor(x: number, y: number, config: any = null) {
|
||||
super(x, y, config);
|
||||
this.objType = 4;
|
||||
this.objLabel = this.setDefaultName();
|
||||
this.interface = [null, null, null, null]; // 路由器有四个接口
|
||||
this.connections = [null, null, null, null]; // 四个接口对应四根连接线
|
||||
this.img = { "id": 16777227, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" }; // 集线器图片
|
||||
this.imgTm = { "id": 16777226, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" }; // 集线器配置成功图片
|
||||
}
|
||||
setDefaultName(): string {
|
||||
return `SHU${++SimBase.flag}`; // 生成组件默认名称
|
||||
}
|
||||
transmit(packet: SimPacket): void {
|
||||
this.interface.forEach((item: Symbol, index) => {
|
||||
let obj = packet.allSimObj.find(obj => obj.objID === item);
|
||||
if (item != null) {
|
||||
if (item != packet.upJump) {
|
||||
const pac = new SimPacket(packet.sourceIp, packet.sourceMac, packet.destinationIp, packet.destinationMac, packet.message, packet.allSimObj, packet.allSimPacket);
|
||||
pac.level = packet.level + 1;
|
||||
pac.upJump = this.objID;
|
||||
pac.points.push([this.objX, this.objY]);
|
||||
packet.allSimPacket.push(pac);
|
||||
obj.receive(pac);
|
||||
}
|
||||
}
|
||||
});
|
||||
} // 集线器转发数据包
|
||||
receive(packet: SimPacket): void {
|
||||
updatePacketLog(`集线器-${this.objLabel}接受到数据,将进行转发!`);
|
||||
packet.points.push([this.objX, this.objY]);
|
||||
this.transmit(packet);
|
||||
} // 收到数据包
|
||||
}
|
||||
function getNewDate() {
|
||||
return new Date().toLocaleString() + '\t';
|
||||
} // 获取当前时间
|
||||
function updatePacketLog(text: string) {
|
||||
let logText = AppStorage.get('LogText');
|
||||
logText = logText + getNewDate() + text + '\n';
|
||||
AppStorage.set('LogText', logText);
|
||||
console.log(text);
|
||||
} // 更新主页面底部日志信息
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/SimBase.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/SimBase.protoBin
vendored
Normal file
Binary file not shown.
58
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/SimBase.ts
vendored
Normal file
58
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/SimBase.ts
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
import type { SimPacket } from './OtherSimObjects';
|
||||
// 路由表和mac表项
|
||||
export interface Table {
|
||||
port: number; // 设备哪个端口
|
||||
net: string; // 连接哪个网络或设备(下一跳可到达网段或设备mac地址)
|
||||
}
|
||||
@Observed
|
||||
export class SimBase {
|
||||
static flag = 0; // 当前仿真对象数量
|
||||
configCorrect: boolean; // 是否配置正确
|
||||
objType: number | null; // 对象类型,1为主机,2为路由器,3为交换机,4为集线器
|
||||
Ip: string | null; // ip地址
|
||||
Mac: string | null; // mac地址
|
||||
routerTable: Array<Table> | null; // 路由表
|
||||
switchTable: Array<Table> | null; // 交换表
|
||||
objLabel: string; // 对象标签
|
||||
objID: Symbol; // 使用symbol()生成对象唯一标识
|
||||
objX: number; // x坐标
|
||||
objY: number; // y坐标
|
||||
img: Resource | null; // 仿真对象图片
|
||||
imgTm: Resource | null; // 仿真对象配置成功图片
|
||||
interface: Array<any>; // 接口网络配置信息
|
||||
connections: Array<any>; // 连接线对象
|
||||
isChose: boolean; // 是否被选中
|
||||
constructor(x: number, y: number, type: number) {
|
||||
this.configCorrect = false;
|
||||
this.objType = type;
|
||||
this.objID = Symbol();
|
||||
this.objX = x;
|
||||
this.objY = y;
|
||||
this.isChose = false;
|
||||
}
|
||||
setDefaultName(): string {
|
||||
let header: string = "";
|
||||
if (this.objType == 1) {
|
||||
header = "SHO";
|
||||
}
|
||||
else if (this.objType == 2) {
|
||||
header = "SRO";
|
||||
}
|
||||
else if (this.objType == 3) {
|
||||
header = "SSW";
|
||||
}
|
||||
else {
|
||||
header = "SHU";
|
||||
}
|
||||
return `${header}${++SimBase.flag}`;
|
||||
} // 生成组件默认名称
|
||||
receive(packet: SimPacket) {
|
||||
} // 发送数据包
|
||||
createPacket(ip: string, mac: string, message: string, allSimObj: SimBase[], allSimPacket: SimPacket[]) {
|
||||
} // 创建数据包
|
||||
transmit(packet: SimPacket) {
|
||||
} // 转发数据包
|
||||
changeIsChose() {
|
||||
this.isChose = !this.isChose;
|
||||
}
|
||||
}
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/TopMenu.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/TopMenu.protoBin
vendored
Normal file
Binary file not shown.
16
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/TopMenu.ts
vendored
Normal file
16
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/classes/TopMenu.ts
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export class TopMenu {
|
||||
title: string;
|
||||
menuItemArr: TopMenuItem[] | undefined;
|
||||
constructor(title: string, menuItemArr?: TopMenuItem[]) {
|
||||
this.title = title;
|
||||
this.menuItemArr = menuItemArr;
|
||||
}
|
||||
} // 顶部菜单类
|
||||
export class TopMenuItem {
|
||||
title: string;
|
||||
fun: Function | undefined;
|
||||
constructor(title: string, fun?: Function) {
|
||||
this.title = title;
|
||||
this.fun = fun;
|
||||
}
|
||||
} // 顶部菜单选项类
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/ButtomMenuBar.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/ButtomMenuBar.protoBin
vendored
Normal file
Binary file not shown.
263
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/ButtomMenuBar.ts
vendored
Normal file
263
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/ButtomMenuBar.ts
vendored
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
interface BottomMenuBar_Params {
|
||||
simClickObjArr?: SimClickObj[];
|
||||
allSimObj?: SimBase[] // 仿真对象数组
|
||||
;
|
||||
isNewObj?: boolean // 是否新增对象
|
||||
;
|
||||
newObjType?: number // 新增对象类型
|
||||
;
|
||||
choseIndex?: number | null // 选中对象下标
|
||||
;
|
||||
TempConn?: any[] // 是否正在新增连接线
|
||||
;
|
||||
isNewConn?: boolean // 选中连接线下标
|
||||
;
|
||||
scroller?: Scroller;
|
||||
LogText?: string;
|
||||
}
|
||||
import type { SimBase } from '../classes/SimBase';
|
||||
interface SimClickObj {
|
||||
name: string;
|
||||
image: Resource;
|
||||
type: number;
|
||||
}
|
||||
export class BottomMenuBar extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.simClickObjArr = [
|
||||
{
|
||||
name: '主机',
|
||||
image: { "id": 16777224, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" },
|
||||
type: 1
|
||||
},
|
||||
{
|
||||
name: '路由器',
|
||||
image: { "id": 16777221, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" },
|
||||
type: 2
|
||||
},
|
||||
{
|
||||
name: '交换器',
|
||||
image: { "id": 16777233, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" },
|
||||
type: 3
|
||||
},
|
||||
{
|
||||
name: '集线器',
|
||||
image: { "id": 16777227, "type": 20000, params: [], "bundleName": "com.example.ensp2", "moduleName": "entry" },
|
||||
type: 4
|
||||
},
|
||||
] // 底部菜单栏数组
|
||||
;
|
||||
this.__allSimObj = this.initializeConsume("allSimObj", "allSimObj");
|
||||
this.__isNewObj = this.initializeConsume("isNewObj", "isNewObj");
|
||||
this.__newObjType = this.initializeConsume("newObjType", "newObjType");
|
||||
this.__choseIndex = this.initializeConsume("choseIndex", "choseIndex");
|
||||
this.__TempConn = this.initializeConsume("TempConn", "TempConn");
|
||||
this.__isNewConn = this.initializeConsume("isNewConn", "isNewConn");
|
||||
this.scroller = new Scroller();
|
||||
this.__LogText = this.createStorageLink('LogText', '', "LogText");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: BottomMenuBar_Params) {
|
||||
if (params.simClickObjArr !== undefined) {
|
||||
this.simClickObjArr = params.simClickObjArr;
|
||||
}
|
||||
if (params.scroller !== undefined) {
|
||||
this.scroller = params.scroller;
|
||||
}
|
||||
}
|
||||
updateStateVars(params: BottomMenuBar_Params) {
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__allSimObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isNewObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__newObjType.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__choseIndex.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__TempConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isNewConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__LogText.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__allSimObj.aboutToBeDeleted();
|
||||
this.__isNewObj.aboutToBeDeleted();
|
||||
this.__newObjType.aboutToBeDeleted();
|
||||
this.__choseIndex.aboutToBeDeleted();
|
||||
this.__TempConn.aboutToBeDeleted();
|
||||
this.__isNewConn.aboutToBeDeleted();
|
||||
this.__LogText.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private simClickObjArr: SimClickObj[]; // 底部菜单栏数组
|
||||
private __allSimObj: ObservedPropertyAbstractPU<SimBase[]>; // 仿真对象数组
|
||||
get allSimObj() {
|
||||
return this.__allSimObj.get();
|
||||
}
|
||||
set allSimObj(newValue: SimBase[] // 仿真对象数组
|
||||
) {
|
||||
this.__allSimObj.set(newValue);
|
||||
}
|
||||
private __isNewObj: ObservedPropertyAbstractPU<boolean>; // 是否新增对象
|
||||
get isNewObj() {
|
||||
return this.__isNewObj.get();
|
||||
}
|
||||
set isNewObj(newValue: boolean // 是否新增对象
|
||||
) {
|
||||
this.__isNewObj.set(newValue);
|
||||
}
|
||||
private __newObjType: ObservedPropertyAbstractPU<number>; // 新增对象类型
|
||||
get newObjType() {
|
||||
return this.__newObjType.get();
|
||||
}
|
||||
set newObjType(newValue: number // 新增对象类型
|
||||
) {
|
||||
this.__newObjType.set(newValue);
|
||||
}
|
||||
private __choseIndex: ObservedPropertyAbstractPU<number | null>; // 选中对象下标
|
||||
get choseIndex() {
|
||||
return this.__choseIndex.get();
|
||||
}
|
||||
set choseIndex(newValue: number | null // 选中对象下标
|
||||
) {
|
||||
this.__choseIndex.set(newValue);
|
||||
}
|
||||
private __TempConn: ObservedPropertyAbstractPU<any[]>; // 是否正在新增连接线
|
||||
get TempConn() {
|
||||
return this.__TempConn.get();
|
||||
}
|
||||
set TempConn(newValue: any[] // 是否正在新增连接线
|
||||
) {
|
||||
this.__TempConn.set(newValue);
|
||||
}
|
||||
private __isNewConn: ObservedPropertyAbstractPU<boolean>; // 选中连接线下标
|
||||
get isNewConn() {
|
||||
return this.__isNewConn.get();
|
||||
}
|
||||
set isNewConn(newValue: boolean // 选中连接线下标
|
||||
) {
|
||||
this.__isNewConn.set(newValue);
|
||||
}
|
||||
private scroller: Scroller;
|
||||
private __LogText: ObservedPropertyAbstractPU<string>;
|
||||
get LogText() {
|
||||
return this.__LogText.get();
|
||||
}
|
||||
set LogText(newValue: string) {
|
||||
this.__LogText.set(newValue);
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create({ space: 10 });
|
||||
Row.debugLine("components/ButtomMenuBar.ets(44:5)");
|
||||
Row.layoutWeight(1);
|
||||
Row.margin({ left: '5%' });
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
ForEach.create();
|
||||
const forEachItemGenFunction = _item => {
|
||||
const item = _item;
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/ButtomMenuBar.ets(46:9)");
|
||||
Column.margin({ top: 5 });
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Image.create(item.image);
|
||||
Image.debugLine("components/ButtomMenuBar.ets(47:11)");
|
||||
Image.border({
|
||||
color: item.type == this.newObjType && this.isNewObj ? Color.Red : Color.Transparent,
|
||||
width: 1
|
||||
});
|
||||
Image.width(50);
|
||||
Image.onClick(() => {
|
||||
this.isNewConn = false;
|
||||
this.TempConn = [];
|
||||
if (!this.isNewObj) { // 选择创建对象
|
||||
this.isNewObj = true;
|
||||
this.newObjType = item.type;
|
||||
}
|
||||
else if (this.newObjType != item.type) { // 选择创建其他对象
|
||||
this.newObjType = item.type;
|
||||
}
|
||||
else { // 取消选择
|
||||
this.isNewObj = false;
|
||||
this.newObjType = -1;
|
||||
}
|
||||
this.allSimObj.forEach(item => {
|
||||
item.isChose = false;
|
||||
}); // 创建对象时必须全部设置为非选中状态
|
||||
this.choseIndex = null;
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Image.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create(item.name);
|
||||
Text.debugLine("components/ButtomMenuBar.ets(70:11)");
|
||||
Text.fontWeight(FontWeight.Bold);
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
Column.pop();
|
||||
};
|
||||
this.forEachUpdateFunction(elmtId, this.simClickObjArr, forEachItemGenFunction);
|
||||
if (!isInitialRender) {
|
||||
ForEach.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
ForEach.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Scroll.create(this.scroller);
|
||||
Scroll.debugLine("components/ButtomMenuBar.ets(76:7)");
|
||||
Scroll.border({
|
||||
color: Color.Black,
|
||||
width: 1
|
||||
});
|
||||
Scroll.layoutWeight(1);
|
||||
Scroll.height('100%');
|
||||
Scroll.margin(2);
|
||||
if (!isInitialRender) {
|
||||
Scroll.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create(this.LogText);
|
||||
Text.debugLine("components/ButtomMenuBar.ets(77:9)");
|
||||
Text.fontSize(15);
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
Scroll.pop();
|
||||
Row.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/Dialog.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/Dialog.protoBin
vendored
Normal file
Binary file not shown.
1512
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/Dialog.ts
vendored
Normal file
1512
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/Dialog.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/LabelRevise.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/LabelRevise.protoBin
vendored
Normal file
Binary file not shown.
163
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/LabelRevise.ts
vendored
Normal file
163
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/LabelRevise.ts
vendored
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
interface LabelRevise_Params {
|
||||
controller?: CustomDialogController;
|
||||
simObj?: SimBase;
|
||||
newLabel?: string;
|
||||
}
|
||||
import type { SimBase } from "../classes/SimBase";
|
||||
export class LabelRevise extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.controller = undefined;
|
||||
this.__simObj = new SynchedPropertyNesedObjectPU(params.simObj, this, "simObj");
|
||||
this.__newLabel = new ObservedPropertySimplePU("", this, "newLabel");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: LabelRevise_Params) {
|
||||
if (params.controller !== undefined) {
|
||||
this.controller = params.controller;
|
||||
}
|
||||
this.__simObj.set(params.simObj);
|
||||
if (params.newLabel !== undefined) {
|
||||
this.newLabel = params.newLabel;
|
||||
}
|
||||
}
|
||||
updateStateVars(params: LabelRevise_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__simObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__newLabel.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__simObj.aboutToBeDeleted();
|
||||
this.__newLabel.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private controller: CustomDialogController;
|
||||
setController(ctr: CustomDialogController) {
|
||||
this.controller = ctr;
|
||||
}
|
||||
private __simObj: SynchedPropertyNesedObjectPU<SimBase>;
|
||||
get simObj() {
|
||||
return this.__simObj.get();
|
||||
}
|
||||
private __newLabel: ObservedPropertySimplePU<string>;
|
||||
get newLabel() {
|
||||
return this.__newLabel.get();
|
||||
}
|
||||
set newLabel(newValue: string) {
|
||||
this.__newLabel.set(newValue);
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/LabelRevise.ets(10:5)");
|
||||
Column.backgroundColor(Color.White);
|
||||
Column.justifyContent(FlexAlign.Center);
|
||||
Column.alignItems(HorizontalAlign.Center);
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create("原标签: " + this.simObj.objLabel);
|
||||
Text.debugLine("components/LabelRevise.ets(11:7)");
|
||||
Text.fontSize(30);
|
||||
Text.fontColor(Color.Gray);
|
||||
Text.width("80%");
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/LabelRevise.ets(16:7)");
|
||||
Row.width("80%");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create("新标签:");
|
||||
Text.debugLine("components/LabelRevise.ets(17:9)");
|
||||
Text.fontSize(30);
|
||||
Text.fontColor(Color.Gray);
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入新标签" });
|
||||
TextInput.debugLine("components/LabelRevise.ets(21:9)");
|
||||
TextInput.onChange((value) => {
|
||||
this.newLabel = value;
|
||||
});
|
||||
TextInput.width("70%");
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Row.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create({ space: 30 });
|
||||
Row.debugLine("components/LabelRevise.ets(29:7)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel("确定");
|
||||
Button.debugLine("components/LabelRevise.ets(30:9)");
|
||||
Button.onClick(() => {
|
||||
this.simObj.objLabel = this.newLabel;
|
||||
this.controller.close();
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
// .margin({ left: , right: })
|
||||
Button.createWithLabel("取消");
|
||||
Button.debugLine("components/LabelRevise.ets(37:9)");
|
||||
// .margin({ left: , right: })
|
||||
Button.onClick(() => {
|
||||
this.controller.close();
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
// .margin({ left: , right: })
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
// .margin({ left: , right: })
|
||||
Button.pop();
|
||||
Row.pop();
|
||||
Column.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/MiddleCanvas.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/MiddleCanvas.protoBin
vendored
Normal file
Binary file not shown.
672
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/MiddleCanvas.ts
vendored
Normal file
672
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/MiddleCanvas.ts
vendored
Normal file
|
|
@ -0,0 +1,672 @@
|
|||
interface CreateLabel_Params {
|
||||
simObj?: SimBase;
|
||||
}
|
||||
interface CreateImg_Params {
|
||||
allSimObj?: SimBase[];
|
||||
allSimConn?: AllSimConnect[];
|
||||
simObj?: SimBase;
|
||||
isNew?: boolean;
|
||||
newObjType?: number;
|
||||
choseIndex?: number | null;
|
||||
isConn?: boolean;
|
||||
TempConn?: any[];
|
||||
thisIndex?: number;
|
||||
}
|
||||
interface CreateCon_Params {
|
||||
objS?: SimBase;
|
||||
objE?: SimBase;
|
||||
}
|
||||
interface MiddleCanvas_Params {
|
||||
allSimObj?: SimBase[] //仿真对象数组
|
||||
;
|
||||
allSimConn?: AllSimConnect[] //仿真连接线数组
|
||||
;
|
||||
isNew?: boolean //是否插入新增对象
|
||||
;
|
||||
newObjType?: number //新增对象类型
|
||||
;
|
||||
choseIndex?: number | null //选中对象下标
|
||||
;
|
||||
isConn?: boolean //是否正在新增连接线
|
||||
;
|
||||
TempConn?: any[] //临时连接线对象
|
||||
;
|
||||
}
|
||||
import { AllSimConnect } from "@bundle:com.example.ensp2/entry/ets/classes/OtherSimObjects";
|
||||
import { SimBase } from "@bundle:com.example.ensp2/entry/ets/classes/SimBase";
|
||||
export class MiddleCanvas extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.__allSimObj = this.initializeConsume("allSimObj", "allSimObj");
|
||||
this.__allSimConn = this.initializeConsume("allSimConn", "allSimConn");
|
||||
this.__isNew = this.initializeConsume("isNew", "isNew");
|
||||
this.__newObjType = this.initializeConsume("newObjType", "newObjType");
|
||||
this.__choseIndex = this.initializeConsume("choseIndex", "choseIndex");
|
||||
this.__isConn = this.initializeConsume("isConn", "isConn");
|
||||
this.__TempConn = this.initializeConsume("TempConn", "TempConn");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: MiddleCanvas_Params) {
|
||||
}
|
||||
updateStateVars(params: MiddleCanvas_Params) {
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__allSimObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__allSimConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isNew.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__newObjType.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__choseIndex.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__TempConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__allSimObj.aboutToBeDeleted();
|
||||
this.__allSimConn.aboutToBeDeleted();
|
||||
this.__isNew.aboutToBeDeleted();
|
||||
this.__newObjType.aboutToBeDeleted();
|
||||
this.__choseIndex.aboutToBeDeleted();
|
||||
this.__isConn.aboutToBeDeleted();
|
||||
this.__TempConn.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private __allSimObj: ObservedPropertyAbstractPU<SimBase[]>; //仿真对象数组
|
||||
get allSimObj() {
|
||||
return this.__allSimObj.get();
|
||||
}
|
||||
set allSimObj(newValue: SimBase[] //仿真对象数组
|
||||
) {
|
||||
this.__allSimObj.set(newValue);
|
||||
}
|
||||
private __allSimConn: ObservedPropertyAbstractPU<AllSimConnect[]>; //仿真连接线数组
|
||||
get allSimConn() {
|
||||
return this.__allSimConn.get();
|
||||
}
|
||||
set allSimConn(newValue: AllSimConnect[] //仿真连接线数组
|
||||
) {
|
||||
this.__allSimConn.set(newValue);
|
||||
}
|
||||
private __isNew: ObservedPropertyAbstractPU<boolean>; //是否插入新增对象
|
||||
get isNew() {
|
||||
return this.__isNew.get();
|
||||
}
|
||||
set isNew(newValue: boolean //是否插入新增对象
|
||||
) {
|
||||
this.__isNew.set(newValue);
|
||||
}
|
||||
private __newObjType: ObservedPropertyAbstractPU<number>; //新增对象类型
|
||||
get newObjType() {
|
||||
return this.__newObjType.get();
|
||||
}
|
||||
set newObjType(newValue: number //新增对象类型
|
||||
) {
|
||||
this.__newObjType.set(newValue);
|
||||
}
|
||||
private __choseIndex: ObservedPropertyAbstractPU<number | null>; //选中对象下标
|
||||
get choseIndex() {
|
||||
return this.__choseIndex.get();
|
||||
}
|
||||
set choseIndex(newValue: number | null //选中对象下标
|
||||
) {
|
||||
this.__choseIndex.set(newValue);
|
||||
}
|
||||
private __isConn: ObservedPropertyAbstractPU<boolean>; //是否正在新增连接线
|
||||
get isConn() {
|
||||
return this.__isConn.get();
|
||||
}
|
||||
set isConn(newValue: boolean //是否正在新增连接线
|
||||
) {
|
||||
this.__isConn.set(newValue);
|
||||
}
|
||||
private __TempConn: ObservedPropertyAbstractPU<any[]>; //临时连接线对象
|
||||
get TempConn() {
|
||||
return this.__TempConn.get();
|
||||
}
|
||||
set TempConn(newValue: any[] //临时连接线对象
|
||||
) {
|
||||
this.__TempConn.set(newValue);
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/MiddleCanvas.ets(15:5)");
|
||||
Row.width('100%');
|
||||
Row.height('74%');
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
//画布
|
||||
Stack.create();
|
||||
Stack.debugLine("components/MiddleCanvas.ets(17:7)");
|
||||
//画布
|
||||
Stack.onClick((event: ClickEvent) => {
|
||||
if (this.isNew) { //若要插入新增对象
|
||||
const obj = new SimBase(event.windowX - 20, event.windowY - 55, this.newObjType);
|
||||
this.allSimObj.push(obj); //插入并绘制新增对象
|
||||
}
|
||||
else if (!this.isNew && this.allSimObj.some(item => item.isChose == true)) {
|
||||
this.allSimObj[this.choseIndex].objX = event.windowX - 20; //更新X坐标
|
||||
this.allSimObj[this.choseIndex].objY = event.windowY - 55; //更新Y坐标
|
||||
this.allSimObj[this.choseIndex].isChose = false; //更新选中状态为未选中
|
||||
}
|
||||
this.choseIndex = null; //取消选中下标
|
||||
this.isNew = false; //取消新增状态
|
||||
this.newObjType = -1; //取消新增类型
|
||||
});
|
||||
//画布
|
||||
Stack.width('78%');
|
||||
//画布
|
||||
Stack.height('100%');
|
||||
//画布
|
||||
Stack.border({ color: Color.Black, width: 1 });
|
||||
if (!isInitialRender) {
|
||||
//画布
|
||||
Stack.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
ForEach.create();
|
||||
const forEachItemGenFunction = _item => {
|
||||
const item = _item;
|
||||
{
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
if (isInitialRender) {
|
||||
let paramsLambda = () => {
|
||||
return {
|
||||
objS: item.nObjS as SimBase,
|
||||
objE: item.nObjE as SimBase
|
||||
};
|
||||
};
|
||||
ViewPU.create(new CreateCon(this, { objS: item.nObjS as SimBase, objE: item.nObjE as SimBase }, undefined, elmtId, paramsLambda));
|
||||
}
|
||||
else {
|
||||
this.updateStateVarsOfChildByElmtId(elmtId, {
|
||||
objS: item.nObjS as SimBase, objE: item.nObjE as SimBase
|
||||
});
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
}
|
||||
};
|
||||
this.forEachUpdateFunction(elmtId, this.allSimConn, forEachItemGenFunction);
|
||||
if (!isInitialRender) {
|
||||
ForEach.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
ForEach.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
ForEach.create();
|
||||
const forEachItemGenFunction = (_item, index) => {
|
||||
const item = _item;
|
||||
{
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
if (isInitialRender) {
|
||||
let paramsLambda = () => {
|
||||
return {
|
||||
simObj: item,
|
||||
thisIndex: index
|
||||
};
|
||||
};
|
||||
ViewPU.create(new CreateImg(this, { simObj: item, thisIndex: index }, undefined, elmtId, paramsLambda));
|
||||
}
|
||||
else {
|
||||
this.updateStateVarsOfChildByElmtId(elmtId, {
|
||||
simObj: item
|
||||
});
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
}
|
||||
{
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
if (isInitialRender) {
|
||||
let paramsLambda = () => {
|
||||
return {
|
||||
simObj: item
|
||||
};
|
||||
};
|
||||
ViewPU.create(new CreateLabel(this, { simObj: item }, undefined, elmtId, paramsLambda));
|
||||
}
|
||||
else {
|
||||
this.updateStateVarsOfChildByElmtId(elmtId, {
|
||||
simObj: item
|
||||
});
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
}
|
||||
};
|
||||
this.forEachUpdateFunction(elmtId, this.allSimObj, forEachItemGenFunction, undefined, true, false);
|
||||
if (!isInitialRender) {
|
||||
ForEach.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
ForEach.pop();
|
||||
//画布
|
||||
Stack.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
//配置信息展示
|
||||
Column.create({ space: 3 });
|
||||
Column.debugLine("components/MiddleCanvas.ets(45:7)");
|
||||
//配置信息展示
|
||||
Column.padding(2);
|
||||
//配置信息展示
|
||||
Column.justifyContent(FlexAlign.SpaceBetween);
|
||||
//配置信息展示
|
||||
Column.layoutWeight(1);
|
||||
if (!isInitialRender) {
|
||||
//配置信息展示
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/MiddleCanvas.ets(46:9)");
|
||||
Column.width('100%');
|
||||
Column.height('50%');
|
||||
Column.border({ color: Color.Orange, width: 1 });
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create('网络配置信息');
|
||||
Text.debugLine("components/MiddleCanvas.ets(47:11)");
|
||||
Text.fontSize(21);
|
||||
Text.fontWeight(FontWeight.Bold);
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
Column.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/MiddleCanvas.ets(55:9)");
|
||||
Column.width('100%');
|
||||
Column.height('50%');
|
||||
Column.border({ color: Color.Orange, width: 1 });
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create('路由/交换表信息');
|
||||
Text.debugLine("components/MiddleCanvas.ets(56:11)");
|
||||
Text.fontSize(21);
|
||||
Text.fontWeight(FontWeight.Bold);
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
Column.pop();
|
||||
//配置信息展示
|
||||
Column.pop();
|
||||
Row.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
class CreateCon extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.__objS = new SynchedPropertyNesedObjectPU(params.objS, this, "objS");
|
||||
this.__objE = new SynchedPropertyNesedObjectPU(params.objE, this, "objE");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: CreateCon_Params) {
|
||||
this.__objS.set(params.objS);
|
||||
this.__objE.set(params.objE);
|
||||
}
|
||||
updateStateVars(params: CreateCon_Params) {
|
||||
this.__objS.set(params.objS);
|
||||
this.__objE.set(params.objE);
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__objS.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__objE.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__objS.aboutToBeDeleted();
|
||||
this.__objE.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private __objS: SynchedPropertyNesedObjectPU<SimBase>;
|
||||
get objS() {
|
||||
return this.__objS.get();
|
||||
}
|
||||
private __objE: SynchedPropertyNesedObjectPU<SimBase>;
|
||||
get objE() {
|
||||
return this.__objE.get();
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Line.create();
|
||||
Line.debugLine("components/MiddleCanvas.ets(79:5)");
|
||||
Line.width('100%');
|
||||
Line.height('100%');
|
||||
Line.stroke(Color.Black);
|
||||
Line.startPoint([this.objS.objX + 25, this.objS.objY + 25]);
|
||||
Line.endPoint([this.objE.objX + 25, this.objE.objY + 25]);
|
||||
if (!isInitialRender) {
|
||||
Line.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
class CreateImg extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.__allSimObj = this.initializeConsume("allSimObj", "allSimObj");
|
||||
this.__allSimConn = this.initializeConsume("allSimConn", "allSimConn");
|
||||
this.__simObj = new SynchedPropertyNesedObjectPU(params.simObj, this, "simObj");
|
||||
this.__isNew = this.initializeConsume("isNew", "isNew");
|
||||
this.__newObjType = this.initializeConsume("newObjType", "newObjType");
|
||||
this.__choseIndex = this.initializeConsume("choseIndex", "choseIndex");
|
||||
this.__isConn = this.initializeConsume("isConn", "isConn");
|
||||
this.__TempConn = this.initializeConsume("TempConn", "TempConn");
|
||||
this.thisIndex = undefined;
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: CreateImg_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
if (params.thisIndex !== undefined) {
|
||||
this.thisIndex = params.thisIndex;
|
||||
}
|
||||
}
|
||||
updateStateVars(params: CreateImg_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__allSimObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__allSimConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__simObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isNew.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__newObjType.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__choseIndex.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__TempConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__allSimObj.aboutToBeDeleted();
|
||||
this.__allSimConn.aboutToBeDeleted();
|
||||
this.__simObj.aboutToBeDeleted();
|
||||
this.__isNew.aboutToBeDeleted();
|
||||
this.__newObjType.aboutToBeDeleted();
|
||||
this.__choseIndex.aboutToBeDeleted();
|
||||
this.__isConn.aboutToBeDeleted();
|
||||
this.__TempConn.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private __allSimObj: ObservedPropertyAbstractPU<SimBase[]>;
|
||||
get allSimObj() {
|
||||
return this.__allSimObj.get();
|
||||
}
|
||||
set allSimObj(newValue: SimBase[]) {
|
||||
this.__allSimObj.set(newValue);
|
||||
}
|
||||
private __allSimConn: ObservedPropertyAbstractPU<AllSimConnect[]>;
|
||||
get allSimConn() {
|
||||
return this.__allSimConn.get();
|
||||
}
|
||||
set allSimConn(newValue: AllSimConnect[]) {
|
||||
this.__allSimConn.set(newValue);
|
||||
}
|
||||
private __simObj: SynchedPropertyNesedObjectPU<SimBase>;
|
||||
get simObj() {
|
||||
return this.__simObj.get();
|
||||
}
|
||||
private __isNew: ObservedPropertyAbstractPU<boolean>;
|
||||
get isNew() {
|
||||
return this.__isNew.get();
|
||||
}
|
||||
set isNew(newValue: boolean) {
|
||||
this.__isNew.set(newValue);
|
||||
}
|
||||
private __newObjType: ObservedPropertyAbstractPU<number>;
|
||||
get newObjType() {
|
||||
return this.__newObjType.get();
|
||||
}
|
||||
set newObjType(newValue: number) {
|
||||
this.__newObjType.set(newValue);
|
||||
}
|
||||
private __choseIndex: ObservedPropertyAbstractPU<number | null>;
|
||||
get choseIndex() {
|
||||
return this.__choseIndex.get();
|
||||
}
|
||||
set choseIndex(newValue: number | null) {
|
||||
this.__choseIndex.set(newValue);
|
||||
}
|
||||
private __isConn: ObservedPropertyAbstractPU<boolean>;
|
||||
get isConn() {
|
||||
return this.__isConn.get();
|
||||
}
|
||||
set isConn(newValue: boolean) {
|
||||
this.__isConn.set(newValue);
|
||||
}
|
||||
private __TempConn: ObservedPropertyAbstractPU<any[]>;
|
||||
get TempConn() {
|
||||
return this.__TempConn.get();
|
||||
}
|
||||
set TempConn(newValue: any[]) {
|
||||
this.__TempConn.set(newValue);
|
||||
}
|
||||
private thisIndex: number;
|
||||
InterfaceMenu(parent = null) {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Menu.create();
|
||||
Menu.debugLine("components/MiddleCanvas.ets(102:5)");
|
||||
Menu.radius(8);
|
||||
if (!isInitialRender) {
|
||||
Menu.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
ForEach.create();
|
||||
const forEachItemGenFunction = (_item, index) => {
|
||||
const item = _item;
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
If.create();
|
||||
if (item == null) {
|
||||
this.ifElseBranchUpdateFunction(0, () => {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
MenuItem.create({ content: '接口' + (index + 1).toString() });
|
||||
MenuItem.debugLine("components/MiddleCanvas.ets(105:11)");
|
||||
MenuItem.width(70);
|
||||
MenuItem.height(30);
|
||||
MenuItem.contentFont({ size: 14 });
|
||||
MenuItem.onChange(() => {
|
||||
if (!this.isConn) {
|
||||
this.TempConn.push(this.allSimObj[this.thisIndex]);
|
||||
this.TempConn.push(index + 1);
|
||||
}
|
||||
else {
|
||||
this.allSimConn.push(new AllSimConnect(this.TempConn[0], this.TempConn[1], this.allSimObj[this.thisIndex], index + 1));
|
||||
this.TempConn = [];
|
||||
}
|
||||
this.isConn = !this.isConn;
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
MenuItem.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
MenuItem.pop();
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.ifElseBranchUpdateFunction(1, () => {
|
||||
});
|
||||
}
|
||||
if (!isInitialRender) {
|
||||
If.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
If.pop();
|
||||
};
|
||||
this.forEachUpdateFunction(elmtId, this.simObj.interface, forEachItemGenFunction, undefined, true, false);
|
||||
if (!isInitialRender) {
|
||||
ForEach.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
ForEach.pop();
|
||||
Menu.pop();
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/MiddleCanvas.ets(126:5)");
|
||||
Column.position({ x: this.simObj.objX, y: this.simObj.objY });
|
||||
Column.bindContextMenu({ builder: () => {
|
||||
this.InterfaceMenu.call(this);
|
||||
} }, ResponseType.LongPress);
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Image.create(this.simObj.img);
|
||||
Image.debugLine("components/MiddleCanvas.ets(127:7)");
|
||||
Image.width(50);
|
||||
Image.border({ color: this.simObj.isChose ? Color.Red : Color.Transparent, width: 1 });
|
||||
Image.onClick(() => {
|
||||
this.isNew = false; //取消插入新对象状态
|
||||
this.newObjType = -1;
|
||||
if (!this.allSimObj.some(item => item.isChose == true)) { //若没有对象被选中
|
||||
this.simObj.changeIsChose(); //更新对象选中状态
|
||||
this.choseIndex = this.thisIndex; //更新选中对象的下标
|
||||
}
|
||||
else if (this.simObj.isChose) { //若要取消选中对象
|
||||
this.simObj.changeIsChose(); //更新对象选中状态
|
||||
this.choseIndex = null; //更新选中下标为null
|
||||
}
|
||||
else if (!this.simObj.isChose && this.choseIndex != null) { //若要更换选择对象
|
||||
this.allSimObj[this.choseIndex].isChose = false; //更新上一个选中对象选中状态
|
||||
this.simObj.changeIsChose(); //更新当前对象选中状态
|
||||
this.choseIndex = this.thisIndex; //更新选中下标
|
||||
}
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Image.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Column.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
class CreateLabel extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.__simObj = new SynchedPropertyNesedObjectPU(params.simObj, this, "simObj");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: CreateLabel_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
}
|
||||
updateStateVars(params: CreateLabel_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__simObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__simObj.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private __simObj: SynchedPropertyNesedObjectPU<SimBase>;
|
||||
get simObj() {
|
||||
return this.__simObj.get();
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
If.create();
|
||||
if (this.simObj.isShowLabel) {
|
||||
this.ifElseBranchUpdateFunction(0, () => {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create(this.simObj.objLabel);
|
||||
Text.debugLine("components/MiddleCanvas.ets(157:7)");
|
||||
Text.fontSize(15);
|
||||
Text.position({ x: this.simObj.objX + 25, y: this.simObj.objY - 12 });
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.ifElseBranchUpdateFunction(1, () => {
|
||||
});
|
||||
}
|
||||
if (!isInitialRender) {
|
||||
If.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
If.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/MiddleContent.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/MiddleContent.protoBin
vendored
Normal file
Binary file not shown.
1060
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/MiddleContent.ts
vendored
Normal file
1060
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/MiddleContent.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/NetworkConfig.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/NetworkConfig.protoBin
vendored
Normal file
Binary file not shown.
176
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/NetworkConfig.ts
vendored
Normal file
176
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/NetworkConfig.ts
vendored
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
interface NetworkConfig_Params {
|
||||
controller?: CustomDialogController;
|
||||
simObj?: SimBase;
|
||||
ip?: string;
|
||||
port?: string;
|
||||
mac?: string;
|
||||
}
|
||||
import type { SimBase } from "../classes/SimBase";
|
||||
export class NetworkConfig extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.controller = undefined;
|
||||
this.__simObj = new SynchedPropertyNesedObjectPU(params.simObj, this, "simObj");
|
||||
this.__ip = new ObservedPropertySimplePU("", this, "ip");
|
||||
this.__port = new ObservedPropertySimplePU("", this, "port");
|
||||
this.__mac = new ObservedPropertySimplePU("", this, "mac");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: NetworkConfig_Params) {
|
||||
if (params.controller !== undefined) {
|
||||
this.controller = params.controller;
|
||||
}
|
||||
this.__simObj.set(params.simObj);
|
||||
if (params.ip !== undefined) {
|
||||
this.ip = params.ip;
|
||||
}
|
||||
if (params.port !== undefined) {
|
||||
this.port = params.port;
|
||||
}
|
||||
if (params.mac !== undefined) {
|
||||
this.mac = params.mac;
|
||||
}
|
||||
}
|
||||
updateStateVars(params: NetworkConfig_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__simObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__ip.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__port.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__mac.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__simObj.aboutToBeDeleted();
|
||||
this.__ip.aboutToBeDeleted();
|
||||
this.__port.aboutToBeDeleted();
|
||||
this.__mac.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private controller: CustomDialogController;
|
||||
setController(ctr: CustomDialogController) {
|
||||
this.controller = ctr;
|
||||
}
|
||||
private __simObj: SynchedPropertyNesedObjectPU<SimBase>;
|
||||
get simObj() {
|
||||
return this.__simObj.get();
|
||||
}
|
||||
private __ip: ObservedPropertySimplePU<string>;
|
||||
get ip() {
|
||||
return this.__ip.get();
|
||||
}
|
||||
set ip(newValue: string) {
|
||||
this.__ip.set(newValue);
|
||||
}
|
||||
private __port: ObservedPropertySimplePU<string>;
|
||||
get port() {
|
||||
return this.__port.get();
|
||||
}
|
||||
set port(newValue: string) {
|
||||
this.__port.set(newValue);
|
||||
}
|
||||
private __mac: ObservedPropertySimplePU<string>;
|
||||
get mac() {
|
||||
return this.__mac.get();
|
||||
}
|
||||
set mac(newValue: string) {
|
||||
this.__mac.set(newValue);
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/NetworkConfig.ets(12:5)");
|
||||
Column.backgroundColor(Color.White);
|
||||
Column.justifyContent(FlexAlign.Center);
|
||||
Column.alignItems(HorizontalAlign.Center);
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入ip地址:192.168.1.1" });
|
||||
TextInput.debugLine("components/NetworkConfig.ets(13:7)");
|
||||
TextInput.onChange((value) => {
|
||||
this.ip = value;
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入端口号:8080" });
|
||||
TextInput.debugLine("components/NetworkConfig.ets(18:7)");
|
||||
TextInput.onChange((value) => {
|
||||
this.port = value;
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入mac地址:mac11" });
|
||||
TextInput.debugLine("components/NetworkConfig.ets(23:7)");
|
||||
TextInput.onChange((value) => {
|
||||
this.mac = value;
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create({ space: 30 });
|
||||
Row.debugLine("components/NetworkConfig.ets(28:7)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel("取消");
|
||||
Button.debugLine("components/NetworkConfig.ets(29:9)");
|
||||
Button.onClick(() => {
|
||||
this.controller.close();
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel("确定");
|
||||
Button.debugLine("components/NetworkConfig.ets(34:9)");
|
||||
Button.onClick(() => {
|
||||
this.simObj.Ip = this.ip;
|
||||
this.simObj.Mac = this.mac;
|
||||
this.simObj.port = this.port;
|
||||
this.controller.close();
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
Row.pop();
|
||||
Column.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
255
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/RouterTableConfig.ts
vendored
Normal file
255
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/RouterTableConfig.ts
vendored
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
interface RouterTableConfig_Params {
|
||||
controller?: CustomDialogController;
|
||||
simObj?: SimBase;
|
||||
ip1?: string;
|
||||
ip2?: string;
|
||||
ip3?: string;
|
||||
ip4?: string;
|
||||
}
|
||||
import type { SimBase } from "../classes/SimBase";
|
||||
export class RouterTableConfig extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.controller = undefined;
|
||||
this.__simObj = new SynchedPropertyNesedObjectPU(params.simObj, this, "simObj");
|
||||
this.__ip1 = new ObservedPropertySimplePU("", this, "ip1");
|
||||
this.__ip2 = new ObservedPropertySimplePU("", this, "ip2");
|
||||
this.__ip3 = new ObservedPropertySimplePU("", this, "ip3");
|
||||
this.__ip4 = new ObservedPropertySimplePU("", this, "ip4");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: RouterTableConfig_Params) {
|
||||
if (params.controller !== undefined) {
|
||||
this.controller = params.controller;
|
||||
}
|
||||
this.__simObj.set(params.simObj);
|
||||
if (params.ip1 !== undefined) {
|
||||
this.ip1 = params.ip1;
|
||||
}
|
||||
if (params.ip2 !== undefined) {
|
||||
this.ip2 = params.ip2;
|
||||
}
|
||||
if (params.ip3 !== undefined) {
|
||||
this.ip3 = params.ip3;
|
||||
}
|
||||
if (params.ip4 !== undefined) {
|
||||
this.ip4 = params.ip4;
|
||||
}
|
||||
}
|
||||
updateStateVars(params: RouterTableConfig_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__simObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__ip1.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__ip2.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__ip3.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__ip4.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__simObj.aboutToBeDeleted();
|
||||
this.__ip1.aboutToBeDeleted();
|
||||
this.__ip2.aboutToBeDeleted();
|
||||
this.__ip3.aboutToBeDeleted();
|
||||
this.__ip4.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private controller: CustomDialogController;
|
||||
setController(ctr: CustomDialogController) {
|
||||
this.controller = ctr;
|
||||
}
|
||||
private __simObj: SynchedPropertyNesedObjectPU<SimBase>;
|
||||
get simObj() {
|
||||
return this.__simObj.get();
|
||||
}
|
||||
private __ip1: ObservedPropertySimplePU<string>;
|
||||
get ip1() {
|
||||
return this.__ip1.get();
|
||||
}
|
||||
set ip1(newValue: string) {
|
||||
this.__ip1.set(newValue);
|
||||
}
|
||||
private __ip2: ObservedPropertySimplePU<string>;
|
||||
get ip2() {
|
||||
return this.__ip2.get();
|
||||
}
|
||||
set ip2(newValue: string) {
|
||||
this.__ip2.set(newValue);
|
||||
}
|
||||
private __ip3: ObservedPropertySimplePU<string>;
|
||||
get ip3() {
|
||||
return this.__ip3.get();
|
||||
}
|
||||
set ip3(newValue: string) {
|
||||
this.__ip3.set(newValue);
|
||||
}
|
||||
private __ip4: ObservedPropertySimplePU<string>;
|
||||
get ip4() {
|
||||
return this.__ip4.get();
|
||||
}
|
||||
set ip4(newValue: string) {
|
||||
this.__ip4.set(newValue);
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/RouterTableConfig.ets(13:5)");
|
||||
Column.backgroundColor(Color.White);
|
||||
Column.justifyContent(FlexAlign.Center);
|
||||
Column.alignItems(HorizontalAlign.Center);
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/RouterTableConfig.ets(14:7)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入端口1下一跳:192.168.1.0/24" });
|
||||
TextInput.debugLine("components/RouterTableConfig.ets(15:9)");
|
||||
TextInput.onChange((value) => {
|
||||
this.ip1 = value;
|
||||
});
|
||||
TextInput.width("80%");
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel("添加");
|
||||
Button.debugLine("components/RouterTableConfig.ets(21:9)");
|
||||
Button.onClick(() => {
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
Row.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/RouterTableConfig.ets(27:7)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入端口2下一跳:" });
|
||||
TextInput.debugLine("components/RouterTableConfig.ets(28:9)");
|
||||
TextInput.onChange((value) => {
|
||||
this.ip2 = value;
|
||||
});
|
||||
TextInput.width("80%");
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel("添加");
|
||||
Button.debugLine("components/RouterTableConfig.ets(34:9)");
|
||||
Button.onClick(() => {
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
Row.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/RouterTableConfig.ets(40:7)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入端口3下一跳:" });
|
||||
TextInput.debugLine("components/RouterTableConfig.ets(41:9)");
|
||||
TextInput.onChange((value) => {
|
||||
this.ip3 = value;
|
||||
});
|
||||
TextInput.width("80%");
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel("添加");
|
||||
Button.debugLine("components/RouterTableConfig.ets(47:9)");
|
||||
Button.onClick(() => {
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
Row.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/RouterTableConfig.ets(53:7)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入端口4下一跳:" });
|
||||
TextInput.debugLine("components/RouterTableConfig.ets(54:9)");
|
||||
TextInput.onChange((value) => {
|
||||
this.ip4 = value;
|
||||
});
|
||||
TextInput.width("80%");
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel("添加");
|
||||
Button.debugLine("components/RouterTableConfig.ets(60:9)");
|
||||
Button.onClick(() => {
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
Row.pop();
|
||||
Column.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
255
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/SwitchTableConfig.ts
vendored
Normal file
255
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/SwitchTableConfig.ts
vendored
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
interface SwitchTableConfig_Params {
|
||||
controller?: CustomDialogController;
|
||||
simObj?: SimBase;
|
||||
mac1?: string;
|
||||
mac2?: string;
|
||||
mac3?: string;
|
||||
mac4?: string;
|
||||
}
|
||||
import type { SimBase } from "../classes/SimBase";
|
||||
export class SwitchTableConfig extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.controller = undefined;
|
||||
this.__simObj = new SynchedPropertyNesedObjectPU(params.simObj, this, "simObj");
|
||||
this.__mac1 = new ObservedPropertySimplePU("", this, "mac1");
|
||||
this.__mac2 = new ObservedPropertySimplePU("", this, "mac2");
|
||||
this.__mac3 = new ObservedPropertySimplePU("", this, "mac3");
|
||||
this.__mac4 = new ObservedPropertySimplePU("", this, "mac4");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: SwitchTableConfig_Params) {
|
||||
if (params.controller !== undefined) {
|
||||
this.controller = params.controller;
|
||||
}
|
||||
this.__simObj.set(params.simObj);
|
||||
if (params.mac1 !== undefined) {
|
||||
this.mac1 = params.mac1;
|
||||
}
|
||||
if (params.mac2 !== undefined) {
|
||||
this.mac2 = params.mac2;
|
||||
}
|
||||
if (params.mac3 !== undefined) {
|
||||
this.mac3 = params.mac3;
|
||||
}
|
||||
if (params.mac4 !== undefined) {
|
||||
this.mac4 = params.mac4;
|
||||
}
|
||||
}
|
||||
updateStateVars(params: SwitchTableConfig_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__simObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__mac1.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__mac2.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__mac3.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__mac4.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__simObj.aboutToBeDeleted();
|
||||
this.__mac1.aboutToBeDeleted();
|
||||
this.__mac2.aboutToBeDeleted();
|
||||
this.__mac3.aboutToBeDeleted();
|
||||
this.__mac4.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private controller: CustomDialogController;
|
||||
setController(ctr: CustomDialogController) {
|
||||
this.controller = ctr;
|
||||
}
|
||||
private __simObj: SynchedPropertyNesedObjectPU<SimBase>;
|
||||
get simObj() {
|
||||
return this.__simObj.get();
|
||||
}
|
||||
private __mac1: ObservedPropertySimplePU<string>;
|
||||
get mac1() {
|
||||
return this.__mac1.get();
|
||||
}
|
||||
set mac1(newValue: string) {
|
||||
this.__mac1.set(newValue);
|
||||
}
|
||||
private __mac2: ObservedPropertySimplePU<string>;
|
||||
get mac2() {
|
||||
return this.__mac2.get();
|
||||
}
|
||||
set mac2(newValue: string) {
|
||||
this.__mac2.set(newValue);
|
||||
}
|
||||
private __mac3: ObservedPropertySimplePU<string>;
|
||||
get mac3() {
|
||||
return this.__mac3.get();
|
||||
}
|
||||
set mac3(newValue: string) {
|
||||
this.__mac3.set(newValue);
|
||||
}
|
||||
private __mac4: ObservedPropertySimplePU<string>;
|
||||
get mac4() {
|
||||
return this.__mac4.get();
|
||||
}
|
||||
set mac4(newValue: string) {
|
||||
this.__mac4.set(newValue);
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/SwitchTableConfig.ets(13:5)");
|
||||
Column.backgroundColor(Color.White);
|
||||
Column.justifyContent(FlexAlign.Center);
|
||||
Column.alignItems(HorizontalAlign.Center);
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/SwitchTableConfig.ets(14:7)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入端口1下一跳:mac11" });
|
||||
TextInput.debugLine("components/SwitchTableConfig.ets(15:9)");
|
||||
TextInput.onChange((value) => {
|
||||
this.mac1 = value;
|
||||
});
|
||||
TextInput.width("80%");
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel("添加");
|
||||
Button.debugLine("components/SwitchTableConfig.ets(21:9)");
|
||||
Button.onClick(() => {
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
Row.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/SwitchTableConfig.ets(27:7)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入端口2下一跳:" });
|
||||
TextInput.debugLine("components/SwitchTableConfig.ets(28:9)");
|
||||
TextInput.onChange((value) => {
|
||||
this.mac2 = value;
|
||||
});
|
||||
TextInput.width("80%");
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel("添加");
|
||||
Button.debugLine("components/SwitchTableConfig.ets(34:9)");
|
||||
Button.onClick(() => {
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
Row.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/SwitchTableConfig.ets(40:7)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入端口3下一跳:" });
|
||||
TextInput.debugLine("components/SwitchTableConfig.ets(41:9)");
|
||||
TextInput.onChange((value) => {
|
||||
this.mac3 = value;
|
||||
});
|
||||
TextInput.width("80%");
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel("添加");
|
||||
Button.debugLine("components/SwitchTableConfig.ets(47:9)");
|
||||
Button.onClick(() => {
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
Row.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/SwitchTableConfig.ets(53:7)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
TextInput.create({ placeholder: "请输入端口4下一跳:" });
|
||||
TextInput.debugLine("components/SwitchTableConfig.ets(54:9)");
|
||||
TextInput.onChange((value) => {
|
||||
this.mac4 = value;
|
||||
});
|
||||
TextInput.width("80%");
|
||||
if (!isInitialRender) {
|
||||
TextInput.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel("添加");
|
||||
Button.debugLine("components/SwitchTableConfig.ets(60:9)");
|
||||
Button.onClick(() => {
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
Row.pop();
|
||||
Column.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/Table.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/Table.protoBin
vendored
Normal file
Binary file not shown.
275
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/Table.ts
vendored
Normal file
275
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/Table.ts
vendored
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
interface TableChart_Params {
|
||||
simObj?: SimBase;
|
||||
}
|
||||
interface NetworkChart_Params {
|
||||
simObj?: SimBase;
|
||||
}
|
||||
import type { SimBase, Table } from '../classes/SimBase';
|
||||
export class NetworkChart extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.__simObj = new SynchedPropertyNesedObjectPU(params.simObj, this, "simObj");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: NetworkChart_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
}
|
||||
updateStateVars(params: NetworkChart_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__simObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__simObj.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private __simObj: SynchedPropertyNesedObjectPU<SimBase>;
|
||||
get simObj() {
|
||||
return this.__simObj.get();
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/Table.ets(8:5)");
|
||||
Column.width("100%");
|
||||
Column.height("100%");
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
If.create();
|
||||
if (this.simObj.objType == 1 || this.simObj.objType == 2) {
|
||||
this.ifElseBranchUpdateFunction(0, () => {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/Table.ets(10:9)");
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create("IP地址:" + this.simObj.Ip);
|
||||
Text.debugLine("components/Table.ets(11:11)");
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create("Mac地址:" + this.simObj.Mac);
|
||||
Text.debugLine("components/Table.ets(13:11)");
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
Column.pop();
|
||||
});
|
||||
}
|
||||
else if (this.simObj.objType == 3) {
|
||||
this.ifElseBranchUpdateFunction(1, () => {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/Table.ets(16:9)");
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create("Mac地址:" + this.simObj.Mac);
|
||||
Text.debugLine("components/Table.ets(17:11)");
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
Column.pop();
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.ifElseBranchUpdateFunction(2, () => {
|
||||
});
|
||||
}
|
||||
if (!isInitialRender) {
|
||||
If.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
If.pop();
|
||||
Column.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
export class TableChart extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.__simObj = new SynchedPropertyNesedObjectPU(params.simObj, this, "simObj");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: TableChart_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
}
|
||||
updateStateVars(params: TableChart_Params) {
|
||||
this.__simObj.set(params.simObj);
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__simObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__simObj.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private __simObj: SynchedPropertyNesedObjectPU<SimBase>;
|
||||
get simObj() {
|
||||
return this.__simObj.get();
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("components/Table.ets(31:5)");
|
||||
Column.width("100%");
|
||||
Column.height("100%");
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
If.create();
|
||||
if (this.simObj.objType == 2) {
|
||||
this.ifElseBranchUpdateFunction(0, () => {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
ForEach.create();
|
||||
const forEachItemGenFunction = _item => {
|
||||
const item = _item;
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/Table.ets(34:11)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create("端口" + item.port.toString() + ":");
|
||||
Text.debugLine("components/Table.ets(35:13)");
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create(item.net);
|
||||
Text.debugLine("components/Table.ets(37:13)");
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
Row.pop();
|
||||
};
|
||||
this.forEachUpdateFunction(elmtId, this.simObj.routerTable, forEachItemGenFunction);
|
||||
if (!isInitialRender) {
|
||||
ForEach.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
ForEach.pop();
|
||||
});
|
||||
}
|
||||
else if (this.simObj.objType == 3) {
|
||||
this.ifElseBranchUpdateFunction(1, () => {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
ForEach.create();
|
||||
const forEachItemGenFunction = _item => {
|
||||
const item = _item;
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/Table.ets(42:11)");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create("端口" + item.port.toString() + ":");
|
||||
Text.debugLine("components/Table.ets(43:13)");
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Text.create(item.net);
|
||||
Text.debugLine("components/Table.ets(45:13)");
|
||||
if (!isInitialRender) {
|
||||
Text.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Text.pop();
|
||||
Row.pop();
|
||||
};
|
||||
this.forEachUpdateFunction(elmtId, this.simObj.switchTable, forEachItemGenFunction);
|
||||
if (!isInitialRender) {
|
||||
ForEach.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
ForEach.pop();
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.ifElseBranchUpdateFunction(2, () => {
|
||||
});
|
||||
}
|
||||
if (!isInitialRender) {
|
||||
If.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
If.pop();
|
||||
Column.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/TopMenuBar.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/TopMenuBar.protoBin
vendored
Normal file
Binary file not shown.
531
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/TopMenuBar.ts
vendored
Normal file
531
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/components/TopMenuBar.ts
vendored
Normal file
|
|
@ -0,0 +1,531 @@
|
|||
interface TopMenuBar_Params {
|
||||
// 修改标签控制器
|
||||
reviseLabelController?: CustomDialogController;
|
||||
// 删除连接线控制器
|
||||
deleteLineController?: CustomDialogController;
|
||||
// 网络配置控制器
|
||||
NetworkController?: CustomDialogController;
|
||||
// 路由表配置配置器
|
||||
RouterController?: CustomDialogController;
|
||||
// 转换表配置控制器
|
||||
SwitchController?: CustomDialogController;
|
||||
// 数据包设置控制器
|
||||
PacketController?: CustomDialogController;
|
||||
// 批量数据包设置控制器
|
||||
BatchPacketController?: CustomDialogController;
|
||||
menuArr?: TopMenu[];
|
||||
allSimObj?: SimBase[] // 仿真对象数组
|
||||
;
|
||||
allSimConn?: SimConnect[] // 仿真连接线数组
|
||||
;
|
||||
TempConn?: any[] // 临时any数组
|
||||
;
|
||||
isNewObj?: boolean // 是否新增对象
|
||||
;
|
||||
newObjType?: number // 新增对象类型
|
||||
;
|
||||
choseIndex?: number | null // 选中对象下标
|
||||
;
|
||||
isShowLabel?: boolean // 是否显示标签
|
||||
;
|
||||
isShowPort?: boolean // 是否显示接口
|
||||
;
|
||||
isShowInterface?: boolean // 是否显示网络配置信息
|
||||
;
|
||||
isShowTable?: boolean // 是否显示路由/交换表信息
|
||||
;
|
||||
allSimPacket?: SimPacket[] // 单次数据包传输的集合
|
||||
;
|
||||
}
|
||||
import promptAction from "@ohos:promptAction";
|
||||
import type { SimBase } from '../classes/SimBase';
|
||||
import type { SimConnect, SimPacket } from '../classes/OtherSimObjects';
|
||||
import { TopMenu, TopMenuItem } from "@bundle:com.example.ensp2/entry/ets/classes/TopMenu";
|
||||
import { LabelRevise, LineDelete, NetworkConfig, RouterTableConfig, SwitchTableConfig, PacketSet, BatchPacketSet } from "@bundle:com.example.ensp2/entry/ets/components/Dialog";
|
||||
export class TopMenuBar extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.reviseLabelController = new CustomDialogController({
|
||||
builder: () => {
|
||||
let paramsLambda = () => {
|
||||
return {
|
||||
simObj: this.allSimObj[this.choseIndex]
|
||||
};
|
||||
};
|
||||
let jsDialog = new LabelRevise(this, { simObj: this.allSimObj[this.choseIndex] }, undefined, -1, paramsLambda);
|
||||
jsDialog.setController(this.
|
||||
// 修改标签控制器
|
||||
reviseLabelController);
|
||||
ViewPU.create(jsDialog);
|
||||
}
|
||||
}, this);
|
||||
this.deleteLineController = new CustomDialogController({
|
||||
builder: () => {
|
||||
let paramsLambda = () => {
|
||||
return {
|
||||
simObj: this.allSimObj[this.choseIndex]
|
||||
};
|
||||
};
|
||||
let jsDialog = new LineDelete(this, { simObj: this.allSimObj[this.choseIndex] }, undefined, -1, paramsLambda);
|
||||
jsDialog.setController(this.
|
||||
// 删除连接线控制器
|
||||
deleteLineController);
|
||||
ViewPU.create(jsDialog);
|
||||
}
|
||||
}, this);
|
||||
this.NetworkController = new CustomDialogController({
|
||||
builder: () => {
|
||||
let paramsLambda = () => {
|
||||
return {
|
||||
simObj: this.allSimObj[this.choseIndex]
|
||||
};
|
||||
};
|
||||
let jsDialog = new NetworkConfig(this, { simObj: this.allSimObj[this.choseIndex] }, undefined, -1, paramsLambda);
|
||||
jsDialog.setController(this.
|
||||
// 网络配置控制器
|
||||
NetworkController);
|
||||
ViewPU.create(jsDialog);
|
||||
}
|
||||
}, this);
|
||||
this.RouterController = new CustomDialogController({
|
||||
builder: () => {
|
||||
let paramsLambda = () => {
|
||||
return {
|
||||
simObj: this.allSimObj[this.choseIndex]
|
||||
};
|
||||
};
|
||||
let jsDialog = new RouterTableConfig(this, { simObj: this.allSimObj[this.choseIndex] }, undefined, -1, paramsLambda);
|
||||
jsDialog.setController(this.
|
||||
// 路由表配置配置器
|
||||
RouterController);
|
||||
ViewPU.create(jsDialog);
|
||||
}
|
||||
}, this);
|
||||
this.SwitchController = new CustomDialogController({
|
||||
builder: () => {
|
||||
let paramsLambda = () => {
|
||||
return {
|
||||
simObj: this.allSimObj[this.choseIndex]
|
||||
};
|
||||
};
|
||||
let jsDialog = new SwitchTableConfig(this, { simObj: this.allSimObj[this.choseIndex] }, undefined, -1, paramsLambda);
|
||||
jsDialog.setController(this.
|
||||
// 转换表配置控制器
|
||||
SwitchController);
|
||||
ViewPU.create(jsDialog);
|
||||
}
|
||||
}, this);
|
||||
this.PacketController = new CustomDialogController({
|
||||
builder: () => {
|
||||
let paramsLambda = () => {
|
||||
return {
|
||||
simObj: this.allSimObj[this.choseIndex]
|
||||
};
|
||||
};
|
||||
let jsDialog = new PacketSet(this, { simObj: this.allSimObj[this.choseIndex] }, undefined, -1, paramsLambda);
|
||||
jsDialog.setController(this.
|
||||
// 数据包设置控制器
|
||||
PacketController);
|
||||
ViewPU.create(jsDialog);
|
||||
}
|
||||
}, this);
|
||||
this.BatchPacketController = new CustomDialogController({
|
||||
builder: () => {
|
||||
let paramsLambda = () => {
|
||||
return {
|
||||
simObj: this.allSimObj[this.choseIndex]
|
||||
};
|
||||
};
|
||||
let jsDialog = new BatchPacketSet(this, { simObj: this.allSimObj[this.choseIndex] }, undefined, -1, paramsLambda);
|
||||
jsDialog.setController(this.
|
||||
// 批量数据包设置控制器
|
||||
BatchPacketController);
|
||||
ViewPU.create(jsDialog);
|
||||
}
|
||||
}, this);
|
||||
this.menuArr = [
|
||||
new TopMenu('删除与修改', [new TopMenuItem('删除对象', () => {
|
||||
if (this.choseIndex != null) {
|
||||
this.allSimConn = this.allSimConn.filter((item) => {
|
||||
if (this.allSimObj[this.choseIndex].objID === item.nObjE.objID || this.allSimObj[this.choseIndex].objID === item.nObjS.objID) {
|
||||
item.deleteObjConn(); // 删除线时应该先将线两端的设备的connection设置为null
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
this.allSimObj.splice(this.choseIndex, 1);
|
||||
this.isNewObj = false;
|
||||
this.newObjType = -1;
|
||||
this.choseIndex = null;
|
||||
}
|
||||
else {
|
||||
promptAction.showToast({
|
||||
message: "请先选择要删除的对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
});
|
||||
}
|
||||
}), new TopMenuItem('删除连接线', () => {
|
||||
if (this.choseIndex != null) {
|
||||
this.deleteLineController.open();
|
||||
}
|
||||
else {
|
||||
promptAction.showToast({
|
||||
message: "请选择要删除的连接线对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
});
|
||||
}
|
||||
}), new TopMenuItem('修改标签', () => {
|
||||
if (this.choseIndex != null) {
|
||||
this.reviseLabelController.open();
|
||||
}
|
||||
else {
|
||||
promptAction.showToast({
|
||||
message: "请选择仿真对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
});
|
||||
}
|
||||
})]),
|
||||
new TopMenu('基础配置', [new TopMenuItem('网络配置', () => {
|
||||
if (this.choseIndex != null && (this.allSimObj[this.choseIndex].objType == 1 || this.allSimObj[this.choseIndex].objType == 2 || this.allSimObj[this.choseIndex].objType == 3)) {
|
||||
this.NetworkController.open();
|
||||
}
|
||||
else {
|
||||
promptAction.showToast({
|
||||
message: "请选择正确对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
});
|
||||
}
|
||||
}), new TopMenuItem('路由器配置', () => {
|
||||
if (this.choseIndex != null && this.allSimObj[this.choseIndex].objType == 2) {
|
||||
this.RouterController.open();
|
||||
}
|
||||
else {
|
||||
promptAction.showToast({
|
||||
message: "请选择路由器对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
});
|
||||
}
|
||||
}), new TopMenuItem('交换器配置', () => {
|
||||
if (this.choseIndex != null && this.allSimObj[this.choseIndex].objType == 3) {
|
||||
this.SwitchController.open();
|
||||
}
|
||||
else {
|
||||
promptAction.showToast({
|
||||
message: "请选择交换机对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
});
|
||||
}
|
||||
})]),
|
||||
new TopMenu('显示设置', [new TopMenuItem('显示/不显示标签', () => {
|
||||
this.isShowLabel = !this.isShowLabel;
|
||||
}), new TopMenuItem('显示/不显示接口', () => {
|
||||
this.isShowPort = !this.isShowPort;
|
||||
}), new TopMenuItem('显示/不显示配置信息', () => {
|
||||
this.isShowInterface = !this.isShowInterface;
|
||||
}), new TopMenuItem('显示/不显示交换表信息', () => {
|
||||
this.isShowTable = !this.isShowTable;
|
||||
})]),
|
||||
new TopMenu('发送数据包', [new TopMenuItem('发送数据包', () => {
|
||||
if (this.choseIndex != null && this.allSimObj[this.choseIndex].objType == 1) {
|
||||
this.PacketController.open();
|
||||
}
|
||||
else {
|
||||
promptAction.showToast({
|
||||
message: "请选择主机对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
});
|
||||
}
|
||||
}), new TopMenuItem('批量发送数据包', () => {
|
||||
if (this.choseIndex != null && this.allSimObj[this.choseIndex].objType == 1) {
|
||||
this.BatchPacketController.open();
|
||||
}
|
||||
else {
|
||||
promptAction.showToast({
|
||||
message: "请选择主机对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
});
|
||||
}
|
||||
})]),
|
||||
new TopMenu('清除屏幕', [new TopMenuItem('清除屏幕', () => {
|
||||
this.allSimObj = [];
|
||||
this.allSimConn = [];
|
||||
this.TempConn = [];
|
||||
this.isNewObj = false;
|
||||
this.choseIndex = null;
|
||||
})])
|
||||
] // 顶部菜单栏数组
|
||||
;
|
||||
this.__allSimObj = this.initializeConsume("allSimObj", "allSimObj");
|
||||
this.__allSimConn = this.initializeConsume("allSimConn", "allSimConn");
|
||||
this.__TempConn = this.initializeConsume("TempConn", "TempConn");
|
||||
this.__isNewObj = this.initializeConsume("isNewObj", "isNewObj");
|
||||
this.__newObjType = this.initializeConsume("newObjType", "newObjType");
|
||||
this.__choseIndex = this.initializeConsume("choseIndex", "choseIndex");
|
||||
this.__isShowLabel = this.initializeConsume("isShowLabel", "isShowLabel");
|
||||
this.__isShowPort = this.initializeConsume("isShowPort", "isShowPort");
|
||||
this.__isShowInterface = this.initializeConsume("isShowInterface", "isShowInterface");
|
||||
this.__isShowTable = this.initializeConsume("isShowTable", "isShowTable");
|
||||
this.__allSimPacket = this.initializeConsume("allSimPacket", "allSimPacket");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: TopMenuBar_Params) {
|
||||
if (params.reviseLabelController !== undefined) {
|
||||
this.reviseLabelController = params.reviseLabelController;
|
||||
}
|
||||
if (params.deleteLineController !== undefined) {
|
||||
this.deleteLineController = params.deleteLineController;
|
||||
}
|
||||
if (params.NetworkController !== undefined) {
|
||||
this.NetworkController = params.NetworkController;
|
||||
}
|
||||
if (params.RouterController !== undefined) {
|
||||
this.RouterController = params.RouterController;
|
||||
}
|
||||
if (params.SwitchController !== undefined) {
|
||||
this.SwitchController = params.SwitchController;
|
||||
}
|
||||
if (params.PacketController !== undefined) {
|
||||
this.PacketController = params.PacketController;
|
||||
}
|
||||
if (params.BatchPacketController !== undefined) {
|
||||
this.BatchPacketController = params.BatchPacketController;
|
||||
}
|
||||
if (params.menuArr !== undefined) {
|
||||
this.menuArr = params.menuArr;
|
||||
}
|
||||
}
|
||||
updateStateVars(params: TopMenuBar_Params) {
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__allSimObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__allSimConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__TempConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isNewObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__newObjType.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__choseIndex.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isShowLabel.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isShowPort.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isShowInterface.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isShowTable.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__allSimPacket.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__allSimObj.aboutToBeDeleted();
|
||||
this.__allSimConn.aboutToBeDeleted();
|
||||
this.__TempConn.aboutToBeDeleted();
|
||||
this.__isNewObj.aboutToBeDeleted();
|
||||
this.__newObjType.aboutToBeDeleted();
|
||||
this.__choseIndex.aboutToBeDeleted();
|
||||
this.__isShowLabel.aboutToBeDeleted();
|
||||
this.__isShowPort.aboutToBeDeleted();
|
||||
this.__isShowInterface.aboutToBeDeleted();
|
||||
this.__isShowTable.aboutToBeDeleted();
|
||||
this.__allSimPacket.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
// 修改标签控制器
|
||||
private reviseLabelController: CustomDialogController;
|
||||
// 删除连接线控制器
|
||||
private deleteLineController: CustomDialogController;
|
||||
// 网络配置控制器
|
||||
private NetworkController: CustomDialogController;
|
||||
// 路由表配置配置器
|
||||
private RouterController: CustomDialogController;
|
||||
// 转换表配置控制器
|
||||
private SwitchController: CustomDialogController;
|
||||
// 数据包设置控制器
|
||||
private PacketController: CustomDialogController;
|
||||
// 批量数据包设置控制器
|
||||
private BatchPacketController: CustomDialogController;
|
||||
MenuItem(menuItemArr: TopMenuItem[], parent = null) {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Menu.create();
|
||||
Menu.debugLine("components/TopMenuBar.ets(40:5)");
|
||||
if (!isInitialRender) {
|
||||
Menu.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
ForEach.create();
|
||||
const forEachItemGenFunction = _item => {
|
||||
const item = _item;
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
MenuItem.create({ content: item.title });
|
||||
MenuItem.debugLine("components/TopMenuBar.ets(42:9)");
|
||||
MenuItem.onChange(() => {
|
||||
if (item.fun) {
|
||||
item.fun();
|
||||
}
|
||||
});
|
||||
if (!isInitialRender) {
|
||||
MenuItem.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
MenuItem.pop();
|
||||
};
|
||||
this.forEachUpdateFunction(elmtId, menuItemArr, forEachItemGenFunction);
|
||||
if (!isInitialRender) {
|
||||
ForEach.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
ForEach.pop();
|
||||
Menu.pop();
|
||||
} // 顶部菜单栏按钮每小项
|
||||
MenuButton(menuArr: TopMenu[], parent = null) {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
ForEach.create();
|
||||
const forEachItemGenFunction = _item => {
|
||||
const item = _item;
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Button.createWithLabel(item.title);
|
||||
Button.debugLine("components/TopMenuBar.ets(55:7)");
|
||||
Button.type(ButtonType.Normal);
|
||||
Button.fontColor(Color.Black);
|
||||
Button.border({ color: Color.Black, width: 1 });
|
||||
Button.backgroundColor(Color.Transparent);
|
||||
Button.bindMenu({ builder: () => {
|
||||
this.MenuItem.call(this, item.menuItemArr);
|
||||
} });
|
||||
if (!isInitialRender) {
|
||||
Button.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
Button.pop();
|
||||
};
|
||||
this.forEachUpdateFunction(elmtId, menuArr, forEachItemGenFunction);
|
||||
if (!isInitialRender) {
|
||||
ForEach.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
ForEach.pop();
|
||||
} // 顶部菜单栏按钮
|
||||
private menuArr: TopMenu[]; // 顶部菜单栏数组
|
||||
private __allSimObj: ObservedPropertyAbstractPU<SimBase[]>; // 仿真对象数组
|
||||
get allSimObj() {
|
||||
return this.__allSimObj.get();
|
||||
}
|
||||
set allSimObj(newValue: SimBase[] // 仿真对象数组
|
||||
) {
|
||||
this.__allSimObj.set(newValue);
|
||||
}
|
||||
private __allSimConn: ObservedPropertyAbstractPU<SimConnect[]>; // 仿真连接线数组
|
||||
get allSimConn() {
|
||||
return this.__allSimConn.get();
|
||||
}
|
||||
set allSimConn(newValue: SimConnect[] // 仿真连接线数组
|
||||
) {
|
||||
this.__allSimConn.set(newValue);
|
||||
}
|
||||
private __TempConn: ObservedPropertyAbstractPU<any[]>; // 临时any数组
|
||||
get TempConn() {
|
||||
return this.__TempConn.get();
|
||||
}
|
||||
set TempConn(newValue: any[] // 临时any数组
|
||||
) {
|
||||
this.__TempConn.set(newValue);
|
||||
}
|
||||
private __isNewObj: ObservedPropertyAbstractPU<boolean>; // 是否新增对象
|
||||
get isNewObj() {
|
||||
return this.__isNewObj.get();
|
||||
}
|
||||
set isNewObj(newValue: boolean // 是否新增对象
|
||||
) {
|
||||
this.__isNewObj.set(newValue);
|
||||
}
|
||||
private __newObjType: ObservedPropertyAbstractPU<number>; // 新增对象类型
|
||||
get newObjType() {
|
||||
return this.__newObjType.get();
|
||||
}
|
||||
set newObjType(newValue: number // 新增对象类型
|
||||
) {
|
||||
this.__newObjType.set(newValue);
|
||||
}
|
||||
private __choseIndex: ObservedPropertyAbstractPU<number | null>; // 选中对象下标
|
||||
get choseIndex() {
|
||||
return this.__choseIndex.get();
|
||||
}
|
||||
set choseIndex(newValue: number | null // 选中对象下标
|
||||
) {
|
||||
this.__choseIndex.set(newValue);
|
||||
}
|
||||
private __isShowLabel: ObservedPropertyAbstractPU<boolean>; // 是否显示标签
|
||||
get isShowLabel() {
|
||||
return this.__isShowLabel.get();
|
||||
}
|
||||
set isShowLabel(newValue: boolean // 是否显示标签
|
||||
) {
|
||||
this.__isShowLabel.set(newValue);
|
||||
}
|
||||
private __isShowPort: ObservedPropertyAbstractPU<boolean>; // 是否显示接口
|
||||
get isShowPort() {
|
||||
return this.__isShowPort.get();
|
||||
}
|
||||
set isShowPort(newValue: boolean // 是否显示接口
|
||||
) {
|
||||
this.__isShowPort.set(newValue);
|
||||
}
|
||||
private __isShowInterface: ObservedPropertyAbstractPU<boolean>; // 是否显示网络配置信息
|
||||
get isShowInterface() {
|
||||
return this.__isShowInterface.get();
|
||||
}
|
||||
set isShowInterface(newValue: boolean // 是否显示网络配置信息
|
||||
) {
|
||||
this.__isShowInterface.set(newValue);
|
||||
}
|
||||
private __isShowTable: ObservedPropertyAbstractPU<boolean>; // 是否显示路由/交换表信息
|
||||
get isShowTable() {
|
||||
return this.__isShowTable.get();
|
||||
}
|
||||
set isShowTable(newValue: boolean // 是否显示路由/交换表信息
|
||||
) {
|
||||
this.__isShowTable.set(newValue);
|
||||
}
|
||||
private __allSimPacket: ObservedPropertyAbstractPU<SimPacket[]>; // 单次数据包传输的集合
|
||||
get allSimPacket() {
|
||||
return this.__allSimPacket.get();
|
||||
}
|
||||
set allSimPacket(newValue: SimPacket[] // 单次数据包传输的集合
|
||||
) {
|
||||
this.__allSimPacket.set(newValue);
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Row.create();
|
||||
Row.debugLine("components/TopMenuBar.ets(190:5)");
|
||||
Row.height("12%");
|
||||
Row.width("100%");
|
||||
if (!isInitialRender) {
|
||||
Row.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
this.MenuButton.bind(this)(this.menuArr);
|
||||
Row.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/entryability/EntryAbility.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/entryability/EntryAbility.protoBin
vendored
Normal file
Binary file not shown.
38
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/entryability/EntryAbility.ts
vendored
Normal file
38
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/entryability/EntryAbility.ts
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import type AbilityConstant from "@ohos:app.ability.AbilityConstant";
|
||||
import hilog from "@ohos:hilog";
|
||||
import UIAbility from "@ohos:app.ability.UIAbility";
|
||||
import type Want from "@ohos:app.ability.Want";
|
||||
import type window from "@ohos:window";
|
||||
export default class EntryAbility extends UIAbility {
|
||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
|
||||
AppStorage.setOrCreate('LogText', '');
|
||||
}
|
||||
onDestroy(): void {
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
|
||||
}
|
||||
onWindowStageCreate(windowStage: window.WindowStage): void {
|
||||
// Main window is created, set main page for this ability
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
|
||||
windowStage.loadContent('pages/Index', (err, data) => {
|
||||
if (err.code) {
|
||||
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
|
||||
return;
|
||||
}
|
||||
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
|
||||
});
|
||||
// windowStage.getMainWindowSync().setWindowSystemBarEnable([]);
|
||||
}
|
||||
onWindowStageDestroy(): void {
|
||||
// Main window is destroyed, release UI related resources
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
|
||||
}
|
||||
onForeground(): void {
|
||||
// Ability has brought to foreground
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
|
||||
}
|
||||
onBackground(): void {
|
||||
// Ability has back to background
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
|
||||
}
|
||||
}
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/functions/functions.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/functions/functions.protoBin
vendored
Normal file
Binary file not shown.
50
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/functions/functions.ts
vendored
Normal file
50
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/functions/functions.ts
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import type { SimBase } from "../classes/SimBase";
|
||||
function ValidateIPAddress(ipAddress: string): boolean {
|
||||
// 定义IP地址的正则表达式模式
|
||||
const patternWithSubnet = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/;
|
||||
const patternWithoutSubnet = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
|
||||
const matchWithSubnet = ipAddress.match(patternWithSubnet);
|
||||
const matchWithoutSubnet = ipAddress.match(patternWithoutSubnet);
|
||||
if (matchWithSubnet) {
|
||||
// 带有子网掩码的IP地址
|
||||
// 检查每个组件的取值范围是否在 0-255 之间
|
||||
for (let i = 1; i <= 4; i++) {
|
||||
const group = parseInt(matchWithSubnet[i]);
|
||||
if (group < 0 || group > 255) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 检查子网掩码的取值范围是否在 0-32 之间
|
||||
const subnetMask = parseInt(matchWithSubnet[5]);
|
||||
if (subnetMask < 0 || subnetMask > 32) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (matchWithoutSubnet) {
|
||||
// 不带子网掩码的IP地址
|
||||
// 检查每个组件的取值范围是否在 0-255 之间
|
||||
for (let i = 1; i <= 4; i++) {
|
||||
const group = parseInt(matchWithoutSubnet[i]);
|
||||
if (group < 0 || group > 255) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// IP地址格式不正确
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export function checkNetwork(allSimObj: SimBase[]) {
|
||||
for (const item of allSimObj) {
|
||||
if (item.objType == 4) {
|
||||
continue;
|
||||
}
|
||||
else if (!ValidateIPAddress(item.Ip)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} // 检查创建虚拟对象的IP地址是否正确
|
||||
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/pages/Index.protoBin
vendored
Normal file
BIN
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/pages/Index.protoBin
vendored
Normal file
Binary file not shown.
290
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/pages/Index.ts
vendored
Normal file
290
ensping/ensp13/entry/.preview/cache/.default/entry/src/main/ets/pages/Index.ts
vendored
Normal file
|
|
@ -0,0 +1,290 @@
|
|||
interface Index_Params {
|
||||
allSimObj?: any[];
|
||||
allSimConn?: any[];
|
||||
TempConn?: any[];
|
||||
isNewObj?: boolean;
|
||||
newObjType?: number;
|
||||
choseIndex?: number | null;
|
||||
isNewConn?: boolean;
|
||||
isShowLabel?: boolean;
|
||||
isShowPort?: boolean;
|
||||
isShowInterface?: boolean;
|
||||
isShowTable?: boolean;
|
||||
allSimPacket?: [
|
||||
];
|
||||
}
|
||||
import { TopMenuBar } from "@bundle:com.example.ensp2/entry/ets/components/TopMenuBar";
|
||||
import { MiddleContent } from "@bundle:com.example.ensp2/entry/ets/components/MiddleContent";
|
||||
import { BottomMenuBar } from "@bundle:com.example.ensp2/entry/ets/components/ButtomMenuBar";
|
||||
class Index extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined) {
|
||||
super(parent, __localStorage, elmtId);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.__allSimObj = new ObservedPropertyObjectPU([] // 仿真对象数组
|
||||
, this, "allSimObj");
|
||||
this.addProvidedVar("allSimObj", this.__allSimObj);
|
||||
this.__allSimConn = new ObservedPropertyObjectPU([] // 仿真连接线数组
|
||||
, this, "allSimConn");
|
||||
this.addProvidedVar("allSimConn", this.__allSimConn);
|
||||
this.__TempConn = new ObservedPropertyObjectPU([] // 临时连接线对象数组
|
||||
, this, "TempConn");
|
||||
this.addProvidedVar("TempConn", this.__TempConn);
|
||||
this.__isNewObj = new ObservedPropertySimplePU(false // 是否新增对象
|
||||
, this, "isNewObj");
|
||||
this.addProvidedVar("isNewObj", this.__isNewObj);
|
||||
this.__newObjType = new ObservedPropertySimplePU(-1 // 新增对象类型
|
||||
, this, "newObjType");
|
||||
this.addProvidedVar("newObjType", this.__newObjType);
|
||||
this.__choseIndex = new ObservedPropertyObjectPU(null // 选中对象下标
|
||||
, this, "choseIndex");
|
||||
this.addProvidedVar("choseIndex", this.__choseIndex);
|
||||
this.__isNewConn = new ObservedPropertySimplePU(false // 是否正在新增连接线
|
||||
, this, "isNewConn");
|
||||
this.addProvidedVar("isNewConn", this.__isNewConn);
|
||||
this.__isShowLabel = new ObservedPropertySimplePU(true // 是否显示标签
|
||||
, this, "isShowLabel");
|
||||
this.addProvidedVar("isShowLabel", this.__isShowLabel);
|
||||
this.__isShowPort = new ObservedPropertySimplePU(true // 是否显示接口
|
||||
, this, "isShowPort");
|
||||
this.addProvidedVar("isShowPort", this.__isShowPort);
|
||||
this.__isShowInterface = new ObservedPropertySimplePU(true // 是否显示网络配置信息
|
||||
, this, "isShowInterface");
|
||||
this.addProvidedVar("isShowInterface", this.__isShowInterface);
|
||||
this.__isShowTable = new ObservedPropertySimplePU(true // 是否显示路由/交换表信息
|
||||
, this, "isShowTable");
|
||||
this.addProvidedVar("isShowTable", this.__isShowTable);
|
||||
this.__allSimPacket = new ObservedPropertyObjectPU([] // 单次数据包传输的集合
|
||||
, this, "allSimPacket");
|
||||
this.addProvidedVar("allSimPacket", this.__allSimPacket);
|
||||
this.setInitiallyProvidedValue(params);
|
||||
}
|
||||
setInitiallyProvidedValue(params: Index_Params) {
|
||||
if (params.allSimObj !== undefined) {
|
||||
this.allSimObj = params.allSimObj;
|
||||
}
|
||||
if (params.allSimConn !== undefined) {
|
||||
this.allSimConn = params.allSimConn;
|
||||
}
|
||||
if (params.TempConn !== undefined) {
|
||||
this.TempConn = params.TempConn;
|
||||
}
|
||||
if (params.isNewObj !== undefined) {
|
||||
this.isNewObj = params.isNewObj;
|
||||
}
|
||||
if (params.newObjType !== undefined) {
|
||||
this.newObjType = params.newObjType;
|
||||
}
|
||||
if (params.choseIndex !== undefined) {
|
||||
this.choseIndex = params.choseIndex;
|
||||
}
|
||||
if (params.isNewConn !== undefined) {
|
||||
this.isNewConn = params.isNewConn;
|
||||
}
|
||||
if (params.isShowLabel !== undefined) {
|
||||
this.isShowLabel = params.isShowLabel;
|
||||
}
|
||||
if (params.isShowPort !== undefined) {
|
||||
this.isShowPort = params.isShowPort;
|
||||
}
|
||||
if (params.isShowInterface !== undefined) {
|
||||
this.isShowInterface = params.isShowInterface;
|
||||
}
|
||||
if (params.isShowTable !== undefined) {
|
||||
this.isShowTable = params.isShowTable;
|
||||
}
|
||||
if (params.allSimPacket !== undefined) {
|
||||
this.allSimPacket = params.allSimPacket;
|
||||
}
|
||||
}
|
||||
updateStateVars(params: Index_Params) {
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__allSimObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__allSimConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__TempConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isNewObj.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__newObjType.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__choseIndex.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isNewConn.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isShowLabel.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isShowPort.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isShowInterface.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__isShowTable.purgeDependencyOnElmtId(rmElmtId);
|
||||
this.__allSimPacket.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__allSimObj.aboutToBeDeleted();
|
||||
this.__allSimConn.aboutToBeDeleted();
|
||||
this.__TempConn.aboutToBeDeleted();
|
||||
this.__isNewObj.aboutToBeDeleted();
|
||||
this.__newObjType.aboutToBeDeleted();
|
||||
this.__choseIndex.aboutToBeDeleted();
|
||||
this.__isNewConn.aboutToBeDeleted();
|
||||
this.__isShowLabel.aboutToBeDeleted();
|
||||
this.__isShowPort.aboutToBeDeleted();
|
||||
this.__isShowInterface.aboutToBeDeleted();
|
||||
this.__isShowTable.aboutToBeDeleted();
|
||||
this.__allSimPacket.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
private __allSimObj: ObservedPropertyObjectPU<any[]>; // 仿真对象数组
|
||||
get allSimObj() {
|
||||
return this.__allSimObj.get();
|
||||
}
|
||||
set allSimObj(newValue: any[]) {
|
||||
this.__allSimObj.set(newValue);
|
||||
}
|
||||
private __allSimConn: ObservedPropertyObjectPU<any[]>; // 仿真连接线数组
|
||||
get allSimConn() {
|
||||
return this.__allSimConn.get();
|
||||
}
|
||||
set allSimConn(newValue: any[]) {
|
||||
this.__allSimConn.set(newValue);
|
||||
}
|
||||
private __TempConn: ObservedPropertyObjectPU<any[]>; // 临时连接线对象数组
|
||||
get TempConn() {
|
||||
return this.__TempConn.get();
|
||||
}
|
||||
set TempConn(newValue: any[]) {
|
||||
this.__TempConn.set(newValue);
|
||||
}
|
||||
private __isNewObj: ObservedPropertySimplePU<boolean>; // 是否新增对象
|
||||
get isNewObj() {
|
||||
return this.__isNewObj.get();
|
||||
}
|
||||
set isNewObj(newValue: boolean) {
|
||||
this.__isNewObj.set(newValue);
|
||||
}
|
||||
private __newObjType: ObservedPropertySimplePU<number>; // 新增对象类型
|
||||
get newObjType() {
|
||||
return this.__newObjType.get();
|
||||
}
|
||||
set newObjType(newValue: number) {
|
||||
this.__newObjType.set(newValue);
|
||||
}
|
||||
private __choseIndex: ObservedPropertyObjectPU<number | null>; // 选中对象下标
|
||||
get choseIndex() {
|
||||
return this.__choseIndex.get();
|
||||
}
|
||||
set choseIndex(newValue: number | null) {
|
||||
this.__choseIndex.set(newValue);
|
||||
}
|
||||
private __isNewConn: ObservedPropertySimplePU<boolean>; // 是否正在新增连接线
|
||||
get isNewConn() {
|
||||
return this.__isNewConn.get();
|
||||
}
|
||||
set isNewConn(newValue: boolean) {
|
||||
this.__isNewConn.set(newValue);
|
||||
}
|
||||
private __isShowLabel: ObservedPropertySimplePU<boolean>; // 是否显示标签
|
||||
get isShowLabel() {
|
||||
return this.__isShowLabel.get();
|
||||
}
|
||||
set isShowLabel(newValue: boolean) {
|
||||
this.__isShowLabel.set(newValue);
|
||||
}
|
||||
private __isShowPort: ObservedPropertySimplePU<boolean>; // 是否显示接口
|
||||
get isShowPort() {
|
||||
return this.__isShowPort.get();
|
||||
}
|
||||
set isShowPort(newValue: boolean) {
|
||||
this.__isShowPort.set(newValue);
|
||||
}
|
||||
private __isShowInterface: ObservedPropertySimplePU<boolean>; // 是否显示网络配置信息
|
||||
get isShowInterface() {
|
||||
return this.__isShowInterface.get();
|
||||
}
|
||||
set isShowInterface(newValue: boolean) {
|
||||
this.__isShowInterface.set(newValue);
|
||||
}
|
||||
private __isShowTable: ObservedPropertySimplePU<boolean>; // 是否显示路由/交换表信息
|
||||
get isShowTable() {
|
||||
return this.__isShowTable.get();
|
||||
}
|
||||
set isShowTable(newValue: boolean) {
|
||||
this.__isShowTable.set(newValue);
|
||||
}
|
||||
private __allSimPacket: ObservedPropertyObjectPU<[
|
||||
]>; // 单次数据包传输的集合
|
||||
get allSimPacket() {
|
||||
return this.__allSimPacket.get();
|
||||
}
|
||||
set allSimPacket(newValue: [
|
||||
]) {
|
||||
this.__allSimPacket.set(newValue);
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
Column.create();
|
||||
Column.debugLine("pages/Index.ets(24:5)");
|
||||
Column.width('100%');
|
||||
Column.height('100%');
|
||||
if (!isInitialRender) {
|
||||
Column.pop();
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
{
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
if (isInitialRender) {
|
||||
let paramsLambda = () => {
|
||||
return {};
|
||||
};
|
||||
ViewPU.create(new
|
||||
// 顶部功能栏
|
||||
TopMenuBar(this, {}, undefined, elmtId, paramsLambda));
|
||||
}
|
||||
else {
|
||||
this.updateStateVarsOfChildByElmtId(elmtId, {});
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
}
|
||||
{
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
if (isInitialRender) {
|
||||
let paramsLambda = () => {
|
||||
return {};
|
||||
};
|
||||
ViewPU.create(new
|
||||
// 中间绘制区
|
||||
MiddleContent(this, {}, undefined, elmtId, paramsLambda));
|
||||
}
|
||||
else {
|
||||
this.updateStateVarsOfChildByElmtId(elmtId, {});
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
}
|
||||
{
|
||||
this.observeComponentCreation((elmtId, isInitialRender) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
|
||||
if (isInitialRender) {
|
||||
let paramsLambda = () => {
|
||||
return {};
|
||||
};
|
||||
ViewPU.create(new
|
||||
// 底部选择栏
|
||||
BottomMenuBar(this, {}, undefined, elmtId, paramsLambda));
|
||||
}
|
||||
else {
|
||||
this.updateStateVarsOfChildByElmtId(elmtId, {});
|
||||
}
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
});
|
||||
}
|
||||
Column.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(ViewStackProcessor.AllocateNewElmetIdForNextComponent());
|
||||
loadDocument(new Index(undefined, {}));
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/entryability/EntryAbility.ts;com.example.ensp2/entry/ets/entryability/EntryAbility;esm;entry/src/main/ets/entryability/EntryAbility.ets;entry
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/pages/Index.ts;com.example.ensp2/entry/ets/pages/Index;esm;entry/src/main/ets/pages/Index.ets;entry
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/TopMenuBar.ts;com.example.ensp2/entry/ets/components/TopMenuBar;esm;entry/src/main/ets/components/TopMenuBar.ets;entry
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/MiddleContent.ts;com.example.ensp2/entry/ets/components/MiddleContent;esm;entry/src/main/ets/components/MiddleContent.ets;entry
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/ButtomMenuBar.ts;com.example.ensp2/entry/ets/components/ButtomMenuBar;esm;entry/src/main/ets/components/ButtomMenuBar.ets;entry
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/classes/TopMenu.ts;com.example.ensp2/entry/ets/classes/TopMenu;esm;entry/src/main/ets/classes/TopMenu.ets;entry
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/Dialog.ts;com.example.ensp2/entry/ets/components/Dialog;esm;entry/src/main/ets/components/Dialog.ets;entry
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/classes/OtherSimObjects.ts;com.example.ensp2/entry/ets/classes/OtherSimObjects;esm;entry/src/main/ets/classes/OtherSimObjects.ets;entry
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/Table.ts;com.example.ensp2/entry/ets/components/Table;esm;entry/src/main/ets/components/Table.ets;entry
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/classes/SimBase.ts;com.example.ensp2/entry/ets/classes/SimBase;esm;entry/src/main/ets/classes/SimBase.ets;entry
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/functions/functions.ts;com.example.ensp2/entry/ets/functions/functions;esm;entry/src/main/ets/functions/functions.ets;entry
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/entryability/EntryAbility.ts;D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/entryability/EntryAbility.protoBin
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/pages/Index.ts;D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/pages/Index.protoBin
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/TopMenuBar.ts;D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/TopMenuBar.protoBin
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/MiddleContent.ts;D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/MiddleContent.protoBin
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/ButtomMenuBar.ts;D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/ButtomMenuBar.protoBin
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/classes/TopMenu.ts;D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/classes/TopMenu.protoBin
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/Dialog.ts;D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/Dialog.protoBin
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/classes/OtherSimObjects.ts;D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/classes/OtherSimObjects.protoBin
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/Table.ts;D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/components/Table.protoBin
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/classes/SimBase.ts;D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/classes/SimBase.protoBin
|
||||
D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/functions/functions.ts;D:/computer_programing/Deveco_Studio/openharmony_program/ENSP_thirteen/entry/.preview/cache/.default/entry/src/main/ets/functions/functions.protoBin
|
||||
D:\computer_programing\Deveco_Studio\openharmony_program\ENSP_thirteen\entry\.preview\cache\.default\npmEntries.txt;D:\computer_programing\Deveco_Studio\openharmony_program\ENSP_thirteen\entry\.preview\cache\.default\npmEntries.protoBin
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1 @@
|
|||
{"deviceType":"default,tablet","checkEntry":"true","localPropertiesPath":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\local.properties","Path":"D:\\computer_programing\\Deveco_Studio\\HuaWei\\nodejs\\","note":"false","aceProfilePath":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\default\\intermediates\\res\\default\\resources\\base\\profile","isPreview":"true","hapMode":"false","buildMode":"debug","img2bin":"true","projectProfilePath":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\build-profile.json5","watchMode":"true","appResource":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\default\\intermediates\\res\\default\\ResourceTable.txt","logLevel":"3","stageRouterConfig":{"contents":["{\"module\":{\"pages\":\"$profile:main_pages\",\"name\":\"entry\"}}","{\"src\":[\"pages/Index\"]}"],"paths":["D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\default\\intermediates\\res\\default\\module.json","D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\default\\intermediates\\res\\default\\resources\\base\\profile\\main_pages.json"]},"port":"29907","aceBuildJson":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\default\\intermediates\\loader\\default\\loader.json","aceModuleRoot":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\src\\main\\ets","aceSoPath":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\cache\\nativeDependencies.txt","cachePath":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\cache\\.default","aceModuleBuild":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\default\\intermediates\\assets\\default\\ets","aceSuperVisualPath":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\src\\main\\supervisual","aceModuleJsonPath":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\default\\intermediates\\res\\default\\module.json"}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RESOURCE_TABLE_H
|
||||
#define RESOURCE_TABLE_H
|
||||
|
||||
#include<stdint.h>
|
||||
|
||||
namespace OHOS {
|
||||
const int32_t STRING_ENTRYABILITY_DESC = 0x01000002;
|
||||
const int32_t STRING_ENTRYABILITY_LABEL = 0x01000003;
|
||||
const int32_t STRING_APP_NAME = 0x01000001;
|
||||
const int32_t STRING_MODULE_DESC = 0x01000004;
|
||||
const int32_t COLOR_START_WINDOW_BACKGROUND = 0x01000006;
|
||||
const int32_t MEDIA_APP_ICON = 0x01000000;
|
||||
const int32_t MEDIA_ICON = 0x0100000f;
|
||||
const int32_t MEDIA_JIAOHUANJI = 0x01000011;
|
||||
const int32_t MEDIA_JIAOHUANJI_TM = 0x0100000e;
|
||||
const int32_t MEDIA_JIXIANQI = 0x0100000b;
|
||||
const int32_t MEDIA_JIXIANQI_TM = 0x0100000a;
|
||||
const int32_t MEDIA_LUYOUQI = 0x01000005;
|
||||
const int32_t MEDIA_LUYOUQI_TM = 0x0100000c;
|
||||
const int32_t MEDIA_PACKET = 0x01000007;
|
||||
const int32_t MEDIA_STARTICON = 0x01000009;
|
||||
const int32_t MEDIA_ZHUJI = 0x01000008;
|
||||
const int32_t MEDIA_ZHUJI_TM = 0x0100000d;
|
||||
const int32_t PROFILE_MAIN_PAGES = 0x01000010;
|
||||
}
|
||||
#endif
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1 @@
|
|||
{"modulePathMap":{"entry":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry"},"compileMode":"esmodule","projectRootPath":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen","nodeModulesPath":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\default\\intermediates\\loader_out\\default\\node_modules","moduleName":"entry","harNameOhmMap":{},"packageManagerType":"ohpm","anBuildOutPut":"D:\\computer_programing\\Deveco_Studio\\openharmony_program\\ENSP_thirteen\\entry\\.preview\\default\\intermediates\\loader_out\\default\\an\\arm64-v8a","anBuildMode":"type"}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"app": {
|
||||
"bundleName": "com.example.ensp2",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:app_name",
|
||||
"apiReleaseType": "Release",
|
||||
"compileSdkVersion": "4.0.10.13",
|
||||
"targetAPIVersion": 10,
|
||||
"minAPIVersion": 9,
|
||||
"compileSdkType": "OpenHarmony",
|
||||
"debug": true
|
||||
},
|
||||
"module": {
|
||||
"name": "entry",
|
||||
"type": "entry",
|
||||
"description": "$string:module_desc",
|
||||
"mainElement": "EntryAbility",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"abilities": [
|
||||
{
|
||||
"name": "EntryAbility",
|
||||
"srcEntry": "./ets/entryability/EntryAbility.ets",
|
||||
"description": "$string:EntryAbility_desc",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:EntryAbility_label",
|
||||
"startWindowIcon": "$media:startIcon",
|
||||
"startWindowBackground": "$color:start_window_background",
|
||||
"exported": true,
|
||||
"orientation": "auto_rotation",
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"app": {
|
||||
"bundleName": "com.example.ensp2",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:app_name",
|
||||
"apiReleaseType": "Release",
|
||||
"compileSdkVersion": "4.0.10.13",
|
||||
"targetAPIVersion": 10,
|
||||
"minAPIVersion": 9,
|
||||
"compileSdkType": "OpenHarmony",
|
||||
"debug": true
|
||||
},
|
||||
"module": {
|
||||
"name": "entry",
|
||||
"type": "entry",
|
||||
"description": "$string:module_desc",
|
||||
"mainElement": "EntryAbility",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"abilities": [
|
||||
{
|
||||
"name": "EntryAbility",
|
||||
"srcEntry": "./ets/entryability/EntryAbility.ets",
|
||||
"description": "$string:EntryAbility_desc",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:EntryAbility_label",
|
||||
"startWindowIcon": "$media:startIcon",
|
||||
"startWindowBackground": "$color:start_window_background",
|
||||
"exported": true,
|
||||
"orientation": "auto_rotation",
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"virtualMachine": "ark9.0.0.0",
|
||||
"compileMode": "esmodule",
|
||||
"dependencies": []
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
string EntryAbility_desc 0x01000002
|
||||
string EntryAbility_label 0x01000003
|
||||
string app_name 0x01000001
|
||||
string module_desc 0x01000004
|
||||
color start_window_background 0x01000006
|
||||
media app_icon 0x01000000
|
||||
media icon 0x0100000f
|
||||
media jiaohuanji 0x01000011
|
||||
media jiaohuanji_tm 0x0100000e
|
||||
media jixianqi 0x0100000b
|
||||
media jixianqi_tm 0x0100000a
|
||||
media luyouqi 0x01000005
|
||||
media luyouqi_tm 0x0100000c
|
||||
media packet 0x01000007
|
||||
media startIcon 0x01000009
|
||||
media zhuji 0x01000008
|
||||
media zhuji_tm 0x0100000d
|
||||
profile main_pages 0x01000010
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
"record" :
|
||||
[
|
||||
{
|
||||
"id" : "0x01000000",
|
||||
"name" : "app_icon",
|
||||
"type" : "media"
|
||||
},
|
||||
{
|
||||
"id" : "0x01000001",
|
||||
"name" : "app_name",
|
||||
"type" : "string"
|
||||
},
|
||||
{
|
||||
"id" : "0x01000002",
|
||||
"name" : "EntryAbility_desc",
|
||||
"type" : "string"
|
||||
},
|
||||
{
|
||||
"id" : "0x01000003",
|
||||
"name" : "EntryAbility_label",
|
||||
"type" : "string"
|
||||
},
|
||||
{
|
||||
"id" : "0x01000004",
|
||||
"name" : "module_desc",
|
||||
"type" : "string"
|
||||
},
|
||||
{
|
||||
"id" : "0x01000005",
|
||||
"name" : "luyouqi",
|
||||
"type" : "media"
|
||||
},
|
||||
{
|
||||
"id" : "0x01000006",
|
||||
"name" : "start_window_background",
|
||||
"type" : "color"
|
||||
},
|
||||
{
|
||||
"id" : "0x01000007",
|
||||
"name" : "packet",
|
||||
"type" : "media"
|
||||
},
|
||||
{
|
||||
"id" : "0x01000008",
|
||||
"name" : "zhuji",
|
||||
"type" : "media"
|
||||
},
|
||||
{
|
||||
"id" : "0x01000009",
|
||||
"name" : "startIcon",
|
||||
"type" : "media"
|
||||
},
|
||||
{
|
||||
"id" : "0x0100000A",
|
||||
"name" : "jixianqi_tm",
|
||||
"type" : "media"
|
||||
},
|
||||
{
|
||||
"id" : "0x0100000B",
|
||||
"name" : "jixianqi",
|
||||
"type" : "media"
|
||||
},
|
||||
{
|
||||
"id" : "0x0100000C",
|
||||
"name" : "luyouqi_tm",
|
||||
"type" : "media"
|
||||
},
|
||||
{
|
||||
"id" : "0x0100000D",
|
||||
"name" : "zhuji_tm",
|
||||
"type" : "media"
|
||||
},
|
||||
{
|
||||
"id" : "0x0100000E",
|
||||
"name" : "jiaohuanji_tm",
|
||||
"type" : "media"
|
||||
},
|
||||
{
|
||||
"id" : "0x0100000F",
|
||||
"name" : "icon",
|
||||
"type" : "media"
|
||||
},
|
||||
{
|
||||
"id" : "0x01000010",
|
||||
"name" : "main_pages",
|
||||
"type" : "profile"
|
||||
},
|
||||
{
|
||||
"id" : "0x01000011",
|
||||
"name" : "jiaohuanji",
|
||||
"type" : "media"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"app" :
|
||||
{
|
||||
"apiReleaseType" : "Release",
|
||||
"bundleName" : "com.example.ensp2",
|
||||
"compileSdkType" : "OpenHarmony",
|
||||
"compileSdkVersion" : "4.0.10.13",
|
||||
"debug" : true,
|
||||
"icon" : "$media:app_icon",
|
||||
"iconId" : 16777216,
|
||||
"label" : "$string:app_name",
|
||||
"labelId" : 16777217,
|
||||
"minAPIVersion" : 9,
|
||||
"targetAPIVersion" : 10,
|
||||
"vendor" : "example",
|
||||
"versionCode" : 1000000,
|
||||
"versionName" : "1.0.0"
|
||||
},
|
||||
"module" :
|
||||
{
|
||||
"abilities" :
|
||||
[
|
||||
{
|
||||
"description" : "$string:EntryAbility_desc",
|
||||
"descriptionId" : 16777218,
|
||||
"exported" : true,
|
||||
"icon" : "$media:icon",
|
||||
"iconId" : 16777231,
|
||||
"label" : "$string:EntryAbility_label",
|
||||
"labelId" : 16777219,
|
||||
"name" : "EntryAbility",
|
||||
"orientation" : "auto_rotation",
|
||||
"skills" :
|
||||
[
|
||||
{
|
||||
"actions" :
|
||||
[
|
||||
"action.system.home"
|
||||
],
|
||||
"entities" :
|
||||
[
|
||||
"entity.system.home"
|
||||
]
|
||||
}
|
||||
],
|
||||
"srcEntry" : "./ets/entryability/EntryAbility.ets",
|
||||
"startWindowBackground" : "$color:start_window_background",
|
||||
"startWindowBackgroundId" : 16777222,
|
||||
"startWindowIcon" : "$media:startIcon",
|
||||
"startWindowIconId" : 16777225
|
||||
}
|
||||
],
|
||||
"compileMode" : "esmodule",
|
||||
"deliveryWithInstall" : true,
|
||||
"dependencies" : [],
|
||||
"description" : "$string:module_desc",
|
||||
"descriptionId" : 16777220,
|
||||
"deviceTypes" :
|
||||
[
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"installationFree" : false,
|
||||
"mainElement" : "EntryAbility",
|
||||
"name" : "entry",
|
||||
"pages" : "$profile:main_pages",
|
||||
"type" : "entry",
|
||||
"virtualMachine" : "ark9.0.0.0"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1 @@
|
|||
{"src":["pages/Index"]}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"apiType": "stageMode",
|
||||
"buildOption": {
|
||||
"arkOptions": {
|
||||
// "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */
|
||||
}
|
||||
},
|
||||
"buildOptionSet": [
|
||||
{
|
||||
"name": "release",
|
||||
"arkOptions": {
|
||||
"obfuscation": {
|
||||
"ruleOptions": {
|
||||
"enable": true,
|
||||
"files": [
|
||||
"./obfuscation-rules.txt"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
"targets": [
|
||||
{
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"name": "ohosTest",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
|
||||
|
||||
export default {
|
||||
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
|
||||
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Define project specific obfuscation rules here.
|
||||
# You can include the obfuscation configuration files in the current module's build-profile.json5.
|
||||
#
|
||||
# For more details, see
|
||||
# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
|
||||
|
||||
# Obfuscation options:
|
||||
# -disable-obfuscation: disable all obfuscations
|
||||
# -enable-property-obfuscation: obfuscate the property names
|
||||
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
|
||||
# -compact: remove unnecessary blank spaces and all line feeds
|
||||
# -remove-log: remove all console.* statements
|
||||
# -print-namecache: print the name cache that contains the mapping from the old names to new names
|
||||
# -apply-namecache: reuse the given cache file
|
||||
|
||||
# Keep options:
|
||||
# -keep-property-name: specifies property names that you want to keep
|
||||
# -keep-global-name: specifies names that you want to keep in the global scope
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"license": "",
|
||||
"devDependencies": {},
|
||||
"author": "",
|
||||
"name": "entry",
|
||||
"description": "Please describe the basic information.",
|
||||
"main": "",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,331 @@
|
|||
import { SimBase } from "./SimBase"
|
||||
|
||||
@Observed
|
||||
export class SimPacket {
|
||||
sourceMac: string; // 源主机mac地址
|
||||
sourceIp: string; // 源主机ip地址
|
||||
destinationMac: string; // 目的主机mac地址
|
||||
destinationIp: string; // 目的主机ip地址
|
||||
message: string;
|
||||
upJump: any; // 可以根据具体类型定义
|
||||
id: symbol;
|
||||
points: number[][]; // 路径点
|
||||
allSimObj: SimBase[];
|
||||
allSimPacket: SimPacket[];
|
||||
level: number; // 数据包展示优先级
|
||||
|
||||
constructor(sourceIp: string, sourceMac: string, destinationIp: string, destinationMac: string, message: string, allSimObj: SimBase[], allSimPacket: SimPacket[]) {
|
||||
this.sourceMac = sourceMac;
|
||||
this.sourceIp = sourceIp;
|
||||
this.destinationMac = destinationMac;
|
||||
this.destinationIp = destinationIp;
|
||||
this.message = message;
|
||||
this.allSimObj = allSimObj;
|
||||
this.allSimPacket = allSimPacket;
|
||||
this.upJump = null; // 上一跳连接对象
|
||||
this.points = [];
|
||||
this.id = Symbol()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class SimConnect {
|
||||
nObjS: SimBase | null; // 线一端节点S
|
||||
ifsS: number; // 线一端节点S的端口
|
||||
nObjE: SimBase | null; // 线一端节点E
|
||||
ifsE: number; // 线一端节点E的端口
|
||||
width: number; // 线的粗细
|
||||
configCorrect: boolean; // 配置正确与否
|
||||
|
||||
constructor(nobjs: SimBase | null, ifss: number, nobje: SimBase | null, ifse: number) {
|
||||
this.nObjS = nobjs;
|
||||
this.ifsS = ifss;
|
||||
this.nObjE = nobje;
|
||||
this.ifsE = ifse;
|
||||
this.width = this.configCorrect === false ? 1 : 4;
|
||||
if (nobjs != null && nobje != null) {
|
||||
this.configCorrect = true
|
||||
} else {
|
||||
this.configCorrect = false
|
||||
}
|
||||
}
|
||||
|
||||
isConnectedTo(other: SimConnect): boolean {
|
||||
return (
|
||||
this.nObjS.objID === other.nObjS.objID &&
|
||||
this.nObjE.objID === other.nObjE.objID
|
||||
);
|
||||
} // 判断两个连接对象是否已经连接
|
||||
|
||||
checkConfig() {
|
||||
if (this.nObjS.Mac && this.nObjS.Ip && this.nObjE.Mac && this.nObjE.Ip) {
|
||||
this.width = 4;
|
||||
} else {
|
||||
this.width = 1;
|
||||
}
|
||||
} // 检查两边节点配置是否正确
|
||||
|
||||
transfer(sourceNode: SimBase, packet: SimPacket): boolean {
|
||||
if (sourceNode === this.nObjS) {
|
||||
this.nObjE.receive(packet)
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} // 传输数据
|
||||
|
||||
updateObjConn() {
|
||||
this.nObjS.interface[this.ifsS-1] = this.nObjE.objID
|
||||
this.nObjE.interface[this.ifsE-1] = this.nObjS.objID
|
||||
} // 更新虚拟对象的接口信息
|
||||
|
||||
deleteObjConn() {
|
||||
this.nObjS.interface[this.ifsS-1] = null
|
||||
this.nObjE.interface[this.ifsE-1] = null
|
||||
} // 删除虚拟对象的接口信息
|
||||
|
||||
equals(other: any): boolean {
|
||||
if (other instanceof SimConnect) {
|
||||
const otherIds = other.nObjS.objID;
|
||||
const otherIde = other.nObjE.objID;
|
||||
return this.nObjS.objID == otherIds && this.nObjE.objID == otherIde;
|
||||
}
|
||||
return false;
|
||||
} // 判断两个连接对象是否相同
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class SimHost extends SimBase {
|
||||
RPacket: SimPacket; // 主机获取到的正确数据包
|
||||
isOnline: boolean = false; // 主机联网状态
|
||||
|
||||
constructor(x: number, y: number, config: any = null) {
|
||||
super(x, y, config)
|
||||
this.objType = 1
|
||||
this.objLabel = this.setDefaultName()
|
||||
this.interface = [null] // 主机只有一个接口
|
||||
this.connections = [null] // 一个接口对应一根连接线
|
||||
this.img = $r("app.media.zhuji") // 主机图片
|
||||
this.imgTm = $r("app.media.zhuji_tm") // 主机配置成功图片
|
||||
this.Ip = ""
|
||||
this.Mac = ""
|
||||
}
|
||||
|
||||
setDefaultName() {
|
||||
return `SHO${++SimBase.flag}`
|
||||
} // 生成组件默认名称
|
||||
|
||||
onlineSwitch(){
|
||||
this.isOnline = !this.isOnline
|
||||
} // 切换联网状态
|
||||
|
||||
createPacket(ip: string, mac: string, message: string, allSimObj: SimBase[], allSimPacket: SimPacket[]) {
|
||||
let objArr = allSimObj
|
||||
let packet = new SimPacket(this.Ip, this.Mac, ip, mac, message, objArr, allSimPacket)
|
||||
packet.allSimPacket.push(packet)
|
||||
packet.level = 1
|
||||
packet.points.push([this.objX, this.objY])
|
||||
updatePacketLog(`${this.objLabel}创建数据包,信息为[${packet.message}]`)
|
||||
this.send(packet)
|
||||
} // 创建数据包
|
||||
|
||||
send(packet: SimPacket) {
|
||||
const connObj: Symbol = this.objID
|
||||
packet.upJump = connObj
|
||||
updatePacketLog(`${this.objLabel}发送数据包,信息为[${packet.message}]`)
|
||||
if(packet.allSimObj.find(item => item.objID === this.interface[0])!=undefined) {
|
||||
packet.allSimObj.find(item => item.objID === this.interface[0]).receive(packet)
|
||||
}
|
||||
} // 发送数据包
|
||||
|
||||
receive(packet: SimPacket): boolean {
|
||||
if (packet.destinationIp == this.Ip) {
|
||||
packet.points.push([this.objX, this.objY])
|
||||
updatePacketLog(`${this.objLabel}成功获取到信息[${packet.message}]!`)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
} // 收到数据包
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class SimRouter extends SimBase {
|
||||
|
||||
constructor(x: number, y: number, config: any = null) {
|
||||
super(x, y, config)
|
||||
this.objType = 2
|
||||
this.objLabel = this.setDefaultName()
|
||||
this.interface = [null, null, null, null] // 路由器有四个接口
|
||||
this.connections = [null, null, null, null] // 四个接口对应四根连接线
|
||||
this.img = $r("app.media.luyouqi") // 路由器图片
|
||||
this.imgTm = $r("app.media.luyouqi_tm") // 路由器配置成功图片
|
||||
this.Ip = ""
|
||||
this.Mac = ""
|
||||
this.routerTable = []
|
||||
}
|
||||
|
||||
setDefaultName() {
|
||||
return `SRO${++SimBase.flag}`
|
||||
} // 生成组件默认名称
|
||||
|
||||
checkDestinationIp(destinationIp: string, network: string): boolean {
|
||||
// 解析目标 IP 和网络地址
|
||||
const [networkAddress, subnetMask] = network.split('/');
|
||||
|
||||
// 分解目标 IP 地址和网络地址为数组
|
||||
const destinationIpParts = destinationIp.split('.');
|
||||
const networkAddressParts = networkAddress.split('.');
|
||||
|
||||
// 计算目标 IP 的网络地址(根据子网掩码)
|
||||
const calculatedNetworkAddressParts = destinationIpParts.map((part, index) => {
|
||||
return parseInt(part) & parseInt(networkAddressParts[index]);
|
||||
});
|
||||
|
||||
// 构建目标 IP 的网络地址和网络地址的比较字符串
|
||||
const calculatedNetworkAddress = calculatedNetworkAddressParts.join('.');
|
||||
const inputNetworkAddress = networkAddressParts.join('.');
|
||||
|
||||
// 比较目标 IP 的网络地址和给定的网络地址是否相同,并检查是否在同一网络范围内
|
||||
return calculatedNetworkAddress === inputNetworkAddress && subnetMask === '24';
|
||||
} // 检查目标ip是否属于指定的网段范围内
|
||||
|
||||
transmit(packet: SimPacket){
|
||||
this.interface.forEach((item: Symbol) => {
|
||||
let obj = packet.allSimObj.find(obj => obj.objID === item)
|
||||
if(item != null){
|
||||
if(item != packet.upJump && this.routerTable.some(table => table.net === packet.destinationIp)){
|
||||
const pac = new SimPacket(packet.sourceIp, packet.sourceMac, packet.destinationIp, packet.destinationMac, packet.message, packet.allSimObj, packet.allSimPacket)
|
||||
pac.level = packet.level + 1
|
||||
pac.upJump = this.objID
|
||||
pac.points.push([this.objX, this.objY])
|
||||
packet.allSimPacket.push(pac)
|
||||
obj.receive(pac)
|
||||
}
|
||||
}
|
||||
})
|
||||
} // 路由器转发数据包
|
||||
|
||||
receive(packet: SimPacket){
|
||||
updatePacketLog(`路由器-${this.objLabel}接受到数据,将进行转发!`)
|
||||
packet.points.push([this.objX, this.objY])
|
||||
try {
|
||||
this.checkDestinationIp(packet.destinationIp, this.Ip)
|
||||
}catch (e){
|
||||
console.log('packet router err:' + JSON.stringify(e))
|
||||
}
|
||||
this.transmit(packet);
|
||||
} // 收到数据包
|
||||
|
||||
getTableConfig(): string {
|
||||
let str = "";
|
||||
const routerTables = this.routerTable;
|
||||
for (let router of routerTables) {
|
||||
str += `接口号: ${router['node_ifs']}\n`;
|
||||
str += `网段号: ${router['segment']}\n`;
|
||||
}
|
||||
return str;
|
||||
} // 获取路由表配置信息用于展示
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class SimSwitch extends SimBase {
|
||||
macTable: object[];
|
||||
|
||||
constructor(x: number, y: number, config: any = null) {
|
||||
super(x, y, config)
|
||||
this.objType = 3
|
||||
this.objLabel = this.setDefaultName()
|
||||
this.interface = [null, null, null, null] // 路由器有四个接口
|
||||
this.connections = [null, null, null, null] // 四个接口对应四根连接线
|
||||
this.img = $r("app.media.jiaohuanji") // 交换机图片
|
||||
this.imgTm = $r("app.media.jiaohuanji_tm") // 交换机配置成功图片
|
||||
this.Mac = ""
|
||||
this.switchTable = []
|
||||
}
|
||||
|
||||
setDefaultName() {
|
||||
return `SSW${++SimBase.flag}`
|
||||
} // 生成组件默认名称
|
||||
|
||||
transmit(packet: SimPacket){
|
||||
this.interface.forEach((item: Symbol) => {
|
||||
let obj = packet.allSimObj.find(obj => obj.objID === item)
|
||||
if(item != null){
|
||||
if(item != packet.upJump && this.switchTable.some(table => table.net === packet.destinationMac)){
|
||||
const pac = new SimPacket(packet.sourceIp, packet.sourceMac, packet.destinationIp, packet.destinationMac, packet.message, packet.allSimObj, packet.allSimPacket)
|
||||
pac.level = packet.level + 1
|
||||
pac.upJump = this.objID
|
||||
pac.points.push([this.objX, this.objY])
|
||||
packet.allSimPacket.push(pac)
|
||||
obj.receive(pac)
|
||||
}
|
||||
}
|
||||
})
|
||||
} // 交换机转发数据包
|
||||
|
||||
receive(packet: SimPacket){
|
||||
updatePacketLog(`交换机-${this.objLabel}接受到数据,将进行转发!`)
|
||||
packet.points.push([this.objX, this.objY])
|
||||
this.transmit(packet);
|
||||
} // 收到数据包
|
||||
|
||||
getTableConfig(): string {
|
||||
let str = "";
|
||||
const macTables = this.macTable;
|
||||
for (const router of macTables) {
|
||||
str += `接口号: ${router['node_ifs']}\n`;
|
||||
str += `网段号: ${router['mac']}\n`;
|
||||
}
|
||||
return str;
|
||||
} // 获取交换机表配置信息用于展示
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class SimHub extends SimBase {
|
||||
constructor(x: number, y: number, config: any = null) {
|
||||
super(x, y, config)
|
||||
this.objType = 4
|
||||
this.objLabel = this.setDefaultName()
|
||||
this.interface = [null, null, null, null] // 路由器有四个接口
|
||||
this.connections = [null, null, null, null] // 四个接口对应四根连接线
|
||||
this.img = $r("app.media.jixianqi") // 集线器图片
|
||||
this.imgTm = $r("app.media.jixianqi_tm") // 集线器配置成功图片
|
||||
}
|
||||
|
||||
setDefaultName(): string {
|
||||
return `SHU${++SimBase.flag}` // 生成组件默认名称
|
||||
}
|
||||
|
||||
transmit(packet: SimPacket): void {
|
||||
this.interface.forEach((item: Symbol, index) => {
|
||||
let obj = packet.allSimObj.find(obj => obj.objID === item)
|
||||
if (item != null) {
|
||||
if (item != packet.upJump) {
|
||||
const pac = new SimPacket(packet.sourceIp, packet.sourceMac, packet.destinationIp, packet.destinationMac, packet.message, packet.allSimObj, packet.allSimPacket)
|
||||
pac.level = packet.level + 1
|
||||
pac.upJump = this.objID
|
||||
pac.points.push([this.objX, this.objY])
|
||||
packet.allSimPacket.push(pac)
|
||||
obj.receive(pac)
|
||||
}
|
||||
}
|
||||
})
|
||||
} // 集线器转发数据包
|
||||
|
||||
receive(packet: SimPacket): void {
|
||||
updatePacketLog(`集线器-${this.objLabel}接受到数据,将进行转发!`)
|
||||
packet.points.push([this.objX, this.objY])
|
||||
this.transmit(packet);
|
||||
} // 收到数据包
|
||||
}
|
||||
|
||||
function getNewDate() {
|
||||
return new Date().toLocaleString() + '\t'
|
||||
} // 获取当前时间
|
||||
|
||||
function updatePacketLog(text: string){
|
||||
let logText = AppStorage.get('LogText')
|
||||
logText = logText + getNewDate() + text + '\n'
|
||||
AppStorage.set('LogText', logText)
|
||||
console.log(text);
|
||||
} // 更新主页面底部日志信息
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
import { SimPacket } from './OtherSimObjects';
|
||||
|
||||
// 路由表和mac表项
|
||||
export interface Table {
|
||||
port: number // 设备哪个端口
|
||||
net: string // 连接哪个网络或设备(下一跳可到达网段或设备mac地址)
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class SimBase {
|
||||
static flag = 0 // 当前仿真对象数量
|
||||
configCorrect: boolean; // 是否配置正确
|
||||
objType: number | null; // 对象类型,1为主机,2为路由器,3为交换机,4为集线器
|
||||
Ip: string | null; // ip地址
|
||||
Mac: string | null; // mac地址
|
||||
routerTable: Array<Table> | null; // 路由表
|
||||
switchTable: Array<Table> | null; // 交换表
|
||||
objLabel: string; // 对象标签
|
||||
objID: Symbol; // 使用symbol()生成对象唯一标识
|
||||
objX: number; // x坐标
|
||||
objY: number; // y坐标
|
||||
img: Resource | null; // 仿真对象图片
|
||||
imgTm: Resource | null; // 仿真对象配置成功图片
|
||||
interface: Array<any>; // 接口网络配置信息
|
||||
connections: Array<any>; // 连接线对象
|
||||
isChose: boolean // 是否被选中
|
||||
|
||||
constructor(x: number, y: number, type: number) {
|
||||
this.configCorrect = false;
|
||||
this.objType = type;
|
||||
this.objID = Symbol();
|
||||
this.objX = x;
|
||||
this.objY = y;
|
||||
this.isChose = false
|
||||
}
|
||||
|
||||
setDefaultName(): string {
|
||||
let header: string = ""
|
||||
if (this.objType == 1) {
|
||||
header = "SHO"
|
||||
} else if (this.objType == 2) {
|
||||
header = "SRO"
|
||||
} else if (this.objType == 3) {
|
||||
header = "SSW"
|
||||
} else {
|
||||
header = "SHU"
|
||||
}
|
||||
return `${header}${++SimBase.flag}`
|
||||
} // 生成组件默认名称
|
||||
|
||||
receive(packet: SimPacket) {
|
||||
} // 发送数据包
|
||||
|
||||
createPacket(ip: string, mac: string, message: string, allSimObj: SimBase[], allSimPacket: SimPacket[]){
|
||||
} // 创建数据包
|
||||
|
||||
transmit(packet: SimPacket){
|
||||
} // 转发数据包
|
||||
|
||||
changeIsChose() {
|
||||
this.isChose = !this.isChose
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
export class TopMenu {
|
||||
title: string
|
||||
menuItemArr: TopMenuItem[] | undefined
|
||||
|
||||
constructor(title: string, menuItemArr?: TopMenuItem[]) {
|
||||
this.title = title
|
||||
this.menuItemArr = menuItemArr
|
||||
}
|
||||
} // 顶部菜单类
|
||||
|
||||
export class TopMenuItem {
|
||||
title: string
|
||||
fun: Function | undefined
|
||||
|
||||
constructor(title: string, fun?: Function) {
|
||||
this.title = title
|
||||
this.fun = fun
|
||||
}
|
||||
} // 顶部菜单选项类
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
import { SimBase } from '../classes/SimBase'
|
||||
|
||||
interface SimClickObj {
|
||||
name: string
|
||||
image: Resource
|
||||
type: number
|
||||
}
|
||||
|
||||
@Component
|
||||
export struct BottomMenuBar {
|
||||
private simClickObjArr: SimClickObj[] = [
|
||||
{
|
||||
name: '主机',
|
||||
image: $r('app.media.zhuji'),
|
||||
type: 1
|
||||
},
|
||||
{
|
||||
name: '路由器',
|
||||
image: $r('app.media.luyouqi'),
|
||||
type: 2
|
||||
},
|
||||
{
|
||||
name: '交换器',
|
||||
image: $r('app.media.jiaohuanji'),
|
||||
type: 3
|
||||
},
|
||||
{
|
||||
name: '集线器',
|
||||
image: $r('app.media.jixianqi'),
|
||||
type: 4
|
||||
},
|
||||
] // 底部菜单栏数组
|
||||
@Consume allSimObj: SimBase[] // 仿真对象数组
|
||||
@Consume isNewObj: boolean // 是否新增对象
|
||||
@Consume newObjType: number // 新增对象类型
|
||||
@Consume choseIndex: number | null // 选中对象下标
|
||||
@Consume TempConn: any[] // 是否正在新增连接线
|
||||
@Consume isNewConn: boolean // 选中连接线下标
|
||||
|
||||
scroller: Scroller = new Scroller()
|
||||
@StorageLink('LogText') LogText: string = ''
|
||||
|
||||
build() {
|
||||
Row({ space: 10 }) {
|
||||
ForEach(this.simClickObjArr, (item: SimClickObj) => {
|
||||
Column() {
|
||||
Image(item.image)
|
||||
.border({
|
||||
color: item.type == this.newObjType && this.isNewObj ? Color.Red : Color.Transparent,
|
||||
width: 1
|
||||
})
|
||||
.width(50)
|
||||
.onClick(() => {
|
||||
this.isNewConn = false
|
||||
this.TempConn = []
|
||||
if (!this.isNewObj) { // 选择创建对象
|
||||
this.isNewObj = true
|
||||
this.newObjType = item.type
|
||||
} else if (this.newObjType != item.type) { // 选择创建其他对象
|
||||
this.newObjType = item.type
|
||||
} else { // 取消选择
|
||||
this.isNewObj = false
|
||||
this.newObjType = -1
|
||||
}
|
||||
this.allSimObj.forEach(item => {
|
||||
item.isChose = false
|
||||
}) // 创建对象时必须全部设置为非选中状态
|
||||
this.choseIndex = null
|
||||
})
|
||||
Text(item.name)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.margin({ top: 5 })
|
||||
})
|
||||
|
||||
Scroll(this.scroller) {
|
||||
Text(this.LogText)
|
||||
.fontSize(15)
|
||||
}
|
||||
.border({
|
||||
color: Color.Black,
|
||||
width: 1
|
||||
})
|
||||
.layoutWeight(1)
|
||||
.height('100%')
|
||||
.margin(2)
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.margin({left: '5%'})
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,476 @@
|
|||
import { SimBase, Table } from "../classes/SimBase"
|
||||
import { SimConnect, SimPacket } from '../classes/OtherSimObjects'
|
||||
import promptAction from '@ohos.promptAction'
|
||||
import { checkNetwork } from '../functions/functions'
|
||||
|
||||
@CustomDialog
|
||||
export struct LabelRevise {
|
||||
controller: CustomDialogController
|
||||
@ObjectLink simObj: SimBase
|
||||
@State newLabel: string = ""
|
||||
|
||||
build() {
|
||||
Column({ space: 5 }) {
|
||||
Text("原标签: " + this.simObj.objLabel)
|
||||
.fontSize(28)
|
||||
.fontColor(Color.Gray)
|
||||
.width("80%")
|
||||
|
||||
Row() {
|
||||
Text("新标签:")
|
||||
.fontSize(28)
|
||||
.fontColor(Color.Gray)
|
||||
|
||||
TextInput({ placeholder: "请输入新标签" })
|
||||
.onChange((value) => {
|
||||
this.newLabel = value
|
||||
})
|
||||
.width("65%")
|
||||
}
|
||||
.width("80%")
|
||||
|
||||
Row({ space: 40 }) {
|
||||
Button("取消")
|
||||
.height(35)
|
||||
.onClick(() => {
|
||||
this.controller.close()
|
||||
})
|
||||
|
||||
Button("确定")
|
||||
.height(35)
|
||||
.onClick(() => {
|
||||
this.simObj.objLabel = this.newLabel
|
||||
this.controller.close()
|
||||
})
|
||||
}
|
||||
.margin({ top: 5 })
|
||||
}
|
||||
.margin(10)
|
||||
.backgroundColor(Color.White)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
export struct LineDelete {
|
||||
controller: CustomDialogController
|
||||
@ObjectLink simObj: SimBase
|
||||
@Consume allSimConn: SimConnect[]
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text(this.simObj.objLabel + ' 连接线列表')
|
||||
.fontSize(18)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
Menu() {
|
||||
ForEach(this.allSimConn, (item: SimConnect, index) => {
|
||||
if (this.simObj.objID === item.nObjE.objID || this.simObj.objID === item.nObjS.objID) {
|
||||
MenuItem({
|
||||
content: this.simObj.objLabel + ' : ' + (this.simObj.objID === item.nObjE.objID ? item.nObjS.objLabel : item.nObjE.objLabel)
|
||||
})
|
||||
.height(25)
|
||||
.contentFont({ size: 18 })
|
||||
.onChange(() => {
|
||||
item.deleteObjConn() // 删除线时应该先将线两端的设备的connection设置为null
|
||||
this.allSimConn.splice(index, 1) // 然后将连接线对象数组中的该连接线对象删除
|
||||
this.controller.close()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.margin(10)
|
||||
.backgroundColor(Color.White)
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
export struct NetworkConfig {
|
||||
controller: CustomDialogController
|
||||
@ObjectLink simObj: SimBase
|
||||
@State ip: string = ""
|
||||
@State mac: string = ""
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
TextInput({ placeholder: "请输入ip地址:192.168.1.1" })
|
||||
.onChange((value) => {
|
||||
this.ip = value
|
||||
})
|
||||
|
||||
TextInput({ placeholder: "请输入mac地址:mac11" })
|
||||
.onChange((value) => {
|
||||
this.mac = value
|
||||
})
|
||||
|
||||
Row({ space: 30 }) {
|
||||
Button("取消")
|
||||
.onClick(() => {
|
||||
this.controller.close()
|
||||
})
|
||||
|
||||
Button("确定")
|
||||
.onClick(() => {
|
||||
if (this.simObj.objType == 3) {
|
||||
this.simObj.Mac = this.mac
|
||||
} else {
|
||||
this.simObj.Ip = this.ip
|
||||
this.simObj.Mac = this.mac
|
||||
}
|
||||
this.controller.close()
|
||||
})
|
||||
}
|
||||
}
|
||||
.backgroundColor(Color.White)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
export struct RouterTableConfig {
|
||||
controller: CustomDialogController
|
||||
@ObjectLink simObj: SimBase
|
||||
@State ip1: string = ""
|
||||
@State ip2: string = ""
|
||||
@State ip3: string = ""
|
||||
@State ip4: string = ""
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Row() {
|
||||
TextInput({ placeholder: "请输入端口1下一跳:192.168.1.0/24" })
|
||||
.onChange((value) => {
|
||||
this.ip1 = value
|
||||
})
|
||||
.width("80%")
|
||||
|
||||
Button("添加")
|
||||
.onClick(() => {
|
||||
let pushItem: Table = {
|
||||
port: 1,
|
||||
net: this.ip1
|
||||
}
|
||||
if (this.simObj.routerTable.some(item => item.port == pushItem.port)) {
|
||||
this.simObj.routerTable[pushItem.port-1] = pushItem
|
||||
} else {
|
||||
this.simObj.routerTable.push(pushItem)
|
||||
this.simObj.routerTable.sort((a: Table, b: Table) => a.port > b.port ? 1 : -1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Row() {
|
||||
TextInput({ placeholder: "请输入端口2下一跳:" })
|
||||
.onChange((value) => {
|
||||
this.ip2 = value
|
||||
})
|
||||
.width("80%")
|
||||
|
||||
Button("添加")
|
||||
.onClick(() => {
|
||||
let pushItem: Table = {
|
||||
port: 2,
|
||||
net: this.ip2
|
||||
}
|
||||
if (this.simObj.routerTable.some(item => item.port == pushItem.port)) {
|
||||
this.simObj.routerTable[pushItem.port-1] = pushItem
|
||||
} else {
|
||||
this.simObj.routerTable.push(pushItem)
|
||||
this.simObj.routerTable.sort((a: Table, b: Table) => a.port > b.port ? 1 : -1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Row() {
|
||||
TextInput({ placeholder: "请输入端口3下一跳:" })
|
||||
.onChange((value) => {
|
||||
this.ip3 = value
|
||||
})
|
||||
.width("80%")
|
||||
|
||||
Button("添加")
|
||||
.onClick(() => {
|
||||
let pushItem: Table = {
|
||||
port: 3,
|
||||
net: this.ip3
|
||||
}
|
||||
if (this.simObj.routerTable.some(item => item.port == pushItem.port)) {
|
||||
this.simObj.routerTable[pushItem.port-1] = pushItem
|
||||
} else {
|
||||
this.simObj.routerTable.push(pushItem)
|
||||
this.simObj.routerTable.sort((a: Table, b: Table) => a.port > b.port ? 1 : -1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Row() {
|
||||
TextInput({ placeholder: "请输入端口4下一跳:" })
|
||||
.onChange((value) => {
|
||||
this.ip4 = value
|
||||
})
|
||||
.width("80%")
|
||||
|
||||
Button("添加")
|
||||
.onClick(() => {
|
||||
let pushItem: Table = {
|
||||
port: 4,
|
||||
net: this.ip4
|
||||
}
|
||||
if (this.simObj.routerTable.some(item => item.port == pushItem.port)) {
|
||||
this.simObj.routerTable[pushItem.port-1] = pushItem
|
||||
} else {
|
||||
this.simObj.routerTable.push(pushItem)
|
||||
this.simObj.routerTable.sort((a: Table, b: Table) => a.port > b.port ? 1 : -1)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
.backgroundColor(Color.White)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
export struct SwitchTableConfig {
|
||||
controller: CustomDialogController
|
||||
@ObjectLink simObj: SimBase
|
||||
@State mac1: string = ""
|
||||
@State mac2: string = ""
|
||||
@State mac3: string = ""
|
||||
@State mac4: string = ""
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Row() {
|
||||
TextInput({ placeholder: "请输入端口1下一跳:mac11" })
|
||||
.onChange((value) => {
|
||||
this.mac1 = value
|
||||
})
|
||||
.width("80%")
|
||||
|
||||
Button("添加")
|
||||
.onClick(() => {
|
||||
let pushItem: Table = {
|
||||
port: 1,
|
||||
net: this.mac1
|
||||
}
|
||||
if (this.simObj.switchTable.some(item => item.port == pushItem.port)) {
|
||||
this.simObj.switchTable[pushItem.port-1] = pushItem
|
||||
} else {
|
||||
this.simObj.switchTable.push(pushItem)
|
||||
this.simObj.switchTable.sort((a: Table, b: Table) => a.port > b.port ? 1 : -1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Row() {
|
||||
TextInput({ placeholder: "请输入端口2下一跳:" })
|
||||
.onChange((value) => {
|
||||
this.mac2 = value
|
||||
})
|
||||
.width("80%")
|
||||
|
||||
Button("添加")
|
||||
.onClick(() => {
|
||||
let pushItem: Table = {
|
||||
port: 2,
|
||||
net: this.mac2
|
||||
}
|
||||
if (this.simObj.switchTable.some(item => item.port == pushItem.port)) {
|
||||
this.simObj.switchTable[pushItem.port-1] = pushItem
|
||||
} else {
|
||||
this.simObj.switchTable.push(pushItem)
|
||||
this.simObj.switchTable.sort((a: Table, b: Table) => a.port > b.port ? 1 : -1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Row() {
|
||||
TextInput({ placeholder: "请输入端口3下一跳:" })
|
||||
.onChange((value) => {
|
||||
this.mac3 = value
|
||||
})
|
||||
.width("80%")
|
||||
|
||||
Button("添加")
|
||||
.onClick(() => {
|
||||
let pushItem: Table = {
|
||||
port: 3,
|
||||
net: this.mac3
|
||||
}
|
||||
if (this.simObj.switchTable.some(item => item.port == pushItem.port)) {
|
||||
this.simObj.switchTable[pushItem.port-1] = pushItem
|
||||
} else {
|
||||
this.simObj.switchTable.push(pushItem)
|
||||
this.simObj.switchTable.sort((a: Table, b: Table) => a.port > b.port ? 1 : -1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Row() {
|
||||
TextInput({ placeholder: "请输入端口4下一跳:" })
|
||||
.onChange((value) => {
|
||||
this.mac4 = value
|
||||
})
|
||||
.width("80%")
|
||||
|
||||
Button("添加")
|
||||
.onClick(() => {
|
||||
let pushItem: Table = {
|
||||
port: 4,
|
||||
net: this.mac4
|
||||
}
|
||||
if (this.simObj.switchTable.some(item => item.port == pushItem.port)) {
|
||||
this.simObj.switchTable[pushItem.port-1] = pushItem
|
||||
} else {
|
||||
this.simObj.switchTable.push(pushItem)
|
||||
this.simObj.switchTable.sort((a: Table, b: Table) => a.port > b.port ? 1 : -1)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
.backgroundColor(Color.White)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
export struct PacketSet {
|
||||
controller: CustomDialogController
|
||||
@ObjectLink simObj: SimBase
|
||||
@State ip: string = ""
|
||||
@State mac: string = ""
|
||||
@State message: string = ""
|
||||
@Consume allSimObj: SimBase[]
|
||||
@Consume allSimPacket: SimPacket[]
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
TextInput({ placeholder: "请输入目标ip地址:192.168.1.1" })
|
||||
.onChange((value) => {
|
||||
this.ip = value
|
||||
})
|
||||
|
||||
TextInput({ placeholder: "请输入目标mac地址:mac11" })
|
||||
.onChange((value) => {
|
||||
this.mac = value
|
||||
})
|
||||
|
||||
TextInput({ placeholder: "请输入发送信息" })
|
||||
.onChange((value) => {
|
||||
this.message = value
|
||||
})
|
||||
|
||||
Row({ space: 30 }) {
|
||||
Button("取消")
|
||||
.onClick(() => {
|
||||
this.controller.close()
|
||||
})
|
||||
|
||||
Button("确定")
|
||||
.onClick(() => {
|
||||
if (!checkNetwork(this.allSimObj)) {
|
||||
promptAction.showToast({
|
||||
message: "请正确配置IP地址",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
} else if (this.simObj.objType == 1) {
|
||||
this.simObj.createPacket(this.ip, this.mac, this.message, this.allSimObj, this.allSimPacket)
|
||||
} else {
|
||||
promptAction.showToast({
|
||||
message: "请选择正确对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
}
|
||||
this.controller.close()
|
||||
})
|
||||
}
|
||||
}
|
||||
.backgroundColor(Color.White)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
export struct BatchPacketSet {
|
||||
controller: CustomDialogController
|
||||
@ObjectLink simObj: SimBase
|
||||
@State ip: string = ""
|
||||
@State mac: string = ""
|
||||
@State message: string = ""
|
||||
@Consume allSimObj: SimBase[]
|
||||
@Consume allSimPacket: SimPacket[]
|
||||
@State packets: any[] = []
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
TextInput({ placeholder: "请输入目标ip地址:192.168.1.1" })
|
||||
.onChange((value) => {
|
||||
this.ip = value
|
||||
})
|
||||
|
||||
TextInput({ placeholder: "请输入目标mac地址:mac11" })
|
||||
.onChange((value) => {
|
||||
this.mac = value
|
||||
})
|
||||
|
||||
TextInput({ placeholder: "请输入发送信息" })
|
||||
.onChange((value) => {
|
||||
this.message = value
|
||||
})
|
||||
|
||||
Row({ space: 30 }) {
|
||||
Button('取消')
|
||||
.onClick(() => {
|
||||
this.controller.close()
|
||||
})
|
||||
|
||||
Button("新增")
|
||||
.onClick(() => {
|
||||
if (!checkNetwork(this.allSimObj)) {
|
||||
promptAction.showToast({
|
||||
message: "请正确配置IP地址",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
} else if (this.simObj.objType == 1) {
|
||||
this.packets.push(
|
||||
{
|
||||
ip: this.ip,
|
||||
mac: this.mac,
|
||||
message: this.message,
|
||||
allSimObj: this.allSimObj,
|
||||
allSimPacket: this.allSimPacket
|
||||
}
|
||||
)
|
||||
} else {
|
||||
promptAction.showToast({
|
||||
message: "请选择正确对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Button("批量发送")
|
||||
.onClick(() => {
|
||||
this.packets.forEach(item => {
|
||||
this.simObj.createPacket(item.ip, item.mac, item.message, item.allSimObj, item.allSimPacket)
|
||||
})
|
||||
this.controller.close()
|
||||
})
|
||||
}
|
||||
}
|
||||
.backgroundColor(Color.White)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,284 @@
|
|||
import promptAction from '@ohos.promptAction'
|
||||
import { SimConnect, SimHost, SimHub, SimRouter, SimSwitch } from '../classes/OtherSimObjects'
|
||||
import { SimBase } from '../classes/SimBase'
|
||||
import { TableChart, NetworkChart } from './Table'
|
||||
|
||||
@Component
|
||||
export struct MiddleContent {
|
||||
@Consume allSimObj: SimBase[] // 仿真对象数组
|
||||
@Consume allSimConn: SimConnect[] // 仿真连接线数组
|
||||
@Consume TempConn: any[] // 临时any数组
|
||||
@Consume isNewObj: boolean // 是否插入新增对象
|
||||
@Consume newObjType: number // 新增对象类型
|
||||
@Consume choseIndex: number | null // 选中对象下标
|
||||
@Consume isNewConn: boolean // 是否正在新增连接线
|
||||
@Consume isShowLabel: boolean // 是否显示标签
|
||||
@Consume isShowPort: boolean // 是否显示接口
|
||||
@Consume isShowInterface: boolean // 是否显示网络配置信息
|
||||
@Consume isShowTable: boolean // 是否显示路由/交换表信息
|
||||
@Consume allSimPacket: [] // 单次数据包传输的集合
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
// 画布
|
||||
Stack() {
|
||||
ForEach(this.allSimConn, (item: SimConnect) => {
|
||||
CreateCon({ objS: item.nObjS as SimBase, objE: item.nObjE as SimBase }) // 连接线绘制组件
|
||||
CreatePort({ objS: item.nObjS as SimBase, objE: item.nObjE as SimBase, conn: item }) // 接口绘制组件
|
||||
})
|
||||
|
||||
ForEach(this.allSimObj, (item: SimBase, index) => {
|
||||
CreateImg({ simObj: item, thisIndex: index }) // 虚拟对象绘制组件
|
||||
CreateLabel({ simObj: item }) // 标签绘制组件
|
||||
})
|
||||
}
|
||||
.onClick((event: ClickEvent) => {
|
||||
if (this.isNewObj) { // 若要插入新增对象
|
||||
const obj = this.newObjType == 1 ? new SimHost(event.x - 25, event.y - 15) : this.newObjType == 2 ? new SimRouter(event.x - 25, event.y - 15) : this.newObjType == 3 ? new SimSwitch(event.x - 25, event.y - 15) : new SimHub(event.x - 25, event.y - 15)
|
||||
this.allSimObj.push(obj) // 插入并绘制新增对象
|
||||
} else if (!this.isNewObj && this.allSimObj.some(item => item.isChose == true)) {
|
||||
this.allSimObj[this.choseIndex].objX = event.x - 25 // 更新X坐标
|
||||
this.allSimObj[this.choseIndex].objY = event.y - 15 // 更新Y坐标
|
||||
this.allSimObj[this.choseIndex].isChose = false // 更新选中状态为未选中
|
||||
}
|
||||
this.isNewObj = false // 取消新增状态
|
||||
this.newObjType = -1 // 取消新增类型
|
||||
this.choseIndex = null // 取消选中下标
|
||||
this.isNewConn = false // 取消新增连接线
|
||||
this.TempConn = [] // 清空临时连接线对象
|
||||
})
|
||||
.width('78%')
|
||||
.height('100%')
|
||||
.border({ color: Color.Black, width: 1 })
|
||||
|
||||
// 配置信息展示
|
||||
Column({ space: 3 }) {
|
||||
Column() {
|
||||
Text('网络配置信息')
|
||||
.fontSize(21)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
|
||||
Column() {
|
||||
if (this.choseIndex != null && this.isShowInterface) {
|
||||
NetworkChart({ simObj: this.allSimObj[this.choseIndex] })
|
||||
}
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('50%')
|
||||
.border({ color: Color.Orange, width: 1 })
|
||||
|
||||
Column() {
|
||||
Text('路由/交换表信息')
|
||||
.fontSize(21)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
|
||||
Column() {
|
||||
if (this.choseIndex != null && this.isShowTable) {
|
||||
TableChart({ simObj: this.allSimObj[this.choseIndex] })
|
||||
}
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('50%')
|
||||
.border({ color: Color.Orange, width: 1 })
|
||||
}
|
||||
.padding(2)
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.width('100%')
|
||||
.height('74%')
|
||||
}
|
||||
}
|
||||
|
||||
// 绘制连接线组件
|
||||
@Component
|
||||
struct CreateCon {
|
||||
@ObjectLink objS: SimBase
|
||||
@ObjectLink objE: SimBase
|
||||
|
||||
build() {
|
||||
Line()
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.stroke(Color.Black)
|
||||
.startPoint([this.objS.objX + 25, this.objS.objY + 15])
|
||||
.endPoint([this.objE.objX + 25, this.objE.objY + 15])
|
||||
}
|
||||
}
|
||||
|
||||
class coordinates {
|
||||
x: number
|
||||
y: number
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
this.x = x
|
||||
this.y = y
|
||||
}
|
||||
} // 坐标类
|
||||
|
||||
// 绘制接口组件
|
||||
@Component
|
||||
struct CreatePort {
|
||||
@ObjectLink objS: SimBase
|
||||
@ObjectLink objE: SimBase
|
||||
@ObjectLink conn: SimConnect
|
||||
r: number = 30
|
||||
|
||||
k() {
|
||||
return (this.objS.objY - this.objE.objY) / (this.objS.objX - this.objE.objX)
|
||||
} // 直线斜率
|
||||
|
||||
distance(point1: coordinates, point2: coordinates) {
|
||||
return Math.sqrt((point1.x - point2.x)**2 + (point1.y - point2.y)**2)
|
||||
} // 两点距离
|
||||
|
||||
closerSPoint() {
|
||||
let objEPoint = new coordinates(this.objE.objX + 25, this.objE.objY + 15)
|
||||
let objSPoint1 = new coordinates(this.objS.objX + 25 + this.r / Math.sqrt(this.k()**2 + 1), this.objS.objY + 15 + this.k() * this.r / Math.sqrt(this.k()**2 + 1))
|
||||
let objSPoint2 = new coordinates(this.objS.objX + 25 - this.r / Math.sqrt(this.k()**2 + 1), this.objS.objY + 15 - this.k() * this.r / Math.sqrt(this.k()**2 + 1))
|
||||
let objSPoint = this.distance(objSPoint1, objEPoint) < this.distance(objSPoint2, objEPoint) ? objSPoint1 : objSPoint2
|
||||
return { x: objSPoint.x, y: objSPoint.y }
|
||||
}
|
||||
|
||||
closerEPoint() {
|
||||
let objSPoint = new coordinates(this.objS.objX + 25, this.objS.objY + 15)
|
||||
let objEPoint1 = new coordinates(this.objE.objX + 25 + this.r / Math.sqrt(this.k()**2 + 1), this.objE.objY + 15 + this.k() * this.r / Math.sqrt(this.k()**2 + 1))
|
||||
let objEPoint2 = new coordinates(this.objE.objX + 25 - this.r / Math.sqrt(this.k()**2 + 1), this.objE.objY + 15 - this.k() * this.r / Math.sqrt(this.k()**2 + 1))
|
||||
let objEPoint = this.distance(objEPoint1, objSPoint) < this.distance(objEPoint2, objSPoint) ? objEPoint1 : objEPoint2
|
||||
return { x: objEPoint.x, y: objEPoint.y }
|
||||
}
|
||||
|
||||
build() {
|
||||
Stack() {
|
||||
Text(this.conn.ifsS.toString())
|
||||
.fontSize(15)
|
||||
.fontColor(Color.Green)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.position(this.closerSPoint())
|
||||
Text(this.conn.ifsE.toString())
|
||||
.fontSize(15)
|
||||
.fontColor(Color.Green)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.position(this.closerEPoint())
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
||||
|
||||
// 绘制仿真对象组件
|
||||
@Component
|
||||
struct CreateImg {
|
||||
@Consume allSimObj: SimBase[] // 仿真对象数组
|
||||
@Consume allSimConn: SimConnect[] // 仿真连接线数组
|
||||
@Consume TempConn: any[] // 临时any数组
|
||||
@ObjectLink simObj: SimBase // 当前对象
|
||||
@Consume isNewObj: boolean // 是否新增对象
|
||||
@Consume newObjType: number // 新增对象类型
|
||||
@Consume choseIndex: number | null // 选中对象下标
|
||||
@Consume isNewConn: boolean // 是否正在新增连接线
|
||||
thisIndex: number
|
||||
|
||||
@Builder
|
||||
InterfaceMenu() { // 接口选择菜单
|
||||
Menu() {
|
||||
ForEach(this.simObj.interface, (item, index) => {
|
||||
if (item === null) {
|
||||
MenuItem({ content: '接口' + (index + 1).toString() })
|
||||
.width(70)
|
||||
.height(30)
|
||||
.contentFont({ size: 14 })
|
||||
.onChange(() => {
|
||||
if (!this.isNewConn) {
|
||||
this.TempConn.push(this.allSimObj[this.thisIndex])
|
||||
this.TempConn.push(index + 1)
|
||||
} else {
|
||||
if (this.TempConn[0] != this.simObj && !this.TempConn[0].interface.includes(this.simObj)) {
|
||||
const conn = new SimConnect(this.TempConn[0], this.TempConn[1], this.allSimObj[this.thisIndex], index + 1)
|
||||
this.allSimConn.push(conn)
|
||||
// 更新两个连接对象中的连接线信息
|
||||
conn.updateObjConn()
|
||||
this.TempConn = []
|
||||
} else {
|
||||
this.TempConn = []
|
||||
promptAction.showToast({
|
||||
message: "请选择连接不同的对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
}
|
||||
}
|
||||
if (this.choseIndex != null) {
|
||||
this.allSimObj[this.choseIndex].isChose = false
|
||||
}
|
||||
this.isNewObj = false
|
||||
this.newObjType = -1
|
||||
this.choseIndex = null
|
||||
this.isNewConn = !this.isNewConn
|
||||
})
|
||||
} else {
|
||||
MenuItem({ content: '接口' + (index + 1).toString() + '已连接' })
|
||||
.width(105)
|
||||
.height(30)
|
||||
.contentFont({ size: 13, style: FontStyle.Italic })
|
||||
.contentFontColor(Color.Green)
|
||||
.onChange(() => {
|
||||
promptAction.showToast({
|
||||
message: "该接口已连接",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
.radius(8)
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Image(this.simObj.img)
|
||||
.width(50)
|
||||
.border({
|
||||
color: this.TempConn[0] === this.simObj ? Color.Green : this.simObj.isChose ? Color.Red : Color.Transparent,
|
||||
width: 1.2
|
||||
})// 选中框
|
||||
.onClick(() => { // 仅允许一个对象被选中
|
||||
this.TempConn = []
|
||||
this.isNewObj = false // 取消插入新对象状态
|
||||
this.newObjType = -1
|
||||
this.isNewConn = false
|
||||
if (!this.allSimObj.some(item => item.isChose == true)) { // 若没有对象被选中
|
||||
this.choseIndex = this.thisIndex // 更新选中对象的下标
|
||||
this.simObj.changeIsChose() // 更新对象选中状态
|
||||
} else if (this.simObj.isChose) { // 若要取消选中对象
|
||||
this.choseIndex = null // 更新选中下标为null
|
||||
this.simObj.changeIsChose() // 更新对象选中状态
|
||||
} else if (!this.simObj.isChose && this.choseIndex != null) { // 若要更换选择对象
|
||||
this.allSimObj[this.choseIndex].changeIsChose() // 更新上一个选中对象选中状态
|
||||
this.choseIndex = this.thisIndex // 更新选中下标
|
||||
this.simObj.changeIsChose() // 更新当前对象选中状态
|
||||
}
|
||||
})
|
||||
}
|
||||
.position({ x: this.simObj.objX, y: this.simObj.objY })
|
||||
.bindContextMenu(this.InterfaceMenu(), ResponseType.LongPress) // 外容器绑定长按事件,避免与内组件冲突
|
||||
}
|
||||
}
|
||||
|
||||
// 绘制标签组件
|
||||
@Component
|
||||
struct CreateLabel {
|
||||
@ObjectLink simObj: SimBase
|
||||
@Consume isShowLabel: boolean // 是否显示标签
|
||||
|
||||
build() {
|
||||
if (this.isShowLabel) {
|
||||
Text(this.simObj.objLabel)
|
||||
.fontSize(15)
|
||||
.position({ x: this.simObj.objX + 25, y: this.simObj.objY - 12 })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import { SimBase, Table } from '../classes/SimBase'
|
||||
|
||||
@Component
|
||||
export struct NetworkChart {
|
||||
@ObjectLink simObj: SimBase
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
if (this.simObj.objType == 1 || this.simObj.objType == 2) {
|
||||
Column() {
|
||||
Text("IP地址:" + this.simObj.Ip)
|
||||
|
||||
Text("Mac地址:" + this.simObj.Mac)
|
||||
}
|
||||
} else if (this.simObj.objType == 3) {
|
||||
Column() {
|
||||
Text("Mac地址:" + this.simObj.Mac)
|
||||
}
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
export struct TableChart {
|
||||
@ObjectLink simObj: SimBase
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
if (this.simObj.objType == 2) {
|
||||
ForEach(this.simObj.routerTable, (item: Table) => {
|
||||
Row() {
|
||||
Text("端口" + item.port.toString() + ":")
|
||||
|
||||
Text(item.net)
|
||||
}
|
||||
})
|
||||
} else if (this.simObj.objType == 3) {
|
||||
ForEach(this.simObj.switchTable, (item: Table) => {
|
||||
Row() {
|
||||
Text("端口" + item.port.toString() + ":")
|
||||
|
||||
Text(item.net)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
import promptAction from '@ohos.promptAction';
|
||||
import { SimBase } from '../classes/SimBase'
|
||||
import { SimConnect, SimPacket } from '../classes/OtherSimObjects'
|
||||
import { TopMenu, TopMenuItem } from "../classes/TopMenu"
|
||||
import { LabelRevise, LineDelete, NetworkConfig, RouterTableConfig, SwitchTableConfig, PacketSet, BatchPacketSet } from "./Dialog"
|
||||
|
||||
@Component
|
||||
export struct TopMenuBar {
|
||||
// 修改标签控制器
|
||||
reviseLabelController: CustomDialogController = new CustomDialogController({
|
||||
builder: LabelRevise({ simObj: this.allSimObj[this.choseIndex] })
|
||||
})
|
||||
// 删除连接线控制器
|
||||
deleteLineController: CustomDialogController = new CustomDialogController({
|
||||
builder: LineDelete({ simObj: this.allSimObj[this.choseIndex] })
|
||||
})
|
||||
// 网络配置控制器
|
||||
NetworkController: CustomDialogController = new CustomDialogController({
|
||||
builder: NetworkConfig({ simObj: this.allSimObj[this.choseIndex] })
|
||||
})
|
||||
// 路由表配置配置器
|
||||
RouterController: CustomDialogController = new CustomDialogController({
|
||||
builder: RouterTableConfig({ simObj: this.allSimObj[this.choseIndex] })
|
||||
})
|
||||
// 转换表配置控制器
|
||||
SwitchController: CustomDialogController = new CustomDialogController({
|
||||
builder: SwitchTableConfig({ simObj: this.allSimObj[this.choseIndex] })
|
||||
})
|
||||
// 数据包设置控制器
|
||||
PacketController: CustomDialogController = new CustomDialogController({
|
||||
builder: PacketSet({ simObj: this.allSimObj[this.choseIndex] })
|
||||
})
|
||||
// 批量数据包设置控制器
|
||||
BatchPacketController: CustomDialogController = new CustomDialogController({
|
||||
builder: BatchPacketSet({ simObj: this.allSimObj[this.choseIndex] })
|
||||
})
|
||||
|
||||
@Builder
|
||||
MenuItem(menuItemArr: TopMenuItem[]) {
|
||||
Menu() {
|
||||
ForEach(menuItemArr, (item: TopMenuItem) => {
|
||||
MenuItem({ content: item.title })
|
||||
.onChange(() => {
|
||||
if (item.fun) {
|
||||
item.fun()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
} // 顶部菜单栏按钮每小项
|
||||
|
||||
@Builder
|
||||
MenuButton(menuArr: TopMenu[]) {
|
||||
ForEach(menuArr, (item: TopMenu) => {
|
||||
Button(item.title)
|
||||
.type(ButtonType.Normal)
|
||||
.fontColor(Color.Black)
|
||||
.border({ color: Color.Black, width: 1 })
|
||||
.backgroundColor(Color.Transparent)
|
||||
.bindMenu(this.MenuItem(item.menuItemArr))
|
||||
})
|
||||
} // 顶部菜单栏按钮
|
||||
|
||||
private menuArr: TopMenu[] = [
|
||||
new TopMenu('删除与修改', [new TopMenuItem('删除对象', () => {
|
||||
if (this.choseIndex != null) {
|
||||
this.allSimConn = this.allSimConn.filter((item)=>{
|
||||
if(this.allSimObj[this.choseIndex].objID === item.nObjE.objID || this.allSimObj[this.choseIndex].objID === item.nObjS.objID){
|
||||
item.deleteObjConn() // 删除线时应该先将线两端的设备的connection设置为null
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
this.allSimObj.splice(this.choseIndex, 1)
|
||||
this.isNewObj = false
|
||||
this.newObjType = -1
|
||||
this.choseIndex = null
|
||||
} else {
|
||||
promptAction.showToast({
|
||||
message: "请先选择要删除的对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
}
|
||||
}), new TopMenuItem('删除连接线', () => {
|
||||
if (this.choseIndex != null) {
|
||||
this.deleteLineController.open()
|
||||
} else {
|
||||
promptAction.showToast({
|
||||
message: "请选择要删除的连接线对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
}
|
||||
}), new TopMenuItem('修改标签', () => {
|
||||
if (this.choseIndex != null) {
|
||||
this.reviseLabelController.open()
|
||||
} else {
|
||||
promptAction.showToast({
|
||||
message: "请选择仿真对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
}
|
||||
})]),
|
||||
new TopMenu('基础配置', [new TopMenuItem('网络配置', () => {
|
||||
if (this.choseIndex != null && (this.allSimObj[this.choseIndex].objType == 1 || this.allSimObj[this.choseIndex].objType == 2 || this.allSimObj[this.choseIndex].objType == 3)) {
|
||||
this.NetworkController.open()
|
||||
} else {
|
||||
promptAction.showToast({
|
||||
message: "请选择正确对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
}
|
||||
}), new TopMenuItem('路由器配置', () => {
|
||||
if (this.choseIndex != null && this.allSimObj[this.choseIndex].objType == 2) {
|
||||
this.RouterController.open()
|
||||
} else {
|
||||
promptAction.showToast({
|
||||
message: "请选择路由器对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
}
|
||||
}), new TopMenuItem('交换器配置', () => {
|
||||
if (this.choseIndex != null && this.allSimObj[this.choseIndex].objType == 3) {
|
||||
this.SwitchController.open()
|
||||
} else {
|
||||
promptAction.showToast({
|
||||
message: "请选择交换机对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
}
|
||||
})]),
|
||||
new TopMenu('显示设置', [new TopMenuItem('显示/不显示标签', () => {
|
||||
this.isShowLabel = !this.isShowLabel
|
||||
}), new TopMenuItem('显示/不显示接口', () => {
|
||||
this.isShowPort = !this.isShowPort
|
||||
}), new TopMenuItem('显示/不显示配置信息', () => {
|
||||
this.isShowInterface = !this.isShowInterface
|
||||
}), new TopMenuItem('显示/不显示交换表信息', () => {
|
||||
this.isShowTable = !this.isShowTable
|
||||
})]),
|
||||
new TopMenu('发送数据包', [new TopMenuItem('发送数据包', () => {
|
||||
if (this.choseIndex != null && this.allSimObj[this.choseIndex].objType == 1){
|
||||
this.PacketController.open()
|
||||
}else{
|
||||
promptAction.showToast({
|
||||
message: "请选择主机对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
}
|
||||
}), new TopMenuItem('批量发送数据包', () => {
|
||||
if (this.choseIndex != null && this.allSimObj[this.choseIndex].objType == 1){
|
||||
this.BatchPacketController.open()
|
||||
}else{
|
||||
promptAction.showToast({
|
||||
message: "请选择主机对象",
|
||||
duration: 3000,
|
||||
bottom: 50
|
||||
})
|
||||
}
|
||||
})]),
|
||||
new TopMenu('清除屏幕', [new TopMenuItem('清除屏幕', () => {
|
||||
this.allSimObj = []
|
||||
this.allSimConn = []
|
||||
this.TempConn = []
|
||||
this.isNewObj = false
|
||||
this.choseIndex = null
|
||||
})])
|
||||
] // 顶部菜单栏数组
|
||||
@Consume allSimObj: SimBase[] // 仿真对象数组
|
||||
@Consume allSimConn: SimConnect[] // 仿真连接线数组
|
||||
@Consume TempConn: any[] // 临时any数组
|
||||
@Consume isNewObj: boolean // 是否新增对象
|
||||
@Consume newObjType: number // 新增对象类型
|
||||
@Consume choseIndex: number | null // 选中对象下标
|
||||
|
||||
@Consume isShowLabel: boolean // 是否显示标签
|
||||
@Consume isShowPort: boolean // 是否显示接口
|
||||
@Consume isShowInterface: boolean // 是否显示网络配置信息
|
||||
@Consume isShowTable: boolean // 是否显示路由/交换表信息
|
||||
|
||||
@Consume allSimPacket: SimPacket[] // 单次数据包传输的集合
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
this.MenuButton(this.menuArr)
|
||||
}
|
||||
.height("12%")
|
||||
.width("100%")
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
|
||||
import hilog from '@ohos.hilog';
|
||||
import UIAbility from '@ohos.app.ability.UIAbility';
|
||||
import Want from '@ohos.app.ability.Want';
|
||||
import window from '@ohos.window';
|
||||
|
||||
|
||||
export default class EntryAbility extends UIAbility {
|
||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
|
||||
AppStorage.setOrCreate('LogText', '')
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage: window.WindowStage): void {
|
||||
// Main window is created, set main page for this ability
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
|
||||
|
||||
|
||||
windowStage.loadContent('pages/Index', (err, data) => {
|
||||
if (err.code) {
|
||||
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
|
||||
return;
|
||||
}
|
||||
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
|
||||
});
|
||||
|
||||
// windowStage.getMainWindowSync().setWindowSystemBarEnable([]);
|
||||
}
|
||||
|
||||
onWindowStageDestroy(): void {
|
||||
// Main window is destroyed, release UI related resources
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
|
||||
}
|
||||
|
||||
onForeground(): void {
|
||||
// Ability has brought to foreground
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
|
||||
}
|
||||
|
||||
onBackground(): void {
|
||||
// Ability has back to background
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
import { SimBase } from "../classes/SimBase"
|
||||
|
||||
function ValidateIPAddress(ipAddress: string): boolean {
|
||||
// 定义IP地址的正则表达式模式
|
||||
const patternWithSubnet = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/;
|
||||
const patternWithoutSubnet = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
|
||||
|
||||
const matchWithSubnet = ipAddress.match(patternWithSubnet);
|
||||
const matchWithoutSubnet = ipAddress.match(patternWithoutSubnet);
|
||||
|
||||
if (matchWithSubnet) {
|
||||
// 带有子网掩码的IP地址
|
||||
// 检查每个组件的取值范围是否在 0-255 之间
|
||||
for (let i = 1; i <= 4; i++) {
|
||||
const group = parseInt(matchWithSubnet[i]);
|
||||
if (group < 0 || group > 255) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 检查子网掩码的取值范围是否在 0-32 之间
|
||||
const subnetMask = parseInt(matchWithSubnet[5]);
|
||||
if (subnetMask < 0 || subnetMask > 32) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else if (matchWithoutSubnet) {
|
||||
// 不带子网掩码的IP地址
|
||||
// 检查每个组件的取值范围是否在 0-255 之间
|
||||
for (let i = 1; i <= 4; i++) {
|
||||
const group = parseInt(matchWithoutSubnet[i]);
|
||||
if (group < 0 || group > 255) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// IP地址格式不正确
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function checkNetwork(allSimObj: SimBase[]) {
|
||||
for (const item of allSimObj) {
|
||||
if(item.objType == 4){
|
||||
continue
|
||||
}else if(!ValidateIPAddress(item.Ip)){
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
} // 检查创建虚拟对象的IP地址是否正确
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue