Skip to content

Commit

Permalink
1.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
IngoHHacks committed Apr 10, 2023
1 parent ec85ce5 commit eca28d3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Release 1.1.8
- Fixed characters not being able to exported if their name contains characters that are not allowed in file names.

## Release 1.1.7
- Patch to show stack traces.

Expand Down
3 changes: 2 additions & 1 deletion Content/ModdedCharacterManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using WECCL.Utils;

namespace WECCL.Content;

Expand All @@ -23,7 +24,7 @@ public static void SaveAllCharacters()

CharacterWithModdedData moddedCharacter = new(character);
string json = JsonConvert.SerializeObject(moddedCharacter, Formatting.Indented);
string path = Path.Combine(exportPath, $"{character.id}_{character.name}.json");
string path = Path.Combine(exportPath, $"{character.id}_{FileNameUtils.Escape(character.name)}.json");
File.WriteAllText(path, json);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Plugin : BaseUnityPlugin
{
public const string PluginGuid = "IngoH.WrestlingEmpire.WECCL";
public const string PluginName = "Wrestling Empire Custom Content Loader";
public const string PluginVer = "1.1.7";
public const string PluginVer = "1.1.8";

internal static DirectoryInfo AssetsDir;
internal static DirectoryInfo ExportDir;
Expand Down
14 changes: 14 additions & 0 deletions Utils/FileNameUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace WECCL.Utils;

public class FileNameUtils
{
public static string Escape(string fileName)
{
var replace = Path.GetInvalidFileNameChars();
foreach (var c in replace)
{
fileName = fileName.Replace(c, '_');
}
return fileName;
}
}
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"namespace": "IngoH",
"name": "WECCL",
"description": "Loads custom content for Wrestling Empire",
"version_number": "1.1.7",
"version_number": "1.1.8",
"dependencies": [
"BepInEx-BepInExPack-5.4.2100"
],
Expand Down

0 comments on commit eca28d3

Please sign in to comment.