コード例 #1
0
ファイル: AnalyzeCommand.cs プロジェクト: pmiossec/snitch
        private static int GetExitCode(Settings settings, ProjectAnalyzerResult result)
        {
            if (settings.Strict && !result.NoPackagesToRemove)
            {
                return(-1);
            }

            return(0);
        }
コード例 #2
0
        private void AddVersionInfoSyntaxes(IEnumerable <SyntaxTree> syntaxTrees, ProjectAnalyzerResult analyzerResult)
        {
            // add assembly info
            StringBuilder assInfo = new StringBuilder();

            assInfo.AppendLine("using System.Reflection;");
            assInfo.AppendLine($"[assembly: AssemblyTitle(\"{analyzerResult.Properties.GetValueOrDefault("TargetName")}\")]");
            assInfo.AppendLine("[assembly: AssemblyVersion(\"0.0.0\")]");
            assInfo.AppendLine("[assembly: AssemblyFileVersion(\"0.0.0\")]");

            syntaxTrees.ToList().Add(CSharpSyntaxTree.ParseText(assInfo.ToString(), encoding: Encoding.Default));
        }
コード例 #3
0
        public void ProjectAnalyzerShouldDecodeFramework(string version, Framework fmk, int major, int minor)
        {
            var test = new ProjectAnalyzerResult(null, null)
            {
                ProjectReferences = new List <string> {
                    projectUnderTestPath
                },
                TargetFrameworkString = version,
                ProjectFilePath       = alternateTestProjectPath,
                References            = new[] { "" }
            };

            test.TargetFrameworkAndVersion.ShouldBe((fmk, new Version(major, minor)));
        }
コード例 #4
0
        private void AddVersionInfoSyntaxes(IList <SyntaxTree> syntaxTrees, ProjectAnalyzerResult analyzerResult)
        {
            // add assembly info
            StringBuilder assInfo = new StringBuilder();

            assInfo.AppendLine("using System.Reflection;");
            assInfo.AppendLine($"[assembly: AssemblyTitle(\"Mutated {analyzerResult.Properties.GetValueOrDefault("TargetName")}\")]");
            if (!analyzerResult.Properties.TryGetValue("AssemblyFileVersion", out var versionString))
            {
                versionString = "0.0.0";
            }
            assInfo.AppendLine($"[assembly: AssemblyFileVersion(\"{versionString}\")]");
            var refVersion = versionString;

            if (!analyzerResult.Properties.TryGetValue("AssemblyVersion", out versionString))
            {
                versionString = refVersion;
            }
            assInfo.AppendLine($"[assembly: AssemblyVersion(\"{versionString}\")]");

            syntaxTrees.Add(CSharpSyntaxTree.ParseText(assInfo.ToString(), encoding: Encoding.Default));
        }