Skip to content

Commit

Permalink
Fix BatchMap execution
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Jan 23, 2021
1 parent 26d58b3 commit 741d035
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions BatchMap/Program.cs
Expand Up @@ -136,6 +136,7 @@ private static void Main(string[] args)
private static void SetupDependencies()
{
_typeRegistry = new UnityRegistry("EOLib.IO");
_typeRegistry.RegisterDiscoveredTypes();

_pubProvider = _typeRegistry.Resolve<IPubFileProvider>();
_mapFileProvider = _typeRegistry.Resolve<IMapFileProvider>();
Expand Down
6 changes: 3 additions & 3 deletions EOLib.IO/Map/MapPathToIDConverter.cs
Expand Up @@ -6,11 +6,11 @@ public class MapPathToIDConverter
{
public int ConvertFromPathToID(string pathToMapFile)
{
var lastSlash = pathToMapFile.LastIndexOf('\\') < 0 ? pathToMapFile.LastIndexOf('/') : -1;
if (lastSlash < 0)
var lastDot = pathToMapFile.LastIndexOf('.');
if (lastDot < 5)
throw new IOException();

var strID = pathToMapFile.Substring(lastSlash + 1, 5);
var strID = pathToMapFile.Substring(lastDot - 5, 5);
return int.Parse(strID);
}
}
Expand Down

0 comments on commit 741d035

Please sign in to comment.