Browse Source

fix excite and google hack

Scrublord1336 6 years ago
parent
commit
22f18e8782

+ 2 - 10
src/XUnity.AutoTranslator.Plugin.Core/Web/ExciteTranslateEndpoint.cs

@@ -63,16 +63,8 @@ namespace XUnity.AutoTranslator.Plugin.Core.Web
             try
             {                
                 String extracted = getBetween(result, "class=\"inputText\">", "</p>");
-                if (String.IsNullOrEmpty(extracted))
-                {
-                    translated = null;
-                    return false;
-                }
-                else
-                {
-                    translated = RestSharp.Contrib.HttpUtility.HtmlDecode(extracted);
-                    return true;
-                }
+                translated = RestSharp.Contrib.HttpUtility.HtmlDecode( extracted ?? string.Empty );
+                return true;
             }
             catch
             {

+ 2 - 10
src/XUnity.AutoTranslator.Plugin.Core/Web/GoogleTranslateHackEndpoint.cs

@@ -63,16 +63,8 @@ namespace XUnity.AutoTranslator.Plugin.Core.Web
             {
 
                 String extracted = getBetween(result, "class=\"t0\">", "</div>");
-                if (String.IsNullOrEmpty(extracted))
-                {
-                    translated = null;
-                    return false;
-                }
-                else
-                {
-                    translated = RestSharp.Contrib.HttpUtility.HtmlDecode(extracted);
-                    return true;
-                }
+                translated = RestSharp.Contrib.HttpUtility.HtmlDecode( extracted ?? string.Empty );
+                return true;
             }
             catch
             {