32 lines
814 B
C#
32 lines
814 B
C#
using System.IO;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace Framework.GameBuild
|
|
{
|
|
public static class GameBuildUtils
|
|
{
|
|
public static int ExtractNumber(string input)
|
|
{
|
|
var str = input;
|
|
int lastIndex = input.LastIndexOf('_');
|
|
if (lastIndex != -1 && lastIndex < input.Length - 1)
|
|
{
|
|
str = input.Substring(lastIndex + 1);
|
|
}
|
|
|
|
Match match = Regex.Match(str, @"\d+");
|
|
|
|
if (match.Success)
|
|
{
|
|
return int.Parse(match.Value);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
public static string GetFileNameWithoutExtension(string fileName)
|
|
{
|
|
return Path.GetFileNameWithoutExtension(fileName);
|
|
}
|
|
}
|
|
} |