[NUI] Fix build warning CA1820
authorBowon Ryu <bowon.ryu@samsung.com>
Wed, 16 Dec 2020 05:36:27 +0000 (14:36 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Mon, 21 Dec 2020 12:05:23 +0000 (21:05 +0900)
CA1820: Test for empty strings using string length

Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
src/Tizen.NUI/src/internal/NUICoreBackend.cs
src/Tizen.NUI/src/internal/Xaml/XamlParser.cs
src/Tizen.NUI/src/internal/XamlBinding/BindingExpression.cs
src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs
src/Tizen.NUI/src/public/BaseComponents/ImageView.cs

index 3ec90d6..6562101 100755 (executable)
@@ -138,7 +138,7 @@ namespace Tizen.NUI
             NDalicPINVOKE.SWIGStringHelper.RegistCallback();
 
             args[0] = Tizen.Applications.Application.Current.ApplicationInfo.ExecutablePath;
-            if ("" == args[0])
+            if (string.IsNullOrEmpty(args[0]))
             {
                 args[0] = this.GetType().Assembly.FullName;
             }
index bfe97d7..c70d268 100755 (executable)
@@ -207,7 +207,7 @@ namespace Tizen.NUI.Xaml
                 }
 
                 var namespaceUri = reader.NamespaceURI;
-                if (reader.LocalName.Contains(".") && namespaceUri == "")
+                if (reader.LocalName.Contains(".") && string.IsNullOrEmpty(namespaceUri))
                     namespaceUri = ((IXmlNamespaceResolver)reader).LookupNamespace("");
                 var propertyName = new XmlName(namespaceUri, reader.LocalName);
 
index e754104..f1a7642 100755 (executable)
@@ -205,7 +205,7 @@ namespace Tizen.NUI.Binding
         IEnumerable<BindingExpressionPart> GetPart(string part)
         {
             part = part.Trim();
-            if (part == string.Empty)
+            if (string.IsNullOrEmpty(part))
                 throw new FormatException("Path contains an empty part");
 
             BindingExpressionPart indexer = null;
index 26c195d..07117ca 100755 (executable)
@@ -170,7 +170,7 @@ namespace Tizen.NUI.BaseComponents
             {
                 tlog.Fatal(tag, $"[VAV START[ [{GetId()}] CurrentFrame SET");
 
-                if (mResourceURL == null || mResourceURL == String.Empty)
+                if (string.IsNullOrEmpty(mResourceURL))
                 {
                     throw new InvalidOperationException("Resource Url not yet Set");
                 }
@@ -338,7 +338,7 @@ namespace Tizen.NUI.BaseComponents
         {
             tlog.Fatal(tag, $"[VAV START[ [{GetId()}] AnimationState={AnimationState}, PlayState={PlayState}");
 
-            if (mResourceURL == null || mResourceURL == String.Empty)
+            if (string.IsNullOrEmpty(mResourceURL))
             {
                 throw new InvalidOperationException("Resource Url not yet Set");
             }
@@ -381,7 +381,7 @@ namespace Tizen.NUI.BaseComponents
         {
             tlog.Fatal(tag, $"[VAV START[ [{GetId()}] AnimationState={AnimationState}, PlayState={PlayState}");
 
-            if (mResourceURL == null || mResourceURL == String.Empty)
+            if (string.IsNullOrEmpty(mResourceURL))
             {
                 throw new InvalidOperationException("Resource Url not yet Set");
             }
@@ -406,7 +406,7 @@ namespace Tizen.NUI.BaseComponents
         {
             tlog.Fatal(tag, $"[VAV START[ [{GetId()}] endAction:({endAction}), PlayState={PlayState}");
 
-            if (mResourceURL == null || mResourceURL == String.Empty)
+            if (string.IsNullOrEmpty(mResourceURL))
             {
                 throw new InvalidOperationException("Resource Url not yet Set");
             }
index fa34110..e800cd8 100755 (executable)
@@ -1198,7 +1198,7 @@ namespace Tizen.NUI.BaseComponents
                 alphaMaskUrl?.Dispose();
             }
 
-            if (_resourceUrl == "")
+            if (string.IsNullOrEmpty(_resourceUrl))
             {
                 PropertyValue resourceUrl = new PropertyValue(_resourceUrl);
                 imageMap?.Insert(ImageVisualProperty.URL, resourceUrl);