Skip to content

Commit 32e0483

Browse files
committed
Handle case-insensitive picto name matching
Added a check to handle cases where the picto name from `PictoPath` is not found in `imageDict`. If not found, attempt a case-insensitive match and update `pictoName` accordingly. Log a warning if no match is found. Updated `PictoPath` assignment to use the corrected `pictoName`.
1 parent 5db1ae2 commit 32e0483

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

JustDanceEditor.Converter/Converters/Bundles/MapPackageBundleGenerator.cs

+14-1
Original file line numberDiff line numberDiff line change
@@ -591,12 +591,25 @@ static void GenerateMapPackageInternally(ConvertUbiArtToUnity convert)
591591
if (clip.Duration == 0)
592592
duration = 16;
593593

594+
// If the picto cannot be found, try to find it in the pictoDict with different casing
595+
string pictoName = Path.GetFileNameWithoutExtension(clip.PictoPath);
596+
597+
if (!imageDict.ContainsKey(pictoName))
598+
{
599+
string? key = imageDict.Keys.FirstOrDefault(x => x.Equals(pictoName, StringComparison.InvariantCultureIgnoreCase));
600+
601+
if (key is null)
602+
Logger.Log($"Picto {pictoName} not found in imageDict", LogLevel.Warning);
603+
else
604+
pictoName = key;
605+
}
606+
594607
newPictoClip["StartTime"].AsInt = clip.StartTime;
595608
newPictoClip["Duration"].AsInt = duration;
596609
newPictoClip["Id"].AsLong = clip.Id;
597610
newPictoClip["TrackId"].AsLong = clip.TrackId;
598611
newPictoClip["IsActive"].AsUInt = (uint)clip.IsActive;
599-
newPictoClip["PictoPath"].AsString = Path.GetFileNameWithoutExtension(clip.PictoPath);
612+
newPictoClip["PictoPath"].AsString = pictoName;
600613
newPictoClip["CoachCount"].AsUInt = (uint)clip.CoachCount;
601614

602615
pictoClips.Children.Add(newPictoClip);

0 commit comments

Comments
 (0)