Replace F extension with string interpolation
This commit is contained in:
@@ -30,7 +30,7 @@ namespace OpenRA.Platforms.Default
|
||||
this.size = size;
|
||||
this.clearColor = clearColor;
|
||||
if (!Exts.IsPowerOf2(size.Width) || !Exts.IsPowerOf2(size.Height))
|
||||
throw new InvalidDataException("Frame buffer size ({0}x{1}) must be a power of two".F(size.Width, size.Height));
|
||||
throw new InvalidDataException($"Frame buffer size ({size.Width}x{size.Height}) must be a power of two");
|
||||
|
||||
OpenGL.glGenFramebuffers(1, out framebuffer);
|
||||
OpenGL.CheckGLError();
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Platforms.Default
|
||||
var status = OpenGL.glCheckFramebufferStatus(OpenGL.GL_FRAMEBUFFER);
|
||||
if (status != OpenGL.GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
var error = "Error creating framebuffer: {0}\n{1}".F(status, new StackTrace());
|
||||
var error = $"Error creating framebuffer: {status}\n{new StackTrace()}";
|
||||
OpenGL.WriteGraphicsLog(error);
|
||||
throw new InvalidOperationException("OpenGL Error: See graphics.log for details.");
|
||||
}
|
||||
|
||||
@@ -646,7 +646,7 @@ namespace OpenRA.Platforms.Default
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
WriteGraphicsLog("Failed to initialize OpenGL bindings.\nInner exception was: {0}".F(e));
|
||||
WriteGraphicsLog($"Failed to initialize OpenGL bindings.\nInner exception was: {e}");
|
||||
throw new InvalidProgramException("Failed to initialize OpenGL. See graphics.log for details.", e);
|
||||
}
|
||||
}
|
||||
@@ -750,7 +750,7 @@ namespace OpenRA.Platforms.Default
|
||||
|
||||
string errorText;
|
||||
errorText = ErrorToText.TryGetValue(type, out errorText) ? errorText : type.ToString("X");
|
||||
var error = "GL Error: {0}\n{1}".F(errorText, new StackTrace());
|
||||
var error = $"GL Error: {errorText}\n{new StackTrace()}";
|
||||
|
||||
WriteGraphicsLog(error);
|
||||
|
||||
@@ -791,7 +791,7 @@ namespace OpenRA.Platforms.Default
|
||||
severityText = DebugSeverityToText.TryGetValue(severity, out severityText) ? severityText : severity.ToString("X");
|
||||
var messageText = message.ToString();
|
||||
|
||||
return "{0} - GL Debug {1} Output: {2} - {3}\n{4}".F(severityText, sourceText, typeText, messageText, new StackTrace());
|
||||
return $"{severityText} - GL Debug {sourceText} Output: {typeText} - {messageText}\n{new StackTrace()}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Platforms.Default
|
||||
|
||||
context = SDL.SDL_GL_CreateContext(window.Window);
|
||||
if (context == IntPtr.Zero || SDL.SDL_GL_MakeCurrent(window.Window, context) < 0)
|
||||
throw new InvalidOperationException("Can not create OpenGL context. (Error: {0})".F(SDL.SDL_GetError()));
|
||||
throw new InvalidOperationException($"Can not create OpenGL context. (Error: {SDL.SDL_GetError()})");
|
||||
|
||||
OpenGL.Initialize(window.GLProfile == GLProfile.Legacy);
|
||||
OpenGL.CheckGLError();
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace OpenRA.Platforms.Default
|
||||
{
|
||||
surface = SDL.SDL_CreateRGBSurface(0, size.Width, size.Height, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
|
||||
if (surface == IntPtr.Zero)
|
||||
throw new InvalidDataException("Failed to create surface: {0}".F(SDL.SDL_GetError()));
|
||||
throw new InvalidDataException($"Failed to create surface: {SDL.SDL_GetError()}");
|
||||
|
||||
var sur = (SDL.SDL_Surface)Marshal.PtrToStructure(surface, typeof(SDL.SDL_Surface));
|
||||
Marshal.Copy(data, 0, sur.pixels, data.Length);
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Platforms.Default
|
||||
Cursor = SDL.SDL_CreateColorCursor(surface, hotspot.X, hotspot.Y);
|
||||
|
||||
if (Cursor == IntPtr.Zero)
|
||||
throw new Sdl2HardwareCursorException("Failed to create cursor: {0}".F(SDL.SDL_GetError()));
|
||||
throw new Sdl2HardwareCursorException($"Failed to create cursor: {SDL.SDL_GetError()}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -349,7 +349,7 @@ namespace OpenRA.Platforms.Default
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Sdl2HardwareCursorException("Failed to create hardware cursor `{0}` - {1}".F(name, ex.Message), ex);
|
||||
throw new Sdl2HardwareCursorException($"Failed to create hardware cursor `{name}` - {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA.Platforms.Default
|
||||
OpenGL.glGetShaderInfoLog(shader, len, out _, log);
|
||||
|
||||
Log.Write("graphics", "GL Info Log:\n{0}", log.ToString());
|
||||
throw new InvalidProgramException("Compile error in shader object '{0}'".F(filename));
|
||||
throw new InvalidProgramException($"Compile error in shader object '{filename}'");
|
||||
}
|
||||
|
||||
return shader;
|
||||
@@ -106,7 +106,7 @@ namespace OpenRA.Platforms.Default
|
||||
var log = new StringBuilder(len);
|
||||
OpenGL.glGetProgramInfoLog(program, len, out _, log);
|
||||
Log.Write("graphics", "GL Info Log:\n{0}", log.ToString());
|
||||
throw new InvalidProgramException("Link error in shader program '{0}'".F(name));
|
||||
throw new InvalidProgramException($"Link error in shader program '{name}'");
|
||||
}
|
||||
|
||||
OpenGL.glUseProgram(program);
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace OpenRA.Platforms.Default
|
||||
{
|
||||
VerifyThreadAffinity();
|
||||
if (!Exts.IsPowerOf2(width) || !Exts.IsPowerOf2(height))
|
||||
throw new InvalidDataException("Non-power-of-two array {0}x{1}".F(width, height));
|
||||
throw new InvalidDataException($"Non-power-of-two array {width}x{height}");
|
||||
|
||||
Size = new Size(width, height);
|
||||
unsafe
|
||||
@@ -100,7 +100,7 @@ namespace OpenRA.Platforms.Default
|
||||
var height = colors.GetUpperBound(0) + 1;
|
||||
|
||||
if (!Exts.IsPowerOf2(width) || !Exts.IsPowerOf2(height))
|
||||
throw new InvalidDataException("Non-power-of-two array {0}x{1}".F(width, height));
|
||||
throw new InvalidDataException($"Non-power-of-two array {width}x{height}");
|
||||
|
||||
Size = new Size(width, height);
|
||||
unsafe
|
||||
@@ -180,7 +180,7 @@ namespace OpenRA.Platforms.Default
|
||||
{
|
||||
VerifyThreadAffinity();
|
||||
if (!Exts.IsPowerOf2(width) || !Exts.IsPowerOf2(height))
|
||||
throw new InvalidDataException("Non-power-of-two array {0}x{1}".F(width, height));
|
||||
throw new InvalidDataException($"Non-power-of-two array {width}x{height}");
|
||||
|
||||
Size = new Size(width, height);
|
||||
SetData(IntPtr.Zero, width, height);
|
||||
|
||||
Reference in New Issue
Block a user