tzachshabtay / MonoAGS

AGS (Adventure Game Studio) reimagined in Mono
https://tzachshabtay.github.io/MonoAGS/
Artistic License 2.0
27 stars 8 forks source link

Debug.WriteLine not used properly #239

Closed ghost closed 6 years ago

ghost commented 6 years ago

Noticed this occasionally, Debug.WriteLine has a number of overrides, most important for this issue are these two:

public static void WriteLine(string format, params object[] args);
public static void WriteLine(string message, string category);

On many occasions in MonoAGS WriteLine is called with just two parameters: a formatting string and a string argument, probably intended as a formatting argument, but system treats it as category instead.

For example, in FileSystemResourcePack.loadFile:

Debug.WriteLine("File system resource pack- failed to find resource at path: {0}", path);

This command produces following output:

../../Assets/UI/face6.png: File system resource pack- failed to find resource at path: {0}

This incorrect use of WriteLine may be found in numerous places, including commentaries with example to property usage. What would be the correct way of fixing this? I was thinking of just changing to

Debug.WriteLine("File system resource pack- failed to find resource at path: " + path);
tzachshabtay commented 6 years ago

Yeah, that's annoying. String interpolation is probably the best solution:

Debug.WriteLine($"File system resource pack- failed to find resource at path: {path}");