//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //------------------------------------------------------------------------------ namespace System.Web.Security.AntiXss.CodeCharts { using System.Collections; /// /// Provides safe character positions for the middle section of the UTF code tables. /// internal static class Middle { /// /// Determines if the specified flag is set. /// /// The value to check. /// The flag to check for. /// true if the flag is set, otherwise false. public static bool IsFlagSet(MidCodeCharts flags, MidCodeCharts flagToCheck) { return (flags & flagToCheck) != 0; } /// /// Provides the safe characters for the Greek Extended code table. /// /// The safe characters for the code table. public static IEnumerable GreekExtended() { return CodeChartHelper.GetRange(0x1F00, 0x1FFE, i => (i == 0x1F16 || i == 0x1F17 || i == 0x1F1E || i == 0x1F1F || i == 0x1F46 || i == 0x1F47 || i == 0x1F4E || i == 0x1F4F || i == 0x1F58 || i == 0x1F5A || i == 0x1F5C || i == 0x1F5E || i == 0x1F7E || i == 0x1F7F || i == 0x1FB5 || i == 0x1FC5 || i == 0x1FD4 || i == 0x1FD5 || i == 0x1FDC || i == 0x1FF0 || i == 0x1FF1 || i == 0x1FF5)); } /// /// Provides the safe characters for the General Punctuation code table. /// /// The safe characters for the code table. public static IEnumerable GeneralPunctuation() { return CodeChartHelper.GetRange(0x2000, 0x206F, i => (i >= 0x2065 && i <= 0x2069)); } /// /// Provides the safe characters for the Superscripts and subscripts code table. /// /// The safe characters for the code table. public static IEnumerable SuperscriptsAndSubscripts() { return CodeChartHelper.GetRange(0x2070, 0x2094, i => (i == 0x2072 || i == 0x2073 || i == 0x208F)); } /// /// Provides the safe characters for the Currency Symbols code table. /// /// The safe characters for the code table. public static IEnumerable CurrencySymbols() { return CodeChartHelper.GetRange(0x20A0, 0x20B8); } /// /// Provides the safe characters for the Combining Diacritrical Marks for Symbols code table. /// /// The safe characters for the code table. public static IEnumerable CombiningDiacriticalMarksForSymbols() { return CodeChartHelper.GetRange(0x20D0, 0x20F0); } /// /// Provides the safe characters for the Letterlike Symbols code table. /// /// The safe characters for the code table. public static IEnumerable LetterlikeSymbols() { return CodeChartHelper.GetRange(0x2100, 0x214F); } /// /// Provides the safe characters for the Number Forms code table. /// /// The safe characters for the code table. public static IEnumerable NumberForms() { return CodeChartHelper.GetRange(0x2150, 0x2189); } /// /// Provides the safe characters for the Arrows code table. /// /// The safe characters for the code table. public static IEnumerable Arrows() { return CodeChartHelper.GetRange(0x2190, 0x21FF); } /// /// Provides the safe characters for the Mathematical Operators code table. /// /// The safe characters for the code table. public static IEnumerable MathematicalOperators() { return CodeChartHelper.GetRange(0x2200, 0x22FF); } /// /// Provides the safe characters for the Miscellaneous Technical code table. /// /// The safe characters for the code table. public static IEnumerable MiscellaneousTechnical() { return CodeChartHelper.GetRange(0x2300, 0x23E8); } /// /// Provides the safe characters for the Control Pictures code table. /// /// The safe characters for the code table. public static IEnumerable ControlPictures() { return CodeChartHelper.GetRange(0x2400, 0x2426); } /// /// Provides the safe characters for the OCR code table. /// /// The safe characters for the code table. public static IEnumerable OpticalCharacterRecognition() { return CodeChartHelper.GetRange(0x2440, 0x244A); } /// /// Provides the safe characters for the Enclosed Alphanumerics code table. /// /// The safe characters for the code table. public static IEnumerable EnclosedAlphanumerics() { return CodeChartHelper.GetRange(0x2460, 0x24FF); } /// /// Provides the safe characters for the Box Drawing code table. /// /// The safe characters for the code table. public static IEnumerable BoxDrawing() { return CodeChartHelper.GetRange(0x2500, 0x257F); } /// /// Provides the safe characters for the Block Elements code table. /// /// The safe characters for the code table. public static IEnumerable BlockElements() { return CodeChartHelper.GetRange(0x2580, 0x259F); } /// /// Provides the safe characters for the Geometric Shapes code table. /// /// The safe characters for the code table. public static IEnumerable GeometricShapes() { return CodeChartHelper.GetRange(0x25A0, 0x25FF); } /// /// Provides the safe characters for the Miscellaneous Symbols code table. /// /// The safe characters for the code table. public static IEnumerable MiscellaneousSymbols() { return CodeChartHelper.GetRange(0x2600, 0x26FF, i => (i == 0x26CE || i == 0x26E2 || (i >= 0x26E4 && i <= 0x26E7))); } /// /// Provides the safe characters for the Dingbats code table. /// /// The safe characters for the code table. public static IEnumerable Dingbats() { return CodeChartHelper.GetRange(0x2701, 0x27BE, i => (i == 0x2705 || i == 0x270A || i == 0x270B || i == 0x2728 || i == 0x274C || i == 0x274E || i == 0x2753 || i == 0x2754 || i == 0x2755 || i == 0x275F || i == 0x2760 || i == 0x2795 || i == 0x2796 || i == 0x2797 || i == 0x27B0)); } /// /// Provides the safe characters for the Miscellaneous Mathematical Symbols A code table. /// /// The safe characters for the code table. public static IEnumerable MiscellaneousMathematicalSymbolsA() { return CodeChartHelper.GetRange(0x27C0, 0x27EF, i => (i == 0x27CB || i == 0x27CD || i == 0x27CE || i == 0x27CF)); } /// /// Provides the safe characters for the Supplemental Arrows A code table. /// /// The safe characters for the code table. public static IEnumerable SupplementalArrowsA() { return CodeChartHelper.GetRange(0x27F0, 0x27FF); } /// /// Provides the safe characters for the Braille Patterns code table. /// /// The safe characters for the code table. public static IEnumerable BraillePatterns() { return CodeChartHelper.GetRange(0x2800, 0x28FF); } /// /// Provides the safe characters for the Supplemental Arrows B code table. /// /// The safe characters for the code table. public static IEnumerable SupplementalArrowsB() { return CodeChartHelper.GetRange(0x2900, 0x297F); } /// /// Provides the safe characters for the Miscellaneous Mathematical Symbols B code table. /// /// The safe characters for the code table. public static IEnumerable MiscellaneousMathematicalSymbolsB() { return CodeChartHelper.GetRange(0x2980, 0x29FF); } /// /// Provides the safe characters for the Supplemental Mathematical Operators code table. /// /// The safe characters for the code table. public static IEnumerable SupplementalMathematicalOperators() { return CodeChartHelper.GetRange(0x2A00, 0x2AFF); } /// /// Provides the safe characters for the Miscellaneous Symbols and Arrows code table. /// /// The safe characters for the code table. public static IEnumerable MiscellaneousSymbolsAndArrows() { return CodeChartHelper.GetRange(0x2B00, 0x2B59, i => (i == 0x2B4D || i == 0x2B4E || i == 0x2B4F)); } /// /// Provides the safe characters for the Glagolitic code table. /// /// The safe characters for the code table. public static IEnumerable Glagolitic() { return CodeChartHelper.GetRange(0x2C00, 0x2C5E, i => (i == 0x2C2F)); } /// /// Provides the safe characters for the Latin Extended C code table. /// /// The safe characters for the code table. public static IEnumerable LatinExtendedC() { return CodeChartHelper.GetRange(0x2C60, 0x2C7F); } /// /// Provides the safe characters for the Coptic table. /// /// The safe characters for the code table. public static IEnumerable Coptic() { return CodeChartHelper.GetRange(0x2C80, 0x2CFF, i => (i >= 0x2CF2 && i <= 0x2CF8)); } /// /// Provides the safe characters for the Georgian Supplement code table. /// /// The safe characters for the code table. public static IEnumerable GeorgianSupplement() { return CodeChartHelper.GetRange(0x2D00, 0x2D25); } /// /// Provides the safe characters for the Tifinagh code table. /// /// The safe characters for the code table. public static IEnumerable Tifinagh() { return CodeChartHelper.GetRange(0x2D30, 0x2D6F, i => (i >= 0x2D66 && i <= 0x2D6E)); } /// /// Provides the safe characters for the Ethiopic Extended code table. /// /// The safe characters for the code table. public static IEnumerable EthiopicExtended() { return CodeChartHelper.GetRange(0x2D80, 0x2DDE, i => ((i >= 0x2D97 && i <= 0x2D9F) || i == 0x2DA7 || i == 0x2DAF || i == 0x2DB7 || i == 0x2DBF || i == 0x2DC7 || i == 0x2DCF || i == 0x2DD7 || i == 0x2DDF)); } } }