├── .dockerignore ├── .gitattributes ├── .gitignore ├── Pathfinding.sln ├── README.md ├── benchmarks └── Pathfinding.Infrastructure.Business.Benchmarks │ ├── Data │ ├── BenchmarkRange.cs │ ├── BenchmarkVertex.cs │ └── Serializable.cs │ ├── HeuristicsBenchmarks.cs │ ├── Pathfinding.Infrastructure.Business.Benchmarks.csproj │ ├── Program.cs │ ├── SerializersBenchmarks.cs │ ├── StepRulesBenchmarks.cs │ └── WaveAlgorithmsBenchmarks.cs ├── src ├── Pathfinding.App.Console │ ├── App.config │ ├── Extensions │ │ ├── AlgorithmExtensions.cs │ │ ├── ExportFormatExtensions.cs │ │ ├── ExportOptionsExtensions.cs │ │ ├── GraphStatusesExtensions.cs │ │ ├── HeuristicsExtensions.cs │ │ ├── MappingExtensions.cs │ │ ├── MessengerExtensions.cs │ │ ├── NeighborhoodsExtensions.cs │ │ ├── RunStatusesExtensions.cs │ │ ├── SmoothLevelsExtensions.cs │ │ └── StepRulesExtensions.cs │ ├── Factories │ │ ├── AlgorithmsFactory.cs │ │ ├── Algos │ │ │ ├── AStarAlgorithmFactory.cs │ │ │ ├── AStarGreedyAlgorithmFactory.cs │ │ │ ├── AStarLeeAlgorithmFactory.cs │ │ │ ├── BidirectAStarAlgorithmFactory.cs │ │ │ ├── BidirectDijkstraAlgorithmFactory.cs │ │ │ ├── BidirectLeeAlgorithmFactory.cs │ │ │ ├── BidirectRandomAlgorithmFactory.cs │ │ │ ├── CostGreedyAlgorithmFactory.cs │ │ │ ├── DepthFirstAlgorithmFactory.cs │ │ │ ├── DepthRandomAlgorithmFactory.cs │ │ │ ├── DijkstraAlgorithmFactory.cs │ │ │ ├── DistanceFirstAlgorithmFactory.cs │ │ │ ├── LeeAlgorithmFactory.cs │ │ │ ├── RandomAlgorithmFactory.cs │ │ │ └── SnakeAlgorithmFactory.cs │ │ ├── HeuristicsFactory.cs │ │ ├── IAlgorithmFactory.cs │ │ ├── IAlgorithmsFactory.cs │ │ ├── IHeuristicsFactory.cs │ │ ├── INeighborhoodLayerFactory.cs │ │ ├── ISmoothLevelFactory.cs │ │ ├── IStepRuleFactory.cs │ │ ├── NeighborhoodLayerFactory.cs │ │ ├── SmoothLevelFactory.cs │ │ └── StepRulesFactory.cs │ ├── GlobalUsings.cs │ ├── Injection │ │ ├── KeyFilters.cs │ │ ├── MetadataKeys.cs │ │ └── Modules.cs │ ├── Messages │ │ ├── IAwaitMessage.cs │ │ ├── Tokens.cs │ │ ├── View │ │ │ ├── CloseHeuristicsViewMessage.cs │ │ │ ├── CloseRunCreateViewMessage.cs │ │ │ ├── CloseRunFieldMessage.cs │ │ │ ├── CloseRunPopulateViewMessage.cs │ │ │ ├── CloseStepRulesViewMessage.cs │ │ │ ├── OpenHeuristicsViewMessage.cs │ │ │ ├── OpenRunFieldMessage.cs │ │ │ ├── OpenRunsPopulateViewMessage.cs │ │ │ └── OpenStepRuleViewMessage.cs │ │ └── ViewModel │ │ │ ├── Requests │ │ │ ├── IsVertexInRangeRequestMessage.cs │ │ │ └── PathfindingRangeRequestMessage.cs │ │ │ └── ValueMessages │ │ │ ├── AwaitGraphActivatedMessage.cs │ │ │ ├── AwaitGraphUpdatedMessage.cs │ │ │ ├── AwaitValueChangedMessage.cs │ │ │ ├── GraphActivatedMessage.cs │ │ │ ├── GraphStateChangedMessage.cs │ │ │ ├── GraphUpdatedMessage.cs │ │ │ ├── GraphsCreatedMessage.cs │ │ │ ├── GraphsDeletedMessage.cs │ │ │ ├── GraphsSelectedMessage.cs │ │ │ ├── ObstaclesCountChangedMessage.cs │ │ │ ├── RunsCreatedMessaged.cs │ │ │ ├── RunsDeletedMessage.cs │ │ │ ├── RunsSelectedMessage.cs │ │ │ └── RunsUpdatedMessage.cs │ ├── Models │ │ ├── ActivatedGraphModel.cs │ │ ├── ExportOptions.cs │ │ ├── GraphInfoModel.cs │ │ ├── GraphVertexModel.cs │ │ ├── RunInfoModel.cs │ │ ├── RunModel.cs │ │ ├── RunVertexModel.cs │ │ ├── StreamFormat.cs │ │ └── StreamModel.cs │ ├── Pathfinding.App.Console.csproj │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── launchSettings.json │ ├── Resources │ │ ├── Resource.Designer.cs │ │ └── Resource.resx │ ├── Settings.Designer.cs │ ├── Settings.settings │ ├── ViewModels │ │ ├── BaseViewModel.cs │ │ ├── GraphAssembleViewModel.cs │ │ ├── GraphCopyViewModel.cs │ │ ├── GraphDeleteViewModel.cs │ │ ├── GraphExportViewModel.cs │ │ ├── GraphFieldViewModel.cs │ │ ├── GraphImportViewModel.cs │ │ ├── GraphTableViewModel.cs │ │ ├── GraphUpdateViewModel.cs │ │ ├── Interface │ │ │ ├── IGraphAssembleViewModel.cs │ │ │ ├── IGraphCopyViewModel.cs │ │ │ ├── IGraphDeleteViewModel.cs │ │ │ ├── IGraphExportViewModel.cs │ │ │ ├── IGraphFieldViewModel.cs │ │ │ ├── IGraphImportViewModel.cs │ │ │ ├── IGraphTableViewModel.cs │ │ │ ├── IRequireGraphNameViewModel.cs │ │ │ ├── IRequireGraphParametresViewModel.cs │ │ │ ├── IRequireHeuristicsViewModel.cs │ │ │ ├── IRequireNeighborhoodNameViewModel.cs │ │ │ ├── IRequirePopulationViewModel.cs │ │ │ ├── IRequireSmoothLevelViewModel.cs │ │ │ ├── IRequireStepRulesViewModel.cs │ │ │ ├── IRunCreateViewModel.cs │ │ │ ├── IRunDeleteViewModel.cs │ │ │ ├── IRunFieldViewModel.cs │ │ │ ├── IRunRangeViewModel.cs │ │ │ ├── IRunUpdateViewModel.cs │ │ │ └── IRunsTableViewModel.cs │ │ ├── RunCreateViewModel.cs │ │ ├── RunDeleteViewModel.cs │ │ ├── RunFieldViewModel.cs │ │ ├── RunRangeViewModel.cs │ │ ├── RunUpdateViewModel.cs │ │ └── RunsTableViewModel.cs │ └── Views │ │ ├── ComponentsPartials │ │ ├── DeleteRunButton.cs │ │ ├── GraphAssembleButton.cs │ │ ├── GraphAssembleView.cs │ │ ├── GraphDeleteButton.cs │ │ ├── GraphExportButton.cs │ │ ├── GraphFieldView.cs │ │ ├── GraphImportView.cs │ │ ├── GraphNameUpdateView.cs │ │ ├── GraphNameView.cs │ │ ├── GraphNeighborhoodUpdateView.cs │ │ ├── GraphNeighborhoodView.cs │ │ ├── GraphPanel.cs │ │ ├── GraphParametresView.cs │ │ ├── GraphSmoothLevelView.cs │ │ ├── GraphTableButtonsFrame.cs │ │ ├── GraphUpdateView.cs │ │ ├── GraphsTableView.cs │ │ ├── RunCreateButton.cs │ │ ├── RunHeuristicsView.cs │ │ ├── RunProgressView.cs │ │ ├── RunStepRulesView.cs │ │ ├── RunsListView.cs │ │ ├── RunsPanel.cs │ │ ├── RunsPopulateView.cs │ │ ├── RunsTableButtonsFrame.cs │ │ └── RunsTableView.cs │ │ ├── GraphAssembleButton.cs │ │ ├── GraphAssembleView.cs │ │ ├── GraphCopyButton.cs │ │ ├── GraphDeleteButton.cs │ │ ├── GraphExportButton.cs │ │ ├── GraphExportOptionsView.cs │ │ ├── GraphFieldView.cs │ │ ├── GraphImportButton.cs │ │ ├── GraphNameUpdateView.cs │ │ ├── GraphNameView.cs │ │ ├── GraphNeighborhoodUpdateView.cs │ │ ├── GraphNeighborhoodView.cs │ │ ├── GraphPanel.cs │ │ ├── GraphParametresView.cs │ │ ├── GraphSmoothLevelView.cs │ │ ├── GraphTableButtonsFrame.cs │ │ ├── GraphUpdateButton.cs │ │ ├── GraphUpdateView.cs │ │ ├── GraphVertexView.cs │ │ ├── GraphsTableView.cs │ │ ├── MainView.cs │ │ ├── MessageBoxLog.cs │ │ ├── RightPanelView.cs │ │ ├── RunCreateButton.cs │ │ ├── RunCreateView.cs │ │ ├── RunDeleteButton.cs │ │ ├── RunFieldView.cs │ │ ├── RunHeuristicsView.cs │ │ ├── RunParametresView.cs │ │ ├── RunProgressView.cs │ │ ├── RunStepRulesView.cs │ │ ├── RunUpdateView.cs │ │ ├── RunVertexView.cs │ │ ├── RunsListView.cs │ │ ├── RunsPanel.cs │ │ ├── RunsPopulateView.cs │ │ ├── RunsTableButtonsFrame.cs │ │ ├── RunsTableView.cs │ │ └── VertexView.cs ├── Pathfinding.Domain.Core │ ├── Entities │ │ ├── Graph.cs │ │ ├── PathfindingRange.cs │ │ ├── Statistics.cs │ │ └── Vertex.cs │ ├── Enums │ │ ├── Algorithms.cs │ │ ├── GraphStatuses.cs │ │ ├── Heuristics.cs │ │ ├── Neighborhoods.cs │ │ ├── RunStatuses.cs │ │ ├── SmoothLevels.cs │ │ └── StepRules.cs │ ├── IEntity.cs │ └── Pathfinding.Domain.Core.csproj ├── Pathfinding.Domain.Interface │ ├── Extensions │ │ └── UnitOfWorkFactoryExtensions.cs │ ├── Factories │ │ ├── IGraphAssemble.cs │ │ └── IUnitOfWorkFactory.cs │ ├── IGraph.cs │ ├── ILayer.cs │ ├── INeighborhood.cs │ ├── IPathfindingRange.cs │ ├── IUnitOfWork.cs │ ├── IVertex.cs │ ├── IVertexCost.cs │ ├── Pathfinding.Domain.Interface.csproj │ └── Repositories │ │ ├── IGraphParametersRepository.cs │ │ ├── IRangeRepository.cs │ │ ├── IStatisticsRepository.cs │ │ └── IVerticesRepository.cs ├── Pathfinding.Infrastructure.Business │ ├── Algorithms │ │ ├── AStarAlgorithm.cs │ │ ├── AStarGreedyAlgorithm.cs │ │ ├── AStarLeeAlgorithm.cs │ │ ├── BidirectAStarAlgorithm.cs │ │ ├── BidirectBreadthFirstAlgorithm.cs │ │ ├── BidirectDijkstraAlgorithm.cs │ │ ├── BidirectLeeAlgorithm.cs │ │ ├── BidirectPathfindingAlgorithm.cs │ │ ├── BidirectRandomAlgorithm.cs │ │ ├── BidirectWaveAlgorithm.cs │ │ ├── BreadthFirstAlgorithm.cs │ │ ├── CostGreedyAlgorithm.cs │ │ ├── DepthAlgorithm.cs │ │ ├── DepthFirstAlgorithm.cs │ │ ├── DepthRandomAlgorithm.cs │ │ ├── DijkstraAlgorithm.cs │ │ ├── DistanceFirstAlgorithm.cs │ │ ├── Events │ │ │ ├── SubPathFoundEventArgs.cs │ │ │ ├── SubPathFoundEventHandler.cs │ │ │ ├── VertexProcessedEventHandler.cs │ │ │ └── VerticesProcessedEventArgs.cs │ │ ├── Exceptions │ │ │ ├── DeadendVertexException.cs │ │ │ └── PathfindingException.cs │ │ ├── GraphPaths │ │ │ ├── BidirectGraphPath.cs │ │ │ ├── CompositeGraphPath.cs │ │ │ ├── GraphPath.cs │ │ │ └── NullGraphPath.cs │ │ ├── GreedyAlgorithm.cs │ │ ├── Heuristics │ │ │ ├── ChebyshevDistance.cs │ │ │ ├── DiagonalDistance.cs │ │ │ ├── Distance.cs │ │ │ ├── EuclideanDistance.cs │ │ │ ├── ManhattanDistance.cs │ │ │ └── WeightedHeuristic.cs │ │ ├── LeeAlgorithm.cs │ │ ├── PathfindingAlgorithm.cs │ │ ├── PathfindingProcess.cs │ │ ├── RandomAlgorithm.cs │ │ ├── SnakeAlgorithm.cs │ │ ├── StepRules │ │ │ ├── DefaultStepRule.cs │ │ │ └── LandscapeStepRule.cs │ │ └── WaveAlgorithm.cs │ ├── Commands │ │ ├── ExcludeSourceVertex.cs │ │ ├── ExcludeTargetVertex.cs │ │ ├── ExcludeTransitVertex.cs │ │ ├── IncludeSourceVertex.cs │ │ ├── IncludeTargetVertex.cs │ │ ├── IncludeTransitVertex.cs │ │ ├── ReplaceIsolatedSourceVertex.cs │ │ ├── ReplaceIsolatedTargetVertex.cs │ │ └── ReplaceTransitIsolatedVertex.cs │ ├── Extensions │ │ ├── EnumerableExtensions.cs │ │ ├── HeuristicsExtensions.cs │ │ ├── LayerExtensions.cs │ │ ├── PriorityQueueExtensions.cs │ │ ├── SimplePriorityQueueExtensions.cs │ │ └── VertexExtensions.cs │ ├── Layers │ │ ├── DiagonalNeighborhoodLayer.cs │ │ ├── KnightsNeighborhoodLayer.cs │ │ ├── Layers.cs │ │ ├── MooreNeighborhoodLayer.cs │ │ ├── NeighborhoodLayer.cs │ │ ├── ObstacleLayer.cs │ │ ├── SmoothLayer.cs │ │ ├── VertexCostLayer.cs │ │ └── VonNeumannNeighborhoodLayer.cs │ ├── MappingExtensions.cs │ ├── Pathfinding.Infrastructure.Business.csproj │ ├── RequestService.cs │ └── Serializers │ │ ├── BinarySerializer.cs │ │ ├── BundleSerializer.cs │ │ ├── Decorators │ │ ├── BufferedSerializer.cs │ │ └── CompressSerializer.cs │ │ ├── Exceptions │ │ └── SerializationException.cs │ │ ├── JsonSerializer.cs │ │ └── XmlSerializer.cs ├── Pathfinding.Infrastructure.Data │ ├── DbTables.cs │ ├── Extensions │ │ ├── CoordinateExtensions.cs │ │ ├── DictionaryExtensions.cs │ │ ├── GraphAssembleExtensions.cs │ │ ├── GraphExtensions.cs │ │ ├── PathfindingRangeExtensions.cs │ │ └── VertexExtension.cs │ ├── InMemory │ │ ├── InMemoryUnitOfWork.cs │ │ ├── InMemoryUnitOfWorkFactory.cs │ │ └── Repositories │ │ │ ├── EntityComparer.cs │ │ │ ├── InMemoryGraphParametersRepository.cs │ │ │ ├── InMemoryRangeRepository.cs │ │ │ ├── InMemoryStatisicsRepository.cs │ │ │ └── InMemoryVerticesRepository.cs │ ├── LiteDb │ │ ├── LiteDbInFileUnitOfWorkFactory.cs │ │ ├── LiteDbInMemoryUnitOfWorkFactory.cs │ │ ├── LiteDbUnitOfWork.cs │ │ └── Repositories │ │ │ ├── LiteDbGraphRepository.cs │ │ │ ├── LiteDbRangeRepository.cs │ │ │ ├── LiteDbStatisticsRepository.cs │ │ │ └── LiteDbVerticesRepository.cs │ ├── Pathfinding.Infrastructure.Data.csproj │ ├── Pathfinding │ │ ├── Graph.cs │ │ ├── GraphAssemble.cs │ │ ├── Neighborhoods │ │ │ ├── DiagonalNeighborhood.cs │ │ │ ├── KnightsNeighborhood.cs │ │ │ ├── MooreNeighborhood.cs │ │ │ ├── Neighborhood.cs │ │ │ └── VonNeumannNeighborhood.cs │ │ ├── NullCost.cs │ │ ├── NullPathfindingVertex.cs │ │ └── VertexCost.cs │ └── Sqlite │ │ ├── Repositories │ │ ├── SqliteGraphRepository.cs │ │ ├── SqliteRangeRepository.cs │ │ ├── SqliteRepository.cs │ │ ├── SqliteStatisticsRepository.cs │ │ └── SqliteVerticesRepository.cs │ │ ├── SqliteUnitOfWork.cs │ │ └── SqliteUnitOfWorkFactory.cs ├── Pathfinding.Logging │ ├── Interface │ │ └── ILog.cs │ ├── Loggers │ │ ├── FileLog.cs │ │ └── Logs.cs │ └── Pathfinding.Logging.csproj ├── Pathfinding.Service.Interface │ ├── Extensions │ │ ├── PathfindingRangeCommandExtensions.cs │ │ ├── StreamReaderExtensions.cs │ │ ├── StreamWriterExtensions.cs │ │ ├── XmlReaderExtensions.cs │ │ ├── XmlWriterExtensions.cs │ │ └── ZipArchiveExtensions.cs │ ├── IAlgorithm.cs │ ├── IBinarySerializable.cs │ ├── IBundleSerializable.cs │ ├── IGraphPath.cs │ ├── IHeuristic.cs │ ├── IPathfindingRangeCommand.cs │ ├── IPathfindingVertex.cs │ ├── IRequestService.cs │ ├── ISerializer.cs │ ├── IStepRule.cs │ ├── Models │ │ ├── IAlgorithmBuildInfo.cs │ │ ├── Read │ │ │ ├── GraphInformationModel.cs │ │ │ ├── GraphModel.cs │ │ │ ├── PathfindingHistoryModel.cs │ │ │ └── PathfindingRangeModel.cs │ │ ├── Serialization │ │ │ ├── Csv │ │ │ │ ├── CsvHistory.cs │ │ │ │ ├── CsvMappings.cs │ │ │ │ ├── CsvRange.cs │ │ │ │ ├── CsvStatistics.cs │ │ │ │ ├── CsvVertex.cs │ │ │ │ └── CvsGraph.cs │ │ │ ├── GraphSerializationModel.cs │ │ │ ├── PathfindingHistoriesSerializationModel.cs │ │ │ ├── PathfindingHistorySerializationModel.cs │ │ │ ├── RunStatisticsSerializationModel.cs │ │ │ └── VertexSerializationModel.cs │ │ └── Undefined │ │ │ ├── CoordinateModel.cs │ │ │ ├── RunStatisticsModel.cs │ │ │ └── VertexCostModel.cs │ ├── Pathfinding.Service.Interface.csproj │ └── Requests │ │ ├── Create │ │ ├── CreateGraphRequest.cs │ │ └── CreateStatisticsRequest.cs │ │ └── Update │ │ └── UpdateVerticesRequest.cs └── Pathfinding.Shared │ ├── BlackWhole.cs │ ├── Exceptions │ └── SingletonException.cs │ ├── Extensions │ ├── ComparableExtensions.cs │ ├── EnumerableExtension.cs │ ├── GenericExtensions.cs │ └── InclusiveValueRangeExtensions.cs │ ├── Interface │ └── ICloneable.cs │ ├── Pathfinding.Shared.csproj │ └── Primitives │ ├── Coordinate.cs │ ├── InclusiveValueRange.cs │ ├── ReturnOptions.cs │ └── Singleton.cs └── tests ├── Pathfinding.App.Console.Tests ├── Generators.cs ├── IsAnyToken.cs ├── Pathfinding.App.Console.Tests.csproj └── ViewModelTests │ ├── DeleteGraphViewModelTests.cs │ ├── DeleteRunViewModelTests.cs │ ├── GraphAssembleViewModelTests.cs │ ├── GraphCopyViewModelTests.cs │ ├── GraphExportViewModelTests.cs │ ├── GraphTableViewModelTests.cs │ └── RunTableViewModelTests.cs └── Pathfinding.Infrastructure.Business.Tests ├── FakeVertex.cs ├── Pathfinding.Infrastructure.Business.Tests.csproj └── RequestServiceTests.cs /.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md 26 | !**/.gitignore 27 | !.git/HEAD 28 | !.git/config 29 | !.git/packed-refs 30 | !.git/refs/heads/** -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /benchmarks/Pathfinding.Infrastructure.Business.Benchmarks/Data/BenchmarkVertex.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Interface; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Shared.Primitives; 4 | using System.Runtime.CompilerServices; 5 | 6 | namespace Pathfinding.Infrastructure.Business.Benchmarks.Data; 7 | 8 | internal sealed class BenchmarkVertex : IVertex, IPathfindingVertex 9 | { 10 | public bool IsObstacle { get; set; } 11 | 12 | public IVertexCost Cost { get; set; } 13 | 14 | public Coordinate Position { get; set; } 15 | 16 | public BenchmarkVertex[] Neighbors { get; private set; } 17 | = Array.Empty(); 18 | 19 | IReadOnlyCollection IPathfindingVertex.Neighbors => Neighbors; 20 | 21 | IReadOnlyCollection IVertex.Neighbors 22 | { 23 | get => Neighbors; 24 | set => Neighbors = value.Cast().ToArray(); 25 | } 26 | 27 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 28 | public override bool Equals(object obj) 29 | { 30 | return obj is BenchmarkVertex vert && Equals(vert); 31 | } 32 | 33 | public bool Equals(IVertex other) 34 | { 35 | throw new System.NotImplementedException(); 36 | } 37 | 38 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 39 | public override int GetHashCode() 40 | { 41 | return Position.GetHashCode(); 42 | } 43 | } -------------------------------------------------------------------------------- /benchmarks/Pathfinding.Infrastructure.Business.Benchmarks/HeuristicsBenchmarks.cs: -------------------------------------------------------------------------------- 1 | using BenchmarkDotNet.Attributes; 2 | using Pathfinding.Infrastructure.Business.Algorithms.Heuristics; 3 | using Pathfinding.Infrastructure.Business.Benchmarks.Data; 4 | using Pathfinding.Shared.Primitives; 5 | 6 | namespace Pathfinding.Infrastructure.Business.Benchmarks; 7 | 8 | public class HeuristicsBenchmarks 9 | { 10 | private static BenchmarkVertex first; 11 | private static BenchmarkVertex second; 12 | 13 | [GlobalSetup] 14 | public static void Setup() 15 | { 16 | first = new BenchmarkVertex() { Position = new Coordinate(2, 4) }; 17 | second = new BenchmarkVertex() { Position = new Coordinate(7, 11) }; 18 | } 19 | 20 | [Benchmark] 21 | public static void ChebyshevDistanceBenchmark() 22 | { 23 | var chebyshev = new ChebyshevDistance(); 24 | 25 | chebyshev.Calculate(first, second); 26 | } 27 | 28 | [Benchmark(Baseline = true)] 29 | public static void ManhattanDistanceBenchmark() 30 | { 31 | var chebyshev = new ManhattanDistance(); 32 | 33 | chebyshev.Calculate(first, second); 34 | } 35 | 36 | [Benchmark] 37 | public static void EuclidianDistanceBenchmark() 38 | { 39 | var chebyshev = new EuclideanDistance(); 40 | 41 | chebyshev.Calculate(first, second); 42 | } 43 | } -------------------------------------------------------------------------------- /benchmarks/Pathfinding.Infrastructure.Business.Benchmarks/Pathfinding.Infrastructure.Business.Benchmarks.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | disable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /benchmarks/Pathfinding.Infrastructure.Business.Benchmarks/Program.cs: -------------------------------------------------------------------------------- 1 | using BenchmarkDotNet.Running; 2 | using Pathfinding.Infrastructure.Business.Benchmarks; 3 | 4 | BenchmarkRunner.Run(); 5 | //BenchmarkRunner.Run(); 6 | //BenchmarkRunner.Run(); 7 | //BenchmarkRunner.Run(); 8 | -------------------------------------------------------------------------------- /benchmarks/Pathfinding.Infrastructure.Business.Benchmarks/StepRulesBenchmarks.cs: -------------------------------------------------------------------------------- 1 | using BenchmarkDotNet.Attributes; 2 | using Pathfinding.Infrastructure.Business.Algorithms.StepRules; 3 | using Pathfinding.Infrastructure.Business.Benchmarks.Data; 4 | using Pathfinding.Infrastructure.Data.Pathfinding; 5 | using Pathfinding.Shared.Primitives; 6 | 7 | namespace Pathfinding.Infrastructure.Business.Benchmarks; 8 | 9 | public class StepRulesBenchmarks 10 | { 11 | private static BenchmarkVertex first; 12 | private static BenchmarkVertex second; 13 | 14 | [GlobalSetup] 15 | public void Setup() 16 | { 17 | var range = new InclusiveValueRange(9, 1); 18 | first = new BenchmarkVertex() 19 | { 20 | Position = new Coordinate(2, 3), 21 | Cost = new VertexCost(3, range) 22 | }; 23 | second = new BenchmarkVertex() 24 | { 25 | Position = new Coordinate(12, 45), 26 | Cost = new VertexCost(6, range) 27 | }; 28 | } 29 | 30 | [Benchmark(Baseline = true)] 31 | public void DefaultStepRuleBenchmark() 32 | { 33 | var stepRule = new DefaultStepRule(); 34 | 35 | stepRule.CalculateStepCost(first, second); 36 | } 37 | 38 | [Benchmark] 39 | public void LandscapeStepRuleBenchmark() 40 | { 41 | var stepRule = new LandscapeStepRule(); 42 | 43 | stepRule.CalculateStepCost(first, second); 44 | } 45 | } -------------------------------------------------------------------------------- /benchmarks/Pathfinding.Infrastructure.Business.Benchmarks/WaveAlgorithmsBenchmarks.cs: -------------------------------------------------------------------------------- 1 | using BenchmarkDotNet.Attributes; 2 | using Pathfinding.Infrastructure.Business.Algorithms; 3 | using Pathfinding.Infrastructure.Business.Benchmarks.Data; 4 | 5 | namespace Pathfinding.Infrastructure.Business.Benchmarks; 6 | 7 | [MemoryDiagnoser] 8 | public class WaveAlgorithmsBenchmarks 9 | { 10 | private static List range; 11 | 12 | [GlobalSetup] 13 | public static void Setup() 14 | { 15 | range = [.. BenchmarkRange.Interface]; 16 | } 17 | 18 | [Benchmark(Baseline = true)] 19 | public static void DijkstraAlgorithmBenchmark() 20 | { 21 | var algorithm = new DijkstraAlgorithm(range); 22 | 23 | algorithm.FindPath(); 24 | } 25 | 26 | [Benchmark] 27 | public static void BidirectDijkstraAlgorithmBenchmark() 28 | { 29 | var algorithm = new BidirectDijkstraAlgorithm(range); 30 | 31 | algorithm.FindPath(); 32 | } 33 | 34 | [Benchmark] 35 | public static void BidirectAStarDijkstraAlgorithmBenchmark() 36 | { 37 | var algorithm = new BidirectAStarAlgorithm(range); 38 | 39 | algorithm.FindPath(); 40 | } 41 | 42 | 43 | [Benchmark] 44 | public static void AStarAlgorithmBenchmark() 45 | { 46 | var algorithm = new AStarAlgorithm(range); 47 | 48 | algorithm.FindPath(); 49 | } 50 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Extensions/AlgorithmExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | using Pathfinding.Domain.Core.Enums; 3 | 4 | namespace Pathfinding.App.Console.Extensions; 5 | 6 | internal static class AlgorithmExtensions 7 | { 8 | public static string ToStringRepresentation(this Algorithms algorithm) 9 | { 10 | return algorithm switch 11 | { 12 | Algorithms.Dijkstra => Resource.Dijkstra, 13 | Algorithms.BidirectDijkstra => Resource.BidirectDijkstra, 14 | Algorithms.AStar => Resource.AStar, 15 | Algorithms.BidirectAStar => Resource.BidirectAStar, 16 | Algorithms.Lee => Resource.Lee, 17 | Algorithms.BidirectLee => Resource.BidirectLee, 18 | Algorithms.AStarLee => Resource.AStarLee, 19 | Algorithms.DistanceFirst => Resource.DistanceFirst, 20 | Algorithms.CostGreedy => Resource.CostGreedy, 21 | Algorithms.AStarGreedy => Resource.AStarGreedy, 22 | Algorithms.DepthFirst => Resource.DepthFirst, 23 | Algorithms.Snake => Resource.Snake, 24 | Algorithms.Random => Resource.RandomAlgorithm, 25 | Algorithms.BidirectRandom => Resource.BidirectRandom, 26 | Algorithms.DepthFirstRandom => Resource.DepthRandom, 27 | _ => string.Empty 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Extensions/ExportFormatExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Models; 2 | 3 | namespace Pathfinding.App.Console.Extensions; 4 | 5 | internal static class ExportFormatExtensions 6 | { 7 | public static string ToExtensionRepresentation(this StreamFormat exportFormat) 8 | { 9 | return exportFormat switch 10 | { 11 | StreamFormat.Binary => ".dat", 12 | StreamFormat.Json => ".json", 13 | StreamFormat.Xml => ".xml", 14 | StreamFormat.Csv => ".zip", 15 | _ => string.Empty 16 | }; 17 | } 18 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Extensions/ExportOptionsExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Models; 2 | using Pathfinding.App.Console.Resources; 3 | 4 | namespace Pathfinding.App.Console.Extensions; 5 | 6 | internal static class ExportOptionsExtensions 7 | { 8 | public static string ToStringRepresentation(this ExportOptions options) 9 | { 10 | return options switch 11 | { 12 | ExportOptions.GraphOnly => Resource.GraphOnly, 13 | ExportOptions.WithRange => Resource.WithRange, 14 | ExportOptions.WithRuns => Resource.WithRuns, 15 | _ => string.Empty 16 | }; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Extensions/GraphStatusesExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | using Pathfinding.Domain.Core.Enums; 3 | 4 | namespace Pathfinding.App.Console.Extensions; 5 | 6 | internal static class GraphStatusesExtensions 7 | { 8 | public static string ToStringRepresentation(this GraphStatuses status) 9 | { 10 | return status switch 11 | { 12 | GraphStatuses.Editable => Resource.Editable, 13 | GraphStatuses.Readonly => Resource.Readonly, 14 | _ => string.Empty 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Extensions/HeuristicsExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | using Pathfinding.Domain.Core.Enums; 3 | 4 | namespace Pathfinding.App.Console.Extensions; 5 | 6 | internal static class HeuristicsExtensions 7 | { 8 | public static string ToStringRepresentation(this Heuristics heuristics) 9 | { 10 | return heuristics switch 11 | { 12 | Heuristics.Euclidean => Resource.Euclidian, 13 | Heuristics.Chebyshev => Resource.Chebyshev, 14 | Heuristics.Diagonal => Resource.Diagonal, 15 | Heuristics.Manhattan => Resource.Manhattan, 16 | _ => string.Empty 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Extensions/MessengerExtensions.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging; 2 | using Pathfinding.App.Console.Messages; 3 | 4 | // ReSharper disable AsyncVoidLambda 5 | 6 | namespace Pathfinding.App.Console.Extensions; 7 | 8 | internal static class MessengerExtensions 9 | { 10 | public static void RegisterAwaitHandler(this IMessenger messenger, 11 | object recipient, TToken token, Func handler) 12 | where TMessage : class, IAwaitMessage 13 | where TToken : IEquatable 14 | { 15 | messenger.Register(recipient, token, 16 | async (r, msg) => 17 | { 18 | await handler(r, msg).ConfigureAwait(false); 19 | msg.SetCompleted(); 20 | }); 21 | } 22 | 23 | public static void RegisterAsyncHandler(this IMessenger messenger, 24 | object recipient, Func handler) 25 | where TMessage : class 26 | { 27 | messenger.Register(recipient, async (r, msg) 28 | => await handler(r, msg).ConfigureAwait(false)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Extensions/NeighborhoodsExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | using Pathfinding.Domain.Core.Enums; 3 | 4 | namespace Pathfinding.App.Console.Extensions; 5 | 6 | internal static class NeighborhoodsExtensions 7 | { 8 | public static string ToStringRepresentation(this Neighborhoods neighborhood) 9 | { 10 | return neighborhood switch 11 | { 12 | Neighborhoods.Moore => Resource.Moore, 13 | Neighborhoods.VonNeumann => Resource.VonNeumann, 14 | Neighborhoods.Diagonal => Resource.DiagonalNeighborhood, 15 | Neighborhoods.Knight => Resource.Knight, 16 | _ => string.Empty 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Extensions/RunStatusesExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | using Pathfinding.Domain.Core.Enums; 3 | 4 | namespace Pathfinding.App.Console.Extensions; 5 | 6 | internal static class RunStatusesExtensions 7 | { 8 | public static string ToStringRepresentation(this RunStatuses statuses) 9 | { 10 | return statuses switch 11 | { 12 | RunStatuses.Success => Resource.Success, 13 | RunStatuses.Failure => Resource.Failure, 14 | _ => string.Empty, 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Extensions/SmoothLevelsExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | using Pathfinding.Domain.Core.Enums; 3 | 4 | namespace Pathfinding.App.Console.Extensions; 5 | 6 | internal static class SmoothLevelsExtensions 7 | { 8 | public static string ToStringRepresentation(this SmoothLevels level) 9 | { 10 | return level switch 11 | { 12 | SmoothLevels.No => Resource.No, 13 | SmoothLevels.Low => Resource.Low, 14 | SmoothLevels.Medium => Resource.Medium, 15 | SmoothLevels.High => Resource.High, 16 | SmoothLevels.Extreme => Resource.Extreme, 17 | _ => string.Empty, 18 | }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Extensions/StepRulesExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | using Pathfinding.Domain.Core.Enums; 3 | 4 | namespace Pathfinding.App.Console.Extensions; 5 | 6 | internal static class StepRulesExtensions 7 | { 8 | public static string ToStringRepresentation(this StepRules stepRules) 9 | { 10 | return stepRules switch 11 | { 12 | StepRules.Default => Resource.Default, 13 | StepRules.Landscape => Resource.Landscape, 14 | _ => string.Empty, 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/AlgorithmsFactory.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Features.Metadata; 2 | using Pathfinding.App.Console.Injection; 3 | using Pathfinding.Domain.Core.Enums; 4 | using Pathfinding.Infrastructure.Business.Algorithms; 5 | 6 | namespace Pathfinding.App.Console.Factories; 7 | 8 | internal sealed class AlgorithmsFactory : IAlgorithmsFactory 9 | { 10 | private readonly Dictionary> algorithms; 11 | 12 | public IReadOnlyCollection Allowed { get; } 13 | 14 | public AlgorithmsFactory(Meta>[] algorithms) 15 | { 16 | this.algorithms = algorithms.ToDictionary( 17 | x => (Algorithms)x.Metadata[MetadataKeys.Algorithm], 18 | x => x.Value); 19 | Allowed = [.. algorithms.OrderBy(x => x.Metadata[MetadataKeys.Order]) 20 | .Select(x => (Algorithms)x.Metadata[MetadataKeys.Algorithm])]; 21 | } 22 | 23 | public IAlgorithmFactory GetAlgorithmFactory(Algorithms algorithm) 24 | { 25 | if (algorithms.TryGetValue(algorithm, out var value)) 26 | { 27 | return value; 28 | } 29 | 30 | throw new KeyNotFoundException($"{algorithm} was not found"); 31 | } 32 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/AStarAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class AStarAlgorithmFactory( 8 | IStepRuleFactory stepRuleFactory, 9 | IHeuristicsFactory heuristicFactory) 10 | : IAlgorithmFactory 11 | { 12 | public AStarAlgorithm CreateAlgorithm( 13 | IReadOnlyCollection range, 14 | IAlgorithmBuildInfo info) 15 | { 16 | ArgumentNullException.ThrowIfNull(info.Heuristics, nameof(info.Heuristics)); 17 | ArgumentNullException.ThrowIfNull(info.Weight, nameof(info.Weight)); 18 | ArgumentNullException.ThrowIfNull(info.StepRule, nameof(info.StepRule)); 19 | 20 | var heuristics = heuristicFactory.CreateHeuristic(info.Heuristics.Value, info.Weight.Value); 21 | var stepRule = stepRuleFactory.CreateStepRule(info.StepRule.Value); 22 | return new(range, stepRule, heuristics); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/AStarGreedyAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class AStarGreedyAlgorithmFactory( 8 | IStepRuleFactory stepRuleFactory, 9 | IHeuristicsFactory heuristicFactory) 10 | : IAlgorithmFactory 11 | { 12 | public AStarGreedyAlgorithm CreateAlgorithm( 13 | IReadOnlyCollection range, 14 | IAlgorithmBuildInfo info) 15 | { 16 | ArgumentNullException.ThrowIfNull(info.Heuristics, nameof(info.Heuristics)); 17 | ArgumentNullException.ThrowIfNull(info.Weight, nameof(info.Weight)); 18 | ArgumentNullException.ThrowIfNull(info.StepRule, nameof(info.StepRule)); 19 | 20 | var heuristics = heuristicFactory.CreateHeuristic(info.Heuristics.Value, info.Weight.Value); 21 | var stepRule = stepRuleFactory.CreateStepRule(info.StepRule.Value); 22 | return new(range, heuristics, stepRule); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/AStarLeeAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class AStarLeeAlgorithmFactory( 8 | IHeuristicsFactory heuristicsFactory) 9 | : IAlgorithmFactory 10 | { 11 | public AStarLeeAlgorithm CreateAlgorithm( 12 | IReadOnlyCollection range, 13 | IAlgorithmBuildInfo info) 14 | { 15 | ArgumentNullException.ThrowIfNull(info.Heuristics, nameof(info.Heuristics)); 16 | ArgumentNullException.ThrowIfNull(info.Weight, nameof(info.Weight)); 17 | 18 | var heuristics = heuristicsFactory.CreateHeuristic(info.Heuristics.Value, info.Weight.Value); 19 | return new(range, heuristics); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/BidirectAStarAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class BidirectAStarAlgorithmFactory( 8 | IStepRuleFactory stepRuleFactory, 9 | IHeuristicsFactory heuristicFactory) 10 | : IAlgorithmFactory 11 | { 12 | public BidirectAStarAlgorithm CreateAlgorithm( 13 | IReadOnlyCollection range, 14 | IAlgorithmBuildInfo info) 15 | { 16 | ArgumentNullException.ThrowIfNull(info.Heuristics, nameof(info.Heuristics)); 17 | ArgumentNullException.ThrowIfNull(info.Weight, nameof(info.Weight)); 18 | ArgumentNullException.ThrowIfNull(info.StepRule, nameof(info.StepRule)); 19 | 20 | var heuristics = heuristicFactory.CreateHeuristic(info.Heuristics.Value, info.Weight.Value); 21 | var stepRule = stepRuleFactory.CreateStepRule(info.StepRule.Value); 22 | return new(range, stepRule, heuristics); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/BidirectDijkstraAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class BidirectDijkstraAlgorithmFactory(IStepRuleFactory stepRuleFactory) : IAlgorithmFactory 8 | { 9 | public BidirectDijkstraAlgorithm CreateAlgorithm( 10 | IReadOnlyCollection range, 11 | IAlgorithmBuildInfo info) 12 | { 13 | ArgumentNullException.ThrowIfNull(info.StepRule, nameof(info.StepRule)); 14 | var stepRule = stepRuleFactory.CreateStepRule(info.StepRule.Value); 15 | return new(range, stepRule); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/BidirectLeeAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class BidirectLeeAlgorithmFactory : IAlgorithmFactory 8 | { 9 | public BidirectLeeAlgorithm CreateAlgorithm( 10 | IReadOnlyCollection range, 11 | IAlgorithmBuildInfo info) 12 | { 13 | return new(range); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/BidirectRandomAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class BidirectRandomAlgorithmFactory 8 | : IAlgorithmFactory 9 | { 10 | public BidirectRandomAlgorithm CreateAlgorithm( 11 | IReadOnlyCollection range, 12 | IAlgorithmBuildInfo info) 13 | { 14 | return new(range); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/CostGreedyAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class CostGreedyAlgorithmFactory( 8 | IStepRuleFactory stepRuleFactory) 9 | : IAlgorithmFactory 10 | { 11 | public CostGreedyAlgorithm CreateAlgorithm( 12 | IReadOnlyCollection range, 13 | IAlgorithmBuildInfo info) 14 | { 15 | ArgumentNullException.ThrowIfNull(info.StepRule, nameof(info.StepRule)); 16 | 17 | var stepRule = stepRuleFactory.CreateStepRule(info.StepRule.Value); 18 | return new(range, stepRule); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/DepthFirstAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class DepthFirstAlgorithmFactory 8 | : IAlgorithmFactory 9 | { 10 | public DepthFirstAlgorithm CreateAlgorithm( 11 | IReadOnlyCollection range, 12 | IAlgorithmBuildInfo info) 13 | { 14 | return new(range); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/DepthRandomAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | internal sealed class DepthRandomAlgorithmFactory 8 | : IAlgorithmFactory 9 | { 10 | public DepthRandomAlgorithm CreateAlgorithm( 11 | IReadOnlyCollection range, 12 | IAlgorithmBuildInfo info) 13 | { 14 | return new(range); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/DijkstraAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class DijkstraAlgorithmFactory(IStepRuleFactory stepRuleFactory) 8 | : IAlgorithmFactory 9 | { 10 | public DijkstraAlgorithm CreateAlgorithm( 11 | IReadOnlyCollection range, 12 | IAlgorithmBuildInfo info) 13 | { 14 | ArgumentNullException.ThrowIfNull(info.StepRule, nameof(info.StepRule)); 15 | 16 | var stepRule = stepRuleFactory.CreateStepRule(info.StepRule.Value); 17 | return new(range, stepRule); 18 | } 19 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/DistanceFirstAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class DistanceFirstAlgorithmFactory( 8 | IHeuristicsFactory heuristicsFactory) 9 | : IAlgorithmFactory 10 | { 11 | public DistanceFirstAlgorithm CreateAlgorithm( 12 | IReadOnlyCollection range, 13 | IAlgorithmBuildInfo info) 14 | { 15 | ArgumentNullException.ThrowIfNull(info.Heuristics, nameof(info.Heuristics)); 16 | ArgumentNullException.ThrowIfNull(info.Weight, nameof(info.Weight)); 17 | 18 | var heuristics = heuristicsFactory.CreateHeuristic(info.Heuristics.Value, info.Weight.Value); 19 | return new(range, heuristics); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/LeeAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class LeeAlgorithmFactory : IAlgorithmFactory 8 | { 9 | public LeeAlgorithm CreateAlgorithm( 10 | IReadOnlyCollection range, 11 | IAlgorithmBuildInfo info) 12 | { 13 | return new(range); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/RandomAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class RandomAlgorithmFactory : IAlgorithmFactory 8 | { 9 | public RandomAlgorithm CreateAlgorithm( 10 | IReadOnlyCollection range, 11 | IAlgorithmBuildInfo info) 12 | { 13 | return new(range); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/Algos/SnakeAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Infrastructure.Business.Algorithms; 2 | using Pathfinding.Service.Interface; 3 | using Pathfinding.Service.Interface.Models; 4 | 5 | namespace Pathfinding.App.Console.Factories.Algos; 6 | 7 | public sealed class SnakeAlgorithmFactory 8 | : IAlgorithmFactory 9 | { 10 | public SnakeAlgorithm CreateAlgorithm( 11 | IReadOnlyCollection range, 12 | IAlgorithmBuildInfo info) 13 | { 14 | return new(range); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/HeuristicsFactory.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Features.Metadata; 2 | using Pathfinding.App.Console.Injection; 3 | using Pathfinding.Infrastructure.Business.Extensions; 4 | using Pathfinding.Service.Interface; 5 | using Heuristic = Pathfinding.Domain.Core.Enums.Heuristics; 6 | 7 | namespace Pathfinding.App.Console.Factories; 8 | 9 | public sealed class HeuristicsFactory : IHeuristicsFactory 10 | { 11 | private readonly Dictionary heuristics; 12 | 13 | public IReadOnlyCollection Allowed => heuristics.Keys; 14 | 15 | public HeuristicsFactory(IEnumerable> heuristics) 16 | { 17 | this.heuristics = heuristics.ToDictionary(x => (Heuristic)x.Metadata[MetadataKeys.Heuristics], x => x.Value); 18 | } 19 | 20 | public IHeuristic CreateHeuristic(Heuristic heuristic, double weight) 21 | { 22 | if (heuristics.TryGetValue(heuristic, out var value)) 23 | { 24 | return value.WithWeight(weight); 25 | } 26 | 27 | throw new KeyNotFoundException($"{heuristic} was not found"); 28 | } 29 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/IAlgorithmFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Service.Interface; 2 | using Pathfinding.Service.Interface.Models; 3 | using Pathfinding.Shared.Primitives; 4 | 5 | namespace Pathfinding.App.Console.Factories; 6 | 7 | public interface IAlgorithmFactory where T 8 | : IAlgorithm> 9 | { 10 | T CreateAlgorithm( 11 | IReadOnlyCollection range, 12 | IAlgorithmBuildInfo info); 13 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/IAlgorithmsFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | using Pathfinding.Infrastructure.Business.Algorithms; 3 | 4 | namespace Pathfinding.App.Console.Factories; 5 | 6 | public interface IAlgorithmsFactory 7 | { 8 | IReadOnlyCollection Allowed { get; } 9 | 10 | IAlgorithmFactory GetAlgorithmFactory(Algorithms algorithm); 11 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/IHeuristicsFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | using Pathfinding.Service.Interface; 3 | 4 | namespace Pathfinding.App.Console.Factories; 5 | 6 | public interface IHeuristicsFactory 7 | { 8 | IReadOnlyCollection Allowed { get; } 9 | 10 | IHeuristic CreateHeuristic(Heuristics heuristics, double weight); 11 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/INeighborhoodLayerFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | using Pathfinding.Domain.Interface; 3 | 4 | namespace Pathfinding.App.Console.Factories; 5 | 6 | public interface INeighborhoodLayerFactory 7 | { 8 | IReadOnlyCollection Allowed { get; } 9 | 10 | ILayer CreateNeighborhoodLayer(Neighborhoods neighborhoods); 11 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/ISmoothLevelFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | using Pathfinding.Infrastructure.Business.Layers; 3 | 4 | namespace Pathfinding.App.Console.Factories; 5 | 6 | internal interface ISmoothLevelFactory 7 | { 8 | IReadOnlyCollection Allowed { get; } 9 | 10 | SmoothLayer CreateLayer(SmoothLevels level); 11 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/IStepRuleFactory.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | using Pathfinding.Service.Interface; 3 | 4 | namespace Pathfinding.App.Console.Factories; 5 | 6 | public interface IStepRuleFactory 7 | { 8 | IStepRule CreateStepRule(StepRules stepRule); 9 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/NeighborhoodLayerFactory.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Features.AttributeFilters; 2 | using Autofac.Features.Metadata; 3 | using Pathfinding.App.Console.Injection; 4 | using Pathfinding.Domain.Core.Enums; 5 | using Pathfinding.Domain.Interface; 6 | 7 | namespace Pathfinding.App.Console.Factories; 8 | 9 | public sealed class NeighborhoodLayerFactory : INeighborhoodLayerFactory 10 | { 11 | private readonly Dictionary layers; 12 | 13 | public IReadOnlyCollection Allowed => layers.Keys; 14 | 15 | public NeighborhoodLayerFactory( 16 | [KeyFilter(KeyFilters.Neighborhoods)] Meta[] layers) 17 | { 18 | this.layers = layers.ToDictionary(x => (Neighborhoods)x.Metadata[MetadataKeys.Neighborhoods], x => x.Value); 19 | } 20 | 21 | public ILayer CreateNeighborhoodLayer(Neighborhoods neighborhoods) 22 | { 23 | if (layers.TryGetValue(neighborhoods, out var value)) 24 | { 25 | return value; 26 | } 27 | 28 | throw new KeyNotFoundException($"{neighborhoods} was not found"); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/SmoothLevelFactory.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Features.Metadata; 2 | using Pathfinding.App.Console.Injection; 3 | using Pathfinding.Domain.Core.Enums; 4 | using Pathfinding.Infrastructure.Business.Layers; 5 | 6 | namespace Pathfinding.App.Console.Factories; 7 | 8 | internal sealed class SmoothLevelFactory : ISmoothLevelFactory 9 | { 10 | private readonly Dictionary layers; 11 | 12 | public IReadOnlyCollection Allowed => layers.Keys; 13 | 14 | public SmoothLevelFactory(Meta[] layers) 15 | { 16 | this.layers = layers.ToDictionary( 17 | x => (SmoothLevels)x.Metadata[MetadataKeys.SmoothLevels], 18 | x => x.Value); 19 | } 20 | 21 | public SmoothLayer CreateLayer(SmoothLevels level) 22 | { 23 | if (layers.TryGetValue(level, out var value)) 24 | { 25 | return value; 26 | } 27 | 28 | throw new KeyNotFoundException($"{level} was not found"); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Factories/StepRulesFactory.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Features.Metadata; 2 | using Pathfinding.App.Console.Injection; 3 | using Pathfinding.Domain.Core.Enums; 4 | using Pathfinding.Service.Interface; 5 | 6 | namespace Pathfinding.App.Console.Factories; 7 | 8 | public sealed class StepRulesFactory : IStepRuleFactory 9 | { 10 | private readonly Dictionary stepRules; 11 | 12 | public StepRulesFactory(IEnumerable> stepRules) 13 | { 14 | this.stepRules = stepRules.ToDictionary(x => (StepRules)x.Metadata[MetadataKeys.StepRule], x => x.Value); 15 | } 16 | 17 | public IStepRule CreateStepRule(StepRules stepRule) 18 | { 19 | if (stepRules.TryGetValue(stepRule, out var value)) 20 | { 21 | return value; 22 | } 23 | 24 | throw new KeyNotFoundException($"{stepRule} was not found"); 25 | } 26 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Command = Pathfinding.Service.Interface.IPathfindingRangeCommand; 2 | global using Serializer = Pathfinding.Service.Interface.ISerializer; -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Injection/KeyFilters.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Injection; 2 | 3 | internal static class KeyFilters 4 | { 5 | public const string RightPanel = nameof(RightPanel); 6 | public const string MainWindow = nameof(MainWindow); 7 | public const string GraphTableButtons = nameof(GraphTableButtons); 8 | public const string GraphPanel = nameof(GraphPanel); 9 | public const string Views = nameof(Views); 10 | public const string ViewModels = nameof(ViewModels); 11 | public const string GraphAssembleView = nameof(GraphAssembleView); 12 | public const string GraphUpdateView = nameof(GraphUpdateView); 13 | public const string RunsPanel = nameof(RunsPanel); 14 | public const string IncludeCommands = nameof(IncludeCommands); 15 | public const string ExcludeCommands = nameof(ExcludeCommands); 16 | public const string RunButtonsFrame = nameof(RunButtonsFrame); 17 | public const string RunCreateView = nameof(RunCreateView); 18 | public const string RunParametersView = nameof(RunParametersView); 19 | public const string Compress = nameof(Compress); 20 | public const string Neighborhoods = nameof(Neighborhoods); 21 | public const string SmoothLevels = nameof(SmoothLevels); 22 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Injection/MetadataKeys.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Injection; 2 | 3 | internal static class MetadataKeys 4 | { 5 | public const string ExportFormat = "ExportFormat"; 6 | public const string Order = "Order"; 7 | public const string Algorithm = "Algorithm"; 8 | public const string StepRule = "StepRule"; 9 | public const string Heuristics = "Heuristics"; 10 | public const string Neighborhoods = "Neighborhoods"; 11 | public const string SmoothLevels = "SmoothLevels"; 12 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/IAwaitMessage.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | namespace Pathfinding.App.Console.Messages; 4 | 5 | internal interface IAwaitMessage 6 | { 7 | TaskAwaiter GetAwaiter(); 8 | 9 | void SetCompleted(); 10 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/Tokens.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Messages; 2 | 3 | internal static class Tokens 4 | { 5 | public const int GraphField = 1; 6 | public const int PathfindingRange = 2; 7 | public const int GraphTable = 3; 8 | public const int AlgorithmUpdate = 4; 9 | public const int RunsTable = 5; 10 | } 11 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/View/CloseHeuristicsViewMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Messages.View; 2 | 3 | internal sealed record CloseHeuristicsViewMessage; -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/View/CloseRunCreateViewMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Messages.View; 2 | 3 | internal sealed record CloseRunCreateViewMessage; -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/View/CloseRunFieldMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Messages.View; 2 | 3 | internal sealed record CloseRunFieldMessage; -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/View/CloseRunPopulateViewMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Messages.View; 2 | 3 | internal sealed record CloseRunPopulateViewMessage; -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/View/CloseStepRulesViewMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Messages.View; 2 | 3 | internal sealed record CloseStepRulesViewMessage; -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/View/OpenHeuristicsViewMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Messages.View; 2 | 3 | internal sealed record OpenHeuristicsViewMessage; -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/View/OpenRunFieldMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Messages.View; 2 | 3 | internal sealed record OpenRunFieldMessage; -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/View/OpenRunsPopulateViewMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Messages.View; 2 | 3 | internal sealed record OpenRunsPopulateViewMessage; -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/View/OpenStepRuleViewMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Messages.View; 2 | 3 | internal sealed record OpenStepRuleViewMessage; -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/Requests/IsVertexInRangeRequestMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | using Pathfinding.App.Console.Models; 3 | 4 | namespace Pathfinding.App.Console.Messages.ViewModel.Requests; 5 | 6 | internal sealed class IsVertexInRangeRequestMessage(GraphVertexModel vertex) 7 | : RequestMessage 8 | { 9 | public GraphVertexModel Vertex { get; } = vertex; 10 | } 11 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/Requests/PathfindingRangeRequestMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | using Pathfinding.App.Console.Models; 3 | 4 | namespace Pathfinding.App.Console.Messages.ViewModel.Requests; 5 | 6 | internal sealed class PathfindingRangeRequestMessage 7 | : RequestMessage; 8 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/AwaitGraphActivatedMessage.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Models; 2 | 3 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 4 | 5 | internal sealed class AwaitGraphActivatedMessage(ActivatedGraphModel model) 6 | : AwaitValueChangedMessage(model); -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/AwaitGraphUpdatedMessage.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Service.Interface.Models.Read; 2 | 3 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 4 | 5 | internal sealed class AwaitGraphUpdatedMessage(GraphInformationModel model) 6 | : AwaitValueChangedMessage(model); -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/AwaitValueChangedMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | using System.Runtime.CompilerServices; 3 | 4 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 5 | 6 | internal abstract class AwaitValueChangedMessage(T payload) 7 | : ValueChangedMessage(payload), IAwaitMessage 8 | { 9 | private readonly TaskCompletionSource source = new(); 10 | 11 | public TaskAwaiter GetAwaiter() 12 | { 13 | return source.Task.GetAwaiter(); 14 | } 15 | 16 | public void SetCompleted() 17 | { 18 | source.TrySetResult(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/GraphActivatedMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | using Pathfinding.App.Console.Models; 3 | 4 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 5 | 6 | internal sealed class GraphActivatedMessage(ActivatedGraphModel models) 7 | : ValueChangedMessage(models); -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/GraphStateChangedMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | using Pathfinding.Domain.Core.Enums; 3 | 4 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 5 | 6 | internal sealed class GraphStateChangedMessage((int Id, GraphStatuses Status) state) 7 | : ValueChangedMessage<(int Id, GraphStatuses Status)>(state); -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/GraphUpdatedMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | using Pathfinding.Service.Interface.Models.Read; 3 | 4 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 5 | 6 | internal sealed class GraphUpdatedMessage(GraphInformationModel model) 7 | : ValueChangedMessage(model); -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/GraphsCreatedMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | using Pathfinding.App.Console.Models; 3 | 4 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 5 | 6 | internal sealed class GraphsCreatedMessage(GraphInfoModel[] models) 7 | : ValueChangedMessage(models); -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/GraphsDeletedMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | 3 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 4 | 5 | internal sealed class GraphsDeletedMessage(int[] graphsIds) 6 | : ValueChangedMessage(graphsIds); -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/GraphsSelectedMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | using Pathfinding.App.Console.Models; 3 | 4 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 5 | 6 | internal sealed class GraphsSelectedMessage(GraphInfoModel[] graphs) 7 | : ValueChangedMessage(graphs); -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/ObstaclesCountChangedMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | 3 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 4 | 5 | internal sealed class ObstaclesCountChangedMessage((int GraphId, int Delta) count) 6 | : ValueChangedMessage<(int GraphId, int Delta)>(count); 7 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/RunsCreatedMessaged.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | using Pathfinding.Service.Interface.Models.Undefined; 3 | 4 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 5 | 6 | internal sealed class RunsCreatedMessaged(RunStatisticsModel[] models) 7 | : ValueChangedMessage(models); 8 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/RunsDeletedMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | 3 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 4 | 5 | internal sealed class RunsDeletedMessage(int[] runIds) 6 | : ValueChangedMessage(runIds); 7 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/RunsSelectedMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | using Pathfinding.App.Console.Models; 3 | 4 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 5 | 6 | internal sealed class RunsSelectedMessage(RunInfoModel[] selectedRuns) 7 | : ValueChangedMessage(selectedRuns); 8 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Messages/ViewModel/ValueMessages/RunsUpdatedMessage.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Messaging.Messages; 2 | using Pathfinding.Service.Interface.Models.Undefined; 3 | 4 | namespace Pathfinding.App.Console.Messages.ViewModel.ValueMessages; 5 | 6 | internal sealed class RunsUpdatedMessage(RunStatisticsModel[] updated) 7 | : ValueChangedMessage(updated); 8 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Models/ActivatedGraphModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | using Pathfinding.Infrastructure.Data.Pathfinding; 3 | 4 | namespace Pathfinding.App.Console.Models; 5 | 6 | internal record ActivatedGraphModel( 7 | Graph Graph, 8 | Neighborhoods Neighborhood, 9 | SmoothLevels SmoothLevel, 10 | GraphStatuses Status, 11 | int GraphId); -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Models/ExportOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Models; 2 | 3 | internal enum ExportOptions { GraphOnly, WithRange, WithRuns } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Models/RunInfoModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | using Pathfinding.Service.Interface.Models; 3 | using ReactiveUI; 4 | 5 | namespace Pathfinding.App.Console.Models; 6 | 7 | internal sealed class RunInfoModel : ReactiveObject, IAlgorithmBuildInfo 8 | { 9 | public int Id { get; init; } 10 | 11 | public int GraphId { get; init; } 12 | 13 | public Algorithms Algorithm { get; init; } 14 | 15 | private int visited; 16 | public int Visited 17 | { 18 | get => visited; 19 | set => this.RaiseAndSetIfChanged(ref visited, value); 20 | } 21 | 22 | private int steps; 23 | public int Steps 24 | { 25 | get => steps; 26 | set => this.RaiseAndSetIfChanged(ref steps, value); 27 | } 28 | 29 | private double cost; 30 | public double Cost 31 | { 32 | get => cost; 33 | set => this.RaiseAndSetIfChanged(ref cost, value); 34 | } 35 | 36 | private TimeSpan elapsed; 37 | public TimeSpan Elapsed 38 | { 39 | get => elapsed; 40 | set => this.RaiseAndSetIfChanged(ref elapsed, value); 41 | } 42 | 43 | public StepRules? StepRule { get; init; } 44 | 45 | public Heuristics? Heuristics { get; init; } 46 | 47 | public double? Weight { get; init; } 48 | 49 | private RunStatuses status; 50 | public RunStatuses ResultStatus 51 | { 52 | get => status; 53 | set => this.RaiseAndSetIfChanged(ref status, value); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Models/StreamFormat.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Models; 2 | 3 | internal enum StreamFormat { Binary, Json, Xml, Csv } 4 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Models/StreamModel.cs: -------------------------------------------------------------------------------- 1 | using System.Reactive.Disposables; 2 | 3 | namespace Pathfinding.App.Console.Models; 4 | 5 | internal class StreamModel(Stream stream, 6 | StreamFormat? format = null, 7 | params IDisposable[] disposables) : IDisposable, IAsyncDisposable 8 | { 9 | public static readonly StreamModel Empty = new(Stream.Null); 10 | 11 | private readonly CompositeDisposable disposables = [.. disposables.Append(stream)]; 12 | 13 | public Stream Stream { get; } = stream; 14 | 15 | public StreamFormat? Format { get; } = format; 16 | 17 | public bool IsEmpty => Stream == Stream.Null || !Format.HasValue; 18 | 19 | public void Dispose() 20 | { 21 | disposables.Dispose(); 22 | } 23 | 24 | public async ValueTask DisposeAsync() 25 | { 26 | foreach (var disposable in disposables) 27 | { 28 | if (disposable is IAsyncDisposable async) 29 | { 30 | await async.DisposeAsync(); 31 | } 32 | else 33 | { 34 | disposable.Dispose(); 35 | } 36 | } 37 | disposables.Dispose(); 38 | } 39 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Program.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Pathfinding.App.Console.Injection; 3 | using Pathfinding.App.Console.Views; 4 | using Terminal.Gui; 5 | 6 | Application.Init(); 7 | await using var scope = Modules.Build(); 8 | using var main = scope.Resolve(); 9 | Application.Top.Add(main); 10 | Application.Run(_ => true); -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Pathfinding.App.Console.Tests")] 4 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Pathfinding.App.Console": { 4 | "commandName": "Project" 5 | }, 6 | "Container (Dockerfile)": { 7 | "commandName": "Docker" 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/BaseViewModel.cs: -------------------------------------------------------------------------------- 1 | using ReactiveUI; 2 | 3 | namespace Pathfinding.App.Console.ViewModels; 4 | 5 | internal abstract class BaseViewModel : ReactiveObject 6 | { 7 | protected static async Task ExecuteSafe(Func action, Action log) 8 | { 9 | try 10 | { 11 | await action().ConfigureAwait(false); 12 | } 13 | catch (Exception ex) 14 | { 15 | log(ex, ex.Message); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IGraphAssembleViewModel.cs: -------------------------------------------------------------------------------- 1 | using ReactiveUI; 2 | using System.Reactive; 3 | 4 | namespace Pathfinding.App.Console.ViewModels.Interface; 5 | 6 | internal interface IGraphAssembleViewModel 7 | { 8 | ReactiveCommand AssembleGraphCommand { get; } 9 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IGraphCopyViewModel.cs: -------------------------------------------------------------------------------- 1 | using ReactiveUI; 2 | using System.Reactive; 3 | 4 | namespace Pathfinding.App.Console.ViewModels.Interface; 5 | 6 | internal interface IGraphCopyViewModel 7 | { 8 | ReactiveCommand CopyGraphCommand { get; } 9 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IGraphDeleteViewModel.cs: -------------------------------------------------------------------------------- 1 | using ReactiveUI; 2 | using System.Reactive; 3 | 4 | namespace Pathfinding.App.Console.ViewModels.Interface; 5 | 6 | internal interface IGraphDeleteViewModel 7 | { 8 | ReactiveCommand DeleteGraphCommand { get; } 9 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IGraphExportViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Models; 2 | using ReactiveUI; 3 | using System.Reactive; 4 | 5 | namespace Pathfinding.App.Console.ViewModels.Interface; 6 | 7 | internal interface IGraphExportViewModel 8 | { 9 | ExportOptions Options { get; set; } 10 | 11 | IReadOnlyList AllowedOptions { get; } 12 | 13 | IReadOnlyCollection StreamFormats { get; } 14 | 15 | ReactiveCommand, Unit> ExportGraphCommand { get; } 16 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IGraphFieldViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Models; 2 | using Pathfinding.Domain.Interface; 3 | using ReactiveUI; 4 | using System.Reactive; 5 | 6 | namespace Pathfinding.App.Console.ViewModels.Interface; 7 | 8 | internal interface IGraphFieldViewModel 9 | { 10 | IGraph Graph { get; } 11 | 12 | ReactiveCommand ChangeVertexPolarityCommand { get; } 13 | 14 | ReactiveCommand DecreaseVertexCostCommand { get; } 15 | 16 | ReactiveCommand IncreaseVertexCostCommand { get; } 17 | 18 | ReactiveCommand ReverseVertexCommand { get; } 19 | 20 | ReactiveCommand InverseVertexCommand { get; } 21 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IGraphImportViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Models; 2 | using ReactiveUI; 3 | using System.Reactive; 4 | 5 | namespace Pathfinding.App.Console.ViewModels.Interface; 6 | 7 | internal interface IGraphImportViewModel 8 | { 9 | IReadOnlyCollection StreamFormats { get; } 10 | 11 | ReactiveCommand, Unit> ImportGraphCommand { get; } 12 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IGraphTableViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Models; 2 | using ReactiveUI; 3 | using System.Collections.ObjectModel; 4 | using System.Reactive; 5 | 6 | namespace Pathfinding.App.Console.ViewModels.Interface; 7 | 8 | internal interface IGraphTableViewModel 9 | { 10 | ObservableCollection Graphs { get; } 11 | 12 | ReactiveCommand ActivateGraphCommand { get; } 13 | 14 | ReactiveCommand SelectGraphsCommand { get; } 15 | 16 | ReactiveCommand LoadGraphsCommand { get; } 17 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRequireGraphNameViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.ViewModels.Interface; 2 | 3 | internal interface IRequireGraphNameViewModel 4 | { 5 | string Name { get; set; } 6 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRequireGraphParametresViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Pathfinding.App.Console.ViewModels.Interface; 4 | 5 | internal interface IRequireGraphParametresViewModel 6 | { 7 | event PropertyChangedEventHandler PropertyChanged; 8 | 9 | public int Width { get; set; } 10 | 11 | public int Length { get; set; } 12 | 13 | public int Obstacles { get; set; } 14 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRequireHeuristicsViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | using System.Collections.ObjectModel; 3 | 4 | namespace Pathfinding.App.Console.ViewModels.Interface; 5 | 6 | internal interface IRequireHeuristicsViewModel 7 | { 8 | IReadOnlyCollection AllowedHeuristics { get; } 9 | 10 | ObservableCollection AppliedHeuristics { get; } 11 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRequireNeighborhoodNameViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | 3 | namespace Pathfinding.App.Console.ViewModels.Interface; 4 | 5 | internal interface IRequireNeighborhoodNameViewModel 6 | { 7 | Neighborhoods Neighborhood { get; set; } 8 | 9 | IReadOnlyCollection AllowedNeighborhoods { get; } 10 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRequirePopulationViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Pathfinding.App.Console.ViewModels.Interface; 4 | 5 | internal interface IRequirePopulationViewModel 6 | { 7 | event PropertyChangedEventHandler PropertyChanged; 8 | 9 | double? FromWeight { get; set; } 10 | 11 | double? ToWeight { get; set; } 12 | 13 | double? Step { get; set; } 14 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRequireSmoothLevelViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | 3 | namespace Pathfinding.App.Console.ViewModels.Interface; 4 | 5 | internal interface IRequireSmoothLevelViewModel 6 | { 7 | SmoothLevels SmoothLevel { get; set; } 8 | 9 | IReadOnlyCollection AllowedLevels { get; } 10 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRequireStepRulesViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | 3 | namespace Pathfinding.App.Console.ViewModels.Interface; 4 | 5 | internal interface IRequireStepRuleViewModel 6 | { 7 | StepRules? StepRule { get; set; } 8 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRunCreateViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.Domain.Core.Enums; 2 | using ReactiveUI; 3 | using System.Reactive; 4 | 5 | namespace Pathfinding.App.Console.ViewModels.Interface; 6 | 7 | internal interface IRunCreateViewModel 8 | { 9 | Algorithms? Algorithm { get; set; } 10 | 11 | IReadOnlyCollection AllowedAlgorithms { get; } 12 | 13 | ReactiveCommand CreateRunCommand { get; } 14 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRunDeleteViewModel.cs: -------------------------------------------------------------------------------- 1 | using ReactiveUI; 2 | using System.Reactive; 3 | 4 | namespace Pathfinding.App.Console.ViewModels.Interface; 5 | 6 | internal interface IRunDeleteViewModel 7 | { 8 | ReactiveCommand DeleteRunsCommand { get; } 9 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRunFieldViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Models; 2 | using Pathfinding.Domain.Interface; 3 | 4 | namespace Pathfinding.App.Console.ViewModels.Interface; 5 | 6 | internal interface IRunFieldViewModel 7 | { 8 | RunModel SelectedRun { get; set; } 9 | 10 | IGraph RunGraph { get; } 11 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRunRangeViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Models; 2 | using ReactiveUI; 3 | using System.Reactive; 4 | 5 | namespace Pathfinding.App.Console.ViewModels.Interface; 6 | 7 | internal interface IRunRangeViewModel 8 | { 9 | ReactiveCommand AddToRangeCommand { get; } 10 | 11 | ReactiveCommand RemoveFromRangeCommand { get; } 12 | 13 | ReactiveCommand DeletePathfindingRange { get; } 14 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRunUpdateViewModel.cs: -------------------------------------------------------------------------------- 1 | using ReactiveUI; 2 | using System.Reactive; 3 | 4 | namespace Pathfinding.App.Console.ViewModels.Interface; 5 | 6 | internal interface IRunUpdateViewModel 7 | { 8 | ReactiveCommand UpdateRunsCommand { get; } 9 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/ViewModels/Interface/IRunsTableViewModel.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Models; 2 | using ReactiveUI; 3 | using System.Collections.ObjectModel; 4 | using System.Reactive; 5 | 6 | namespace Pathfinding.App.Console.ViewModels.Interface; 7 | 8 | internal interface IRunsTableViewModel 9 | { 10 | ObservableCollection Runs { get; } 11 | 12 | ReactiveCommand SelectRunsCommand { get; } 13 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/DeleteRunButton.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class RunDeleteButton 6 | { 7 | private void Initialize() 8 | { 9 | Text = "Delete"; 10 | X = Pos.Percent(66); 11 | Y = 0; 12 | Width = Dim.Percent(34); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphAssembleButton.cs: -------------------------------------------------------------------------------- 1 | namespace Pathfinding.App.Console.Views; 2 | 3 | internal sealed partial class GraphAssembleButton 4 | { 5 | private void Initialize() 6 | { 7 | Text = "New"; 8 | } 9 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphAssembleView.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class GraphAssembleView 6 | { 7 | private readonly Button createButton = new("Create"); 8 | private readonly Button cancelButton = new("Cancel"); 9 | private readonly FrameView buttonsFrame = new(); 10 | 11 | private void Initialize() 12 | { 13 | buttonsFrame.Border = new() 14 | { 15 | BorderStyle = BorderStyle.Rounded 16 | }; 17 | buttonsFrame.X = 0; 18 | buttonsFrame.Y = Pos.Percent(90); 19 | buttonsFrame.Width = Dim.Fill(); 20 | buttonsFrame.Height = Dim.Fill(); 21 | X = Pos.Center(); 22 | Y = Pos.Center(); 23 | Width = Dim.Fill(); 24 | Height = Dim.Fill(); 25 | Visible = false; 26 | Border = new Border() 27 | { 28 | BorderStyle = BorderStyle.None, 29 | BorderThickness = new Thickness(0) 30 | }; 31 | 32 | cancelButton.X = Pos.Percent(65); 33 | cancelButton.Y = 0; 34 | createButton.X = Pos.Percent(15); 35 | createButton.Y = 0; 36 | buttonsFrame.Add(createButton, cancelButton); 37 | Add(buttonsFrame); 38 | } 39 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphDeleteButton.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class GraphDeleteButton 6 | { 7 | private void Initialize() 8 | { 9 | Text = Resource.DeleteGraph; 10 | } 11 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphExportButton.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | using Terminal.Gui; 3 | 4 | namespace Pathfinding.App.Console.Views; 5 | 6 | internal sealed partial class GraphExportButton : Button 7 | { 8 | private void Initialize() 9 | { 10 | Text = Resource.Save; 11 | } 12 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphFieldView.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | using Terminal.Gui; 3 | 4 | namespace Pathfinding.App.Console.Views; 5 | 6 | internal sealed partial class GraphFieldView 7 | { 8 | private void Initialize() 9 | { 10 | X = 0; 11 | Y = 0; 12 | Width = Dim.Percent(66); 13 | Height = Dim.Percent(95); 14 | Border = new Border() 15 | { 16 | BorderBrush = Color.BrightYellow, 17 | BorderStyle = BorderStyle.Rounded, 18 | Title = Resource.GraphField 19 | }; 20 | } 21 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphImportView.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class GraphImportButton 6 | { 7 | private void Initialize() 8 | { 9 | Text = Resource.Load; 10 | } 11 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphNameUpdateView.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class GraphNameUpdateView 6 | { 7 | private readonly TextField nameField = new TextField(); 8 | private readonly Label nameLabel = new Label("Name"); 9 | 10 | private void Initialize() 11 | { 12 | X = 1; 13 | Y = 1; 14 | Height = Dim.Percent(15, true); 15 | Width = Dim.Fill(3); 16 | Border = new Border() 17 | { 18 | BorderStyle = BorderStyle.None, 19 | Padding = new Thickness(0) 20 | }; 21 | 22 | nameLabel.X = 1; 23 | nameLabel.Y = 1; 24 | nameLabel.Width = Dim.Percent(15); 25 | 26 | nameField.X = Pos.Percent(15) + 1; 27 | nameField.Y = 1; 28 | nameField.Width = Dim.Fill(); 29 | 30 | Add(nameField, nameLabel); 31 | } 32 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphNameView.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class GraphNameView 6 | { 7 | private readonly TextField nameField = new TextField(); 8 | private readonly Label nameLabel = new Label("Name"); 9 | 10 | private void Initialize() 11 | { 12 | X = 1; 13 | Y = 1; 14 | Height = Dim.Percent(15, true); 15 | Width = Dim.Fill(3); 16 | Border = new Border() 17 | { 18 | BorderStyle = BorderStyle.None, 19 | Padding = new Thickness(0) 20 | }; 21 | 22 | nameLabel.X = 1; 23 | nameLabel.Y = 1; 24 | nameLabel.Width = Dim.Percent(15); 25 | 26 | nameField.X = Pos.Percent(15) + 1; 27 | nameField.Y = 1; 28 | nameField.Width = Dim.Fill(); 29 | 30 | Add(nameField, nameLabel); 31 | } 32 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphNeighborhoodUpdateView.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class GraphNeighborhoodUpdateView 6 | { 7 | private readonly RadioGroup neighborhoods = new(); 8 | 9 | private void Initialize() 10 | { 11 | X = Pos.Percent(33); 12 | Y = Pos.Percent(33); 13 | Width = Dim.Percent(25); 14 | Height = Dim.Percent(25); 15 | Border = new Border() 16 | { 17 | BorderStyle = BorderStyle.Rounded, 18 | Padding = new Thickness(0), 19 | Title = "Neighbors" 20 | }; 21 | neighborhoods.X = 1; 22 | neighborhoods.Y = 1; 23 | Add(neighborhoods); 24 | } 25 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphNeighborhoodView.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class GraphNeighborhoodView 6 | { 7 | private readonly RadioGroup neighborhoods = new(); 8 | 9 | private void Initialize() 10 | { 11 | X = Pos.Percent(35) + 1; 12 | Y = Pos.Percent(25) + 1; 13 | Width = Dim.Percent(35); 14 | Height = Dim.Percent(40); 15 | Border = new Border() 16 | { 17 | BorderStyle = BorderStyle.Rounded, 18 | Padding = new Thickness(0), 19 | Title = "Neighbors" 20 | }; 21 | neighborhoods.X = 1; 22 | neighborhoods.Y = 1; 23 | Add(neighborhoods); 24 | } 25 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphPanel.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class GraphPanel : FrameView 6 | { 7 | private void Initialize() 8 | { 9 | X = 0; 10 | Y = Pos.Percent(0); 11 | Width = Dim.Fill(); 12 | Height = Dim.Percent(50); 13 | Border = new Border() 14 | { 15 | BorderStyle = BorderStyle.Rounded, 16 | BorderBrush = Color.Brown, 17 | Padding = new Thickness(1, 0, 1, 0), 18 | Title = "Graphs" 19 | }; 20 | } 21 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphSmoothLevelView.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class GraphSmoothLevelView 6 | { 7 | private readonly RadioGroup smoothLevels = new(); 8 | 9 | private void Initialize() 10 | { 11 | X = Pos.Percent(70) + 1; 12 | Y = Pos.Percent(25) + 1; 13 | Width = Dim.Fill(1); 14 | Height = Dim.Percent(40); 15 | Border = new Border() 16 | { 17 | BorderStyle = BorderStyle.Rounded, 18 | Padding = new Thickness(0), 19 | Title = "Smooth" 20 | }; 21 | 22 | smoothLevels.X = 1; 23 | smoothLevels.Y = 1; 24 | Add(smoothLevels); 25 | } 26 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphTableButtonsFrame.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class GraphTableButtonsFrame 6 | { 7 | private void Initialize() 8 | { 9 | Border = new () 10 | { 11 | BorderStyle = BorderStyle.Rounded, 12 | DrawMarginFrame = false, 13 | Padding = new (0) 14 | }; 15 | X = 0; 16 | Y = Pos.Percent(90); 17 | Width = Dim.Fill(); 18 | Height = Dim.Percent(15); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/GraphUpdateView.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class GraphUpdateView 6 | { 7 | private readonly Button updateButton = new("Update"); 8 | private readonly Button cancelButton = new("Cancel"); 9 | 10 | private void Initialize() 11 | { 12 | X = Pos.Center(); 13 | Y = Pos.Center(); 14 | Width = Dim.Fill(); 15 | Height = Dim.Fill(); 16 | Visible = false; 17 | Border = new Border() 18 | { 19 | BorderStyle = BorderStyle.None, 20 | BorderThickness = new Thickness(0) 21 | }; 22 | 23 | updateButton.X = Pos.Percent(35); 24 | updateButton.Y = Pos.Percent(85) + 1; 25 | cancelButton.X = Pos.Right(updateButton) + 2; 26 | cancelButton.Y = Pos.Percent(85) + 1; 27 | Add(updateButton, cancelButton); 28 | } 29 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/RunCreateButton.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal partial class RunCreateButton 6 | { 7 | private void Initialize() 8 | { 9 | Text = "New"; 10 | X = Pos.Percent(0); 11 | Y = 0; 12 | Width = Dim.Percent(33); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/RunHeuristicsView.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class RunHeuristicsView : FrameView 6 | { 7 | private void Initialize() 8 | { 9 | X = 0; 10 | Y = Pos.Percent(20) + 1; 11 | Height = Dim.Percent(35); 12 | Width = Dim.Percent(30); 13 | Border = new Border() 14 | { 15 | BorderStyle = BorderStyle.Rounded, 16 | Title = "Heuristics" 17 | }; 18 | Visible = false; 19 | } 20 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/RunStepRulesView.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal partial class RunStepRulesView 6 | { 7 | private readonly RadioGroup stepRules = new(); 8 | 9 | private void Initialize() 10 | { 11 | stepRules.X = 1; 12 | stepRules.Y = 0; 13 | X = 0; 14 | Y = 1; 15 | Height = Dim.Percent(20); 16 | Width = Dim.Percent(30); 17 | Border = new Border() 18 | { 19 | BorderStyle = BorderStyle.Rounded, 20 | Title = "Step rules" 21 | }; 22 | Visible = false; 23 | Add(stepRules); 24 | } 25 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/RunsListView.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | using Terminal.Gui; 3 | 4 | namespace Pathfinding.App.Console.Views; 5 | 6 | internal partial class RunsListView 7 | { 8 | private readonly ListView runList = new(); 9 | 10 | private void Initialize() 11 | { 12 | runList.X = 0; 13 | runList.Y = 0; 14 | runList.Width = Dim.Fill(); 15 | runList.Height = Dim.Fill(); 16 | X = 0; 17 | Y = 1; 18 | Width = Dim.Percent(25); 19 | Height = Dim.Percent(80); 20 | Border = new Border() 21 | { 22 | BorderStyle = BorderStyle.Rounded, 23 | Title = Resource.Algorithms, 24 | BorderThickness = new Thickness(0) 25 | }; 26 | Add(runList); 27 | } 28 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/RunsPanel.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal sealed partial class RunsPanel 6 | { 7 | private void Initialize() 8 | { 9 | X = 0; 10 | Y = Pos.Percent(50); 11 | Width = Dim.Fill(); 12 | Height = Dim.Fill(); 13 | Border = new Border() 14 | { 15 | BorderStyle = BorderStyle.Rounded, 16 | Padding = new Thickness(1, 0, 1, 0), 17 | BorderBrush = Color.BrightCyan, 18 | Title = "Runs" 19 | }; 20 | } 21 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/ComponentsPartials/RunsTableButtonsFrame.cs: -------------------------------------------------------------------------------- 1 | using Terminal.Gui; 2 | 3 | namespace Pathfinding.App.Console.Views; 4 | 5 | internal partial class RunsTableButtonsFrame 6 | { 7 | private void Initialize() 8 | { 9 | Border = new Border() 10 | { 11 | BorderStyle = BorderStyle.Rounded, 12 | DrawMarginFrame = false, 13 | Padding = new Thickness(0) 14 | }; 15 | X = 0; 16 | Y = Pos.Percent(90); 17 | Width = Dim.Fill(); 18 | Height = Dim.Fill(); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/GraphAssembleButton.cs: -------------------------------------------------------------------------------- 1 | using ReactiveMarbles.ObservableEvents; 2 | using ReactiveUI; 3 | using System.Reactive.Linq; 4 | using Terminal.Gui; 5 | 6 | namespace Pathfinding.App.Console.Views; 7 | 8 | internal sealed partial class GraphAssembleButton : Button 9 | { 10 | public GraphAssembleButton(GraphAssembleView view) 11 | { 12 | Initialize(); 13 | this.Events().MouseClick 14 | .Select(x => x.MouseEvent.Flags == MouseFlags.Button1Clicked) 15 | .BindTo(view, x => x.Visible); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/GraphCopyButton.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.Resources; 2 | using Pathfinding.App.Console.ViewModels.Interface; 3 | using ReactiveMarbles.ObservableEvents; 4 | using ReactiveUI; 5 | using System.Reactive; 6 | using System.Reactive.Linq; 7 | using Terminal.Gui; 8 | 9 | namespace Pathfinding.App.Console.Views; 10 | 11 | internal sealed class GraphCopyButton : Button 12 | { 13 | public GraphCopyButton(IGraphCopyViewModel viewModel) 14 | { 15 | Text = Resource.Copy; 16 | viewModel.CopyGraphCommand.CanExecute 17 | .BindTo(this, x => x.Enabled); 18 | this.Events().MouseClick 19 | .Where(x => x.MouseEvent.Flags == MouseFlags.Button1Clicked) 20 | .Select(x => Unit.Default) 21 | .InvokeCommand(viewModel, x => x.CopyGraphCommand); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/GraphDeleteButton.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.ViewModels.Interface; 2 | using ReactiveMarbles.ObservableEvents; 3 | using ReactiveUI; 4 | using System.Reactive; 5 | using System.Reactive.Linq; 6 | using Terminal.Gui; 7 | 8 | namespace Pathfinding.App.Console.Views; 9 | 10 | internal sealed partial class GraphDeleteButton : Button 11 | { 12 | public GraphDeleteButton(IGraphDeleteViewModel viewModel) 13 | { 14 | Initialize(); 15 | viewModel.DeleteGraphCommand.CanExecute 16 | .BindTo(this, x => x.Enabled); 17 | this.Events().MouseClick 18 | .Where(x => x.MouseEvent.Flags == MouseFlags.Button1Clicked) 19 | .Select(_ => Unit.Default) 20 | .InvokeCommand(viewModel, x => x.DeleteGraphCommand); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/GraphExportOptionsView.cs: -------------------------------------------------------------------------------- 1 | using NStack; 2 | using Pathfinding.App.Console.Extensions; 3 | using Pathfinding.App.Console.ViewModels.Interface; 4 | using ReactiveMarbles.ObservableEvents; 5 | using ReactiveUI; 6 | using System.Reactive.Linq; 7 | using Terminal.Gui; 8 | 9 | namespace Pathfinding.App.Console.Views; 10 | 11 | internal sealed class GraphExportOptionsView : FrameView 12 | { 13 | private readonly RadioGroup exportOptions = new(); 14 | 15 | public DisplayModeLayout DisplayMode 16 | { 17 | get => exportOptions.DisplayMode; 18 | set => exportOptions.DisplayMode = value; 19 | } 20 | 21 | public GraphExportOptionsView(IGraphExportViewModel viewModel) 22 | { 23 | exportOptions.RadioLabels = [.. viewModel.AllowedOptions 24 | .Select(x => ustring.Make(x.ToStringRepresentation()))]; 25 | DisplayMode = DisplayModeLayout.Horizontal; 26 | Border = new(); 27 | exportOptions.Events().SelectedItemChanged 28 | .Where(x => x.SelectedItem >= 0) 29 | .Select(x => viewModel.AllowedOptions[x.SelectedItem]) 30 | .BindTo(viewModel, x => x.Options); 31 | exportOptions.X = 1; 32 | exportOptions.Y = 1; 33 | exportOptions.SelectedItem = viewModel.AllowedOptions.Count - 1; 34 | Add(exportOptions); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/GraphNameUpdateView.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.ViewModels; 2 | using ReactiveMarbles.ObservableEvents; 3 | using ReactiveUI; 4 | using System.Reactive.Linq; 5 | using Terminal.Gui; 6 | 7 | namespace Pathfinding.App.Console.Views; 8 | 9 | internal sealed partial class GraphNameUpdateView : FrameView 10 | { 11 | public GraphNameUpdateView(GraphUpdateViewModel viewModel) 12 | { 13 | Initialize(); 14 | nameField.Events().TextChanged.Select(_ => nameField.Text) 15 | .BindTo(viewModel, x => x.Name); 16 | viewModel.WhenAnyValue(x => x.Name) 17 | .Where(x => x != null) 18 | .Do(x => nameField.Text = x) 19 | .Subscribe(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/GraphNameView.cs: -------------------------------------------------------------------------------- 1 | using Pathfinding.App.Console.ViewModels.Interface; 2 | using ReactiveMarbles.ObservableEvents; 3 | using ReactiveUI; 4 | using System.Reactive.Linq; 5 | using Terminal.Gui; 6 | 7 | namespace Pathfinding.App.Console.Views; 8 | 9 | internal sealed partial class GraphNameView : FrameView 10 | { 11 | public GraphNameView(IRequireGraphNameViewModel viewModel) 12 | { 13 | Initialize(); 14 | nameField.Events().TextChanged 15 | .Select(_ => nameField.Text) 16 | .BindTo(viewModel, x => x.Name); 17 | this.Events().VisibleChanged 18 | .Where(_ => Visible) 19 | .Do(_ => nameField.Text = string.Empty) 20 | .Subscribe(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/GraphNeighborhoodUpdateView.cs: -------------------------------------------------------------------------------- 1 | using DynamicData; 2 | using NStack; 3 | using Pathfinding.App.Console.Extensions; 4 | using Pathfinding.App.Console.ViewModels; 5 | using ReactiveMarbles.ObservableEvents; 6 | using ReactiveUI; 7 | using System.Reactive.Linq; 8 | using Terminal.Gui; 9 | 10 | namespace Pathfinding.App.Console.Views; 11 | 12 | internal sealed partial class GraphNeighborhoodUpdateView : FrameView 13 | { 14 | public GraphNeighborhoodUpdateView(GraphUpdateViewModel viewModel) 15 | { 16 | Initialize(); 17 | var factories = viewModel.Allowed 18 | .ToDictionary(x => x.ToStringRepresentation()); 19 | var radioLabels = factories.Keys 20 | .Select(ustring.Make) 21 | .ToArray(); 22 | var values = radioLabels 23 | .Select(x => factories[x.ToString()]) 24 | .ToArray(); 25 | neighborhoods.RadioLabels = radioLabels; 26 | neighborhoods.Events().SelectedItemChanged 27 | .Where(x => x.SelectedItem > -1) 28 | .Select(x => values[x.SelectedItem]) 29 | .BindTo(viewModel, x => x.Neighborhood); 30 | viewModel.WhenAnyValue(x => x.Neighborhood) 31 | .Select(x => factories.Values.IndexOf(x)) 32 | .BindTo(neighborhoods, x => x.SelectedItem); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/GraphNeighborhoodView.cs: -------------------------------------------------------------------------------- 1 | using NStack; 2 | using Pathfinding.App.Console.Extensions; 3 | using Pathfinding.App.Console.ViewModels.Interface; 4 | using ReactiveMarbles.ObservableEvents; 5 | using ReactiveUI; 6 | using System.Reactive.Linq; 7 | using Terminal.Gui; 8 | 9 | namespace Pathfinding.App.Console.Views; 10 | 11 | internal sealed partial class GraphNeighborhoodView : FrameView 12 | { 13 | public GraphNeighborhoodView(IRequireNeighborhoodNameViewModel viewModel) 14 | { 15 | var map = viewModel.AllowedNeighborhoods 16 | .ToDictionary(x => x.ToStringRepresentation()); 17 | Initialize(); 18 | var labels = map.Keys.Select(ustring.Make).ToArray(); 19 | var values = labels.Select(x => map[x.ToString()]).ToList(); 20 | this.neighborhoods.RadioLabels = labels; 21 | this.neighborhoods.Events().SelectedItemChanged 22 | .Where(x => x.SelectedItem > -1) 23 | .Select(x => values[x.SelectedItem]) 24 | .BindTo(viewModel, x => x.Neighborhood); 25 | this.neighborhoods.SelectedItem = 0; 26 | this.Events().VisibleChanged 27 | .Where(_ => Visible) 28 | .Do(_ => neighborhoods.SelectedItem = 0); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/GraphPanel.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Features.AttributeFilters; 2 | using Pathfinding.App.Console.Injection; 3 | using Terminal.Gui; 4 | 5 | namespace Pathfinding.App.Console.Views; 6 | 7 | internal sealed partial class GraphPanel : FrameView 8 | { 9 | public GraphPanel([KeyFilter(KeyFilters.GraphPanel)] View[] children) 10 | { 11 | Initialize(); 12 | Add(children); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/GraphSmoothLevelView.cs: -------------------------------------------------------------------------------- 1 | using NStack; 2 | using Pathfinding.App.Console.Extensions; 3 | using Pathfinding.App.Console.ViewModels.Interface; 4 | using ReactiveMarbles.ObservableEvents; 5 | using ReactiveUI; 6 | using System.Reactive.Linq; 7 | using Terminal.Gui; 8 | 9 | namespace Pathfinding.App.Console.Views; 10 | 11 | internal sealed partial class GraphSmoothLevelView : FrameView 12 | { 13 | public GraphSmoothLevelView(IRequireSmoothLevelViewModel viewModel) 14 | { 15 | var smoothLevels = viewModel.AllowedLevels 16 | .ToDictionary(x => x.ToStringRepresentation()); 17 | Initialize(); 18 | var labels = smoothLevels.Keys.Select(ustring.Make).ToArray(); 19 | var values = labels.Select(x => smoothLevels[x.ToString()]).ToList(); 20 | this.smoothLevels.RadioLabels = labels; 21 | this.smoothLevels.Events() 22 | .SelectedItemChanged 23 | .Where(x => x.SelectedItem > -1) 24 | .Select(x => values[x.SelectedItem]) 25 | .BindTo(viewModel, x => x.SmoothLevel); 26 | this.smoothLevels.SelectedItem = 0; 27 | VisibleChanged += OnVisibilityChanged; 28 | } 29 | 30 | private void OnVisibilityChanged() 31 | { 32 | if (Visible) 33 | { 34 | smoothLevels.SelectedItem = 0; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Pathfinding.App.Console/Views/GraphTableButtonsFrame.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Features.AttributeFilters; 2 | using Autofac.Features.Metadata; 3 | using Pathfinding.App.Console.Injection; 4 | using Terminal.Gui; 5 | 6 | namespace Pathfinding.App.Console.Views; 7 | 8 | internal sealed partial class GraphTableButtonsFrame : FrameView 9 | { 10 | public GraphTableButtonsFrame( 11 | [KeyFilter(KeyFilters.GraphTableButtons)] Meta