Переглянути джерело

Fix issues introduced from reformat

Some reflection magic strings referred to old variable names and broke
scene (de)serialization.

Translation key for main light name was erroneously called "name" when
extracting magic string to constant.

Logger was apparently erroneously extracted to another variable for some
reason.
habeebweeb 2 роки тому
батько
коміт
cb49284cb7

+ 1 - 1
src/MeidoPhotoStudio.Plugin/DragPoint/DragPointLight.cs

@@ -193,7 +193,7 @@ public class DragPointLight : DragPointGeneral
         const string spotName = "spot";
         const string normalName = "normal";
         const string pointName = "point";
-        const string mainName = "name";
+        const string mainName = "main";
 
         var lightType = LightType.Directional;
         var name = normalName;

+ 1 - 1
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/DragPointLightSerializer.cs

@@ -40,5 +40,5 @@ public class DragPointLightSerializer : Serializer<DragPointLight>
     }
 
     private static LightProperty[] GetLightProperties(DragPointLight light) =>
-        Utility.GetFieldValue<DragPointLight, LightProperty[]>(light, "LightProperties");
+        Utility.GetFieldValue<DragPointLight, LightProperty[]>(light, "lightProperties");
 }

+ 2 - 2
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/EffectManagerSerializer.cs

@@ -26,7 +26,7 @@ public class EffectManagerSerializer : Serializer<EffectManager>
 
         var headerToManager =
             GetEffectManagers(manager).ToDictionary(
-                x => (string)x.Key.GetField("header").GetValue(null),
+                x => (string)x.Key.GetField("Header").GetValue(null),
                 y => y.Value);
 
         string header;
@@ -40,5 +40,5 @@ public class EffectManagerSerializer : Serializer<EffectManager>
     }
 
     private static Dictionary<Type, IEffectManager> GetEffectManagers(EffectManager manager) =>
-        Utility.GetFieldValue<EffectManager, Dictionary<Type, IEffectManager>>(manager, "EffectManagers");
+        Utility.GetFieldValue<EffectManager, Dictionary<Type, IEffectManager>>(manager, "effectManagers");
 }

+ 1 - 4
src/MeidoPhotoStudio.Plugin/Utility.cs

@@ -11,9 +11,6 @@ namespace MeidoPhotoStudio.Plugin;
 
 public static class Utility
 {
-    public static readonly BepInEx.Logging.ManualLogSource Logger =
-        ManualLogSource;
-
     internal static readonly byte[] PngHeader = { 137, 80, 78, 71, 13, 10, 26, 10 };
     internal static readonly byte[] PngEnd = System.Text.Encoding.ASCII.GetBytes("IEND");
     internal static readonly Regex GuidRegEx =
@@ -25,7 +22,7 @@ public static class Utility
     private const BindingFlags ReflectionFlags =
         BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
 
-    private static readonly BepInEx.Logging.ManualLogSource ManualLogSource =
+    private static readonly BepInEx.Logging.ManualLogSource Logger =
         BepInEx.Logging.Logger.CreateLogSource(MeidoPhotoStudio.PluginName);
 
     static Utility()