diff --git a/source/icu.net.sln.DotSettings b/source/icu.net.sln.DotSettings index 04eedcf6..f9b136d4 100644 --- a/source/icu.net.sln.DotSettings +++ b/source/icu.net.sln.DotSettings @@ -1,2 +1,31 @@  - True \ No newline at end of file + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True \ No newline at end of file diff --git a/source/icu.net/NativeMethods/NativeMethods.cs b/source/icu.net/NativeMethods/NativeMethods.cs index d0c4e0b4..f4b23b08 100644 --- a/source/icu.net/NativeMethods/NativeMethods.cs +++ b/source/icu.net/NativeMethods/NativeMethods.cs @@ -1,15 +1,20 @@ // Copyright (c) 2013-2017 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) + using System; using System.ComponentModel; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; +// ReSharper disable once CheckNamespace namespace Icu { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "IdentifierTypo")] internal static partial class NativeMethods { private static readonly object _lock = new object(); @@ -21,7 +26,7 @@ internal static partial class NativeMethods internal static bool Verbose { get; set; } - public static void SetMinMaxIcuVersions(int minVersion = Wrapper.MinSupportedIcuVersion, + internal static void SetMinMaxIcuVersions(int minVersion = Wrapper.MinSupportedIcuVersion, int maxVersion = Wrapper.MaxSupportedIcuVersion) { Trace.WriteLineIf(Verbose, $"Setting min/max ICU versions to {minVersion} and {maxVersion}"); @@ -104,6 +109,7 @@ private static string dlerror() private static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName); [Flags] + [SuppressMessage("ReSharper", "UnusedMember.Local")] private enum LoadLibraryFlags : uint { NONE = 0x00000000, @@ -134,6 +140,7 @@ private static IntPtr IcuCommonLibHandle get { if (_IcuCommonLibHandle == IntPtr.Zero) + // ReSharper disable once StringLiteralTypo _IcuCommonLibHandle = LoadIcuLibrary("icuuc"); return _IcuCommonLibHandle; } @@ -298,7 +305,7 @@ private static IntPtr GetIcuLibHandle(string basename, int icuVersion) IntPtr handle; string libPath; - var lastError = 0; + int lastError; if (IsWindows) { @@ -337,7 +344,7 @@ private static IntPtr GetIcuLibHandle(string basename, int icuVersion) } } - public static void Cleanup() + internal static void Cleanup() { Trace.WriteLineIf(Verbose, "icu.net: Cleanup"); lock (_lock) @@ -438,13 +445,13 @@ private static T GetMethod(IntPtr handle, string methodName, bool missingInMi #endregion - public static string GetAnsiString(Func> lambda, + internal static string GetAnsiString(Func> lambda, int initialLength = 255) { return GetString(lambda, false, initialLength); } - public static string GetUnicodeString(Func> lambda, + internal static string GetUnicodeString(Func> lambda, int initialLength = 255) { return GetString(lambda, true, initialLength); @@ -492,7 +499,7 @@ private static string GetString(Func> lambda, /// This function does cleanup of the enumerator object /// /// Enumeration to be closed - public static void uenum_close(IntPtr en) + internal static void uenum_close(IntPtr en) { if (Methods.uenum_close == null) Methods.uenum_close = GetMethod(IcuCommonLibHandle, "uenum_close"); @@ -505,7 +512,7 @@ public static void uenum_close(IntPtr en) /// /// next element as string, or null after all elements haven been /// enumerated - public static IntPtr uenum_unext( + internal static IntPtr uenum_unext( SafeEnumeratorHandle en, out int resultLength, out ErrorCode status) @@ -515,7 +522,7 @@ public static IntPtr uenum_unext( return Methods.uenum_unext(en, out resultLength, out status); } - public enum LocaleType + internal enum LocaleType { /// /// This is locale the data actually comes from @@ -527,7 +534,7 @@ public enum LocaleType ValidLocale = 1, } - public enum CollationAttributeValue + internal enum CollationAttributeValue { Default = -1, //accepted by most attributes Primary = 0, // primary collation strength @@ -547,7 +554,7 @@ public enum CollationAttributeValue UpperFirst = 25 // Valid for CaseFirst - upper case sorts before lower case } - public enum CollationAttribute + internal enum CollationAttribute { FrenchCollation, AlternateHandling, @@ -561,13 +568,14 @@ public enum CollationAttribute AttributeCount } - public enum CollationResult + internal enum CollationResult { Equal = 0, Greater = 1, Less = -1 } + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class MethodsContainer { [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Unicode)] @@ -699,7 +707,7 @@ internal delegate int u_strToUpperDelegate(IntPtr dest, int destCapacity, string } /// get the name of an ICU code point - public static void u_init(out ErrorCode errorCode) + internal static void u_init(out ErrorCode errorCode) { IsInitialized = true; if (Methods.u_init == null) @@ -708,7 +716,8 @@ public static void u_init(out ErrorCode errorCode) } /// Clean up the ICU files that could be locked - public static void u_cleanup() + // ReSharper disable once MemberCanBePrivate.Global + internal static void u_cleanup() { if (Methods.u_cleanup == null) Methods.u_cleanup = GetMethod(IcuCommonLibHandle, "u_cleanup"); @@ -717,7 +726,7 @@ public static void u_cleanup() } /// Return the ICU data directory - public static IntPtr u_getDataDirectory() + internal static IntPtr u_getDataDirectory() { if (Methods.u_getDataDirectory == null) Methods.u_getDataDirectory = GetMethod(IcuCommonLibHandle, "u_getDataDirectory"); @@ -725,7 +734,7 @@ public static IntPtr u_getDataDirectory() } /// Set the ICU data directory - public static void u_setDataDirectory( + internal static void u_setDataDirectory( [MarshalAs(UnmanagedType.LPStr)]string directory) { if (Methods.u_setDataDirectory == null) @@ -734,7 +743,7 @@ public static void u_setDataDirectory( } /// get the name of an ICU code point - public static int u_charName( + internal static int u_charName( int code, Character.UCharNameChoice nameChoice, IntPtr buffer, @@ -747,7 +756,7 @@ public static int u_charName( } /// Returns the bidirectional category value for the code point, which is used in the Unicode bidirectional algorithm - public static int u_charDirection(int characterCode) + internal static int u_charDirection(int characterCode) { if (Methods.u_charDirection == null) Methods.u_charDirection = GetMethod(IcuCommonLibHandle, "u_charDirection"); @@ -759,7 +768,7 @@ public static int u_charDirection(int characterCode) /// get the numeric value for the Unicode digit /// /// ------------------------------------------------------------------------------------ - public static int u_digit( + internal static int u_digit( int characterCode, byte radix) { @@ -783,7 +792,7 @@ public static int u_digit( /// /// Consider adding a specific implementation for each property! /// ------------------------------------------------------------------------------------ - public static int u_getIntPropertyValue( + internal static int u_getIntPropertyValue( int codePoint, Character.UProperty which) { @@ -792,7 +801,7 @@ public static int u_getIntPropertyValue( return Methods.u_getIntPropertyValue(codePoint, which); } - public static void u_getUnicodeVersion(out VersionInfo versionArray) + internal static void u_getUnicodeVersion(out VersionInfo versionArray) { if (Methods.u_getUnicodeVersion == null) Methods.u_getUnicodeVersion = GetMethod(IcuCommonLibHandle, "u_getUnicodeVersion"); @@ -805,7 +814,7 @@ public static void u_getUnicodeVersion(out VersionInfo versionArray) /// /// Stores the version information for ICU. /// ------------------------------------------------------------------------------------ - public static void u_getVersion(out VersionInfo versionArray) + internal static void u_getVersion(out VersionInfo versionArray) { if (Methods.u_getVersion == null) Methods.u_getVersion = GetMethod(IcuCommonLibHandle, "u_getVersion"); @@ -817,7 +826,7 @@ public static void u_getVersion(out VersionInfo versionArray) /// /// /// - public static sbyte u_charType(int characterCode) + internal static sbyte u_charType(int characterCode) { if (Methods.u_charType == null) Methods.u_charType = GetMethod(IcuCommonLibHandle, "u_charType"); @@ -844,7 +853,7 @@ public static sbyte u_charType(int characterCode) ///Code point to get the numeric value for ///Numeric value of c, or U_NO_NUMERIC_VALUE if none is defined. /// ------------------------------------------------------------------------------------ - public static double u_getNumericValue( + internal static double u_getNumericValue( int characterCode) { if (Methods.u_getNumericValue == null) @@ -858,7 +867,7 @@ public static double u_getNumericValue( /// /// the code point to be tested /// ------------------------------------------------------------------------------------ - public static bool u_ispunct( + internal static bool u_ispunct( int characterCode) { if (Methods.u_ispunct == null) @@ -885,7 +894,7 @@ public static bool u_ispunct( /// the code point to be tested /// true if the character has the Bidi_Mirrored property /// ------------------------------------------------------------------------------------ - public static bool u_isMirrored( + internal static bool u_isMirrored( int characterCode) { if (Methods.u_isMirrored == null) @@ -907,7 +916,7 @@ public static bool u_isMirrored( /// /// the code point to be tested /// ------------------------------------------------------------------------------------ - public static bool u_iscntrl( + internal static bool u_iscntrl( int characterCode) { if (Methods.u_iscntrl == null) @@ -932,7 +941,7 @@ public static bool u_iscntrl( /// /// the code point to be tested /// ------------------------------------------------------------------------------------ - public static bool u_isspace( + internal static bool u_isspace( int characterCode) { if (Methods.u_isspace == null) @@ -941,15 +950,15 @@ public static bool u_isspace( } /// Map character to its lowercase equivalent according to UnicodeData.txt - public static int u_tolower(int characterCode) + internal static int u_tolower(int characterCode) { if (Methods.u_tolower == null) Methods.u_tolower = GetMethod(IcuCommonLibHandle, "u_tolower"); return Methods.u_tolower(characterCode); } - /// Map character to its titlecase equivalent according to UnicodeData.txt - public static int u_totitle(int characterCode) + /// Map character to its title-case equivalent according to UnicodeData.txt + internal static int u_totitle(int characterCode) { if (Methods.u_totitle == null) Methods.u_totitle = GetMethod(IcuCommonLibHandle, "u_totitle"); @@ -957,7 +966,7 @@ public static int u_totitle(int characterCode) } /// Map character to its uppercase equivalent according to UnicodeData.txt - public static int u_toupper(int characterCode) + internal static int u_toupper(int characterCode) { if (Methods.u_toupper == null) Methods.u_toupper = GetMethod(IcuCommonLibHandle, "u_toupper"); @@ -965,7 +974,7 @@ public static int u_toupper(int characterCode) } /// Return the lower case equivalent of the string. - public static int u_strToLower(IntPtr dest, int destCapacity, string src, + internal static int u_strToLower(IntPtr dest, int destCapacity, string src, int srcLength, [MarshalAs(UnmanagedType.LPStr)] string locale, out ErrorCode errorCode) { if (Methods.u_strToLower == null) @@ -973,7 +982,7 @@ public static int u_strToLower(IntPtr dest, int destCapacity, string src, return Methods.u_strToLower(dest, destCapacity, src, srcLength, locale, out errorCode); } - public static int u_strToTitle(IntPtr dest, int destCapacity, string src, + internal static int u_strToTitle(IntPtr dest, int destCapacity, string src, int srcLength, [MarshalAs(UnmanagedType.LPStr)] string locale, out ErrorCode errorCode) { @@ -982,7 +991,8 @@ public static int u_strToTitle(IntPtr dest, int destCapacity, string src, } /// Return the title case equivalent of the string. - public static int u_strToTitle(IntPtr dest, int destCapacity, string src, + // ReSharper disable once MemberCanBePrivate.Global + internal static int u_strToTitle(IntPtr dest, int destCapacity, string src, int srcLength, IntPtr titleIter, [MarshalAs(UnmanagedType.LPStr)] string locale, out ErrorCode errorCode) { @@ -993,7 +1003,7 @@ public static int u_strToTitle(IntPtr dest, int destCapacity, string src, } /// Return the upper case equivalent of the string. - public static int u_strToUpper(IntPtr dest, int destCapacity, string src, + internal static int u_strToUpper(IntPtr dest, int destCapacity, string src, int srcLength, [MarshalAs(UnmanagedType.LPStr)] string locale, out ErrorCode errorCode) { if (Methods.u_strToUpper == null) diff --git a/source/icu.net/NativeMethods/NativeMethodsHelper.cs b/source/icu.net/NativeMethods/NativeMethodsHelper.cs index 88657167..02706c8c 100644 --- a/source/icu.net/NativeMethods/NativeMethodsHelper.cs +++ b/source/icu.net/NativeMethods/NativeMethodsHelper.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013-2018 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) + using System; using System.Diagnostics; -using System.Globalization; using System.IO; using System.Linq; using System.Text.RegularExpressions; - #if !NET40 using Microsoft.Extensions.DependencyModel; #endif +// ReSharper disable once CheckNamespace namespace Icu { /// @@ -19,6 +19,8 @@ namespace Icu /// internal static class NativeMethodsHelper { + // ReSharper disable once InconsistentNaming + // ReSharper disable once UnusedMember.Local private const string Icu4c = nameof(Icu4c); private const string IcuRegexLinux = @"libicu\w+.so\.(?[0-9]{2,})(\.[0-9])*"; private const string IcuRegexWindows = @"icu\w+(?[0-9]{2,})(\.[0-9])*\.dll"; @@ -27,6 +29,7 @@ internal static class NativeMethodsHelper private static readonly string IcuSearchPattern = Platform.OperatingSystem == OperatingSystemType.Windows ? "icu*.dll" : "libicu*.so.*"; private static readonly string NugetPackageDirectory = GetDefaultPackageDirectory(Platform.OperatingSystem); + // ReSharper disable once InconsistentNaming private static IcuVersionInfo IcuVersion; /// @@ -177,6 +180,7 @@ private static bool TryGetPathFromAssemblyDirectory() // If we found the icu*.dll files under {directoryOfAssembly}/runtimes/{rid}/native/, // they should ALL be there... or else something went wrong in publishing the app or // restoring the files, or packaging the NuGet package. + // ReSharper disable once ExpressionIsAlwaysNull return TrySetIcuPathFromDirectory(assemblyDirectory, nativeAssetPaths); } @@ -233,11 +237,12 @@ private static bool TrySetIcuPathFromDirectory(DirectoryInfo baseDirectory, stri var assetPaths = nativeAssetPaths .Select(asset => new FileInfo(Path.Combine(baseDirectory.FullName, asset))); - var doAllAssetsExistInDirectory = assetPaths.All(x => x.Exists); + var fileInfos = assetPaths.ToList(); + var doAllAssetsExistInDirectory = fileInfos.All(x => x.Exists); if (doAllAssetsExistInDirectory) { - var directories = assetPaths.Select(file => file.Directory).ToArray(); + var directories = fileInfos.Select(file => file.Directory).ToArray(); if (directories.Length > 1) Trace.TraceWarning($"There are multiple directories for these runtime assets: {string.Join(Path.PathSeparator.ToString(), directories.Select(x => x.FullName))}. There should only be one... Using first directory."); @@ -332,20 +337,8 @@ private static string GetDefaultPackageDirectory(OperatingSystemType osPlatform) return packageDirectory; } - string basePath; - if (osPlatform == OperatingSystemType.Windows) - { - basePath = Environment.GetEnvironmentVariable("USERPROFILE"); - } - else - { - basePath = Environment.GetEnvironmentVariable("HOME"); - } - if (string.IsNullOrEmpty(basePath)) - { - return null; - } - return Path.Combine(basePath, ".nuget", "packages"); + var basePath = Environment.GetEnvironmentVariable(osPlatform == OperatingSystemType.Windows ? "USERPROFILE" : "HOME"); + return string.IsNullOrEmpty(basePath) ? null : Path.Combine(basePath, ".nuget", "packages"); } } } diff --git a/source/icu.net/NativeMethods/NativeMethods_BiDi.cs b/source/icu.net/NativeMethods/NativeMethods_BiDi.cs index e06c765e..c423aee3 100644 --- a/source/icu.net/NativeMethods/NativeMethods_BiDi.cs +++ b/source/icu.net/NativeMethods/NativeMethods_BiDi.cs @@ -2,12 +2,16 @@ // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +// ReSharper disable once CheckNamespace namespace Icu { internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class BiDiMethodsContainer { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] @@ -148,6 +152,7 @@ private class BiDiMethodsContainer internal ubidi_getBaseDirectionDelegate ubidi_getBaseDirection; } + // ReSharper disable once InconsistentNaming private static BiDiMethodsContainer BiDiMethods = new BiDiMethodsContainer(); /// @@ -275,6 +280,7 @@ public static bool ubidi_isOrderParagraphsLTR(IntPtr bidi) /// /// The BiDi object /// True to use level 0 for block separators + // ReSharper disable once InconsistentNaming public static void ubidi_orderParagraphsLTR(IntPtr bidi, bool orderParagraphsLTR) { if (BiDiMethods.ubidi_orderParagraphsLTR == null) diff --git a/source/icu.net/NativeMethods/NativeMethods_BreakIterator.cs b/source/icu.net/NativeMethods/NativeMethods_BreakIterator.cs index 753f23d8..3dc0818c 100644 --- a/source/icu.net/NativeMethods/NativeMethods_BreakIterator.cs +++ b/source/icu.net/NativeMethods/NativeMethods_BreakIterator.cs @@ -2,12 +2,16 @@ // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +// ReSharper disable once CheckNamespace namespace Icu { internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class BreakIteratorMethodsContainer { [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Unicode)] @@ -66,6 +70,7 @@ internal delegate void ubrk_setTextDelegate(IntPtr bi, string text, int textLeng internal ubrk_setTextDelegate ubrk_setText; } + // ReSharper disable once InconsistentNaming private static BreakIteratorMethodsContainer BreakIteratorMethods = new BreakIteratorMethodsContainer(); #region Break iterator @@ -95,7 +100,7 @@ public static IntPtr ubrk_open(BreakIterator.UBreakIteratorType type, /// The length of the rules. /// The text. /// Length of the text. - /// Receives position and context information for any syntax errors detected while parsing the rules. + /// Receives position and context information for any syntax errors detected while parsing the rules. /// The error code. /// public static IntPtr ubrk_openRules( @@ -193,7 +198,7 @@ public static int ubrk_getRuleStatus(IntPtr bi) /// /// The break iterator. /// An array to be filled in with the status values. - /// The length of the supplied vector. A length of zero causes the function to return the number of status values, in the normal way, without attemtping to store any values. + /// The length of the supplied vector. A length of zero causes the function to return the number of status values, in the normal way, without attempting to store any values. /// Receives error codes. /// The number of rule status values from rules that determined the most recent boundary returned by the break iterator. public static int ubrk_getRuleStatusVec(IntPtr bi, diff --git a/source/icu.net/NativeMethods/NativeMethods_CodepageConversion.cs b/source/icu.net/NativeMethods/NativeMethods_CodepageConversion.cs index f519c8eb..566d2551 100644 --- a/source/icu.net/NativeMethods/NativeMethods_CodepageConversion.cs +++ b/source/icu.net/NativeMethods/NativeMethods_CodepageConversion.cs @@ -2,25 +2,30 @@ // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +// ReSharper disable once CheckNamespace namespace Icu { internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class CodepageConversionMethodsContainer { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate SafeEnumeratorHandle ucnv_openAllNamesDelegate(out ErrorCode err); - + [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate IntPtr ucnv_getStandardNameDelegate(string name, string standard, + internal delegate IntPtr ucnv_getStandardNameDelegate(string name, string standard, out ErrorCode errorCode); internal ucnv_openAllNamesDelegate ucnv_openAllNames; internal ucnv_getStandardNameDelegate ucnv_getStandardName; } + // ReSharper disable once InconsistentNaming private static CodepageConversionMethodsContainer CodepageConversionMethods = new CodepageConversionMethodsContainer(); public static SafeEnumeratorHandle ucnv_openAllNames(out ErrorCode err) diff --git a/source/icu.net/NativeMethods/NativeMethods_Locales.cs b/source/icu.net/NativeMethods/NativeMethods_Locales.cs index 0b18dfce..84607cea 100644 --- a/source/icu.net/NativeMethods/NativeMethods_Locales.cs +++ b/source/icu.net/NativeMethods/NativeMethods_Locales.cs @@ -2,16 +2,20 @@ // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +// ReSharper disable once CheckNamespace namespace Icu { internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class LocalesMethodsContainer { [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getLCIDDelegate([MarshalAs(UnmanagedType.LPStr)]string localeID); + internal delegate int uloc_getLCIDDelegate([MarshalAs(UnmanagedType.LPStr)]string localeId); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal delegate int uloc_getLocaleForLCIDDelegate(int lcid, IntPtr locale, int localeCapacity, out ErrorCode err); @@ -31,51 +35,51 @@ internal delegate IntPtr uloc_getISO3LanguageDelegate( internal delegate IntPtr uloc_getAvailableDelegate(int n); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getLanguageDelegate(string localeID, IntPtr language, + internal delegate int uloc_getLanguageDelegate(string localeId, IntPtr language, int languageCapacity, out ErrorCode err); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getScriptDelegate(string localeID, IntPtr script, + internal delegate int uloc_getScriptDelegate(string localeId, IntPtr script, int scriptCapacity, out ErrorCode err); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getCountryDelegate(string localeID, IntPtr country, + internal delegate int uloc_getCountryDelegate(string localeId, IntPtr country, int countryCapacity, out ErrorCode err); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getVariantDelegate(string localeID, IntPtr variant, + internal delegate int uloc_getVariantDelegate(string localeId, IntPtr variant, int variantCapacity, out ErrorCode err); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getDisplayNameDelegate(string localeID, string inLocaleID, + internal delegate int uloc_getDisplayNameDelegate(string localeId, string inLocaleID, IntPtr result, int maxResultSize, out ErrorCode err); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getDisplayLanguageDelegate(string localeID, string displayLocaleID, + internal delegate int uloc_getDisplayLanguageDelegate(string localeId, string displayLocaleID, IntPtr result, int maxResultSize, out ErrorCode err); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getDisplayScriptDelegate(string localeID, string displayLocaleID, + internal delegate int uloc_getDisplayScriptDelegate(string localeId, string displayLocaleID, IntPtr result, int maxResultSize, out ErrorCode err); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getDisplayCountryDelegate(string localeID, string displayLocaleID, + internal delegate int uloc_getDisplayCountryDelegate(string localeId, string displayLocaleID, IntPtr result, int maxResultSize, out ErrorCode err); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getDisplayVariantDelegate(string localeID, string displayLocaleID, + internal delegate int uloc_getDisplayVariantDelegate(string localeId, string displayLocaleID, IntPtr result, int maxResultSize, out ErrorCode err); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getNameDelegate(string localeID, IntPtr name, + internal delegate int uloc_getNameDelegate(string localeId, IntPtr name, int nameCapacity, out ErrorCode err); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_getBaseNameDelegate(string localeID, IntPtr name, + internal delegate int uloc_getBaseNameDelegate(string localeId, IntPtr name, int nameCapacity, out ErrorCode err); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] - internal delegate int uloc_canonicalizeDelegate(string localeID, IntPtr name, + internal delegate int uloc_canonicalizeDelegate(string localeId, IntPtr name, int nameCapacity, out ErrorCode err); internal uloc_countAvailableDelegate uloc_countAvailable; @@ -98,17 +102,18 @@ internal delegate int uloc_canonicalizeDelegate(string localeID, IntPtr name, internal uloc_canonicalizeDelegate uloc_canonicalize; } + // ReSharper disable once InconsistentNaming private static LocalesMethodsContainer LocalesMethods = new LocalesMethodsContainer(); /// Get the ICU LCID for a locale - public static int uloc_getLCID([MarshalAs(UnmanagedType.LPStr)] string localeID) + public static int uloc_getLCID([MarshalAs(UnmanagedType.LPStr)] string localeId) { if (LocalesMethods.uloc_getLCID == null) LocalesMethods.uloc_getLCID = GetMethod(IcuCommonLibHandle, "uloc_getLCID"); - return LocalesMethods.uloc_getLCID(localeID); + return LocalesMethods.uloc_getLCID(localeId); } - /// Gets the ICU locale ID for the specified Win32 LCID value. + /// Gets the ICU locale ID for the specified Win32 LCID value. public static int uloc_getLocaleForLCID(int lcid, IntPtr locale, int localeCapacity, out ErrorCode err) { err = ErrorCode.NoErrors; @@ -138,7 +143,7 @@ public static IntPtr uloc_getISO3Language( /// /// Gets the size of the all available locale list. /// - /// the size of the locale list + /// the size of the locale list public static int uloc_countAvailable() { if (LocalesMethods.uloc_countAvailable == null) @@ -164,163 +169,165 @@ public static IntPtr uloc_getAvailable(int n) /// /// Gets the language code for the specified locale. /// - /// the locale to get the language code with - /// the language code for localeID + /// the locale to get the language code with + /// the language code for localeId /// the size of the language buffer to store the language - /// code with + /// code with /// error information if retrieving the language code failed /// the actual buffer size needed for the language code. If it's greater /// than languageCapacity, the returned language code will be truncated - public static int uloc_getLanguage(string localeID, IntPtr language, + public static int uloc_getLanguage(string localeId, IntPtr language, int languageCapacity, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_getLanguage == null) LocalesMethods.uloc_getLanguage = GetMethod(IcuCommonLibHandle, "uloc_getLanguage"); - return LocalesMethods.uloc_getLanguage(localeID, language, languageCapacity, out err); + return LocalesMethods.uloc_getLanguage(localeId, language, languageCapacity, out err); } /// /// Gets the script code for the specified locale. /// - /// the locale to get the script code with - /// the script code for localeID + /// the locale to get the script code with + /// the script code for localeId /// the size of the script buffer to store the script - /// code with + /// code with /// error information if retrieving the script code failed /// the actual buffer size needed for the script code. If it's greater /// than scriptCapacity, the returned script code will be truncated - public static int uloc_getScript(string localeID, IntPtr script, + public static int uloc_getScript(string localeId, IntPtr script, int scriptCapacity, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_getScript == null) LocalesMethods.uloc_getScript = GetMethod(IcuCommonLibHandle, "uloc_getScript"); - return LocalesMethods.uloc_getScript(localeID, script, scriptCapacity, out err); + return LocalesMethods.uloc_getScript(localeId, script, scriptCapacity, out err); } /// /// Gets the country code for the specified locale. /// - /// the locale to get the country code with - /// the country code for localeID + /// the locale to get the country code with + /// the country code for localeId /// the size of the country buffer to store the country - /// code with + /// code with /// error information if retrieving the country code failed /// the actual buffer size needed for the country code. If it's greater /// than countryCapacity, the returned country code will be truncated - public static int uloc_getCountry(string localeID, IntPtr country, + public static int uloc_getCountry(string localeId, IntPtr country, int countryCapacity, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_getCountry == null) LocalesMethods.uloc_getCountry = GetMethod(IcuCommonLibHandle, "uloc_getCountry"); - return LocalesMethods.uloc_getCountry(localeID, country, countryCapacity, out err); + return LocalesMethods.uloc_getCountry(localeId, country, countryCapacity, out err); } /// /// Gets the variant code for the specified locale. /// - /// the locale to get the variant code with - /// the variant code for localeID + /// the locale to get the variant code with + /// the variant code for localeId /// the size of the variant buffer to store the variant - /// code with + /// code with /// error information if retrieving the variant code failed /// the actual buffer size needed for the variant code. If it's greater /// than variantCapacity, the returned variant code will be truncated - public static int uloc_getVariant(string localeID, IntPtr variant, + public static int uloc_getVariant(string localeId, IntPtr variant, int variantCapacity, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_getVariant == null) LocalesMethods.uloc_getVariant = GetMethod(IcuCommonLibHandle, "uloc_getVariant"); - return LocalesMethods.uloc_getVariant(localeID, variant, variantCapacity, out err); + return LocalesMethods.uloc_getVariant(localeId, variant, variantCapacity, out err); } + // ReSharper disable CommentTypo /// /// Gets the full name suitable for display for the specified locale. /// - /// the locale to get the displayable name with - /// Specifies the locale to be used to display the name. In + /// the locale to get the displayable name with + /// Specifies the locale to be used to display the name. In /// other words, if the locale's language code is "en", passing Locale::getFrench() /// for inLocale would result in "Anglais", while passing Locale::getGerman() for - /// inLocale would result in "Englisch". - /// the displayable name for localeID + /// inLocale would result in "Englisch". + /// the displayable name for localeId /// the size of the name buffer to store the displayable /// full name with /// error information if retrieving the displayable name failed /// the actual buffer size needed for the displayable name. If it's greater /// than variantCapacity, the returned displayable name will be truncated. - public static int uloc_getDisplayName(string localeID, string inLocaleID, + // ReSharper restore CommentTypo + public static int uloc_getDisplayName(string localeId, string inLocaleId, IntPtr result, int maxResultSize, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_getDisplayName == null) LocalesMethods.uloc_getDisplayName = GetMethod(IcuCommonLibHandle, "uloc_getDisplayName"); - return LocalesMethods.uloc_getDisplayName(localeID, inLocaleID, result, maxResultSize, out err); + return LocalesMethods.uloc_getDisplayName(localeId, inLocaleId, result, maxResultSize, out err); } - public static int uloc_getDisplayLanguage(string localeID, string displayLocaleID, + public static int uloc_getDisplayLanguage(string localeId, string displayLocaleId, IntPtr result, int maxResultSize, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_getDisplayLanguage == null) LocalesMethods.uloc_getDisplayLanguage = GetMethod(IcuCommonLibHandle, "uloc_getDisplayLanguage"); - return LocalesMethods.uloc_getDisplayLanguage(localeID, displayLocaleID, result, maxResultSize, out err); + return LocalesMethods.uloc_getDisplayLanguage(localeId, displayLocaleId, result, maxResultSize, out err); } - public static int uloc_getDisplayScript(string localeID, string displayLocaleID, + public static int uloc_getDisplayScript(string localeId, string displayLocaleId, IntPtr result, int maxResultSize, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_getDisplayScript == null) LocalesMethods.uloc_getDisplayScript = GetMethod(IcuCommonLibHandle, "uloc_getDisplayScript"); - return LocalesMethods.uloc_getDisplayScript(localeID, displayLocaleID, result, maxResultSize, out err); + return LocalesMethods.uloc_getDisplayScript(localeId, displayLocaleId, result, maxResultSize, out err); } - public static int uloc_getDisplayCountry(string localeID, string displayLocaleID, + public static int uloc_getDisplayCountry(string localeId, string displayLocaleId, IntPtr result, int maxResultSize, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_getDisplayCountry == null) LocalesMethods.uloc_getDisplayCountry = GetMethod(IcuCommonLibHandle, "uloc_getDisplayCountry"); - return LocalesMethods.uloc_getDisplayCountry(localeID, displayLocaleID, result, maxResultSize, out err); + return LocalesMethods.uloc_getDisplayCountry(localeId, displayLocaleId, result, maxResultSize, out err); } - public static int uloc_getDisplayVariant(string localeID, string displayLocaleID, + public static int uloc_getDisplayVariant(string localeId, string displayLocaleId, IntPtr result, int maxResultSize, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_getDisplayVariant == null) LocalesMethods.uloc_getDisplayVariant = GetMethod(IcuCommonLibHandle, "uloc_getDisplayVariant"); - return LocalesMethods.uloc_getDisplayVariant(localeID, displayLocaleID, result, maxResultSize, out err); + return LocalesMethods.uloc_getDisplayVariant(localeId, displayLocaleId, result, maxResultSize, out err); } - public static int uloc_getName(string localeID, IntPtr name, + public static int uloc_getName(string localeId, IntPtr name, int nameCapacity, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_getName == null) LocalesMethods.uloc_getName = GetMethod(IcuCommonLibHandle, "uloc_getName"); - return LocalesMethods.uloc_getName(localeID, name, nameCapacity, out err); + return LocalesMethods.uloc_getName(localeId, name, nameCapacity, out err); } - public static int uloc_getBaseName(string localeID, IntPtr name, + public static int uloc_getBaseName(string localeId, IntPtr name, int nameCapacity, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_getBaseName == null) LocalesMethods.uloc_getBaseName = GetMethod(IcuCommonLibHandle, "uloc_getBaseName"); - return LocalesMethods.uloc_getBaseName(localeID, name, nameCapacity, out err); + return LocalesMethods.uloc_getBaseName(localeId, name, nameCapacity, out err); } - public static int uloc_canonicalize(string localeID, IntPtr name, + public static int uloc_canonicalize(string localeId, IntPtr name, int nameCapacity, out ErrorCode err) { err = ErrorCode.NoErrors; if (LocalesMethods.uloc_canonicalize == null) LocalesMethods.uloc_canonicalize = GetMethod(IcuCommonLibHandle, "uloc_canonicalize"); - var res = LocalesMethods.uloc_canonicalize(localeID, name, nameCapacity, out err); + var res = LocalesMethods.uloc_canonicalize(localeId, name, nameCapacity, out err); return res; } } diff --git a/source/icu.net/NativeMethods/NativeMethods_MessageFormat.cs b/source/icu.net/NativeMethods/NativeMethods_MessageFormat.cs index 3f95cbb9..429dd319 100644 --- a/source/icu.net/NativeMethods/NativeMethods_MessageFormat.cs +++ b/source/icu.net/NativeMethods/NativeMethods_MessageFormat.cs @@ -2,14 +2,17 @@ // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using System.Text; +// ReSharper disable once CheckNamespace namespace Icu { /// internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class MessageFormatMethodsContainer { /// @@ -37,6 +40,7 @@ internal delegate int umsg_toPatternDelegate(IntPtr format, IntPtr result, } + // ReSharper disable once InconsistentNaming private static MessageFormatMethodsContainer MessageFormatMethods = new MessageFormatMethodsContainer(); /// diff --git a/source/icu.net/NativeMethods/NativeMethods_Normalize.cs b/source/icu.net/NativeMethods/NativeMethods_Normalize.cs index a36b3b46..07bdaf0c 100644 --- a/source/icu.net/NativeMethods/NativeMethods_Normalize.cs +++ b/source/icu.net/NativeMethods/NativeMethods_Normalize.cs @@ -2,13 +2,17 @@ // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using Icu.Normalization; +// ReSharper disable once CheckNamespace namespace Icu { internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class NormalizeMethodsContainer { [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Unicode)] @@ -66,6 +70,7 @@ internal delegate int unorm2_getRawDecompositionDelegate(IntPtr norm2, int c, internal unorm2_getCombiningClassDelegate unorm2_getCombiningClass; } + // ReSharper disable once InconsistentNaming private static NormalizeMethodsContainer NormalizeMethods = new NormalizeMethodsContainer(); #region normalize @@ -209,7 +214,7 @@ public static int unorm2_getRawDecomposition(IntPtr norm2, int c, IntPtr decompo out errorCode); } - /// Gets the combining class of c. + /// Gets the combining class of c. public static int unorm2_getCombiningClass(IntPtr norm2, int c) { if (NormalizeMethods.unorm2_getCombiningClass == null) diff --git a/source/icu.net/NativeMethods/NativeMethods_Regex.cs b/source/icu.net/NativeMethods/NativeMethods_Regex.cs index 732f7536..8d4ffe5a 100644 --- a/source/icu.net/NativeMethods/NativeMethods_Regex.cs +++ b/source/icu.net/NativeMethods/NativeMethods_Regex.cs @@ -2,12 +2,16 @@ // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +// ReSharper disable once CheckNamespace namespace Icu { internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class RegexMethodsContainer { [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Unicode)] @@ -33,6 +37,7 @@ internal delegate void uregex_setTextDelegate(IntPtr regexp, internal uregex_closeDelegate uregex_close; } + // ReSharper disable once InconsistentNaming private static RegexMethodsContainer RegexMethods = new RegexMethodsContainer(); /// diff --git a/source/icu.net/NativeMethods/NativeMethods_ResourceBundle.cs b/source/icu.net/NativeMethods/NativeMethods_ResourceBundle.cs index 18ac8c8b..c6a1c4e8 100644 --- a/source/icu.net/NativeMethods/NativeMethods_ResourceBundle.cs +++ b/source/icu.net/NativeMethods/NativeMethods_ResourceBundle.cs @@ -2,12 +2,16 @@ // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +// ReSharper disable once CheckNamespace namespace Icu { internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class ResourceBundleMethodsContainer { [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] @@ -64,6 +68,7 @@ internal delegate IntPtr ures_getNextResourceDelegate(IntPtr resourceBundle, internal ures_getNextResourceDelegate ures_getNextResource; } + // ReSharper disable once InconsistentNaming private static ResourceBundleMethodsContainer ResourceBundleMethods = new ResourceBundleMethodsContainer(); /// diff --git a/source/icu.net/NativeMethods/NativeMethods_TimeZone.cs b/source/icu.net/NativeMethods/NativeMethods_TimeZone.cs index 51421927..c05d285c 100644 --- a/source/icu.net/NativeMethods/NativeMethods_TimeZone.cs +++ b/source/icu.net/NativeMethods/NativeMethods_TimeZone.cs @@ -1,13 +1,14 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +// ReSharper disable once CheckNamespace namespace Icu { internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class TimeZoneMethodsContainer { [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Unicode)] @@ -57,13 +58,13 @@ internal delegate IntPtr ucal_getTZDataVersionDelegate( internal delegate int ucal_getWindowsTimeZoneIdDelegate( [MarshalAs(UnmanagedType.LPWStr)] string id, int len, - IntPtr winid, - int winidCapacity, + IntPtr winId, + int winIdCapacity, out ErrorCode status); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Unicode)] internal delegate int ucal_getTimeZoneIDForWindowsIdDelegate( - [MarshalAs(UnmanagedType.LPWStr)] string winid, + [MarshalAs(UnmanagedType.LPWStr)] string winId, int len, [MarshalAs(UnmanagedType.LPStr)] string region, IntPtr id, @@ -137,21 +138,21 @@ public static int ucal_getDefaultTimeZone( } public static void ucal_setDefaultTimeZone( - string zoneID, + string zoneId, out ErrorCode ec) { if (TimeZoneMethods.ucal_setDefaultTimeZone == null) TimeZoneMethods.ucal_setDefaultTimeZone = GetMethod(IcuI18NLibHandle, "ucal_setDefaultTimeZone"); - TimeZoneMethods.ucal_setDefaultTimeZone(zoneID, out ec); + TimeZoneMethods.ucal_setDefaultTimeZone(zoneId, out ec); } public static int ucal_getDSTSavings( - string zoneID, + string zoneId, out ErrorCode ec) { if (TimeZoneMethods.ucal_getDSTSavings == null) TimeZoneMethods.ucal_getDSTSavings = GetMethod(IcuI18NLibHandle, "ucal_getDSTSavings"); - return TimeZoneMethods.ucal_getDSTSavings(zoneID, out ec); + return TimeZoneMethods.ucal_getDSTSavings(zoneId, out ec); } public static IntPtr ucal_getTZDataVersion(out ErrorCode ec) @@ -163,17 +164,17 @@ public static IntPtr ucal_getTZDataVersion(out ErrorCode ec) public static int ucal_getWindowsTimeZoneId( string id, - IntPtr winid, - int winidCapacity, + IntPtr winId, + int winIdCapacity, out ErrorCode status) { if (TimeZoneMethods.ucal_getWindowsTimeZoneId == null) TimeZoneMethods.ucal_getWindowsTimeZoneId = GetMethod(IcuI18NLibHandle, "ucal_getWindowsTimeZoneID"); - return TimeZoneMethods.ucal_getWindowsTimeZoneId(id, id.Length, winid, winidCapacity, out status); + return TimeZoneMethods.ucal_getWindowsTimeZoneId(id, id.Length, winId, winIdCapacity, out status); } public static int ucal_getTimeZoneIDForWindowsId( - string winid, + string winId, string region, IntPtr id, int idCapacity, @@ -181,7 +182,7 @@ public static int ucal_getTimeZoneIDForWindowsId( { if (TimeZoneMethods.ucal_getTimeZoneIDForWindowsId == null) TimeZoneMethods.ucal_getTimeZoneIDForWindowsId = GetMethod(IcuI18NLibHandle, "ucal_getTimeZoneIDForWindowsID"); - return TimeZoneMethods.ucal_getTimeZoneIDForWindowsId(winid, winid.Length, region, id, idCapacity, out status); + return TimeZoneMethods.ucal_getTimeZoneIDForWindowsId(winId, winId.Length, region, id, idCapacity, out status); } } } diff --git a/source/icu.net/NativeMethods/NativeMethods_Transliterator.cs b/source/icu.net/NativeMethods/NativeMethods_Transliterator.cs index 17ffc5c8..a8ca1025 100644 --- a/source/icu.net/NativeMethods/NativeMethods_Transliterator.cs +++ b/source/icu.net/NativeMethods/NativeMethods_Transliterator.cs @@ -2,14 +2,17 @@ // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using System.Text; +// ReSharper disable once CheckNamespace namespace Icu { /// internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class TransliteratorMethodsContainer { /// @@ -38,6 +41,7 @@ internal delegate void utrans_transUCharsDelegate( internal utrans_transUCharsDelegate utrans_transUChars; } + // ReSharper disable once InconsistentNaming private static TransliteratorMethodsContainer TransliteratorMethods = new TransliteratorMethodsContainer(); /// diff --git a/source/icu.net/NativeMethods/NativeMethods_UnicodeCollator.cs b/source/icu.net/NativeMethods/NativeMethods_UnicodeCollator.cs index 38dbd093..28f038b4 100644 --- a/source/icu.net/NativeMethods/NativeMethods_UnicodeCollator.cs +++ b/source/icu.net/NativeMethods/NativeMethods_UnicodeCollator.cs @@ -2,13 +2,17 @@ // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using Icu.Collation; +// ReSharper disable once CheckNamespace namespace Icu { internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class CollatorMethodsContainer { [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Unicode)] @@ -87,6 +91,7 @@ internal delegate int ucol_getBoundDelegate(byte[] source, int sourceLength, internal ucol_getBoundDelegate ucol_getBound; } + // ReSharper disable once InconsistentNaming private static CollatorMethodsContainer CollatorMethods = new CollatorMethodsContainer(); #region Unicode collator diff --git a/source/icu.net/NativeMethods/NativeMethods_UnicodeSet.cs b/source/icu.net/NativeMethods/NativeMethods_UnicodeSet.cs index 0061ff62..fff5760a 100644 --- a/source/icu.net/NativeMethods/NativeMethods_UnicodeSet.cs +++ b/source/icu.net/NativeMethods/NativeMethods_UnicodeSet.cs @@ -2,12 +2,16 @@ // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +// ReSharper disable once CheckNamespace namespace Icu { internal static partial class NativeMethods { + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")] private class UnicodeSetMethodsContainer { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] @@ -47,12 +51,13 @@ internal delegate int uset_getItemDelegate(IntPtr set, int itemIndex, out int st internal uset_getItemCountDelegate uset_getItemCount; } + // ReSharper disable once InconsistentNaming private static UnicodeSetMethodsContainer UnicodeSetMethods = new UnicodeSetMethodsContainer(); /// /// Disposes of the storage used by Unicode set. This function should be called exactly once for objects returned by uset_open() /// - /// Unicode set to dispose of + /// Unicode set to dispose of public static void uset_close(IntPtr set) { if (UnicodeSetMethods.uset_close == null) @@ -113,6 +118,7 @@ public static void uset_add(IntPtr set, char c) /// \uxxxx or \Uxxxxxxxx. Unprintable characters are those other than U+000A, U+0020..U+007E. /// Error code /// Length of string, possibly larger than resultCapacity + [SuppressMessage("ReSharper", "CommentTypo")] public static int uset_toPattern(IntPtr set, IntPtr result, int resultCapacity, bool escapeUnprintable, out ErrorCode status) { @@ -136,14 +142,14 @@ public static void uset_addString(IntPtr set, string str, int strLen) } /// - /// Returns an item of this Unicode set. An item is either a range of characters or a single multicharacter string. + /// Returns an item of this Unicode set. An item is either a range of characters or a single multi-character string. /// /// The Unicode set /// A non-negative integer in the range 0..uset_getItemCount(set)-1 /// Pointer to variable to receive first character in range, inclusive - /// POinter to variable to receive the last character in range, inclusive + /// Pointer to variable to receive the last character in range, inclusive /// Buffer to receive the string, may be NULL - /// Capcacity of str, or 0 if str is NULL + /// Capacity of str, or 0 if str is NULL /// Error Code /// The length of the string (>=2), or 0 if the item is a range, in which case it /// is the range *start..*end, or -1 if itemIndex is out of range @@ -157,7 +163,7 @@ public static int uset_getItem(IntPtr set, int itemIndex, out int start, } /// - /// Returns the number of items in this set. An item is either a range of characters or a single multicharacter string + /// Returns the number of items in this set. An item is either a range of characters or a single multi-character string /// /// The Unicode set /// A non-negative integer counting the character ranges and/or strings contained in the set