Ejemplo n.º 1
0
        /// <summary>
        /// The parse.
        /// </summary>
        /// <param name="subprocessArgs">
        /// The subprocess args.
        /// </param>
        /// <returns>
        /// The <see cref="SubprocessParams"/>.
        /// </returns>
        public static SubprocessParams Parse(IEnumerable <string> subprocessArgs)
        {
            var processParams = new SubprocessParams();

            try
            {
                if (subprocessArgs == null || !subprocessArgs.Any())
                {
                    return(processParams);
                }

                var customSchemesValue  = subprocessArgs.GetArgumentValue(SubprocessArguments.CustomSchemeArgument);
                var customCmdlinesValue = subprocessArgs.GetArgumentValue(SubprocessArguments.CustomCmdlineArgument);

                if (string.IsNullOrWhiteSpace(customSchemesValue))
                {
                    return(processParams);
                }

                if (string.IsNullOrWhiteSpace(customCmdlinesValue))
                {
                    return(processParams);
                }

                processParams.CustomSchemes = customSchemesValue.Split(SubprocessArguments.Separator).ToList();
                var customCmdlinesParts = customCmdlinesValue.Split(SubprocessArguments.Separator).ToList();

                processParams.CommandLineArgs = new List <Tuple <string, string, bool> >();

                foreach (var part in customCmdlinesParts)
                {
                    var cmdline = part.Split(SubprocessArguments.ChildSeparator).ToList();
                    if (cmdline.Count < 3)
                    {
                        continue;
                    }

                    var item1 = cmdline[0];
                    var item2 = cmdline[1];
                    var item3 = cmdline[2].Equals("T");

                    processParams.CommandLineArgs.Add(new Tuple <string, string, bool>(item1, item2, item3));
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
                Console.WriteLine(e);
            }

            return(processParams);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Subprocess"/> class.
        /// </summary>
        public Subprocess(string[] cmdlineArgs)
        {
            var subprocessParams = SubprocessParams.Parse(cmdlineArgs);

            _cefglueApp = new SubprocessCefGlueApp(subprocessParams);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SubprocessCefGlueApp"/> class.
 /// </summary>
 /// <param name="subprocessParams">
 /// Subprocess params
 /// </param>
 public SubprocessCefGlueApp(SubprocessParams subprocessParams)
 {
     _subprocessParams = subprocessParams;
 }