Add DebuggerDisplay attributes.

Format some code to C# 7.0.
Remove useless using directives.
This commit is contained in:
GoldenCrystal
2017-09-07 23:10:17 +02:00
parent d65f7f0a77
commit 751e84fc6d
30 changed files with 144 additions and 280 deletions
+2 -1
View File
@@ -18,6 +18,7 @@ bld/
# Roslyn cache directories
*.ide/
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
@@ -186,4 +187,4 @@ FakesAssemblies/
# LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
ModelManifest.xml
+33
View File
@@ -0,0 +1,33 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace System.Unicode.Builder
{
internal static class EnumHelper<T>
where T : struct
{
private static readonly Dictionary<string, T> namedValueDictionary = CreateNamedValueDictionary();
private static Dictionary<string, T> CreateNamedValueDictionary()
{
var type = typeof(T).GetTypeInfo();
if (!type.IsEnum) throw new InvalidOperationException();
return
(
from field in type.DeclaredFields
where field.IsPublic && field.IsLiteral
from attr in field.GetCustomAttributes<ValueNameAttribute>()
where attr.Name != null
select new KeyValuePair<string, T>(attr.Name, (T)field.GetValue(null))
).ToDictionary(kvp => kvp.Key, kvp => kvp.Value, StringComparer.OrdinalIgnoreCase);
}
public static bool TryGetNamedValue(string name, out T value)
{
return namedValueDictionary.TryGetValue(name, out value);
}
}
}
+1 -6
View File
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace System.Unicode
{
+2 -5
View File
@@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace System.Unicode
{
/// <summary>Provides information on a specific CJK radical.</summary>
[DebuggerDisplay("{RadicalIndex} - {TraditionalRadicalCodePoint.ToString(),nq} / {SimplifiedRadicalCodePoint.ToString(),nq}")]
public struct CjkRadicalInfo
{
private readonly byte radicalIndex;
+6 -26
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
{
@@ -14,34 +10,18 @@ namespace System.Unicode
/// </remarks>
public struct CodePointEnumerable : IEnumerable<int>
{
private readonly string text;
/// <summary>Initializes a new instance of the struct <see cref="CodePointEnumerable"/>.</summary>
/// <param name="text">The string whose code points must be enumerated.</param>
public CodePointEnumerable(string text)
{
if (text == null) throw new ArgumentNullException(nameof(text));
this.text = text;
}
public CodePointEnumerable(string text) => Text = text ?? throw new ArgumentNullException(nameof(text));
/// <summary>Gets the text whose code points are being enumerated.</summary>
public string Text { get { return text; } }
public string Text { get; }
/// <summary>Gets an enumerator which can be used to enumerate the code points in the text.</summary>
public CodePointEnumerator GetEnumerator()
{
return new CodePointEnumerator(text);
}
public CodePointEnumerator GetEnumerator() => new CodePointEnumerator(Text);
IEnumerator<int> IEnumerable<int>.GetEnumerator()
{
return GetEnumerator();
}
IEnumerator<int> IEnumerable<int>.GetEnumerator() => GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}
+3 -7
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
{
@@ -28,9 +24,9 @@ namespace System.Unicode
/// <summary>Gets the element in the collection at the current position of the enumerator..</summary>
/// <value>The element in the collection at the current position of the enumerator.</value>
public int Current { get { return current; } }
public int Current => current;
object IEnumerator.Current { get { return current; } }
object IEnumerator.Current => current;
void IDisposable.Dispose() { }
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace System.Unicode
{
+1 -6
View File
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace System.Unicode
{
+1 -6
View File
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace System.Unicode
{
+16 -16
View File
@@ -1,19 +1,15 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
{
internal sealed class EnumHelper<T>
internal static class EnumHelper<T>
where T : struct
{
private static readonly Dictionary<string, T> namedValueDictionary = CreateNamedValueDictionary();
private static readonly Dictionary<T, string[]> valueNameDictionary = CreateValueNameDictionary();
private static Dictionary<string, T> CreateNamedValueDictionary()
private static Dictionary<T, string[]> CreateValueNameDictionary()
{
var type = typeof(T).GetTypeInfo();
@@ -22,15 +18,19 @@ namespace System.Unicode
return
(
from field in type.DeclaredFields
from attr in field.GetCustomAttributes<ValueNameAttribute>()
where attr.Name != null
select new KeyValuePair<string, T>(attr.Name, (T)field.GetValue(null))
).ToDictionary(kvp => kvp.Key, kvp => kvp.Value, StringComparer.OrdinalIgnoreCase);
where field.IsPublic && field.IsLiteral
select new KeyValuePair<T, string[]>
(
(T)field.GetValue(null),
(
from attr in field.GetCustomAttributes<ValueNameAttribute>()
where attr.Name != null
select attr.Name
).ToArray()
)
).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
}
public static bool TryGetNamedValue(string name, out T value)
{
return namedValueDictionary.TryGetValue(name, out value);
}
public static string[] GetValueNames(T value) => valueNameDictionary.TryGetValue(value, out string[] names) ? names : null;
}
}
+1 -7
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
namespace System.Unicode
{
internal static class HangulInfo
{
@@ -1,9 +1,5 @@
using System;
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
{
@@ -14,35 +10,19 @@ namespace System.Unicode
/// </remarks>
public struct PermissiveCodePointEnumerable : IEnumerable<int>
{
private readonly string text;
/// <summary>Initializes a new instance of the struct <see cref="PermissiveCodePointEnumerable"/>.</summary>
/// <param name="text">The string whose code points must be enumerated.</param>
public PermissiveCodePointEnumerable(string text)
{
if (text == null) throw new ArgumentNullException(nameof(text));
this.text = text;
}
public PermissiveCodePointEnumerable(string text) => Text = text ?? throw new ArgumentNullException(nameof(text));
/// <summary>Gets the text whose code points are being enumerated.</summary>
public string Text { get { return text; } }
public string Text { get; }
/// <summary>Gets an enumerator which can be used to enumerate the code points in the text.</summary>
/// <returns></returns>
public PermissiveCodePointEnumerator GetEnumerator()
{
return new PermissiveCodePointEnumerator(text);
}
public PermissiveCodePointEnumerator GetEnumerator() => new PermissiveCodePointEnumerator(Text);
IEnumerator<int> IEnumerable<int>.GetEnumerator()
{
return GetEnumerator();
}
IEnumerator<int> IEnumerable<int>.GetEnumerator() => GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}
@@ -1,9 +1,5 @@
using System;
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
{
@@ -41,7 +37,7 @@ namespace System.Unicode
if (index < text.Length && (index += current > 0xFFFF ? 2 : 1) < text.Length)
{
current = GetUtf32(text, index);
return true;
return true;
}
else
{
+1 -7
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
namespace System.Unicode
{
/// <summary>Contains extension methods applicable to the <see cref="string"/> type.</summary>
public static class StringExtensions
+1 -7
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
namespace System.Unicode
{
/// <summary>Represents the fields available for an UCD entry.</summary>
/// <remarks>Not all the enumeration member directly map to a field.</remarks>
+4 -7
View File
@@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace System.Unicode
{
/// <summary>Represents a Unicode block.</summary>
[DebuggerDisplay("[{CodePointRange.ToString(),nq}] {Name,nq}")]
public struct UnicodeBlock
{
/// <summary>The code point range of this block.</summary>
@@ -16,8 +13,8 @@ namespace System.Unicode
internal UnicodeBlock(UnicodeCodePointRange codePointRange, string name)
{
this.CodePointRange = codePointRange;
this.Name = name;
CodePointRange = codePointRange;
Name = name;
}
}
}
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;
namespace System.Unicode
{
+17 -45
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
{
@@ -84,26 +80,17 @@ namespace System.Unicode
/// <summary>Gets an <see cref="UnicodeCategoryInfo"/> value providing information on the specified unicode category.</summary>
/// <param name="category">The category on which information should be retrieved.</param>
/// <returns>Information on the specified category.</returns>
public static UnicodeCategoryInfo Get(UnicodeCategory category)
{
return categories[(int)category];
}
public static UnicodeCategoryInfo Get(UnicodeCategory category) => categories[(int)category];
/// <summary>Gets an <see cref="UnicodeCategoryInfo"/> value providing information on the unicode category, accessed by its short name, as per the Unicode standard.</summary>
/// <param name="name">The short name for which information should be retrieved .</param>
/// <returns>Information on the specified category.</returns>
public static UnicodeCategoryInfo FromShortName(string name)
{
return Get(GetCategoryFromShortName(name));
}
public static UnicodeCategoryInfo FromShortName(string name) => Get(GetCategoryFromShortName(name));
/// <summary>Gets an <see cref="UnicodeCategoryInfo"/> value providing information on the unicode category, accessed by its long name, as per the Unicode standard.</summary>
/// <param name="name">The long name for which information should be retrieved .</param>
/// <returns>Information on the specified category.</returns>
public static UnicodeCategoryInfo FromLongName(string name)
{
return Get(GetCategoryFromLongName(name));
}
public static UnicodeCategoryInfo FromLongName(string name) => Get(GetCategoryFromLongName(name));
/// <summary>The unicode category described.</summary>
public readonly UnicodeCategory Category;
@@ -114,47 +101,32 @@ namespace System.Unicode
private UnicodeCategoryInfo(UnicodeCategory category, string shortName, string longName)
{
this.Category = category;
this.ShortName = shortName;
this.LongName = longName;
Category = category;
ShortName = shortName;
LongName = longName;
}
/// <summary>Returns a <see cref="System.String" /> that represents this instance.</summary>
/// <returns>A <see cref="System.String" /> that represents this instance.</returns>
public override string ToString()
{
return Category.ToString();
}
/// <summary>Returns a <see cref="string" /> that represents this instance.</summary>
/// <returns>A <see cref="string" /> that represents this instance.</returns>
public override string ToString() => Category.ToString();
/// <summary>Determines whether the specified <see cref="System.Object" />, is equal to this instance.</summary>
/// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
/// <returns><see langword="true" /> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <see langword="false" />.</returns>
public override bool Equals(object obj)
{
return obj is UnicodeCategoryInfo && Equals((UnicodeCategoryInfo)obj);
}
/// <summary>Determines whether the specified <see cref="object" />, is equal to this instance.</summary>
/// <param name="obj">The <see cref="object" /> to compare with this instance.</param>
/// <returns><see langword="true" /> if the specified <see cref="object" /> is equal to this instance; otherwise, <see langword="false" />.</returns>
public override bool Equals(object obj) => obj is UnicodeCategoryInfo && Equals((UnicodeCategoryInfo)obj);
/// <summary>Indicates whether the current object is equal to another object of the same type.</summary>
/// <param name="other">An object to compare with this object.</param>
/// <returns><see langword="true" /> if the current object is equal to the other parameter; otherwise, <see langword="false" />.</returns>
public bool Equals(UnicodeCategoryInfo other)
{
return other.Category == Category && (other.Category != 0 || other.ShortName != null);
}
public bool Equals(UnicodeCategoryInfo other) => other.Category == Category && (other.Category != 0 || other.ShortName != null);
/// <summary>Returns a hash code for this instance.</summary>
/// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
public override int GetHashCode()
{
return (int)Category;
}
public override int GetHashCode() => (int)Category;
/// <summary>Performs an implicit conversion from <see cref="UnicodeCategoryInfo"/> to <see cref="UnicodeCategory"/>.</summary>
/// <param name="info">The information.</param>
/// <returns>The result of the conversion.</returns>
public static implicit operator UnicodeCategory(UnicodeCategoryInfo info)
{
return info.Category;
}
public static implicit operator UnicodeCategory(UnicodeCategoryInfo info) => info.Category;
}
}
+2 -5
View File
@@ -1,13 +1,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
{
/// <summary>Provides information on a specific unicode code point.</summary>
[DebuggerDisplay(@"{CodePoint.ToString(""X4""),nq} - {Name,nq}")]
public struct UnicodeCharInfo
{
/// <summary>The code point.</summary>
+1 -5
View File
@@ -1,10 +1,6 @@
using System;
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
{
+12 -11
View File
@@ -24,6 +24,7 @@ namespace System.Unicode
private static readonly UnicodeBlock[] blocks;
private static readonly CjkRadicalData[] radicals;
private static readonly int maxContiguousIndex;
private static readonly string[] emojiSequences;
static UnicodeInfo()
{
@@ -49,7 +50,7 @@ namespace System.Unicode
if (formatVersion != 2) throw new InvalidDataException();
var fileUnicodeVersion = new Version(reader.ReadUInt16(), reader.ReadByte(), reader.ReadByte());
var unicodeCharacterDataEntries = new UnicodeCharacterData[ReadCodePoint(reader)]; // Allocate one extra entry to act as a dummy entry.
byte[] nameBuffer = new byte[128];
int mci = 0;
@@ -72,7 +73,7 @@ namespace System.Unicode
for (; i < unicodeCharacterDataEntries.Length; ++i)
{
ReadUnicodeCharacterDataEntry(reader, nameBuffer, out unicodeCharacterDataEntries[i]);
ReadUnicodeCharacterDataEntry(reader, nameBuffer, out unicodeCharacterDataEntries[i]);
}
var blockEntries = new UnicodeBlock[reader.ReadUInt16()];
@@ -430,11 +431,11 @@ namespace System.Unicode
/// <returns>A display text for the code point, which may be the representation of the code point itself.</returns>
public static string GetDisplayText(int codePoint)
{
if (codePoint <= 0x0020) return ((char)(0x2400 + codePoint)).ToString(); // Provide a display text for control characters, including space.
if (codePoint <= 0x0020) return ((char)(0x2400 + codePoint)).ToString(); // Provide a display text for control characters, including space.
else if (GetCategory(codePoint) == UnicodeCategory.NonSpacingMark) return "\u25CC" + char.ConvertFromUtf32(codePoint);
else if (codePoint >= 0xD800 && codePoint <= 0xDFFF) return "\xFFFD";
else if (codePoint >= 0xD800 && codePoint <= 0xDFFF) return "\xFFFD";
else if (codePoint >= 0xE0020 && codePoint < 0xE007F) return char.ConvertFromUtf32(codePoint - 0xE0000); // Handle "TAG" ASCII subset by remapping it to regular ASCII
else return char.ConvertFromUtf32(codePoint);
else return char.ConvertFromUtf32(codePoint);
}
private static string GetDisplayText(int codePoint, int unicodeCharacterDataIndex)
@@ -458,18 +459,18 @@ namespace System.Unicode
HangulInfo.GetHangulName((char)codePoint) :
GetNameInternal(codePoint);
private static string GetNameInternal(int codePoint)
private static string GetNameInternal(int codePoint)
=> FindUnicodeCodePointIndex(codePoint) is int codePointInfoIndex && codePointInfoIndex >= 0 ?
GetName(codePoint, ref GetUnicodeCharacterData(codePointInfoIndex)) :
null;
internal static string GetName(int codePoint, ref UnicodeCharacterData characterData)
{
if (characterData.CodePointRange.IsSingleCodePoint) return characterData.Name;
else if (HangulInfo.IsHangul(codePoint)) return HangulInfo.GetHangulName((char)codePoint);
else if (characterData.Name != null) return characterData.Name + "-" + codePoint.ToString("X4");
else return null;
}
if (characterData.CodePointRange.IsSingleCodePoint) return characterData.Name;
else if (HangulInfo.IsHangul(codePoint)) return HangulInfo.GetHangulName((char)codePoint);
else if (characterData.Name != null) return characterData.Name + "-" + codePoint.ToString("X4");
else return null;
}
/// <summary>Returns information for a CJK radical.</summary>
/// <param name="radicalIndex">The index of the radical. Must be between 1 and <see cref="CjkRadicalCount"/>.</param>
+7 -1
View File
@@ -1,6 +1,10 @@
namespace System.Unicode
using System.Diagnostics;
using System.Linq;
namespace System.Unicode
{
/// <summary>Represents a name alias for an Unicode code point.</summary>
[DebuggerDisplay("{DisplayText,nq}")]
public struct UnicodeNameAlias
{
internal static readonly UnicodeNameAlias[] EmptyArray = new UnicodeNameAlias[0];
@@ -12,6 +16,8 @@
/// <value>The kind of alias.</value>
public UnicodeNameAliasKind Kind { get; }
private string DisplayText => (Kind != 0 ? "<" + EnumHelper<UnicodeNameAliasKind>.GetValueNames(Kind).FirstOrDefault() + "> " : string.Empty) + Name;
internal UnicodeNameAlias(string name, UnicodeNameAliasKind kind)
{
Name = name;
@@ -1,9 +1,5 @@
using System;
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
{
+1 -7
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
namespace System.Unicode
{
/// <summary>Represents the value of the Numeric_Type property.</summary>
public enum UnicodeNumericType : byte
+16 -23
View File
@@ -1,29 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace System.Unicode
{
/// <summary>Provides information on radical and additional stroke count for a code point.</summary>
/// <remarks>Values of this type are usually associated with the property kRSUnicode (aka. Unicode_Radical_Stroke).</remarks>
[DebuggerDisplay(@"{IsSimplified ? ""Simplified"" : ""Traditional"",nq} Radical {Radical} + {StrokeCount} Strokes")]
public struct UnicodeRadicalStrokeCount
{
internal static readonly UnicodeRadicalStrokeCount[] EmptyArray = new UnicodeRadicalStrokeCount[0];
/// <summary>The radical index.</summary>
private readonly byte radical;
/// <summary>The stroke count as a 7bit signed value, together with the <see cref="IsSimplified"/> flag as a 1bit value.</summary>
private readonly byte strokeCount;
/// <summary>Initializes a new instance of the class <see cref="UnicodeRadicalStrokeCount"/> from raw data.</summary>
/// <param name="rawRadical">The raw value to use for <see cref="radical"/>.</param>
/// <param name="rawStrokeCount">The raw value to use for <see cref="strokeCount"/>.</param>
/// <param name="rawRadical">The raw value to use for <see cref="Radical"/>.</param>
/// <param name="rawStrokeCount">The raw value to use for <see cref="RawStrokeCount"/>.</param>
internal UnicodeRadicalStrokeCount(byte rawRadical, byte rawStrokeCount)
{
radical = rawRadical;
strokeCount = rawStrokeCount;
Radical = rawRadical;
RawStrokeCount = rawStrokeCount;
}
/// <summary>Initializes a new instance of the class <see cref="UnicodeRadicalStrokeCount"/>.</summary>
@@ -36,23 +28,24 @@ namespace System.Unicode
{
if (strokeCount < -64 || strokeCount > 63) throw new ArgumentOutOfRangeException(nameof(strokeCount));
this.radical = radical;
Radical = radical;
// Pack strokeCount together with isSimplified in a single byte.
this.strokeCount = unchecked((byte)(strokeCount & 0x7F | (isSimplified ? 0x80 : 0x00)));
RawStrokeCount = unchecked((byte)(strokeCount & 0x7F | (isSimplified ? 0x80 : 0x00)));
}
/// <summary>Gets the index of the Kangxi radical of the character.</summary>
/// <remarks>The Kangxi radicals are numbered from 1 to 214 inclusive.</remarks>
/// <value>The index of the Kangxi radical.</value>
public byte Radical { get { return radical; } }
public byte Radical { get; }
/// <summary>Gets the value of <see cref="StrokeCount"/> packed with <see cref="IsSimplified"/>.</summary>
/// <value>The raw value of <see cref="strokeCount"/>.</value>
internal byte RawStrokeCount { get { return strokeCount; } }
/// <remarks>The stroke count is stored as a 7bit signed value, together with the <see cref="IsSimplified"/> flag as a 1bit value.</remarks>
/// <value>The raw value of <see cref="StrokeCount"/>.</value>
internal byte RawStrokeCount { get; }
/// <summary>Gets the additional stroke count.</summary>
/// <value>The additional stroke count.</value>
public sbyte StrokeCount { get { return unchecked((sbyte)(strokeCount & 0x7F | (strokeCount & 0x40) << 1)); } } // To unpack the stroke count, we simply need to copy bit 6 to bit 7.
/// <summary>Gets a value indicating whether the information is based on the simplified form of the radical.</summary>
/// <value><see langword="true" /> if the information is based on the simplified form of the radical; otherwise, <see langword="false" />.</value>
public bool IsSimplified { get { return (strokeCount & 0x80) != 0; } }
public sbyte StrokeCount { get { return unchecked((sbyte)(RawStrokeCount & 0x7F | (RawStrokeCount & 0x40) << 1)); } } // To unpack the stroke count, we simply need to copy bit 6 to bit 7.
/// <summary>Gets a value indicating whether the information is based on the simplified form of the radical.</summary>
/// <value><see langword="true" /> if the information is based on the simplified form of the radical; otherwise, <see langword="false" />.</value>
public bool IsSimplified { get { return (RawStrokeCount & 0x80) != 0; } }
}
}
@@ -1,9 +1,5 @@
using System;
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
{
+1 -7
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
namespace System.Unicode
{
/// <summary>Represents a rational number in a format compatible with the Unicode standard.</summary>
public struct UnicodeRationalNumber : IEquatable<UnicodeRationalNumber>
+1 -7
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
namespace System.Unicode
{
[Flags]
internal enum UnihanFields : ushort
+1 -7
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
namespace System.Unicode
{
/// <summary>Represents the different numeric types from the Unihan database.</summary>
public enum UnihanNumericType : byte
+1 -7
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Unicode
namespace System.Unicode
{
/// <summary>Declares a name for a specific value.</summary>
/// <remarks>