More null proofing
This commit is contained in:
parent
f0400a18bb
commit
c5fc9874b1
|
@ -19,6 +19,7 @@
|
||||||
<FileVersion>1.0.0.0</FileVersion>
|
<FileVersion>1.0.0.0</FileVersion>
|
||||||
<VersionSuffix>0.0</VersionSuffix>
|
<VersionSuffix>0.0</VersionSuffix>
|
||||||
<PackageVersion>1.1.$(VersionSuffix)</PackageVersion>
|
<PackageVersion>1.1.$(VersionSuffix)</PackageVersion>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
|
|
@ -30,8 +30,8 @@ namespace CC_Functions.Commandline.TUI
|
||||||
{
|
{
|
||||||
Console.CursorTop = 0;
|
Console.CursorTop = 0;
|
||||||
Console.CursorLeft = 0;
|
Console.CursorLeft = 0;
|
||||||
ConsoleColor fcol = Console.ForegroundColor;
|
ConsoleColor fCol = Console.ForegroundColor;
|
||||||
ConsoleColor bcol = Console.BackgroundColor;
|
ConsoleColor bCol = Console.BackgroundColor;
|
||||||
int width = Width;
|
int width = Width;
|
||||||
int height = Height;
|
int height = Height;
|
||||||
for (int y = 0; y < height; y++)
|
for (int y = 0; y < height; y++)
|
||||||
|
@ -53,8 +53,8 @@ namespace CC_Functions.Commandline.TUI
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.CursorLeft = 0;
|
Console.CursorLeft = 0;
|
||||||
}
|
}
|
||||||
Console.ForegroundColor = fcol;
|
Console.ForegroundColor = fCol;
|
||||||
Console.BackgroundColor = bcol;
|
Console.BackgroundColor = bCol;
|
||||||
_last = Screen;
|
_last = Screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,8 @@ namespace CC_Functions.Commandline.TUI
|
||||||
{
|
{
|
||||||
for (int x = 0; x < width; x++)
|
for (int x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
Pixel tmp1 = Screen[y, x];
|
Pixel? tmp1 = Screen[y, x];
|
||||||
if (color)
|
if (tmp1 != null && color)
|
||||||
{
|
{
|
||||||
if (Console.ForegroundColor != tmp1.ForeColor)
|
if (Console.ForegroundColor != tmp1.ForeColor)
|
||||||
Console.ForegroundColor = tmp1.ForeColor;
|
Console.ForegroundColor = tmp1.ForeColor;
|
||||||
|
@ -84,7 +84,7 @@ namespace CC_Functions.Commandline.TUI
|
||||||
Console.BackgroundColor = tmp1.BackColor;
|
Console.BackgroundColor = tmp1.BackColor;
|
||||||
}
|
}
|
||||||
Console.CursorLeft = x;
|
Console.CursorLeft = x;
|
||||||
Console.Write(tmp1);
|
Console.Write(tmp1 ?? Pixel.Empty);
|
||||||
}
|
}
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.CursorLeft = 0;
|
Console.CursorLeft = 0;
|
||||||
|
|
|
@ -8,6 +8,8 @@ namespace CC_Functions.Commandline.TUI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Pixel
|
public class Pixel
|
||||||
{
|
{
|
||||||
|
public static readonly Pixel Empty = new Pixel();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This pixels background color
|
/// This pixels background color
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Reference in New Issue