Replaced spaces by tabs on files with incoherent indentations.
This commit is contained in:
@@ -38,7 +38,7 @@ namespace UnicodeCharacterInspector
|
||||
storage = value;
|
||||
NotifyPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace UnicodeCharacterInspector
|
||||
{
|
||||
codePoint = 0;
|
||||
characterInfo = UnicodeInfo.GetCharInfo(0);
|
||||
}
|
||||
}
|
||||
|
||||
NotifyPropertyChanged();
|
||||
UpdateDisplayText();
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace UnicodeCharacterInspector
|
||||
CodePoint = codePoint;
|
||||
Character = char.ConvertFromUtf32(codePoint);
|
||||
DisplayText = UnicodeInfo.GetDisplayText(codePoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CharacterCollection : INotifyCollectionChanged, IList<CharacterViewModel>
|
||||
@@ -108,7 +108,7 @@ namespace UnicodeCharacterInspector
|
||||
public CharacterInspectorViewModel()
|
||||
{
|
||||
characterCollection = new CharacterCollection(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void NotifyCollectionChanged(NotifyCollectionChangedAction action)
|
||||
{
|
||||
@@ -164,7 +164,7 @@ namespace UnicodeCharacterInspector
|
||||
NotifyPropertyChanged(nameof(SelectedCharacter));
|
||||
selectedCharacterInfo.Character = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<CharacterViewModel> Characters { get { return characterCollection; } }
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace System.Unicode.Builder
|
||||
index = 0;
|
||||
}
|
||||
|
||||
var buffer = stackalloc char[36]; // From the Unicode docs, a decomposition cannot have more than 18 code points.
|
||||
var buffer = stackalloc char[36]; // From the Unicode docs, a decomposition cannot have more than 18 code points.
|
||||
int charIndex = 0;
|
||||
|
||||
while (index < s.Length && charIndex < 35)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace System.Unicode.Builder
|
||||
{
|
||||
this.httpClient = new HttpClient();
|
||||
this.baseUri = baseUri;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace System.Unicode.Builder
|
||||
"UnicodeData.txt",
|
||||
"PropList.txt",
|
||||
"DerivedCoreProperties.txt",
|
||||
"Blocks.txt",
|
||||
"Blocks.txt",
|
||||
"Jamo.txt",
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace System.Unicode.Builder
|
||||
using (var httpClient = new HttpClient())
|
||||
{
|
||||
return httpClient.GetByteArrayAsync(HttpDataSource.UnicodeCharacterDataUri + archiveName).Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static IDataSource GetDataSource(string archiveName, string directoryName, string[] requiredFiles, bool? shouldDownload, bool? shouldSaveArchive, bool? shouldExtract)
|
||||
@@ -79,7 +79,7 @@ namespace System.Unicode.Builder
|
||||
return new ZipDataSource(File.OpenRead(dataArchiveFileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldDownload != false)
|
||||
{
|
||||
@@ -91,7 +91,7 @@ namespace System.Unicode.Builder
|
||||
try
|
||||
{
|
||||
stream.Write(dataArchiveData, 0, dataArchiveData.Length);
|
||||
dataArchiveData = null; // Release the reference now, since we won't need it anymore.
|
||||
dataArchiveData = null; // Release the reference now, since we won't need it anymore.
|
||||
|
||||
if (shouldExtract == true)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ namespace System.Unicode.Builder
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
@@ -134,6 +134,6 @@ namespace System.Unicode.Builder
|
||||
|
||||
using (var stream = new DeflateStream(File.Create("ucd.dat"), CompressionLevel.Optimal, false))
|
||||
data.WriteToStream(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,8 @@ namespace System.Unicode.Builder
|
||||
if (name != null) fields |= UcdFields.Name;
|
||||
if (category != UnicodeCategory.OtherNotAssigned) fields |= UcdFields.Category;
|
||||
if (canonicalCombiningClass != CanonicalCombiningClass.NotReordered) fields |= UcdFields.CanonicalCombiningClass;
|
||||
/*if (bidirectionalClass != 0)*/fields |= UcdFields.BidirectionalClass;
|
||||
/*if (bidirectionalClass != 0)*/
|
||||
fields |= UcdFields.BidirectionalClass;
|
||||
if (characterDecompositionMapping.DecompositionMapping != null) fields |= UcdFields.DecompositionMapping;
|
||||
fields |= (UcdFields)((int)numericType << 6);
|
||||
if (bidirectionalMirrored) fields |= UcdFields.BidirectionalMirrored;
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace System.Unicode.Builder
|
||||
hasField = true;
|
||||
goto Completed;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
@@ -82,9 +82,9 @@ namespace System.Unicode.Builder
|
||||
} while (RefillBuffer());
|
||||
|
||||
hasField = false;
|
||||
Completed: ;
|
||||
Completed:;
|
||||
return hasField;
|
||||
}
|
||||
}
|
||||
|
||||
private string ReadFieldInternal(bool trim)
|
||||
{
|
||||
@@ -121,7 +121,7 @@ namespace System.Unicode.Builder
|
||||
{
|
||||
byte b = byteBuffer[index];
|
||||
|
||||
if (IsNewLineOrComment(b)) // NB: Do not advance to the next byte when end of line has been reached.
|
||||
if (IsNewLineOrComment(b)) // NB: Do not advance to the next byte when end of line has been reached.
|
||||
{
|
||||
endOffset = index;
|
||||
hasField = false;
|
||||
@@ -192,7 +192,7 @@ namespace System.Unicode.Builder
|
||||
{
|
||||
byte b = byteBuffer[index];
|
||||
|
||||
if (IsNewLineOrComment(b)) // NB: Do not advance to the next byte when end of line has been reached.
|
||||
if (IsNewLineOrComment(b)) // NB: Do not advance to the next byte when end of line has been reached.
|
||||
{
|
||||
hasField = false;
|
||||
return true;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace System.Unicode.Builder
|
||||
|
||||
codePoint = new UnicodeCharacterRange(rangeStartCodePoint, codePoint.LastCodePoint);
|
||||
|
||||
name = name.Substring(1, name.Length - 8).ToUpperInvariant(); // Upper-case the name in order to respect unicode naming scheme. (Spec says all names are uppercase ASCII)
|
||||
name = name.Substring(1, name.Length - 8).ToUpperInvariant(); // Upper-case the name in order to respect unicode naming scheme. (Spec says all names are uppercase ASCII)
|
||||
|
||||
rangeStartCodePoint = -1;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace System.Unicode.Builder
|
||||
if (Δ == 0) return index;
|
||||
else if (Δ < 0) maxIndex = index - 1;
|
||||
else minIndex = index + 1;
|
||||
} while (minIndex <= maxIndex);
|
||||
} while (minIndex <= maxIndex);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ namespace System.Unicode.Builder
|
||||
public void AddBlockEntry(UnicodeBlock block)
|
||||
{
|
||||
blockEntries.Add(block);
|
||||
}
|
||||
}
|
||||
|
||||
//public UnicodeInfo ToUnicodeData()
|
||||
//{
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace System.Unicode.Builder
|
||||
public UnihanDataFileReader(Stream stream, bool leaveOpen)
|
||||
{
|
||||
reader = new UnicodeDataFileReader(stream, '\t', leaveOpen);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace System.Unicode.Builder
|
||||
byte[] buffer;
|
||||
|
||||
return new Utf8Buffer(bufferStack.TryPop(out buffer) ? buffer : new byte[100]);
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] buffer;
|
||||
private int length;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace System.Unicode
|
||||
public enum CompatibilityFormattingTag : byte
|
||||
{
|
||||
Canonical = 0,
|
||||
[ValueName("font"), Display(Name = "font", Description = "Font variant (for example, a blackletter form)")]
|
||||
[ValueName("font"), Display(Name = "font", Description = "Font variant (for example, a blackletter form)")]
|
||||
Font,
|
||||
[ValueName("noBreak"), Display(Name = "noBreak", Description = "No-break version of a space or hyphen")]
|
||||
NoBreak,
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace System.Unicode
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace System.Unicode
|
||||
internal enum UcdFields : ushort
|
||||
{
|
||||
// Not really a field, just here to indicate that the entry is a range
|
||||
CodePointRange = 1,
|
||||
|
||||
CodePointRange = 1,
|
||||
|
||||
Name = 2,
|
||||
Category = 4,
|
||||
CanonicalCombiningClass = 8,
|
||||
@@ -23,7 +23,7 @@ namespace System.Unicode
|
||||
// NumericType / NumericValue : Not exactly a bit mask here… More like [0…3] << 6
|
||||
NumericDecimal = 64,
|
||||
NumericDigit = 128,
|
||||
NumericNumeric = 192,
|
||||
NumericNumeric = 192,
|
||||
|
||||
// This is a yes/no field, so obviously, no extra storage is required for this one…
|
||||
BidirectionalMirrored = 256,
|
||||
|
||||
@@ -16,5 +16,5 @@ namespace System.Unicode
|
||||
this.CodePointRange = codePointRange;
|
||||
this.Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,10 +50,10 @@ namespace System.Unicode
|
||||
{
|
||||
var dictionary = new Dictionary<string, UnicodeCategory>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
foreach (var info in categories)
|
||||
foreach (var info in categories)
|
||||
{
|
||||
dictionary.Add(info.ShortName, info.Category);
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace System.Unicode
|
||||
public static UnicodeCategoryInfo Get(UnicodeCategory category)
|
||||
{
|
||||
return categories[(int)category];
|
||||
}
|
||||
}
|
||||
|
||||
public static UnicodeCategoryInfo FromShortName(string name)
|
||||
{
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace System.Unicode
|
||||
return unicodeCharacterData.Name == null || unicodeCharacterData.CodePointRange.IsSingleCodePoint ?
|
||||
unicodeCharacterData.Name :
|
||||
unicodeCharacterData.Name + "-" + codePoint.ToString("X4");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public UnicodeCategory Category { get { return unicodeCharacterData != null ? unicodeCharacterData.Category : UnicodeCategory.OtherNotAssigned; } }
|
||||
public string Block { get { return block ?? "No_Block"; } }
|
||||
public UnicodeCategory Category { get { return unicodeCharacterData != null ? unicodeCharacterData.Category : UnicodeCategory.OtherNotAssigned; } }
|
||||
public string Block { get { return block ?? "No_Block"; } }
|
||||
public CanonicalCombiningClass CanonicalCombiningClass { get { return unicodeCharacterData.CanonicalCombiningClass; } }
|
||||
public BidirectionalClass BidirectionalClass { get { return unicodeCharacterData.BidirectionalClass; } }
|
||||
public CompatibilityFormattingTag DecompositionType { get { return unicodeCharacterData.DecompositionType; } }
|
||||
|
||||
@@ -36,17 +36,17 @@ namespace System.Unicode
|
||||
CanonicalCombiningClass canonicalCombiningClass,
|
||||
BidirectionalClass bidirectionalClass,
|
||||
CompatibilityFormattingTag decompositionType,
|
||||
string decompositionMapping,
|
||||
string decompositionMapping,
|
||||
UnicodeNumericType numericType,
|
||||
UnicodeRationalNumber numericValue,
|
||||
bool bidirectionalMirrored,
|
||||
string oldName,
|
||||
string simpleUpperCaseMapping,
|
||||
string simpleUpperCaseMapping,
|
||||
string simpleLowerCaseMapping,
|
||||
string simpleTitleCaseMapping,
|
||||
ContributoryProperties contributoryProperties,
|
||||
CoreProperties coreProperties,
|
||||
int[] relatedCodePoints
|
||||
int[] relatedCodePoints
|
||||
)
|
||||
{
|
||||
this.CodePointRange = codePointRange;
|
||||
@@ -66,7 +66,7 @@ namespace System.Unicode
|
||||
this.ContributoryProperties = contributoryProperties;
|
||||
this.CoreProperties = coreProperties;
|
||||
this.RelatedCodePoints = relatedCodePoints;
|
||||
}
|
||||
}
|
||||
|
||||
public UnicodeRationalNumber? NumericValue { get { return NumericType != UnicodeNumericType.None ? numericValue : null as UnicodeRationalNumber?; } }
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace System.Unicode
|
||||
if (firstCodePoint < 0 || firstCodePoint > 0x10FFFF) throw new ArgumentOutOfRangeException("firstCodePoint");
|
||||
if (lastCodePoint < firstCodePoint || lastCodePoint > 0x10FFFF) throw new ArgumentOutOfRangeException("lastCodePoint");
|
||||
|
||||
FirstCodePoint = firstCodePoint;
|
||||
FirstCodePoint = firstCodePoint;
|
||||
LastCodePoint = lastCodePoint;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace System.Unicode
|
||||
{
|
||||
start = int.Parse(s.Substring(0, rangeSeparatorOffset), NumberStyles.HexNumber);
|
||||
end = int.Parse(s.Substring(rangeSeparatorOffset + 2), NumberStyles.HexNumber);
|
||||
}
|
||||
}
|
||||
|
||||
return new UnicodeCharacterRange(start, end);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace System.Unicode
|
||||
|
||||
var codePointRange = (fields & UcdFields.CodePointRange) != 0 ? new UnicodeCharacterRange(ReadCodePoint(reader), ReadCodePoint(reader)) : new UnicodeCharacterRange(ReadCodePoint(reader));
|
||||
|
||||
string name = (fields & UcdFields.Name) != 0 ? reader.ReadString() : null;
|
||||
string name = (fields & UcdFields.Name) != 0 ? reader.ReadString() : null;
|
||||
var category = (fields & UcdFields.Category) != 0 ? (UnicodeCategory)reader.ReadByte() : UnicodeCategory.OtherNotAssigned;
|
||||
var canonicalCombiningClass = (fields & UcdFields.CanonicalCombiningClass) != 0 ? (CanonicalCombiningClass)reader.ReadByte() : CanonicalCombiningClass.NotReordered;
|
||||
var bidirectionalClass = (fields & UcdFields.BidirectionalClass) != 0 ? (BidirectionalClass)reader.ReadByte() : 0;
|
||||
@@ -109,9 +109,9 @@ namespace System.Unicode
|
||||
simpleTitleCaseMapping,
|
||||
contributoryProperties,
|
||||
coreProperties,
|
||||
null
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static UnihanCharacterData ReadUnihanCharacterDataEntry(BinaryReader reader)
|
||||
{
|
||||
@@ -183,7 +183,7 @@ namespace System.Unicode
|
||||
else
|
||||
{
|
||||
return 0x40A0 + (((((b & 0x1F) << 8) | reader.ReadByte()) << 8) | reader.ReadByte());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Version UnicodeVersion { get { return unicodeVersion; } }
|
||||
@@ -255,7 +255,7 @@ namespace System.Unicode
|
||||
int i = FindBlockIndex(codePoint);
|
||||
|
||||
return i >= 0 ? blocks[i].Name : null;
|
||||
}
|
||||
}
|
||||
|
||||
public static UnicodeCharInfo GetCharInfo(int codePoint)
|
||||
{
|
||||
@@ -267,25 +267,25 @@ namespace System.Unicode
|
||||
var charInfo = FindUnicodeCodePoint(codePoint);
|
||||
|
||||
return charInfo != null ? charInfo.Category : UnicodeCategory.OtherNotAssigned;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetDisplayText(UnicodeCharInfo charInfo)
|
||||
{
|
||||
if (charInfo.CodePoint <= 0x0020) return ((char)(0x2400 + charInfo.CodePoint)).ToString();
|
||||
else if (charInfo.Category == UnicodeCategory.NonSpacingMark) return "\u25CC" + char.ConvertFromUtf32(charInfo.CodePoint);
|
||||
else return char.ConvertFromUtf32(charInfo.CodePoint);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetDisplayText(int codePoint)
|
||||
{
|
||||
if (codePoint <= 0x0020) return ((char)(0x2400 + codePoint)).ToString();
|
||||
else if (GetCategory(codePoint) == UnicodeCategory.NonSpacingMark) return "\u25CC" + char.ConvertFromUtf32(codePoint);
|
||||
else return char.ConvertFromUtf32(codePoint);
|
||||
}
|
||||
}
|
||||
|
||||
public static UnicodeBlock[] GetBlocks()
|
||||
{
|
||||
return (UnicodeBlock[])blocks.Clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,10 +66,10 @@ namespace System.Unicode
|
||||
if (codePoint < 0x2F800) return codePoint - 0x19400;
|
||||
else if (codePoint < 0x30000) return codePoint - 0x10000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new ArgumentOutOfRangeException("codePoint");
|
||||
}
|
||||
}
|
||||
|
||||
internal static int UnpackCodePoint(int packedCodePoint)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user