Ejemplo n.º 1
0
        private void PollForState(string itemText, bool state, CaseSensitivity caseSensitivity)
        {
            int       itemIndex = ItemIndex(itemText, caseSensitivity);
            Stopwatch timer     = Stopwatch.StartNew();

            while (true)
            {
                if (ItemChecked(itemIndex) == state)
                {
                    break;
                }

                if (timer.ElapsedMilliseconds > GUI.m_APE.TimeOut)
                {
                    string stateText;
                    if (state)
                    {
                        stateText = "check";
                    }
                    else
                    {
                        stateText = "uncheck";
                    }
                    throw GUI.ApeException("Failed to " + stateText + " item " + itemText + " of the " + Description);
                }

                Thread.Sleep(15);
            }
        }
Ejemplo n.º 2
0
        public static IParser <bool> Boolean(string trueString, string falseString, CaseSensitivity caseSensitivity)
        {
            var comparison = caseSensitivity.ToStringComparison();

            return(Create(s => string.Equals(s, trueString, comparison) ? ParseResult.Success(true)
                             : string.Equals(s, falseString, comparison) ? ParseResult.Success(false)
                             : default));
        /// <summary>
        /// Configures case sensitivity.
        /// </summary>
        /// <param name="configurator">The configuration.</param>
        /// <param name="sensitivity">The case sensitivity.</param>
        /// <returns>A configurator that can be used to configure the application further.</returns>
        public static IConfigurator CaseSensitivity(this IConfigurator configurator, CaseSensitivity sensitivity)
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            configurator.Settings.CaseSensitivity = sensitivity;
            return(configurator);
        }
    public static CommandInfo?FindCommand(this ICommandContainer root, string name, CaseSensitivity sensitivity)
    {
        var result = root.Commands.FirstOrDefault(
            c => c.Name.Equals(name, sensitivity.GetStringComparison(CommandPart.CommandName)));

        if (result == null)
        {
            result = root.Commands.FirstOrDefault(
                c => c.Aliases.Contains(name, sensitivity.GetStringComparer(CommandPart.CommandName)));
        }

        return(result);
    }
Ejemplo n.º 5
0
        public static StringComparison GetStringComparison(this CaseSensitivity caseSensitivity, CommandPart part)
        {
            if (part == CommandPart.CommandName && (caseSensitivity & CaseSensitivity.Commands) == 0)
            {
                return(StringComparison.OrdinalIgnoreCase);
            }
            else if (part == CommandPart.LongOption && (caseSensitivity & CaseSensitivity.LongOptions) == 0)
            {
                return(StringComparison.OrdinalIgnoreCase);
            }

            return(StringComparison.Ordinal);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Unchecks the specified item in the checkedlistbox
 /// </summary>
 /// <param name="itemText">The item to uncheck</param>
 /// <param name="caseSensitivity">Whether to include the case of the item in the comparison</param>
 public void ItemUncheck(string itemText, CaseSensitivity caseSensitivity)
 {
     if (ItemChecked(itemText, caseSensitivity) == false)
     {
         GUI.Log("Ensure " + itemText + " in the " + Description + " is unchecked", LogItemType.Action);
     }
     else
     {
         GUI.Log("Uncheck " + itemText + " in the " + Description, LogItemType.Action);
         ListBox.SingleClickItemInternal(itemText, caseSensitivity);
         PollForState(itemText, false, caseSensitivity);
     }
 }
Ejemplo n.º 7
0
    public CommandTreeParser(CommandModel configuration, ICommandAppSettings settings, ParsingMode?parsingMode = null)
    {
        if (settings is null)
        {
            throw new ArgumentNullException(nameof(settings));
        }

        _configuration = configuration;
        _parsingMode   = parsingMode ?? _configuration.ParsingMode;
        _help          = new CommandOptionAttribute("-h|--help");

        CaseSensitivity = settings.CaseSensitivity;
    }
Ejemplo n.º 8
0
        /// <summary>
        /// Checks if the specified item exists in the listbox
        /// </summary>
        /// <param name="itemText">The item to check if it exists</param>
        /// <param name="caseSensitivity">Whether to include the case of the item in the comparison</param>
        /// <returns>Whether item exists</returns>
        public bool ItemExists(string itemText, CaseSensitivity caseSensitivity)
        {
            int index = ItemIndex(itemText, caseSensitivity);

            if (index == NM.LB_ERR)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 9
0
        public static string ReplaceEnvironmentPrefix(string s, string variableName, CaseSensitivity sensitivity)
        {
            if (variableName == null)
            {
                throw new ArgumentNullException(nameof(variableName));
            }
            if (string.IsNullOrEmpty(s) || variableName == string.Empty)
            {
                return(s);
            }
            string environmentVariable = Environment.GetEnvironmentVariable(variableName);

            if (string.IsNullOrEmpty(environmentVariable) || !s.StartsWith(environmentVariable, sensitivity == CaseSensitivity.Insensitive, CultureInfo.CurrentCulture))
            {
                return(s);
            }
            return($"%{variableName}%{s.Substring(environmentVariable.Length)}");
        }
        CaseSensitivity OutputResult(IQueryable <Book> query, string type, string databaseType,
                                     CaseSensitivity lastCaseSensitivity)
        {
            var foundCount      = query.Count();
            var caseInsensitive = foundCount == 2;
            var result          = caseInsensitive
                ? lastCaseSensitivity == CaseSensitivity.CaseSensitive
                    ?
                                  CaseSensitivity.MixedCaseSensitivity
                    : CaseSensitivity.CaseInsensitive
                : lastCaseSensitivity == CaseSensitivity.CaseInsensitive
                    ? CaseSensitivity.MixedCaseSensitivity
                    : CaseSensitivity.CaseSensitive;
            var caseText = caseInsensitive ? "INsensitive" : "sensitive";

            _output.WriteLine($"{type} on {databaseType} is\t case-{caseText}. SQL created is:");
            foreach (var line in query.ToQueryString().Split('\n').Select(x => x.Trim()))
            {
                _output.WriteLine("      " + line);
            }

            return(result);
        }
Ejemplo n.º 11
0
        internal int ItemIndex(string itemText, CaseSensitivity caseSensitivity)
        {
            //Get the index
            IntPtr sendResult;
            IntPtr messageResult;
            int    itemIndex;

            int startIndex = -1;

            while (true)
            {
                sendResult = NM.SendMessageTimeout(Identity.Handle, NM.ListBoxMessages.LB_FINDSTRINGEXACT, new IntPtr(startIndex), itemText, NM.SendMessageTimeoutFlags.SMTO_NORMAL, GUI.m_APE.TimeOut, out messageResult);
                if (sendResult == IntPtr.Zero)  //Failed
                {
                    throw GUI.ApeException("Failed to find query the " + Description);
                }
                itemIndex = messageResult.ToInt32();

                switch (caseSensitivity)
                {
                case CaseSensitivity.Insensitive:
                    return(itemIndex);

                case CaseSensitivity.Sensitive:
                    string foundItemText = ItemText(itemIndex);
                    if (foundItemText == itemText)
                    {
                        return(itemIndex);
                    }
                    break;

                default:
                    throw GUI.ApeException("Unsupported CaseSensitivity value: " + caseSensitivity.ToString());
                }
                startIndex = itemIndex + 1;
            }
        }
Ejemplo n.º 12
0
 public BaseNamedColumn(string val, CaseSensitivity caseSensitivity)
 {
     _val             = val;
     _caseSensitivity = caseSensitivity;
 }
Ejemplo n.º 13
0
 public Aliased(string val, CaseSensitivity caseSensitivity) : base(val, caseSensitivity)
 {
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Attempts to parse the specified string.
 /// </summary>
 /// <typeparam name="T">The enumerated value type.</typeparam>
 /// <param name="value">The string.</param>
 /// <param name="result">The resulting enumerated value.</param>
 /// <param name="caseSensitivity">The case sensitivity.</param>
 /// <returns>True if the string was successfully parsed.</returns>
 /// <remarks>This method ignores case.</remarks>
 public static bool TryParse <T>(string value, CaseSensitivity caseSensitivity, out T result) where T : struct => Enum.TryParse(value, caseSensitivity == CaseSensitivity.IgnoreCase, out result);
Ejemplo n.º 15
0
 public static StringComparison ToStringComparison(this CaseSensitivity caseSensitivity) =>
 caseSensitivity switch
 {
Ejemplo n.º 16
0
        /// <summary>
        /// Get whether the item in the checkedlistbox is checked or not
        /// </summary>
        /// <param name="itemText">The text of the item to determine if checked</param>
        /// <param name="caseSensitivity">Whether to include the case of the item in the comparison</param>
        /// <returns>True if the item is checked otherwise false</returns>
        public bool ItemChecked(string itemText, CaseSensitivity caseSensitivity)
        {
            int itemIndex = ItemIndex(itemText, caseSensitivity);

            return(ItemChecked(itemIndex));
        }
Ejemplo n.º 17
0
 public static CommandOption?FindOption(this CommandTree tree, string name, bool longOption, CaseSensitivity sensitivity)
 {
     return(tree.Command.Parameters
            .OfType <CommandOption>()
            .FirstOrDefault(o => longOption
             ? o.LongNames.Contains(name, sensitivity.GetStringComparer(CommandPart.LongOption))
             : o.ShortNames.Contains(name, StringComparer.Ordinal)));
 }
Ejemplo n.º 18
0
        public override sealed void Refresh()
        {
            using (IDbConnection cnx = GetConnection())
            {
                cnx.Open();

                Tables.Clear();

                using (IDbCommand cmd = cnx.CreateCommand())
                {
                    cmd.CommandType = CommandType.Text;

                    //Case Sensibility
                    cmd.CommandText = CaseSensitivityTestQuery;
                    using (IDataReader reader = cmd.ExecuteReader())
                    {
                        reader.Read();
                        IsCaseSensitive = new CaseSensitivity(reader.Read());
                    }

                    //Tables
                    cmd.CommandText = TableQuery;
                    using (IDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            Table table = CreateTable(reader);
                            Tables.Add(table.ToString(), table);
                        }
                    }

                    //Columns & Primary Keys
                    foreach (Table table in Tables.Values.Cast <Table>())
                    {
                        cmd.CommandText = string.Format(ColumnQuery, table.Name);
                        using (IDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                Column column = CreateColumn(reader, table);
                                table.AddColumn(column);

                                int pkpos = (int)reader.GetInt64OrDefault(5);
                                if (pkpos > 0)
                                {
                                    if (table.PrimaryKey == null)
                                    {
                                        table.SetPrimaryKey(CreatePrimaryKey(table));
                                    }

                                    PrimaryKey primaryKey = table.PrimaryKey as PrimaryKey;
                                    // ReSharper disable PossibleNullReferenceException
                                    primaryKey.AddColumn(pkpos, column);
                                    // ReSharper restore PossibleNullReferenceException
                                }
                            }
                        }
                    }

                    //Indexes
                    foreach (Table table in Tables.Values.Cast <Table>())
                    {
                        cmd.CommandText = string.Format(IndexListQuery, table.Name);
                        using (IDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                Index index = CreateIndex(reader, table);
                                table.AddIndex(index);
                            }
                        }

                        foreach (Index index in table.Indexes().Cast <Index>())
                        {
                            cmd.CommandText = string.Format(IndexInfoQuery, index.Name);
                            using (IDataReader reader = cmd.ExecuteReader())
                            {
                                while (reader.Read())
                                {
                                    IColumn column = table.GetColumn(reader.GetStringOrDefault(2));
                                    index.AddColumn(new ColumnForIndex {
                                        Column = column, Position = (int)reader.GetInt64OrDefault(0)
                                    });
                                }
                            }
                        }
                    }
                    //ALERT: Foreign Key List TO BE CODED
                }
            }
        }
Ejemplo n.º 19
0
        // Token: 0x060004EC RID: 1260 RVA: 0x00010064 File Offset: 0x0000E264
        public bool FindNext(string searchFor, Encoding encoding, CultureInfo cultureInfo, CaseSensitivity caseSensitivity)
        {
            if (base.IsDisposed)
            {
                throw new ObjectDisposedException("ABinaryReader");
            }
            if (searchFor == null)
            {
                throw new ArgumentNullException("searchFor");
            }
            if (searchFor.Length == 0)
            {
                throw new ArgumentException("String for which to search is empty.", "searchFor");
            }
            switch (caseSensitivity)
            {
            case CaseSensitivity.CaseSensitive:
            {
                byte[] bytes = encoding.GetBytes(searchFor);
                return(this.FindNext(bytes));
            }

            case CaseSensitivity.CaseInsensitive:
            {
                byte[] bytes2 = encoding.GetBytes(searchFor.ToUpper(cultureInfo));
                byte[] bytes3 = encoding.GetBytes(searchFor.ToLower(cultureInfo));
                return(this.FindNext(bytes2, bytes3));
            }

            default:
                throw new ArgumentOutOfRangeException("caseSensitivity", "Case-sensitivity value is out-of-range.");
            }
        }
Ejemplo n.º 20
0
        internal void SingleClickItemInternal(string itemText, CaseSensitivity caseSensitivity)
        {
            //locate the item
            int itemIndex = ItemIndex(itemText, caseSensitivity);

            if (itemIndex == NM.LB_ERR)
            {
                throw GUI.ApeException("Failed to find the item in the " + Description);
            }

            //Locate the rect of the item
            Rectangle itemRectangle = GetItemRectangle(itemIndex);

            //scroll the item into view if needed
            IntPtr sendResult;
            IntPtr messageResult;

            NM.tagRect ClientRect;
            NM.GetClientRect(Identity.Handle, out ClientRect);

            if ((itemRectangle.Height / 2) + itemRectangle.Top > ClientRect.bottom || (itemRectangle.Height / 2) + itemRectangle.Top < ClientRect.top)
            {
                sendResult = NM.SendMessageTimeout(Identity.Handle, NM.ListBoxMessages.LB_SETTOPINDEX, new IntPtr(itemIndex), IntPtr.Zero, NM.SendMessageTimeoutFlags.SMTO_NORMAL, GUI.m_APE.TimeOut, out messageResult);
                if (sendResult == IntPtr.Zero || messageResult.ToInt64() == NM.LB_ERR)  //Failed
                {
                    throw GUI.ApeException("Failed to access the listbox of the " + Description);
                }

                //Wait for animation to finish
                //base.WaitForAnimation(Identity.Handle, false);
                itemRectangle = GetItemRectangle(itemIndex);
            }

            //click the item
            base.SingleClickInternal(-1, (itemRectangle.Height / 2) + itemRectangle.Top, MouseButton.Left, MouseKeyModifier.None);

            //wait for selected == item
            int       selectedIndex = -1;
            Stopwatch timer         = Stopwatch.StartNew();

            while (true)
            {
                sendResult = NM.SendMessageTimeout(Identity.Handle, NM.ListBoxMessages.LB_GETCURSEL, IntPtr.Zero, IntPtr.Zero, NM.SendMessageTimeoutFlags.SMTO_NORMAL, GUI.m_APE.TimeOut, out messageResult);
                if (sendResult == IntPtr.Zero || messageResult.ToInt64() == NM.LB_ERR)  //Failed
                {
                    throw GUI.ApeException("Failed to access the listbox of the " + Description);
                }
                selectedIndex = messageResult.ToInt32();

                if (selectedIndex == itemIndex)
                {
                    break;
                }

                if (timer.ElapsedMilliseconds > GUI.m_APE.TimeOut)
                {
                    throw GUI.ApeException("Failed to select the item in the " + Description);
                }

                Thread.Sleep(15);
            }
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Selects the specified item in the listbox by clicking on it
 /// </summary>
 /// <param name="itemText">The item to select</param>
 /// <param name="caseSensitivity">Whether to include the case of the item in the comparison</param>
 public void SingleClickItem(string itemText, CaseSensitivity caseSensitivity)
 {
     GUI.Log("Single Left click on the item " + itemText + " from the " + Identity.Description, LogItemType.Action);
     SingleClickItemInternal(itemText, caseSensitivity);
 }
Ejemplo n.º 22
0
 public Schema(string val, CaseSensitivity caseSensitivity) : base(val, caseSensitivity)
 {
 }
Ejemplo n.º 23
0
 internal int ItemIndex(string itemText, CaseSensitivity caseSensitivity)
 {
     return(ListBox.ItemIndex(itemText, caseSensitivity));
 }
Ejemplo n.º 24
0
 public StackFrame(StackFrame lastFrame) : this()
 {
     _lastFrame       = lastFrame;
     _caseSensitivity = lastFrame != null ? lastFrame.CaseSensitivity : CaseSensitivity.CaseInsensitive;
 }
Ejemplo n.º 25
0
        private static DataTable Benchmark(BenchmarkMode mode, CaseSensitivity caseSensitivity)
        {
            TimeSpan duration;

            CalculationEngine interpretedEngine = new CalculationEngine(CultureInfo.InvariantCulture, ExecutionMode.Interpreted, true, true, true);
            CalculationEngine interpretedEngineCaseSensitive = new CalculationEngine(CultureInfo.InvariantCulture, ExecutionMode.Interpreted, true, true, false);
            CalculationEngine compiledEngine = new CalculationEngine(CultureInfo.InvariantCulture, ExecutionMode.Compiled, true, true, true);
            CalculationEngine compiledEngineCaseSensitive = new CalculationEngine(CultureInfo.InvariantCulture, ExecutionMode.Compiled, true, true, false);

            BenchMarkOperation[] benchmarks =
            {
                new BenchMarkOperation()
                {
                    Formula = "2+3*7", Mode = BenchmarkMode.Static, BenchMarkDelegate = BenchMarkCalculationEngine
                },
                new BenchMarkOperation()
                {
                    Formula = "logn(var1, (2+3) * 500)", Mode = BenchmarkMode.SimpleFunction, BenchMarkDelegate = BenchMarkCalculationEngineFunctionBuild
                },
                new BenchMarkOperation()
                {
                    Formula = "(var1 + var2 * 3)/(2+3) - something", Mode = BenchmarkMode.Simple, BenchMarkDelegate = BenchMarkCalculationEngineFunctionBuild
                },
            };

            DataTable table = new DataTable();

            table.Columns.Add("Engine");
            table.Columns.Add("Case Sensitive");
            table.Columns.Add("Formula");
            table.Columns.Add("Iterations per Random Formula", typeof(int));
            table.Columns.Add("Total Iteration", typeof(int));
            table.Columns.Add("Total Duration");

            foreach (BenchMarkOperation benchmark in benchmarks)
            {
                if (mode == BenchmarkMode.All || mode == benchmark.Mode)
                {
                    if (caseSensitivity == CaseSensitivity.All || caseSensitivity == CaseSensitivity.CaseInSensitive)
                    {
                        duration = benchmark.BenchMarkDelegate(interpretedEngine, benchmark.Formula);
                        table.AddBenchmarkRecord("Interpreted", false, benchmark.Formula, null, NumberOfTests, duration);
                    }

                    if (caseSensitivity == CaseSensitivity.All || caseSensitivity == CaseSensitivity.CaseSensitive)
                    {
                        duration = benchmark.BenchMarkDelegate(interpretedEngineCaseSensitive, benchmark.Formula);
                        table.AddBenchmarkRecord("Interpreted", true, benchmark.Formula, null, NumberOfTests, duration);
                    }

                    if (caseSensitivity == CaseSensitivity.All || caseSensitivity == CaseSensitivity.CaseInSensitive)
                    {
                        duration = benchmark.BenchMarkDelegate(compiledEngine, benchmark.Formula);
                        table.AddBenchmarkRecord("Compiled", false, benchmark.Formula, null, NumberOfTests, duration);
                    }

                    if (caseSensitivity == CaseSensitivity.All || caseSensitivity == CaseSensitivity.CaseSensitive)
                    {
                        duration = benchmark.BenchMarkDelegate(compiledEngineCaseSensitive, benchmark.Formula);
                        table.AddBenchmarkRecord("Compiled", true, benchmark.Formula, null, NumberOfTests, duration);
                    }
                }
            }

            if (mode == BenchmarkMode.All || mode == BenchmarkMode.Random)
            {
                List <string> functions = GenerateRandomFunctions(NumberOfFunctionsToGenerate);

                if (caseSensitivity == CaseSensitivity.All || caseSensitivity == CaseSensitivity.CaseInSensitive)
                {
                    //Interpreted Mode
                    duration = BenchMarkCalculationEngineRandomFunctionBuild(interpretedEngine, functions, NumberExecutionsPerRandomFunction);
                    table.AddBenchmarkRecord("Interpreted", false, string.Format("Random Mode {0} functions 3 variables", NumberOfFunctionsToGenerate),
                                             NumberExecutionsPerRandomFunction, NumberExecutionsPerRandomFunction * NumberOfFunctionsToGenerate, duration);
                }

                if (caseSensitivity == CaseSensitivity.All || caseSensitivity == CaseSensitivity.CaseSensitive)
                {
                    //Interpreted Mode(Case Sensitive)
                    duration = BenchMarkCalculationEngineRandomFunctionBuild(interpretedEngineCaseSensitive, functions, NumberExecutionsPerRandomFunction);
                    table.AddBenchmarkRecord("Interpreted", true, string.Format("Random Mode {0} functions 3 variables", NumberOfFunctionsToGenerate),
                                             NumberExecutionsPerRandomFunction, NumberExecutionsPerRandomFunction * NumberOfFunctionsToGenerate, duration);
                }

                if (caseSensitivity == CaseSensitivity.All || caseSensitivity == CaseSensitivity.CaseInSensitive)
                {
                    //Compiled Mode
                    duration = BenchMarkCalculationEngineRandomFunctionBuild(compiledEngine, functions, NumberExecutionsPerRandomFunction);
                    table.AddBenchmarkRecord("Compiled", false, string.Format("Random Mode {0} functions 3 variables", NumberOfFunctionsToGenerate),
                                             NumberExecutionsPerRandomFunction, NumberExecutionsPerRandomFunction * NumberOfFunctionsToGenerate, duration);
                }

                if (caseSensitivity == CaseSensitivity.All || caseSensitivity == CaseSensitivity.CaseSensitive)
                {
                    //Compiled Mode(Case Sensitive)
                    duration = BenchMarkCalculationEngineRandomFunctionBuild(compiledEngineCaseSensitive, functions, NumberExecutionsPerRandomFunction);
                    table.AddBenchmarkRecord("Compiled", true, string.Format("Random Mode {0} functions 3 variables", NumberOfFunctionsToGenerate),
                                             NumberExecutionsPerRandomFunction, NumberExecutionsPerRandomFunction * NumberOfFunctionsToGenerate, duration);
                }
            }

            return(table);
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Attempts to parse the specified string.
 /// </summary>
 /// <typeparam name="T">The enumerated value type.</typeparam>
 /// <param name="value">The string.</param>
 /// <param name="caseSensitivity">The case sensitivity.</param>
 /// <returns>A strongly typed enumerated value; null if the string could not be successfully parsed.</returns>
 public static T?TryParse <T>(string value, CaseSensitivity caseSensitivity) where T : struct => Enum.TryParse <T>(value, caseSensitivity == CaseSensitivity.IgnoreCase, out var result) ? result : default(T?);
Ejemplo n.º 27
0
 /// <summary>
 /// Checks if the specified item exists in the checkedlistbox
 /// </summary>
 /// <param name="itemText">The item to check if it exists</param>
 /// <param name="caseSensitivity">Whether to include the case of the item in the comparison</param>
 /// <returns>Whether item exists</returns>
 public bool ItemExists(string itemText, CaseSensitivity caseSensitivity)
 {
     return(ListBox.ItemExists(itemText, caseSensitivity));
 }
Ejemplo n.º 28
0
 public StackFrame(StackFrame lastFrame, CaseSensitivity overrideCaseSensitivity) : this(lastFrame)
 {
     _caseSensitivity = overrideCaseSensitivity;
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Selects the specified item in the checkedlistbox by clicking on it
 /// </summary>
 /// <param name="itemText">The item to select</param>
 /// <param name="caseSensitivity">Whether to include the case of the item in the comparison</param>
 public void SingleClickItem(string itemText, CaseSensitivity caseSensitivity)
 {
     ListBox.SingleClickItem(itemText, caseSensitivity);
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Parses the specified string.
 /// </summary>
 /// <typeparam name="T">The enumerated value type.</typeparam>
 /// <param name="value">The string.</param>
 /// <param name="caseSensitivity">The case sensitivity.</param>
 /// <returns>A strongly typed enumerated value.</returns>
 public static T Parse <T>(string value, CaseSensitivity caseSensitivity) where T : struct => (T)Enum.Parse(typeof(T), value, caseSensitivity == CaseSensitivity.IgnoreCase);