mirror of
https://github.com/osukey/osukey.git
synced 2025-05-31 02:17:34 +09:00
Change screenshot file name
This commit is contained in:
parent
604e725f3f
commit
8429408974
@ -45,7 +45,7 @@ namespace osu.Game.Graphics
|
|||||||
{
|
{
|
||||||
host.TakeScreenshot(screenshotBitmap =>
|
host.TakeScreenshot(screenshotBitmap =>
|
||||||
{
|
{
|
||||||
var stream = storage.GetStream($"{DateTime.Now:yyyyMMddTHHmmss}.{screenshotFormat.ToString().ToLower()}", FileAccess.Write);
|
var stream = getFileStream();
|
||||||
|
|
||||||
switch (screenshotFormat.Value)
|
switch (screenshotFormat.Value)
|
||||||
{
|
{
|
||||||
@ -60,5 +60,23 @@ namespace osu.Game.Graphics
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Stream getFileStream()
|
||||||
|
{
|
||||||
|
var fileExt = screenshotFormat.ToString().ToLower();
|
||||||
|
|
||||||
|
var withoutIndex = $"Screenshot.{fileExt}";
|
||||||
|
if (!storage.Exists(withoutIndex))
|
||||||
|
return storage.GetStream(withoutIndex, FileAccess.Write);
|
||||||
|
|
||||||
|
for (ulong i = 1; i < ulong.MaxValue; i++)
|
||||||
|
{
|
||||||
|
var indexedName = $"Screenshot-{i}.{fileExt}";
|
||||||
|
if (!storage.Exists(indexedName))
|
||||||
|
return storage.GetStream(indexedName, FileAccess.Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception($"Failed to get stream for saving {fileExt} file");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user