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

Fixes #146, #147 includes status result value change #149

Merged
merged 1 commit into from Mar 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 16 additions & 5 deletions AppInspector/Commands/AnalyzeCommand.cs
Expand Up @@ -25,11 +25,12 @@ public class AnalyzeCommand : ICommand

public enum ExitCode
{
NoMatches = 0,
MatchesFound = 1,
Success = 0,
NoMatches = 1,
CriticalError = 2
}


IEnumerable<string> _srcfileList;
AppProfile _appProfile;
RuleProcessor _rulesProcessor;
Expand Down Expand Up @@ -267,11 +268,21 @@ public int Run()
// Iterate through all files and process against rules
foreach (string filename in _srcfileList)
{
ArchiveFileType archiveFileType = MiniMagic.DetectFileType(filename);
ArchiveFileType archiveFileType;
try //fix for #146
{
archiveFileType = MiniMagic.DetectFileType(filename);
}
catch (Exception e)
{
throw new OpException(ErrMsg.FormatString(ErrMsg.ID.ANALYZE_FILE_TYPE_OPEN, filename));
}

if (archiveFileType == ArchiveFileType.UNKNOWN)//not a known zipped file type
ProcessAsFile(filename);
else
UnZipAndProcess(filename,archiveFileType);
UnZipAndProcess(filename, archiveFileType);

}

WriteOnce.General("\r"+ErrMsg.FormatString(ErrMsg.ID.ANALYZE_FILES_PROCESSED_PCNT, 100));
Expand All @@ -298,7 +309,7 @@ public int Run()
}

return _appProfile.MatchList.Count() == 0 ? (int)ExitCode.NoMatches :
(int)ExitCode.MatchesFound;
(int)ExitCode.Success;
}


Expand Down
1 change: 1 addition & 0 deletions AppInspector/ErrorMessage.cs
Expand Up @@ -26,6 +26,7 @@ public enum ID
ANALYZE_COMPRESSED_FILESIZE_WARN,
ANALYZE_COMPRESSED_PROCESSING,
ANALYZE_COMPRESSED_ERROR,
ANALYZE_FILE_TYPE_OPEN,
ANALYZE_OUTPUT_FILE,
ANALYZE_REPORTSIZE_WARN,
CMD_PREPARING_REPORT,
Expand Down
9 changes: 9 additions & 0 deletions AppInspector/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions AppInspector/Properties/Resources.resx
Expand Up @@ -138,6 +138,9 @@
<data name="ANALYZE_FILES_PROCESSED_PCNT" xml:space="preserve">
<value>{0}% source files processed</value>
</data>
<data name="ANALYZE_FILE_TYPE_OPEN" xml:space="preserve">
<value>Unable to determine file type. File open error for {0}</value>
</data>
<data name="ANALYZE_LANGUAGE_NOTFOUND" xml:space="preserve">
<value>File skipped: Language not found for file {0}</value>
</data>
Expand Down
3 changes: 1 addition & 2 deletions AppInspector/Properties/launchSettings.json
@@ -1,8 +1,7 @@
{
"profiles": {
"ApplicationInspector": {
"commandName": "Project",
"commandLineArgs": "analyze -s c:\\temp\\main.cpp -b"
"commandName": "Project"
}
}
}