public SeleniumChromeDriver(string args) : this()
 {
     foreach (var arg in args.Split(';'))
     {
         AdditionalArguments.Add(arg);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Adds the value to the <see cref="AdditionalArguments"/> collection property and
 /// returns this instance.
 /// </summary>
 /// <param name="value">
 /// The value to add to the <see cref="AdditionalArguments"/> collection property.
 /// </param>
 /// <returns>
 /// This instance.
 /// </returns>
 /// <remarks>
 /// This method is part of the fluent interface.
 /// </remarks>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="value"/> is <c>null</c> or empty.</para>
 /// </exception>
 public T WithAdditionalArgument(string value)
 {
     if (StringEx.IsNullOrWhiteSpace(value))
     {
         throw new ArgumentNullException("value");
     }
     AdditionalArguments.Add(value);
     return((T)this);
 }
        /// <summary>
        /// Configure this instance with Windows and MSVC.
        /// </summary>
        /// <returns>This instance</returns>
        public CppParserOptions ConfigureForWindowsMsvc(CppTargetCpu targetCpu = CppTargetCpu.X86, CppVisualStudioVersion vsVersion = CppVisualStudioVersion.VS2019)
        {
            // 1920
            var highVersion = ((int)vsVersion) / 100;   // => 19
            var lowVersion  = ((int)vsVersion) % 100;   // => 20

            var versionAsString = $"{highVersion}.{lowVersion}";

            TargetCpu    = targetCpu;
            TargetCpuSub = string.Empty;
            TargetVendor = "pc";
            TargetSystem = "windows";
            TargetAbi    = $"msvc{versionAsString}";

            // See https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019

            Defines.Add($"_MSC_VER={(int)vsVersion}");
            Defines.Add("_WIN32=1");

            switch (targetCpu)
            {
            case CppTargetCpu.X86:
                Defines.Add("_M_IX86=600");
                break;

            case CppTargetCpu.X86_64:
                Defines.Add("_M_AMD64=100");
                Defines.Add("_M_X64=100");
                Defines.Add("_WIN64=1");
                break;

            case CppTargetCpu.ARM:
                Defines.Add("_M_ARM=7");
                break;

            case CppTargetCpu.ARM64:
                Defines.Add("_M_ARM64=1");
                Defines.Add("_WIN64=1");
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(targetCpu), targetCpu, null);
            }

            AdditionalArguments.Add("-fms-extensions");
            AdditionalArguments.Add("-fms-compatibility");
            AdditionalArguments.Add($"-fms-compatibility-version={versionAsString}");
            return(this);
        }
Beispiel #4
0
        /// <summary>
        /// Adds a configuration override specification to the <see cref="CommandBase{T}.AdditionalArguments"/>
        /// collection in the form of <c>section.name=value</c>.
        /// </summary>
        /// <param name="sectionName">
        /// The name of the section.
        /// </param>
        /// <param name="name">
        /// The name of the value.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <exception cref="System.ArgumentNullException">
        /// <para><paramref name="sectionName"/> is <c>null</c> or empty.</para>
        /// <para>- or -</para>
        /// <para><paramref name="name"/> is <c>null</c> or empty.</para>
        /// <para>- or -</para>
        /// <para><paramref name="value"/> is <c>null</c>.</para>
        /// </exception>
        public void WithConfigurationOverride(string sectionName, string name, string value)
        {
            if (StringEx.IsNullOrWhiteSpace(sectionName))
            {
                throw new ArgumentNullException("sectionName");
            }
            if (StringEx.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("name");
            }
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            AdditionalArguments.Add("--config");
            AdditionalArguments.Add(string.Format(CultureInfo.InvariantCulture, "{0}.{1}=\"{2}\"", sectionName, name, value));
        }