mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 15:52:54 +08:00
Fix some surrounding code formatting
This commit is contained in:
parent
53ff0802cb
commit
370775af68
@ -462,10 +462,10 @@ namespace osu.Game.Database
|
|||||||
if (retrievedItem == null)
|
if (retrievedItem == null)
|
||||||
throw new ArgumentException(@"Specified model could not be found", nameof(item));
|
throw new ArgumentException(@"Specified model could not be found", nameof(item));
|
||||||
|
|
||||||
var filename = $"{getValidFilename(item.ToString())}{HandledExtensions.First()}";
|
string filename = $"{getValidFilename(item.ToString())}{HandledExtensions.First()}";
|
||||||
|
|
||||||
using (var outputStream = exportStorage.GetStream(filename, FileAccess.Write, FileMode.Create))
|
using (var stream = exportStorage.GetStream(filename, FileAccess.Write, FileMode.Create))
|
||||||
ExportModelTo(retrievedItem, outputStream);
|
ExportModelTo(retrievedItem, stream);
|
||||||
|
|
||||||
exportStorage.PresentFileExternally(filename);
|
exportStorage.PresentFileExternally(filename);
|
||||||
}
|
}
|
||||||
|
@ -109,40 +109,42 @@ namespace osu.Game.Graphics
|
|||||||
if (Interlocked.Decrement(ref screenShotTasks) == 0 && cursorVisibility.Value == false)
|
if (Interlocked.Decrement(ref screenShotTasks) == 0 && cursorVisibility.Value == false)
|
||||||
cursorVisibility.Value = true;
|
cursorVisibility.Value = true;
|
||||||
|
|
||||||
var fileName = getFileName();
|
string filename = getFilename();
|
||||||
if (fileName == null) return;
|
|
||||||
|
|
||||||
var stream = storage.GetStream(fileName, FileAccess.Write);
|
if (filename == null) return;
|
||||||
|
|
||||||
switch (screenshotFormat.Value)
|
using (var stream = storage.GetStream(filename, FileAccess.Write))
|
||||||
{
|
{
|
||||||
case ScreenshotFormat.Png:
|
switch (screenshotFormat.Value)
|
||||||
await image.SaveAsPngAsync(stream).ConfigureAwait(false);
|
{
|
||||||
break;
|
case ScreenshotFormat.Png:
|
||||||
|
await image.SaveAsPngAsync(stream).ConfigureAwait(false);
|
||||||
|
break;
|
||||||
|
|
||||||
case ScreenshotFormat.Jpg:
|
case ScreenshotFormat.Jpg:
|
||||||
const int jpeg_quality = 92;
|
const int jpeg_quality = 92;
|
||||||
|
|
||||||
await image.SaveAsJpegAsync(stream, new JpegEncoder { Quality = jpeg_quality }).ConfigureAwait(false);
|
await image.SaveAsJpegAsync(stream, new JpegEncoder { Quality = jpeg_quality }).ConfigureAwait(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException($"Unknown enum member {nameof(ScreenshotFormat)} {screenshotFormat.Value}.");
|
throw new InvalidOperationException($"Unknown enum member {nameof(ScreenshotFormat)} {screenshotFormat.Value}.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notificationOverlay.Post(new SimpleNotification
|
notificationOverlay.Post(new SimpleNotification
|
||||||
{
|
{
|
||||||
Text = $"{fileName} saved!",
|
Text = $"{filename} saved!",
|
||||||
Activated = () =>
|
Activated = () =>
|
||||||
{
|
{
|
||||||
storage.PresentFileExternally(fileName);
|
storage.PresentFileExternally(filename);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
private string getFileName()
|
private string getFilename()
|
||||||
{
|
{
|
||||||
var dt = DateTime.Now;
|
var dt = DateTime.Now;
|
||||||
var fileExt = screenshotFormat.ToString().ToLowerInvariant();
|
var fileExt = screenshotFormat.ToString().ToLowerInvariant();
|
||||||
|
Loading…
Reference in New Issue
Block a user