コード例 #1
0
        /// <summary>
        /// Parse a list of target descriptors from the command line
        /// </summary>
        /// <param name="Arguments">Command-line arguments</param>
        /// <param name="bUsePrecompiled">Whether to use a precompiled engine distribution</param>
        /// <param name="bSkipRulesCompile">Whether to skip compiling rules assemblies</param>
        /// <param name="TargetDescriptors">Receives the list of parsed target descriptors</param>
        public static void ParseCommandLine(CommandLineArguments Arguments, bool bUsePrecompiled, bool bSkipRulesCompile, List <TargetDescriptor> TargetDescriptors)
        {
            List <string> TargetLists;

            Arguments = Arguments.Remove("-TargetList=", out TargetLists);

            List <string> Targets;

            Arguments = Arguments.Remove("-Target=", out Targets);

            if (TargetLists.Count > 0 || Targets.Count > 0)
            {
                // Try to parse multiple arguments from a single command line
                foreach (string TargetList in TargetLists)
                {
                    string[] Lines = File.ReadAllLines(TargetList);
                    foreach (string Line in Lines)
                    {
                        string TrimLine = Line.Trim();
                        if (TrimLine.Length > 0 && TrimLine[0] != ';')
                        {
                            CommandLineArguments NewArguments = Arguments.Append(CommandLineArguments.Split(TrimLine));
                            ParseCommandLine(NewArguments, bUsePrecompiled, bSkipRulesCompile, TargetDescriptors);
                        }
                    }
                }

                foreach (string Target in Targets)
                {
                    CommandLineArguments NewArguments = Arguments.Append(CommandLineArguments.Split(Target));
                    ParseCommandLine(NewArguments, bUsePrecompiled, bSkipRulesCompile, TargetDescriptors);
                }
            }
            else
            {
                // Otherwise just process the whole command line together
                ParseSingleCommandLine(Arguments, bUsePrecompiled, bSkipRulesCompile, TargetDescriptors);
            }
        }