1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
|
//------------------------------------------------------------------------------
// <copyright file="Middle.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Security.AntiXss.CodeCharts {
using System.Collections;
/// <summary>
/// Provides safe character positions for the middle section of the UTF code tables.
/// </summary>
internal static class Middle {
/// <summary>
/// Determines if the specified flag is set.
/// </summary>
/// <param name="flags">The value to check.</param>
/// <param name="flagToCheck">The flag to check for.</param>
/// <returns>true if the flag is set, otherwise false.</returns>
public static bool IsFlagSet(MidCodeCharts flags, MidCodeCharts flagToCheck) {
return (flags & flagToCheck) != 0;
}
/// <summary>
/// Provides the safe characters for the Greek Extended code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
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));
}
/// <summary>
/// Provides the safe characters for the General Punctuation code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable GeneralPunctuation() {
return CodeChartHelper.GetRange(0x2000, 0x206F,
i => (i >= 0x2065 && i <= 0x2069));
}
/// <summary>
/// Provides the safe characters for the Superscripts and subscripts code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable SuperscriptsAndSubscripts() {
return CodeChartHelper.GetRange(0x2070, 0x2094,
i => (i == 0x2072 ||
i == 0x2073 ||
i == 0x208F));
}
/// <summary>
/// Provides the safe characters for the Currency Symbols code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable CurrencySymbols() {
return CodeChartHelper.GetRange(0x20A0, 0x20B8);
}
/// <summary>
/// Provides the safe characters for the Combining Diacritrical Marks for Symbols code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable CombiningDiacriticalMarksForSymbols() {
return CodeChartHelper.GetRange(0x20D0, 0x20F0);
}
/// <summary>
/// Provides the safe characters for the Letterlike Symbols code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable LetterlikeSymbols() {
return CodeChartHelper.GetRange(0x2100, 0x214F);
}
/// <summary>
/// Provides the safe characters for the Number Forms code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable NumberForms() {
return CodeChartHelper.GetRange(0x2150, 0x2189);
}
/// <summary>
/// Provides the safe characters for the Arrows code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable Arrows() {
return CodeChartHelper.GetRange(0x2190, 0x21FF);
}
/// <summary>
/// Provides the safe characters for the Mathematical Operators code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable MathematicalOperators() {
return CodeChartHelper.GetRange(0x2200, 0x22FF);
}
/// <summary>
/// Provides the safe characters for the Miscellaneous Technical code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable MiscellaneousTechnical() {
return CodeChartHelper.GetRange(0x2300, 0x23E8);
}
/// <summary>
/// Provides the safe characters for the Control Pictures code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable ControlPictures() {
return CodeChartHelper.GetRange(0x2400, 0x2426);
}
/// <summary>
/// Provides the safe characters for the OCR code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable OpticalCharacterRecognition() {
return CodeChartHelper.GetRange(0x2440, 0x244A);
}
/// <summary>
/// Provides the safe characters for the Enclosed Alphanumerics code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable EnclosedAlphanumerics() {
return CodeChartHelper.GetRange(0x2460, 0x24FF);
}
/// <summary>
/// Provides the safe characters for the Box Drawing code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable BoxDrawing() {
return CodeChartHelper.GetRange(0x2500, 0x257F);
}
/// <summary>
/// Provides the safe characters for the Block Elements code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable BlockElements() {
return CodeChartHelper.GetRange(0x2580, 0x259F);
}
/// <summary>
/// Provides the safe characters for the Geometric Shapes code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable GeometricShapes() {
return CodeChartHelper.GetRange(0x25A0, 0x25FF);
}
/// <summary>
/// Provides the safe characters for the Miscellaneous Symbols code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable MiscellaneousSymbols() {
return CodeChartHelper.GetRange(0x2600, 0x26FF,
i => (i == 0x26CE ||
i == 0x26E2 ||
(i >= 0x26E4 && i <= 0x26E7)));
}
/// <summary>
/// Provides the safe characters for the Dingbats code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
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));
}
/// <summary>
/// Provides the safe characters for the Miscellaneous Mathematical Symbols A code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable MiscellaneousMathematicalSymbolsA() {
return CodeChartHelper.GetRange(0x27C0, 0x27EF,
i => (i == 0x27CB ||
i == 0x27CD ||
i == 0x27CE ||
i == 0x27CF));
}
/// <summary>
/// Provides the safe characters for the Supplemental Arrows A code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable SupplementalArrowsA() {
return CodeChartHelper.GetRange(0x27F0, 0x27FF);
}
/// <summary>
/// Provides the safe characters for the Braille Patterns code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable BraillePatterns() {
return CodeChartHelper.GetRange(0x2800, 0x28FF);
}
/// <summary>
/// Provides the safe characters for the Supplemental Arrows B code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable SupplementalArrowsB() {
return CodeChartHelper.GetRange(0x2900, 0x297F);
}
/// <summary>
/// Provides the safe characters for the Miscellaneous Mathematical Symbols B code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable MiscellaneousMathematicalSymbolsB() {
return CodeChartHelper.GetRange(0x2980, 0x29FF);
}
/// <summary>
/// Provides the safe characters for the Supplemental Mathematical Operators code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable SupplementalMathematicalOperators() {
return CodeChartHelper.GetRange(0x2A00, 0x2AFF);
}
/// <summary>
/// Provides the safe characters for the Miscellaneous Symbols and Arrows code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable MiscellaneousSymbolsAndArrows() {
return CodeChartHelper.GetRange(0x2B00, 0x2B59,
i => (i == 0x2B4D ||
i == 0x2B4E ||
i == 0x2B4F));
}
/// <summary>
/// Provides the safe characters for the Glagolitic code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable Glagolitic() {
return CodeChartHelper.GetRange(0x2C00, 0x2C5E,
i => (i == 0x2C2F));
}
/// <summary>
/// Provides the safe characters for the Latin Extended C code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable LatinExtendedC() {
return CodeChartHelper.GetRange(0x2C60, 0x2C7F);
}
/// <summary>
/// Provides the safe characters for the Coptic table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable Coptic() {
return CodeChartHelper.GetRange(0x2C80, 0x2CFF,
i => (i >= 0x2CF2 && i <= 0x2CF8));
}
/// <summary>
/// Provides the safe characters for the Georgian Supplement code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable GeorgianSupplement() {
return CodeChartHelper.GetRange(0x2D00, 0x2D25);
}
/// <summary>
/// Provides the safe characters for the Tifinagh code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
public static IEnumerable Tifinagh() {
return CodeChartHelper.GetRange(0x2D30, 0x2D6F,
i => (i >= 0x2D66 && i <= 0x2D6E));
}
/// <summary>
/// Provides the safe characters for the Ethiopic Extended code table.
/// </summary>
/// <returns>The safe characters for the code table.</returns>
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));
}
}
}
|