diff --git a/src/Consolonia.Core/ApplicationStartup.cs b/src/Consolonia.Core/ApplicationStartup.cs index 6655e6f0..5050f2de 100644 --- a/src/Consolonia.Core/ApplicationStartup.cs +++ b/src/Consolonia.Core/ApplicationStartup.cs @@ -20,7 +20,8 @@ public static class ApplicationStartup StartConsolonia(new DefaultNetConsole(), new EgaConsoleColorMode(), args); } - public static void StartConsolonia(IConsole console, IConsoleColorMode consoleColorMode, params string[] args) where TApp : Application, new() + public static void StartConsolonia(IConsole console, IConsoleColorMode consoleColorMode, + params string[] args) where TApp : Application, new() { ClassicDesktopStyleApplicationLifetime lifetime = BuildLifetime(console, consoleColorMode, args); @@ -56,7 +57,8 @@ public static AppBuilder UseConsolonia(this AppBuilder builder) }, nameof(ConsoloniaRenderInterface)); } - public static ClassicDesktopStyleApplicationLifetime BuildLifetime(IConsole console, IConsoleColorMode consoleColorMode, string[] args) + public static ClassicDesktopStyleApplicationLifetime BuildLifetime(IConsole console, + IConsoleColorMode consoleColorMode, string[] args) where TApp : Application, new() { AppBuilder consoloniaAppBuilder = AppBuilder.Configure() @@ -76,7 +78,7 @@ private static ClassicDesktopStyleApplicationLifetime CreateLifetime(AppBuilder ShutdownMode = ShutdownMode.OnMainWindowClose }; builder.SetupWithLifetime(lifetime); - + return lifetime; } diff --git a/src/Consolonia.Core/Drawing/PixelBufferImplementation/EgaConsoleColor/EgaColorMode.cs b/src/Consolonia.Core/Drawing/PixelBufferImplementation/EgaConsoleColor/EgaColorMode.cs index 70a3927e..477d660b 100644 --- a/src/Consolonia.Core/Drawing/PixelBufferImplementation/EgaConsoleColor/EgaColorMode.cs +++ b/src/Consolonia.Core/Drawing/PixelBufferImplementation/EgaConsoleColor/EgaColorMode.cs @@ -1,4 +1,5 @@ // ReSharper disable once CheckNamespace + namespace Consolonia { public enum EgaColorMode : byte diff --git a/src/Consolonia.Core/Drawing/PixelBufferImplementation/EgaConsoleColor/EgaConsoleColorMode.cs b/src/Consolonia.Core/Drawing/PixelBufferImplementation/EgaConsoleColor/EgaConsoleColorMode.cs index 77098bd9..61971b21 100644 --- a/src/Consolonia.Core/Drawing/PixelBufferImplementation/EgaConsoleColor/EgaConsoleColorMode.cs +++ b/src/Consolonia.Core/Drawing/PixelBufferImplementation/EgaConsoleColor/EgaConsoleColorMode.cs @@ -60,7 +60,7 @@ public void SetAttributes(InputLessDefaultNetConsole console, Color background, (ConsoleColor backgroundConsoleColor, EgaColorMode mode) = ConvertToConsoleColorMode(background); if (mode is not EgaColorMode.Colored) ConsoloniaPlatform.RaiseNotSupported(62144, foreground); - + (ConsoleColor foregroundConsoleColor, _) = ConvertToConsoleColorMode(foreground); //todo: if mode is transparent, don't print foreground. if shaded - shade it @@ -108,7 +108,7 @@ static string GetAnsiCode(ConsoleColor color, bool isBackground) $"\x1b[{(isBackground ? 100 + (ansiCode - 8) : 90 + (ansiCode - 8))}m"; } } - + public static (ConsoleColor, EgaColorMode) ConvertToConsoleColorMode(Color color) { ConsoleColor consoleColor = MapToConsoleColor(color); diff --git a/src/Consolonia.Core/Drawing/PixelBufferImplementation/RgbConsoleColorMode.cs b/src/Consolonia.Core/Drawing/PixelBufferImplementation/RgbConsoleColorMode.cs index dbfe33bd..3af791a2 100644 --- a/src/Consolonia.Core/Drawing/PixelBufferImplementation/RgbConsoleColorMode.cs +++ b/src/Consolonia.Core/Drawing/PixelBufferImplementation/RgbConsoleColorMode.cs @@ -1,4 +1,3 @@ -using System; using System.Text; using Avalonia.Media; using Consolonia.Core.Infrastructure; diff --git a/src/Consolonia.Core/Drawing/RenderTarget.cs b/src/Consolonia.Core/Drawing/RenderTarget.cs index bf9932f6..78a11818 100644 --- a/src/Consolonia.Core/Drawing/RenderTarget.cs +++ b/src/Consolonia.Core/Drawing/RenderTarget.cs @@ -143,7 +143,8 @@ private void RenderToDevice() { _console.SetCaretPosition((PixelBufferCoordinate)caretPosition); _console.WriteText(pixelBuffer.CaretStyle switch - {//todo: may be better to move low level stuff to IConsole + { + //todo: may be better to move low level stuff to IConsole CaretStyle.BlinkingBar => Esc.BlinkingBarCursor, CaretStyle.SteadyBar => Esc.SteadyBarCursor, CaretStyle.BlinkingBlock => Esc.BlinkingBlockCursor, diff --git a/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs b/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs index ac102a43..32959687 100644 --- a/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs +++ b/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs @@ -89,7 +89,7 @@ public void Print(PixelBufferCoordinate bufferPoint, Color background, Color for sb.Clear(); consoleColorMode.SetAttributes(this, background, foreground, weight); - + sb.Append(str); sb.Append(Esc.Reset); diff --git a/src/Consolonia.Gallery/App.cs b/src/Consolonia.Gallery/App.cs index 8824840b..713f99bc 100644 --- a/src/Consolonia.Gallery/App.cs +++ b/src/Consolonia.Gallery/App.cs @@ -21,7 +21,6 @@ public App() Styles.Add(new MaterialTheme()); //todo: automatically switch to turbovision if only 16 colors are supported /*Styles.Add(new TurboVisionTheme());*/ - } } } \ No newline at end of file diff --git a/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryColors.axaml b/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryColors.axaml index f6ad6e94..069b4be1 100644 --- a/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryColors.axaml +++ b/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryColors.axaml @@ -468,26 +468,26 @@ Foreground="YellowGreen" Text="YellowGreen" /> - + + Orientation="Vertical" /> - + diff --git a/src/Consolonia.Gallery/View/ControlsListView.axaml b/src/Consolonia.Gallery/View/ControlsListView.axaml index edd5c113..4e9571ac 100644 --- a/src/Consolonia.Gallery/View/ControlsListView.axaml +++ b/src/Consolonia.Gallery/View/ControlsListView.axaml @@ -32,7 +32,8 @@ IsTabStop="false" SelectedIndex="0" HorizontalContentAlignment="Stretch"> - + diff --git a/src/Consolonia.PlatformSupport/PlatformSupportExtensions.cs b/src/Consolonia.PlatformSupport/PlatformSupportExtensions.cs index 0bb748e0..c78c51ab 100644 --- a/src/Consolonia.PlatformSupport/PlatformSupportExtensions.cs +++ b/src/Consolonia.PlatformSupport/PlatformSupportExtensions.cs @@ -55,7 +55,7 @@ public static AppBuilder UseAutoDetectConsoleColorMode(this AppBuilder builder) result = new EgaConsoleColorMode(); break; } - + return builder.UseConsoleColorMode(result); } } diff --git a/src/Tests/Consolonia.Core.Tests/WithLifetimeFixture/LifetimeSetupFixture.cs b/src/Tests/Consolonia.Core.Tests/WithLifetimeFixture/LifetimeSetupFixture.cs index bc556154..3fb888c2 100644 --- a/src/Tests/Consolonia.Core.Tests/WithLifetimeFixture/LifetimeSetupFixture.cs +++ b/src/Tests/Consolonia.Core.Tests/WithLifetimeFixture/LifetimeSetupFixture.cs @@ -13,16 +13,34 @@ namespace Consolonia.Core.Tests.WithLifetimeFixture [SetUpFixture] public class LifetimeSetupFixture : IDisposable { - private class ContextApp2 : Application; - + private bool _disposedValue; + private ClassicDesktopStyleApplicationLifetime _lifetime; + + private IDisposable _scope; + + // // TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources + // ~DrawingContextImplTests() + // { + // // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method + // Dispose(disposing: false); + // } + + public void Dispose() + { + // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method + Dispose(true); + SuppressFinalize(this); + } + [OneTimeSetUp] public void Setup() { AvaloniaLocator.Current = new AvaloniaLocator() .Bind().ToConstant(new UnitTestConsole(new PixelBufferSize(100, 100))); - + _scope = AvaloniaLocator.EnterScope(); - _lifetime = ApplicationStartup.BuildLifetime(new DummyConsole(), new RgbConsoleColorMode(), []); + _lifetime = ApplicationStartup.BuildLifetime(new DummyConsole(), new RgbConsoleColorMode(), + []); } [OneTimeTearDown] @@ -30,11 +48,7 @@ public void TearDown() { Dispose(); } - - private IDisposable _scope; - private ClassicDesktopStyleApplicationLifetime _lifetime; - private bool _disposedValue; - + protected virtual void Dispose(bool disposing) { if (!_disposedValue) @@ -54,18 +68,6 @@ protected virtual void Dispose(bool disposing) } } - // // TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources - // ~DrawingContextImplTests() - // { - // // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method - // Dispose(disposing: false); - // } - - public void Dispose() - { - // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method - Dispose(true); - SuppressFinalize(this); - } + private class ContextApp2 : Application; } } \ No newline at end of file