forked from SMAT-Lab/ArkAnalyzer-Lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: code-sunbo <[email protected]>
- Loading branch information
1 parent
45562d4
commit 7857a2e
Showing
3 changed files
with
39 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { PrinterBuilder, Scene, SceneConfig, ViewTreePrinter } from 'arkanalyzer'; | ||
import { join } from 'path'; | ||
|
||
let config: SceneConfig = new SceneConfig(); | ||
config.buildFromJson(join(__dirname, '../resources/CountDown/arkanalyzer_config.json')); | ||
let scene: Scene = new Scene(); | ||
scene.buildBasicInfo(config); | ||
scene.buildScene4HarmonyProject(); | ||
scene.collectProjectImportInfos(); | ||
scene.inferTypes(); | ||
|
||
let arkFile = scene.getFiles().find((file) => file.getName().endsWith('CountDown.ets')); | ||
let arkClass = arkFile?.getClassWithName('CountDown'); | ||
let vt = arkClass?.getViewTree(); | ||
let root = vt?.getRoot(); | ||
root?.walk((item) => { | ||
let values: string[] = []; | ||
for (const field of item.stateValues) { | ||
values.push(field.getName()); | ||
} | ||
if (values.length > 0) { | ||
console.log(`${item.name} using stateValues ${values.join(',')}`); | ||
} else { | ||
console.log(`${item.name}`); | ||
} | ||
return false; | ||
}); | ||
|
||
PrinterBuilder.dump(new ViewTreePrinter(vt!), 'out/CountDownViewTree.dot'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"targetProjectName": "CountDown", | ||
"targetProjectDirectory": "src/ex/resources/CountDown", | ||
|
||
"logPath": "ArkAnalyzer.log", | ||
"logLevel": "INFO", | ||
|
||
"sdks": [ | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters