소스 검색

Change Console.WriteLine -> Logger.LogWarning

habeebweeb 3 년 전
부모
커밋
5ee6cdc075
1개의 변경된 파일13개의 추가작업 그리고 7개의 파일을 삭제
  1. 13 7
      src/MeidoPhotoStudio.Converter/Converters/MMConverter.cs

+ 13 - 7
src/MeidoPhotoStudio.Converter/Converters/MMConverter.cs

@@ -98,17 +98,23 @@ namespace MeidoPhotoStudio.Converter.Converters
             }
             catch (Exception e)
             {
-                Console.WriteLine($"Could not {(e is IOException ? "read" : "parse")} ini file {filePath}");
-                return null;
-            }
+                if (Plugin.Instance != null)
+                    Plugin.Instance.Logger.LogWarning(
+                        $"Could not {(e is IOException ? "read" : "parse")} ini file {filePath}"
+                    );
 
-            if (!iniFile.HasSection("scene"))
-            {
-                Console.WriteLine($"{filePath} is not a valid MM config because '[scene]' section is missing");
                 return null;
             }
 
-            return iniFile.GetSection("scene");
+            if (iniFile.HasSection("scene"))
+                return iniFile.GetSection("scene");
+
+            if (Plugin.Instance != null)
+                Plugin.Instance.Logger.LogWarning(
+                    $"{filePath} is not a valid MM config because '[scene]' section is missing"
+                );
+
+            return null;
         }
     }
 }