Merge branch 'main' of https://github.com/sp-tarkov/server-csharp
This commit is contained in:
@@ -46,7 +46,7 @@ public class WeatherGenerator
|
||||
*/
|
||||
public void CalculateGameTime(WeatherData data)
|
||||
{
|
||||
var computedDate = new DateTime();
|
||||
var computedDate = DateTime.Now;
|
||||
var formattedDate = this._timeUtil.FormatDate(computedDate);
|
||||
|
||||
data.Date = formattedDate;
|
||||
|
||||
@@ -100,10 +100,15 @@ public class DatabaseImporter : OnLoad
|
||||
{
|
||||
var directoryContent = GetAllFilesInDirectory(directory);
|
||||
|
||||
foreach (var fileNameWithPath in directoryContent) {
|
||||
var bsgPath = $"/{newBasePath}/{_fileUtil.StripExtension(fileNameWithPath)}";
|
||||
var sptPath = $"{directory}{ fileNameWithPath}";
|
||||
_imageRouter.AddRoute(bsgPath, sptPath);
|
||||
foreach (var fileNameWithPath in directoryContent)
|
||||
{
|
||||
var fileNameWithNoSPTPath = fileNameWithPath.Replace(directory, "");
|
||||
var filePathNoExtension = _fileUtil.StripExtension(fileNameWithNoSPTPath, true);
|
||||
if (filePathNoExtension.StartsWith("/") || fileNameWithPath.StartsWith("\\"))
|
||||
filePathNoExtension = $"{filePathNoExtension.Substring(1)}";
|
||||
|
||||
var bsgPath = $"/{newBasePath}/{filePathNoExtension}".Replace("\\", "/");
|
||||
_imageRouter.AddRoute(bsgPath, fileNameWithPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-6
@@ -24,33 +24,38 @@ public class FileUtil
|
||||
{
|
||||
return Path.GetExtension(path).Replace(".", "");
|
||||
}
|
||||
|
||||
|
||||
public string GetFileName(string path)
|
||||
{
|
||||
return Path.GetFileName(path);
|
||||
}
|
||||
|
||||
|
||||
public string StripExtension(string path, bool keepPath = false)
|
||||
{
|
||||
return keepPath ? path.Split('.').First() : Path.GetFileNameWithoutExtension(path);
|
||||
if (keepPath)
|
||||
{
|
||||
return path.StartsWith(".") ? path.Split('.')[1] : path.Split('.').First();
|
||||
}
|
||||
|
||||
return Path.GetFileNameWithoutExtension(path);
|
||||
}
|
||||
|
||||
public bool DirectoryExists(string path)
|
||||
{
|
||||
return Directory.Exists(path);
|
||||
}
|
||||
|
||||
|
||||
public void CreateDirectory(string path)
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool FileExists(string path)
|
||||
{
|
||||
return File.Exists(path);
|
||||
}
|
||||
|
||||
|
||||
public string ReadFile(string path)
|
||||
{
|
||||
return File.ReadAllText(path);
|
||||
|
||||
Reference in New Issue
Block a user