public void Rule(
            MPGOPreProcess mpgoPreProcess)
        {
            if (!mpgoPreProcess.CanProcess)
            {
                return;
            }

            if (mpgoPreProcess.MPGOArgument.AssemblyList.Count >= 1)
            {
                return;
            }

            mpgoPreProcess.MPGOArgumentByRules.AssemblyList.Clear();

            mpgoPreProcess.MPGOArgumentByRules.AssemblyList.AddRange(
                @"*.dll|*.exe"
                    .Split('|')
                    .SelectMany(filter => Directory.GetFiles(mpgoPreProcess.WorkingPath, filter))
                    .Where(assemblyFile =>
                           !assemblyFile.EndsWith(@"VSHOST.EXE", StringComparison.CurrentCultureIgnoreCase) &&
                           AssemblyHelper.IsAssembly(assemblyFile))
                    .Select(Assembly.LoadFrom)
                    .Where(workingPathAssembly =>
                           mpgoPreProcess.TargetAssembly.GetReferencedAssemblies().Any(referenceAssembly =>
                                                                                       referenceAssembly.FullName.Equals(workingPathAssembly.FullName)))
                    .Select(assemblyRef =>
                            mpgoPreProcess.UsePath
                                ? Path.GetFileName(assemblyRef.Location)
                                : assemblyRef.Location));
        }
        public void Rule(
            MPGOPreProcess mpgoPreProcess)
        {
            if (!mpgoPreProcess.CanProcess)
            {
                return;
            }

            if (!mpgoPreProcess.MPGOArgument.AssemblyList.Contains(@"*.*"))
            {
                return;
            }

            mpgoPreProcess.MPGOArgumentByRules.AssemblyList.Clear();

            mpgoPreProcess.MPGOArgumentByRules.AssemblyList.AddRange(
                @"*.dll|*.exe"
                    .Split('|')
                    .SelectMany(filter => Directory.GetFiles(mpgoPreProcess.WorkingPath, filter))
                    .Where(assemblyFile =>
                           !assemblyFile.EndsWith(@"VSHOST.EXE", StringComparison.CurrentCultureIgnoreCase) &&
                           AssemblyHelper.IsAssembly(assemblyFile))
                    .Select(assemblyLocation =>
                            mpgoPreProcess.UsePath
                                ? Path.GetFileName(assemblyLocation)
                                : assemblyLocation));
        }
Exemple #3
0
        private static void Main(
            String[] args)
        {
            if (args.Length == 0)
            {
                using (new MPGOProcess(String.Empty))
                {
                    return;
                }
            }

            var mpgoArgument =
                new MPGOArgument()
                    .ParseArgument(args);
            #if DEBUG
            using (new ConsoleFrontColor(ConsoleColor.Yellow))
            {
                mpgoArgument.ToString().WriteLineWithBlock();
            }
            #endif
            mpgoArgument =
                new MPGOPreProcess(mpgoArgument)
                    .RuleMe(new MPGOAssemblyListReference())
                    .RuleMe(new MPGOAssemblyListAll())
                    .MPGOArgumentByRules;
            #if DEBUG
            using (new ConsoleFrontColor(ConsoleColor.Blue))
            {
                mpgoArgument.ToString().WriteLineWithBlock();
            }
            #endif
            using (new MPGOProcess(mpgoArgument.ToString()))
            {
                @"Thank you for using this software . . .".WriteLineWithBlock();
            }
        }