Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1. 解决 main Thread Checker 问题, 2. 分析方式默认为分组分析 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions LinkMap/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ @interface ViewController()
@property (strong) NSURL *linkMapFileURL;
@property (strong) NSString *linkMapContent;

@property (nonatomic, assign) NSControlStateValue groupButtonState;
@property (nonatomic, copy) NSString *searchKey;
@property (strong) NSMutableString *result;//分析的结果

@end
Expand All @@ -45,6 +47,8 @@ - (void)viewDidLoad {
5.点击“输出文件”,得到解析后的Link Map文件 \n\
6. * 输入目标文件的关键字(例如:libIM),然后点击“开始”。实现搜索功能 \n\
7. * 勾选“分组解析”,然后点击“开始”。实现对不同库的目标文件进行分组";

_groupButton.state = NSControlStateValueOn;
}

- (IBAction)chooseFile:(id)sender {
Expand All @@ -69,6 +73,9 @@ - (IBAction)analyze:(id)sender {
return;
}

self.groupButtonState = _groupButton.state;
self.searchKey = _searchField.stringValue;

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSString *content = [NSString stringWithContentsOfURL:_linkMapFileURL encoding:NSMacOSRomanStringEncoding error:nil];

Expand All @@ -91,7 +98,7 @@ - (IBAction)analyze:(id)sender {

NSArray *sortedSymbols = [self sortSymbols:symbols];

if (_groupButton.state == 1) {
if (_groupButtonState == 1) {
[self buildCombinationResultWithSymbols:sortedSymbols];
} else {
[self buildResultWithSymbols:sortedSymbols];
Expand Down Expand Up @@ -171,7 +178,7 @@ - (void)buildResultWithSymbols:(NSArray *)symbols {
self.result = [@"文件大小\t文件名称\r\n\r\n" mutableCopy];
NSUInteger totalSize = 0;

NSString *searchKey = _searchField.stringValue;
NSString *searchKey = _searchKey;

for(SymbolModel *symbol in symbols) {
if (searchKey.length > 0) {
Expand Down Expand Up @@ -220,7 +227,7 @@ - (void)buildCombinationResultWithSymbols:(NSArray *)symbols {

NSArray *sortedSymbols = [self sortSymbols:combinationSymbols];

NSString *searchKey = _searchField.stringValue;
NSString *searchKey = _searchKey;

for(SymbolModel *symbol in sortedSymbols) {
if (searchKey.length > 0) {
Expand Down