Пример #1
0
        public static void Main(string[] args)
        {
            var references = new List <string> ();
            var prefixes   = new List <string> ();

            List <string> files = new OptionSet {
                { "p|prefix|prefixes=",
                  "Mono installation prefixes (for $prefix/etc/mono/config)",
                  v => prefixes.Add(v) },
                { "r|reference|references=",
                  "Assemblies to load by partial names (e.g. from the GAC)",
                  v => references.Add(v) },
            }.Parse(args);

            AssemblyChecker   checker = new AssemblyChecker();
            AssemblyCheckInfo report  = new AssemblyCheckInfo();

            if (prefixes.Count == 0)
            {
                // SystemConfigurationFile is $sysconfdir/mono/VERSION/machine.config
                // We want $sysconfdir
                DirectoryInfo configDir =
                    new FileInfo(RuntimeEnvironment.SystemConfigurationFile).Directory.Parent.Parent.Parent;
                prefixes.Add(configDir.ToString());
            }
            report.SetInstallationPrefixes(prefixes);
            foreach (string assembly in files)
            {
                checker.CheckFile(assembly, report);
            }

            foreach (string assembly in references)
            {
                checker.CheckWithPartialName(assembly, report);
            }

            foreach (MessageInfo m in report.Errors)
            {
                PrintMessage("error", m);
            }

            foreach (MessageInfo m in report.Warnings)
            {
                PrintMessage("warning", m);
            }
        }
Пример #2
0
		public static void Main (string[] args)
		{
			var references = new List<string> ();
			var prefixes   = new List<string> ();

			List<string> files = new OptionSet {
				{ "p|prefix|prefixes=",
				  "Mono installation prefixes (for $prefix/etc/mono/config)",
				  v => prefixes.Add (v) },
				{ "r|reference|references=",
				  "Assemblies to load by partial names (e.g. from the GAC)",
					v => references.Add (v) },
			}.Parse (args);

			AssemblyChecker checker = new AssemblyChecker ();
			AssemblyCheckInfo report = new AssemblyCheckInfo ();
			if (prefixes.Count == 0) {
				// SystemConfigurationFile is $sysconfdir/mono/VERSION/machine.config
				// We want $sysconfdir
				DirectoryInfo configDir = 
					new FileInfo (RuntimeEnvironment.SystemConfigurationFile).Directory.Parent.Parent.Parent;
				prefixes.Add (configDir.ToString ());
			}
			report.SetInstallationPrefixes (prefixes);
			foreach (string assembly in files) {
				checker.CheckFile (assembly, report);
			}

			foreach (string assembly in references) {
				checker.CheckWithPartialName (assembly, report);
			}

			foreach (MessageInfo m in report.Errors) {
				PrintMessage ("error", m);
			}

			foreach (MessageInfo m in report.Warnings) {
				PrintMessage ("warning", m);
			}
		}