diff --git a/source/Cosmos.System2_Plugs/System/ConsoleImpl.cs b/source/Cosmos.System2_Plugs/System/ConsoleImpl.cs index 3c6af9d5ce..0d969c2280 100644 --- a/source/Cosmos.System2_Plugs/System/ConsoleImpl.cs +++ b/source/Cosmos.System2_Plugs/System/ConsoleImpl.cs @@ -36,24 +36,22 @@ public static void set_BackgroundColor(ConsoleColor value) public static int get_BufferHeight() { - WriteLine("Not implemented: get_BufferHeight"); - return -1; + throw new NotImplementedException("Not implemented: get_BufferHeight"); } public static void set_BufferHeight(int aHeight) { - WriteLine("Not implemented: set_BufferHeight"); + throw new NotImplementedException("Not implemented: set_BufferHeight"); } public static int get_BufferWidth() { - WriteLine("Not implemented: get_BufferWidth"); - return -1; + throw new NotImplementedException("Not implemented: get_BufferWidth"); } public static void set_BufferWidth(int aWidth) { - WriteLine("Not implemented: set_BufferWidth"); + throw new NotImplementedException("Not implemented: set_BufferWidth"); } public static bool get_CapsLock() @@ -81,13 +79,18 @@ public static void set_CursorLeft(int x) return; } - if (x < get_WindowWidth()) + if (x < 0) + { + throw new ArgumentException("The value x must be at least 0!"); + } + + if (x < get_WindowHeight()) { xConsole.X = x; } else { - WriteLine("x must be lower than the console width!"); + throw new ArgumentException("The value x must be lower than the console width!"); } } @@ -133,13 +136,18 @@ public static void set_CursorTop(int y) return; } + if (y < 0) + { + throw new ArgumentException("The value y must be at least 0!"); + } + if (y < get_WindowHeight()) { xConsole.Y = y; } else { - WriteLine("y must be lower than the console height!"); + throw new ArgumentException("The value y must be lower than the console height!"); } } @@ -216,14 +224,12 @@ public static bool get_KeyAvailable() public static int get_LargestWindowHeight() { - WriteLine("Not implemented: get_LargestWindowHeight"); - return -1; + throw new NotImplementedException("Not implemented: get_LargestWindowHeight"); } public static int get_LargestWindowWidth() { - WriteLine("Not implemented: get_LargestWindowWidth"); - return -1; + throw new NotImplementedException("Not implemented: get_LargestWindowWidth"); } public static bool get_NumberLock() @@ -238,24 +244,22 @@ public static bool get_NumberLock() public static string get_Title() { - WriteLine("Not implemented: get_Title"); - return string.Empty; + throw new NotImplementedException("Not implemented: get_Title"); } public static void set_Title(string value) { - WriteLine("Not implemented: set_Title"); + throw new NotImplementedException("Not implemented: set_Title"); } public static bool get_TreatControlCAsInput() { - WriteLine("Not implemented: get_TreatControlCAsInput"); - return false; + throw new NotImplementedException("Not implemented: get_TreatControlCAsInput"); } public static void set_TreatControlCAsInput(bool value) { - WriteLine("Not implemented: set_TreatControlCAsInput"); + throw new NotImplementedException("Not implemented: set_TreatControlCAsInput"); } public static int get_WindowHeight() @@ -271,29 +275,27 @@ public static int get_WindowHeight() public static void set_WindowHeight(int value) { - WriteLine("Not implemented: set_WindowHeight"); + throw new NotImplementedException("Not implemented: set_WindowHeight"); } public static int get_WindowLeft() { - WriteLine("Not implemented: get_WindowLeft"); - return -1; + throw new NotImplementedException("Not implemented: get_WindowLeft"); } public static void set_WindowLeft(int value) { - WriteLine("Not implemented: set_WindowLeft"); + throw new NotImplementedException("Not implemented: set_WindowLeft"); } public static int get_WindowTop() { - WriteLine("Not implemented: get_WindowTop"); - return -1; + throw new NotImplementedException("Not implemented: get_WindowTop"); } public static void set_WindowTop(int value) { - WriteLine("Not implemented: set_WindowTop"); + throw new NotImplementedException("Not implemented: set_WindowTop"); } public static int get_WindowWidth() @@ -309,7 +311,7 @@ public static int get_WindowWidth() public static void set_WindowWidth(int value) { - WriteLine("Not implemented: set_WindowWidth"); + throw new NotImplementedException("Not implemented: set_WindowWidth"); } /// @@ -361,7 +363,7 @@ public static void Clear() public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, Char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor) { - WriteLine("Not implemented: MoveBufferArea"); + throw new NotImplementedException("Not implemented: MoveBufferArea"); } //public static Stream OpenStandardError() { @@ -540,7 +542,7 @@ public static void ResetColor() public static void SetBufferSize(int width, int height) { - WriteLine("Not implemented: SetBufferSize"); + throw new NotImplementedException("Not implemented: SetBufferSize"); } public static void SetCursorPosition(int left, int top) @@ -563,12 +565,12 @@ public static void SetCursorPosition(int left, int top) public static void SetWindowPosition(int left, int top) { - WriteLine("Not implemented: SetWindowPosition"); + throw new NotImplementedException("Not implemented: SetWindowPosition"); } public static void SetWindowSize(int width, int height) { - WriteLine("Not implemented: SetWindowSize"); + throw new NotImplementedException("Not implemented: SetWindowSize"); } #region Write @@ -659,7 +661,7 @@ public static void Write(char[] aBuffer, int aIndex, int aCount) #endregion -#region WriteLine + #region WriteLine public static void WriteLine() => Write(Environment.NewLine);