Browse Source

Corrected StringComparison type

Tal Aloni 7 years ago
parent
commit
0bc9452bbf

+ 5 - 5
SMBLibrary/NTFileStore/Adapter/NTFileSystemAdapter.QueryDirectory.cs

@@ -128,15 +128,15 @@ namespace SMBLibrary
 
                 if (!findExactNameWithoutExtension)
                 {
-                    if (fileName.StartsWith(desiredFileNameStart, StringComparison.InvariantCultureIgnoreCase))
+                    if (fileName.StartsWith(desiredFileNameStart, StringComparison.OrdinalIgnoreCase))
                     {
                         return true;
                     }
                 }
                 else
                 {
-                    if (fileName.StartsWith(desiredFileNameStart + ".", StringComparison.InvariantCultureIgnoreCase) ||
-                        fileName.Equals(desiredFileNameStart, StringComparison.InvariantCultureIgnoreCase))
+                    if (fileName.StartsWith(desiredFileNameStart + ".", StringComparison.OrdinalIgnoreCase) ||
+                        fileName.Equals(desiredFileNameStart, StringComparison.OrdinalIgnoreCase))
                     {
                         return true;
                     }
@@ -145,12 +145,12 @@ namespace SMBLibrary
             else if (expression.StartsWith("<"))
             {
                 string desiredFileNameEnd = expression.Substring(1);
-                if (fileName.EndsWith(desiredFileNameEnd, StringComparison.InvariantCultureIgnoreCase))
+                if (fileName.EndsWith(desiredFileNameEnd, StringComparison.OrdinalIgnoreCase))
                 {
                     return true;
                 }
             }
-            else if (String.Equals(fileName, expression, StringComparison.CurrentCultureIgnoreCase))
+            else if (String.Equals(fileName, expression, StringComparison.OrdinalIgnoreCase))
             {
                 return true;
             }

+ 1 - 1
SMBLibrary/NTFileStore/NamedPipeStore.cs

@@ -60,7 +60,7 @@ namespace SMBLibrary
 
             foreach (RemoteService service in m_services)
             {
-                if (String.Equals(path, service.PipeName, StringComparison.InvariantCultureIgnoreCase))
+                if (String.Equals(path, service.PipeName, StringComparison.OrdinalIgnoreCase))
                 {
                     return service;
                 }

+ 1 - 1
SMBLibrary/Server/NameServer.cs

@@ -109,7 +109,7 @@ namespace SMBLibrary.Server
                             string name = NetBiosUtils.GetNameFromMSNetBiosName(request.Question.Name);
                             NetBiosSuffix suffix = (NetBiosSuffix)request.Question.Name[15];
 
-                            bool nameMatch = String.Equals(name, Environment.MachineName, StringComparison.InvariantCultureIgnoreCase);
+                            bool nameMatch = String.Equals(name, Environment.MachineName, StringComparison.OrdinalIgnoreCase);
                             
                             if (nameMatch && ((suffix == NetBiosSuffix.WorkstationService) || (suffix == NetBiosSuffix.FileServiceService)))
                             {

+ 1 - 1
SMBLibrary/Server/SMB1/TransactionHelper.cs

@@ -100,7 +100,7 @@ namespace SMBLibrary.Server.SMB1
 
         internal static List<SMB1Command> GetCompleteTransactionResponse(SMB1Header header, uint maxDataCount, uint timeout, string name, byte[] requestSetup, byte[] requestParameters, byte[] requestData, ISMBShare share, SMB1ConnectionState state)
         {
-            if (String.Equals(name, @"\pipe\lanman", StringComparison.InvariantCultureIgnoreCase))
+            if (String.Equals(name, @"\PIPE\lanman", StringComparison.OrdinalIgnoreCase))
             {
                 // [MS-RAP] Remote Administration Protocol request
                 state.LogToServer(Severity.Debug, "Remote Administration Protocol requests are not implemented");

+ 1 - 1
SMBLibrary/Server/SMB1/TreeConnectHelper.cs

@@ -22,7 +22,7 @@ namespace SMBLibrary.Server.SMB1
             ISMBShare share;
             ServiceName serviceName;
             OptionalSupportFlags supportFlags;
-            if (String.Equals(shareName, NamedPipeShare.NamedPipeShareName, StringComparison.InvariantCultureIgnoreCase))
+            if (String.Equals(shareName, NamedPipeShare.NamedPipeShareName, StringComparison.OrdinalIgnoreCase))
             {
                 share = services;
                 serviceName = ServiceName.NamedPipe;

+ 1 - 1
SMBLibrary/Server/SMB2/TreeConnectHelper.cs

@@ -22,7 +22,7 @@ namespace SMBLibrary.Server.SMB2
             ISMBShare share;
             ShareType shareType;
             ShareFlags shareFlags;
-            if (String.Equals(shareName, NamedPipeShare.NamedPipeShareName, StringComparison.InvariantCultureIgnoreCase))
+            if (String.Equals(shareName, NamedPipeShare.NamedPipeShareName, StringComparison.OrdinalIgnoreCase))
             {
                 share = services;
                 shareType = ShareType.Pipe;

+ 1 - 1
SMBLibrary/Server/Shares/SMBShareCollection.cs

@@ -50,7 +50,7 @@ namespace SMBLibrary.Server
         /// <param name="relativePath">e.g. \Shared</param>
         public FileSystemShare GetShareFromName(string shareName)
         {
-            int index = IndexOf(shareName, StringComparison.InvariantCultureIgnoreCase);
+            int index = IndexOf(shareName, StringComparison.OrdinalIgnoreCase);
             if (index >= 0)
             {
                 return this[index];

+ 1 - 1
SMBLibrary/Services/ServerService/ServerService.cs

@@ -166,7 +166,7 @@ namespace SMBLibrary.Services
         {
             for (int index = 0; index < m_shares.Count; index++)
             {
-                if (m_shares[index].Equals(shareName, StringComparison.InvariantCultureIgnoreCase))
+                if (m_shares[index].Equals(shareName, StringComparison.OrdinalIgnoreCase))
                 {
                     return index;
                 }

+ 1 - 1
SMBServer/ServerUI.cs

@@ -261,7 +261,7 @@ namespace SMBServer
         {
             for (int index = 0; index < list.Count; index++)
             {
-                if (string.Equals(list[index], value, StringComparison.InvariantCultureIgnoreCase))
+                if (string.Equals(list[index], value, StringComparison.OrdinalIgnoreCase))
                 {
                     return index;
                 }

+ 1 - 1
SMBServer/UserCollection.cs

@@ -20,7 +20,7 @@ namespace SMBServer
         {
             for (int index = 0; index < this.Count; index++)
             {
-                if (string.Equals(this[index].AccountName, accountName, StringComparison.InvariantCultureIgnoreCase))
+                if (string.Equals(this[index].AccountName, accountName, StringComparison.OrdinalIgnoreCase))
                 {
                     return index;
                 }