├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ ├── codeql-analysis.yml │ └── dotnet-core.yml ├── .gitignore ├── HackSystem 2.0.md ├── LICENSE ├── README.md ├── desktop.ini ├── readme ├── DesktopDemo_0.jpg ├── DesktopDemo_1.jpg ├── DesktopDemo_2.jpg ├── Login.jpg ├── MultipleWindowsScheduler.jpg ├── Register.jpg ├── StartUp.jpg ├── TaskScheduler.jpg └── VideoSplash.jpg ├── resource ├── HackSystem-open-graph.png └── HackSystem-open-graph.psd ├── src ├── BuildTools │ └── blazor.webassembly.js ├── HackSystem.Common │ ├── CommonSense.cs │ └── HackSystem.Common.csproj ├── HackSystem.Cryptography │ ├── Extensions │ │ └── RSACryptographyExtension.cs │ ├── HackSystem.Cryptography.csproj │ ├── Options │ │ └── RSACryptographyOptions.cs │ └── RSACryptography │ │ ├── IRSACryptographyService.cs │ │ └── RSACryptographyService.cs ├── HackSystem.CryptographyTests │ ├── HackSystem.CryptographyTests.csproj │ └── RSACryptography │ │ └── RSACryptographyServiceTests.cs ├── HackSystem.DataTransferObjects │ ├── Accounts │ │ ├── LoginRequest.cs │ │ ├── LoginResponse.cs │ │ ├── RegisterRequest.cs │ │ ├── RegisterResponse.cs │ │ └── UserResponse.cs │ ├── HackSystem.DataTransferObjects.csproj │ ├── MockServer │ │ ├── MockRouteRequest.cs │ │ ├── MockRouteResponse.cs │ │ └── MockType.cs │ ├── Programs │ │ ├── ProgramAssets │ │ │ ├── ProgramAssetPackageRequest.cs │ │ │ ├── ProgramAssetPackageResponse.cs │ │ │ ├── ProgramAssetRequest.cs │ │ │ └── ProgramAssetResponse.cs │ │ ├── ProgramResponse.cs │ │ ├── UserProgramMapRequest.cs │ │ └── UserProgramMapResponse.cs │ └── TaskServer │ │ ├── TaskDetailRequest.cs │ │ ├── TaskDetailResponse.cs │ │ └── TaskFrequency.cs ├── HackSystem.Host │ ├── App.config │ ├── Configs │ │ └── HostConfigs.cs │ ├── EventHandlers │ │ ├── AppDomainExceptionHandler.cs │ │ ├── ApplicationExitHandler.cs │ │ ├── ApplicationThreadExceptionHandler.cs │ │ ├── ChromiumDisableMenuHandler.cs │ │ ├── ChromiumRegisterResourceHandler.cs │ │ ├── ChromiumWebBrowserLoadHandler.cs │ │ └── ChromiumWebBrowserMessageHandler.cs │ ├── Extensions │ │ └── BitmapExtension.cs │ ├── HackSystem.Host.csproj │ ├── HostConfigs.json │ ├── HostForm.Designer.cs │ ├── HostForm.cs │ ├── HostForm.resx │ ├── HostResource.Designer.cs │ ├── HostResource.resx │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── Resources │ │ ├── Logo.ico │ │ ├── LogoImage.png │ │ ├── LogoImageIcon.png │ │ └── StartUpPage.html ├── HackSystem.Intermediary.Abstractions │ ├── Application │ │ ├── DefaultIntermediaryEventHandler.cs │ │ ├── IIntermediaryCommandHandler.cs │ │ ├── IIntermediaryEventHandler.cs │ │ ├── IIntermediaryNotificationHandler.cs │ │ ├── IIntermediaryPublisher.cs │ │ └── IIntermediaryRequestHandler.cs │ ├── Domain │ │ ├── IIntermediaryCommand.cs │ │ ├── IIntermediaryEvent.cs │ │ ├── IIntermediaryNotification.cs │ │ └── IIntermediaryRequest.cs │ ├── Extensions │ │ └── HackSystemIntermediaryExtension.cs │ └── HackSystem.Intermediary.Abstractions.csproj ├── HackSystem.Intermediary │ ├── Extensions │ │ └── HackSystemIntermediaryExtension.cs │ ├── HackSystem.Intermediary.csproj │ └── Infrastructure │ │ ├── IntermediaryPipelineBehavior.cs │ │ └── IntermediaryPublisher.cs ├── HackSystem.IntermediaryTests │ ├── HackSystem.IntermediaryTests.csproj │ └── Infrastructure │ │ ├── IntermediaryCommandSenderTests.cs │ │ ├── IntermediaryEventPublisherTests.cs │ │ ├── IntermediaryNotificationPublisherTests.cs │ │ └── IntermediaryRequestSenderTests.cs ├── HackSystem.LRU │ ├── HackSystem.LRU.csproj │ ├── LRUContainer.cs │ └── LRUNode.cs ├── HackSystem.LRUTests │ ├── HackSystem.LRUTests.csproj │ └── LRUContainerTests.cs ├── HackSystem.Observer │ ├── Extensions │ │ └── HackSystemObserverExtension.cs │ ├── HackSystem.Observer.csproj │ ├── Message │ │ └── MessageBase.cs │ ├── Publisher │ │ ├── IPublisher.cs │ │ └── Publisher.cs │ └── Subscriber │ │ ├── ISubscriber.cs │ │ └── Subscriber.cs ├── HackSystem.Web.Application │ ├── Authentication │ │ └── IAuthenticationService.cs │ ├── HackSystem.Web.Application.csproj │ └── Program │ │ ├── IProgramDetailService.cs │ │ └── ProgramAsset │ │ └── IProgramAssetService.cs ├── HackSystem.Web.Authentication.Abstractions │ ├── AuthorizationStateHandlers │ │ ├── IHackSystemAuthenticationStateProvider.cs │ │ └── IHackSystemAuthenticationStateUpdater.cs │ ├── ClaimsIdentityHandlers │ │ └── IHackSystemClaimsIdentityValidator.cs │ ├── HackSystem.Web.Authentication.Abstractions.csproj │ ├── Options │ │ └── HackSystemAuthenticationOptions.cs │ ├── TokenHandlers │ │ ├── IHackSystemAuthenticationTokenHandler.cs │ │ ├── IHackSystemAuthenticationTokenRefresher.cs │ │ └── IJsonWebTokenParser.cs │ └── WebServices │ │ ├── AuthenticatedHttpMessageHandler.cs │ │ └── AuthenticatedServiceBase.cs ├── HackSystem.Web.Authentication │ ├── AuthorizationStateHandlers │ │ ├── HackSystemAuthenticationStateProvider.cs │ │ └── HackSystemAuthenticationStateUpdater.cs │ ├── ClaimsIdentityHandlers │ │ └── HackSystemClaimsIdentityValidator.cs │ ├── Extensions │ │ ├── ClaimsExtension.cs │ │ └── HackSystemAuthenticationExtension.cs │ ├── HackSystem.Web.Authentication.csproj │ ├── MockDefault │ │ ├── HackSystemAuthorizationHandlerContextFactory.cs │ │ └── HackSystemAuthorizationService.cs │ └── TokenHandlers │ │ ├── HackSystemAuthenticationTokenHandler.cs │ │ ├── HackSystemAuthenticationTokenRefresher.cs │ │ └── JsonWebTokenParser.cs ├── HackSystem.Web.AuthenticationTests │ ├── AuthorizationStateHandlers │ │ └── HackSystemAuthenticationStateHandlerTests.cs │ ├── ClaimsIdentityHandlers │ │ └── HackSystemClaimsIdentityValidatorTests.cs │ ├── Extensions │ │ ├── ClaimsExtensionTests.cs │ │ └── HackSystemAuthenticationExtensionTests.cs │ ├── HackSystem.Web.AuthenticationTests.csproj │ └── TokenHandlers │ │ └── JsonWebTokenParserTests.cs ├── HackSystem.Web.Common │ ├── HackSystem.Web.Common.csproj │ └── WebCommonSense.cs ├── HackSystem.Web.Component.Abstractions │ ├── Configurations │ │ └── WebComponentTierConfiguration.cs │ ├── Contracts │ │ ├── Borders.cs │ │ └── Colors.cs │ ├── Extensions │ │ ├── BordersExtension.cs │ │ └── ColorsExtension.cs │ ├── HackSystem.Web.Component.Abstractions.csproj │ ├── Popover │ │ ├── Entity │ │ │ └── PopoverDetail.cs │ │ ├── Enums │ │ │ ├── PopoverPlacement.cs │ │ │ └── PopoverTriggers.cs │ │ └── Handlers │ │ │ └── IPopoverHandler.cs │ └── ToastContainer │ │ ├── Entity │ │ └── ToastDetail.cs │ │ ├── Enums │ │ └── ToastIcons.cs │ │ ├── Handlers │ │ └── IToastHandler.cs │ │ └── Intermediary │ │ └── ToastCommand.cs ├── HackSystem.Web.Component.Infrastructure │ ├── HackSystem.Web.Component.Infrastructure.csproj │ ├── Popover │ │ └── Handlers │ │ │ └── PopoverHandler.cs │ └── ToastContainer │ │ └── Handlers │ │ └── ToastHandler.cs ├── HackSystem.Web.Component │ ├── Extensions │ │ └── HackSystemComponentExtension.cs │ ├── HackSystem.Web.Component.csproj │ ├── ToastContainer │ │ ├── ToastComponent.razor │ │ ├── ToastContainerComponent.cs │ │ └── ToastContainerComponent.razor │ ├── _Imports.razor │ └── wwwroot │ │ ├── hacksystem.popover.js │ │ └── hacksystem.toast.js ├── HackSystem.Web.CookieStorage │ ├── Application │ │ └── ICookieStorageHandler.cs │ ├── Domain │ │ └── CookieChangeEventArgs.cs │ ├── Extension │ │ └── CookieStorageExtension.cs │ ├── HackSystem.Web.CookieStorage.csproj │ ├── Infrastruture │ │ └── CookieStorageHandler.cs │ └── wwwroot │ │ └── blazor.cookie.js ├── HackSystem.Web.Domain │ ├── Configurations │ │ └── WebServiceOptions.cs │ ├── EventArgs │ │ └── ProgramIconMouseEventArgs.cs │ ├── HackSystem.Web.Domain.csproj │ └── Intermediary │ │ ├── LogoutCommand.cs │ │ ├── UserProgramMapCommand.cs │ │ └── UserProgramMapEvent.cs ├── HackSystem.Web.Infrastructure │ ├── Authentication │ │ └── AuthenticationService.cs │ ├── Extensions │ │ └── ServiceCollectionExtension.cs │ ├── HackSystem.Web.Infrastructure.csproj │ ├── IntermediaryHandler │ │ ├── LogoutCommandHandler.cs │ │ └── UserProgramMapCommandHandler.cs │ └── Program │ │ ├── ProgramAsset │ │ └── ProgramAssetService.cs │ │ └── ProgramDetailService.cs ├── HackSystem.Web.ProgramDevelopmentKit │ ├── App.razor │ ├── Authentication │ │ ├── DevelopmentKitAuthenticationStateProvider.cs │ │ └── DevelopmentKitAuthenticationTokenHandler.cs │ ├── HackSystem.Web.ProgramDevelopmentKit.csproj │ ├── Pages │ │ └── Index.razor │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Shared │ │ ├── DesktopLayout.razor │ │ └── DesktopLayout.razor.css │ ├── _Imports.razor │ ├── libman.json │ └── wwwroot │ │ ├── LogoImage.png │ │ ├── css │ │ └── app.css │ │ ├── favicon.ico │ │ ├── images │ │ └── Wallpapers │ │ │ └── DesktopBackground.jpg │ │ ├── index.html │ │ ├── js │ │ ├── blazor.jsTools.js │ │ ├── bootstrap.wrap.js │ │ ├── hacksystem.launch.js │ │ ├── hacksystem.programdock.js │ │ ├── hacksystem.programdrawer.js │ │ ├── hacksystem.startupprogress.js │ │ └── hacksystem.toast.js │ │ └── manifest.json ├── HackSystem.Web.ProgramPlatform.Abstractions │ ├── Components │ │ ├── IDraggableComponent.cs │ │ └── IResizeableComponent.cs │ ├── Contracts │ │ └── ComponentContract.cs │ └── HackSystem.Web.ProgramPlatform.Abstractions.csproj ├── HackSystem.Web.ProgramPlatform │ ├── Components │ │ ├── DraggableHandleComponent │ │ │ └── DraggableHandleComponent.razor │ │ ├── ProgramComponent │ │ │ └── ProgramComponentBase.cs │ │ └── ResizeableBorderComponent │ │ │ └── ResizeableBorderComponent.razor │ ├── HackSystem.Web.ProgramPlatform.csproj │ ├── Windows │ │ └── ProgramWindow │ │ │ ├── DynamicProgramWindow.cs │ │ │ ├── DynamicProgramWindow.razor │ │ │ └── ProgramWindowStyle.cs │ ├── _Imports.razor │ └── wwwroot │ │ ├── blazor.draggable.js │ │ └── blazor.resizeable.js ├── HackSystem.Web.ProgramSchedule.Abstractions │ ├── AssemblyLoader │ │ └── IProgramAssemblyLoader.cs │ ├── Container │ │ └── IProcessContainer.cs │ ├── Destroyer │ │ ├── IProcessDestroyer.cs │ │ └── IWindowDestroyer.cs │ ├── Entity │ │ ├── ProcessDetail.cs │ │ ├── ProgramDetail.cs │ │ ├── ProgramWindowDetail.cs │ │ └── UserProgramMap.cs │ ├── Enums │ │ ├── ModalWindowResults.cs │ │ ├── ProcessChangeStates.cs │ │ ├── ProgramWindowStates.cs │ │ └── WindowChangeStates.cs │ ├── HackSystem.Web.ProgramSchedule.Abstractions.csproj │ ├── IDGenerator │ │ └── IPIDGenerator.cs │ ├── Intermediary │ │ ├── ProcessChangeEvent.cs │ │ ├── ProcessDestroyCommand.cs │ │ ├── ProgramLaunchRequest.cs │ │ ├── ProgramLaunchResponse.cs │ │ ├── WindowChangeEvent.cs │ │ ├── WindowDestroyCommand.cs │ │ ├── WindowScheduleRequest.cs │ │ └── WindowScheduleResponse.cs │ ├── IntermediaryHandler │ │ └── IWindowScheduleRequestHandler.cs │ ├── Launcher │ │ ├── IProgramLauncher.cs │ │ └── IWindowLauncher.cs │ ├── Options │ │ └── ProgramSchedulerOptions.cs │ └── Scheduler │ │ ├── IWindowScheduleContainer.cs │ │ └── IWindowScheduler.cs ├── HackSystem.Web.ProgramSchedule.Infrastructure │ ├── AssemblyLoader │ │ └── ProgramAssemblyLoader.cs │ ├── Container │ │ └── ProcessContainer.cs │ ├── Destroyer │ │ ├── ProcessDestroyer.cs │ │ └── WindowDestroyer.cs │ ├── HackSystem.Web.ProgramSchedule.Infrastructure.csproj │ ├── IDGenerator │ │ └── PIDGenerator.cs │ ├── IntermediaryHandler │ │ ├── ProcessDestroyCommandHandler.cs │ │ ├── ProgramLaunchRequestHandler.cs │ │ ├── WindowDestroyCommandHandler.cs │ │ └── WindowScheduleRequestHandler.cs │ ├── Launcher │ │ ├── ProgramLauncher.cs │ │ └── WindowLauncher.cs │ └── Scheduler │ │ ├── WindowScheduleContainer.cs │ │ └── WindowScheduler.cs ├── HackSystem.Web.ProgramSchedule.InfrastructureTests │ ├── AssemblyLoader │ │ └── ProgramAssemblyLoaderTests.cs │ ├── Container │ │ └── ProcessContainerTests.cs │ ├── HackSystem.Web.ProgramSchedule.InfrastructureTests.csproj │ ├── IntermediaryHandler │ │ ├── ProcessDestroyCommandHandlerTests.cs │ │ └── ProgramLaunchRequestHandlerTests.cs │ └── Launcher │ │ └── ProgramLauncherTests.cs ├── HackSystem.Web.ProgramSchedule │ ├── Extensions │ │ └── ProgramSchedulerExtension.cs │ └── HackSystem.Web.ProgramSchedule.csproj ├── HackSystem.Web.ProgramScheduleTests │ ├── Extensions │ │ └── ProgramSchedulerExtensionTests.cs │ ├── HackSystem.Web.ProgramScheduleTests.csproj │ └── IDGenerator │ │ └── PIDGeneratorTests.cs ├── HackSystem.Web │ ├── Account │ │ ├── LoginComponent.cs │ │ ├── LoginComponent.razor │ │ ├── LogoutComponent.razor │ │ ├── RegisterComponent.cs │ │ ├── RegisterComponent.razor │ │ └── UserStatusComponent.razor │ ├── App.cs │ ├── App.razor │ ├── Configurations │ │ ├── APIConfiguration.cs │ │ ├── SecurityConfiguration.cs │ │ └── WebComponentTierConfiguration.cs │ ├── Desktop │ │ ├── DesktopComponent.cs │ │ ├── DesktopComponent.razor │ │ ├── DesktopMenuComponent.cs │ │ ├── DesktopMenuComponent.razor │ │ └── DesktopStatusComponent.razor │ ├── Extensions │ │ ├── HackSystemWebIntermediaryExtension.cs │ │ └── LaunchBasicServicesExtension.cs │ ├── HackSystem.Web.csproj │ ├── InfoPanel │ │ ├── InfoPanelContainerComponent.razor │ │ └── MainInfoPanelComponent.razor │ ├── Layout │ │ ├── DesktopLayout.razor │ │ └── FullLayout.razor │ ├── Mappers │ │ ├── ProgramAsserts │ │ │ └── ProgramAssertMapperProfile.cs │ │ └── ProgramSchedules │ │ │ ├── ProgramDetailMapperProfile.cs │ │ │ └── UserProgramMapMapperProfile.cs │ ├── Program.cs │ ├── ProgramDock │ │ ├── ProgramDockComponent.cs │ │ ├── ProgramDockComponent.razor │ │ ├── ProgramDockIconComponent.cs │ │ └── ProgramDockIconComponent.razor │ ├── ProgramDrawer │ │ ├── ProgramDrawerComponent.cs │ │ ├── ProgramDrawerComponent.razor │ │ ├── ProgramDrawerComponent.razor.css │ │ ├── ProgramDrawerIconComponent.cs │ │ ├── ProgramDrawerIconComponent.razor │ │ └── ProgramDrawerIconContextMenuComponent.razor │ ├── ProgramLayer │ │ ├── ProgramContainerComponent.cs │ │ └── ProgramContainerComponent.razor │ ├── Properties │ │ └── launchSettings.json │ ├── SystemPage │ │ ├── AccessDenied.razor │ │ ├── HackSystemMessage.razor │ │ ├── NotFound.razor │ │ └── StartUp.razor │ ├── TopBar │ │ ├── MenuBar │ │ │ └── MenuBarComponent.razor │ │ ├── StatusBar │ │ │ ├── StatusBarComponent.cs │ │ │ └── StatusBarComponent.razor │ │ ├── TopBarComponent.cs │ │ ├── TopBarComponent.razor │ │ └── TopBarView.cs │ ├── _Imports.razor │ ├── libman.json │ └── wwwroot │ │ ├── LogoImage.png │ │ ├── LogoImageIcon.png │ │ ├── LogoImageSmall.png │ │ ├── appsettings.Development.json │ │ ├── appsettings.Production.json │ │ ├── appsettings.json │ │ ├── css │ │ └── app.css │ │ ├── favicon.ico │ │ ├── images │ │ ├── Dock │ │ │ └── DockDivider.png │ │ └── Wallpapers │ │ │ ├── DesktopBackground.jpg │ │ │ ├── LoginBackground.jpg │ │ │ └── RegisterBackground.jpg │ │ ├── index.html │ │ ├── js │ │ ├── blazor.jsTools.js │ │ ├── bootstrap.wrap.js │ │ ├── hacksystem.launch.js │ │ ├── hacksystem.programdock.js │ │ └── hacksystem.startupprogress.js │ │ └── manifest.json ├── HackSystem.WebAPI.Application │ ├── HackSystem.WebAPI.Application.csproj │ └── Repository │ │ ├── Abstractions │ │ ├── IRepositoryBase.cs │ │ └── RepositoryBase.cs │ │ ├── IGenericOptionRepository.cs │ │ └── IWebAPILogRepository.cs ├── HackSystem.WebAPI.Authentication │ ├── Configurations │ │ └── JwtAuthenticationOptions.cs │ ├── Extensions │ │ └── HackSystemAuthenticationExtension.cs │ ├── HackSystem.WebAPI.Authentication.csproj │ └── Services │ │ ├── ITokenGenerator.cs │ │ └── TokenGenerator.cs ├── HackSystem.WebAPI.Domain │ ├── Attributes │ │ └── LogActionFilterAttribute.cs │ ├── Configuration │ │ └── HackSystemDbContextOptions.cs │ ├── Entity │ │ ├── GenericOption.cs │ │ ├── Identity │ │ │ ├── HackSystemRole.cs │ │ │ └── HackSystemUser.cs │ │ └── WebAPILog.cs │ ├── HackSystem.WebAPI.Domain.csproj │ └── Notifications │ │ └── CreateAccountNotification.cs ├── HackSystem.WebAPI.Infrastructure │ ├── DBContexts │ │ └── HackSystemDbContext.cs │ ├── DataSeed │ │ ├── DatabaseInitializer.cs │ │ ├── IdentityDatabaseInitializer.cs │ │ ├── ProgramDatabaseInitializer.cs │ │ └── TaskDatabaseInitializer.cs │ ├── HackSystem.WebAPI.Infrastructure.csproj │ ├── Middlewares │ │ └── WebAPILoggingMiddleware.cs │ ├── Migrations │ │ ├── 20221210101430_InitialMigration.Designer.cs │ │ ├── 20221210101430_InitialMigration.cs │ │ └── HackSystemDbContextModelSnapshot.cs │ ├── NotificationHandlers │ │ └── CreateAccountNotificationHandler.cs │ └── Repository │ │ ├── GenericOptionRepository.cs │ │ └── WebAPILogRepository.cs ├── HackSystem.WebAPI.InfrastructureTests │ ├── HackSystem.WebAPI.InfrastructureTests.csproj │ └── Repository │ │ └── GenericOptionRepositoryTests.cs ├── HackSystem.WebAPI.MockServer.Application │ ├── HackSystem.WebAPI.MockServer.Application.csproj │ ├── Repository │ │ ├── IMockRouteLogRepository.cs │ │ └── IMockRouteRepository.cs │ └── Wrappers │ │ ├── IMockForwardRequestWrapper.cs │ │ └── IMockRouteResponseWrapper.cs ├── HackSystem.WebAPI.MockServer.Domain │ ├── Configurations │ │ └── MockServerOptions.cs │ ├── Entity │ │ ├── MockRouteDetail.cs │ │ ├── MockRouteLogDetail.cs │ │ ├── MockRouteLogStatus.cs │ │ └── MockType.cs │ └── HackSystem.WebAPI.MockServer.Domain.csproj ├── HackSystem.WebAPI.MockServer.Infrastructure │ ├── HackSystem.WebAPI.MockServer.Infrastructure.csproj │ ├── Middlewares │ │ └── MockServerMiddleware.cs │ ├── Repository │ │ ├── MockRouteLogRepository.cs │ │ └── MockRouteRepository.cs │ └── Wrappers │ │ ├── MockForwardRequestWrapper.cs │ │ └── MockRouteResponseWrapper.cs ├── HackSystem.WebAPI.MockServer.InfrastructureTests │ ├── HackSystem.WebAPI.MockServer.InfrastructureTests.csproj │ └── Repository │ │ └── MockRouteRepositoryTests.cs ├── HackSystem.WebAPI.MockServer │ ├── Extensions │ │ └── HackSystemMockServerExtension.cs │ └── HackSystem.WebAPI.MockServer.csproj ├── HackSystem.WebAPI.ProgramServer.Application │ ├── HackSystem.WebAPI.ProgramServer.Application.csproj │ └── Repository │ │ ├── IProgramDetailRepository.cs │ │ ├── IProgramUserRepository.cs │ │ ├── IUserProgramMapRepository.cs │ │ └── ProgramAssets │ │ └── IProgramAssetService.cs ├── HackSystem.WebAPI.ProgramServer.Domain │ ├── Configurations │ │ └── ProgramAssetOptions.cs │ ├── Entity │ │ ├── Maps │ │ │ └── UserProgramMap.cs │ │ ├── ProgramAssets │ │ │ ├── ProgramAsset.cs │ │ │ └── ProgramAssetPackage.cs │ │ ├── ProgramUser.cs │ │ └── Programs │ │ │ ├── ProgramBase.cs │ │ │ └── ProgramDetail.cs │ └── HackSystem.WebAPI.ProgramServer.Domain.csproj ├── HackSystem.WebAPI.ProgramServer.Infrastructure │ ├── HackSystem.WebAPI.ProgramServer.Infrastructure.csproj │ └── Repository │ │ ├── ProgramAssets │ │ └── ProgramAssetService.cs │ │ ├── ProgramDetailRepository.cs │ │ ├── ProgramUserRepository.cs │ │ └── UserProgramMapRepository.cs ├── HackSystem.WebAPI.ProgramServer │ ├── Extensions │ │ └── HackSystemProgramServerExtension.cs │ └── HackSystem.WebAPI.ProgramServer.csproj ├── HackSystem.WebAPI.TaskServer.Application │ ├── HackSystem.WebAPI.TaskServer.Application.csproj │ ├── Jobs │ │ ├── ITaskGenericJob.cs │ │ └── ITaskJobBase.cs │ ├── ParameterWrappers │ │ ├── ITaskJsonParameterWrapper.cs │ │ ├── ITaskPairParameterWrapper.cs │ │ └── ITaskParameterWrapper.cs │ ├── Repository │ │ ├── ITaskLogRepository.cs │ │ └── ITaskRepository.cs │ ├── ScheduleWrappers │ │ └── ITaskScheduleWrapper.cs │ └── Services │ │ ├── IHackSystemTaskServer.cs │ │ └── ITaskLoader.cs ├── HackSystem.WebAPI.TaskServer.Domain │ ├── Configuration │ │ └── TaskServerOptions.cs │ ├── Entity │ │ ├── TaskDetail.cs │ │ ├── TaskFrequency.cs │ │ ├── TaskLogDetail.cs │ │ └── TaskLogStatus.cs │ └── HackSystem.WebAPI.TaskServer.Domain.csproj ├── HackSystem.WebAPI.TaskServer.Infrastructure │ ├── Extensions │ │ └── HackSystemTaskServerInfrastructureExtension.cs │ ├── HackSystem.WebAPI.TaskServer.Infrastructure.csproj │ ├── Jobs │ │ ├── TaskGenericJob.cs │ │ └── TaskJobBase.cs │ ├── ParameterWrappers │ │ ├── TaskJsonParameterWrapper.cs │ │ ├── TaskPairParameterWrapper.cs │ │ └── TaskParameterWrapper.cs │ ├── Repository │ │ ├── TaskLogRepository.cs │ │ └── TaskRepository.cs │ ├── ScheduleWrappers │ │ └── TaskScheduleWrapper.cs │ └── Services │ │ ├── HackSystemTaskServer.cs │ │ └── TaskLoader.cs ├── HackSystem.WebAPI.TaskServer.InfrastructureTests │ ├── HackSystem.WebAPI.TaskServer.InfrastructureTests.csproj │ ├── ParameterWrappers │ │ └── TaskPairParameterWrapperTests.cs │ ├── ScheduleWrappers │ │ └── TaskScheduleWrapperTests.cs │ └── Services │ │ └── HackSystemTaskServerTests.cs ├── HackSystem.WebAPI.TaskServer │ ├── Extensions │ │ └── HackSystemTaskServerExtension.cs │ └── HackSystem.WebAPI.TaskServer.csproj ├── HackSystem.WebAPI.Tasks │ ├── DatabaseBackup │ │ ├── DatabaseBackupTask.cs │ │ └── IDatabaseBackupTask.cs │ ├── Extensions │ │ └── HackSystemTaskExtension.cs │ └── HackSystem.WebAPI.Tasks.csproj ├── HackSystem.WebAPI │ ├── .config │ │ └── dotnet-tools.json │ ├── Configurations │ │ └── SecurityConfiguration.cs │ ├── Controllers │ │ ├── Account │ │ │ ├── AccountsController.cs │ │ │ ├── AuthenticateControllerBase.cs │ │ │ └── TokenController.cs │ │ ├── HomeController.cs │ │ ├── MockServer │ │ │ └── MockServerController.cs │ │ ├── Program │ │ │ ├── ProgramAsset │ │ │ │ └── ProgramAssetController.cs │ │ │ └── ProgramDetailController.cs │ │ └── TaskServer │ │ │ └── TaskServerController.cs │ ├── Extensions │ │ └── HackSystemInfrastructureExtension.cs │ ├── HackSystem.WebAPI.csproj │ ├── HackSystem.db │ ├── Mappers │ │ ├── Accounts │ │ │ └── AccountMapperProfile.cs │ │ ├── MockServer │ │ │ └── MockServerMapperProfile.cs │ │ ├── Programs │ │ │ ├── ProgramAsserts │ │ │ │ └── ProgramAssertMapperProfile.cs │ │ │ └── ProgramDetailMapperProfile.cs │ │ └── TaskServer │ │ │ └── TaskDetailMapperProfile.cs │ ├── NLog.config │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Views │ │ ├── Home │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── _Layout.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.Development.json │ ├── appsettings.Production.json │ ├── appsettings.json │ ├── libman.json │ └── wwwroot │ │ ├── LogoImage.png │ │ ├── LogoImageIcon.png │ │ ├── css │ │ └── site.css │ │ ├── favicon.ico │ │ ├── images │ │ └── HackSystemDefaultProgramIcon.png │ │ └── js │ │ └── site.js ├── HackSystem.WebHost │ ├── .config │ │ └── dotnet-tools.json │ ├── HackSystem.WebHost.csproj │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── appsettings.Development.json │ ├── appsettings.Production.json │ ├── appsettings.json │ └── icon.ico ├── HackSystem.WebTests │ ├── Account │ │ ├── LoginComponentTests.cs │ │ └── LogoutComponentTests.cs │ ├── HackSystem.WebTests.csproj │ ├── Mocks │ │ └── MockNavigationManager.cs │ └── SystemPage │ │ └── StartUpTests.cs ├── HackSystem.sln └── programs │ ├── HackSystem.Web.AppStore │ ├── AppStoreComponent.razor │ ├── HackSystem.Web.AppStore.csproj │ ├── Index.png │ ├── Launcher.cs │ └── _Imports.razor │ ├── HackSystem.Web.Explorer │ ├── ExplorerComponent.razor │ ├── HackSystem.Web.Explorer.csproj │ ├── Index.png │ ├── Launcher.cs │ └── _Imports.razor │ ├── HackSystem.Web.Home │ ├── ChildWindowComponent.razor │ ├── HackSystem.Web.Home.csproj │ ├── HomeComponent.razor │ ├── Index.png │ ├── Launcher.cs │ ├── ModalWindowComponent.razor │ └── _Imports.razor │ ├── HackSystem.Web.MockServer │ ├── HackSystem.Web.MockServer.csproj │ ├── Index.png │ ├── Launcher.cs │ ├── MockRouteComponent.cs │ ├── MockRouteComponent.razor │ ├── MockServerComponent.cs │ ├── MockServerComponent.razor │ ├── Services │ │ ├── IMockRouteService.cs │ │ └── MockRouteService.cs │ └── _Imports.razor │ ├── HackSystem.Web.Profile │ ├── HackSystem.Web.Profile.csproj │ ├── Index.png │ ├── Launcher.cs │ ├── ProfileComponent.razor │ └── _Imports.razor │ ├── HackSystem.Web.Setting │ ├── HackSystem.Web.Setting.csproj │ ├── Index.png │ ├── Launcher.cs │ ├── SettingComponent.razor │ └── _Imports.razor │ └── HackSystem.Web.TaskSchedule │ ├── HackSystem.Web.TaskSchedule.csproj │ ├── Index.png │ ├── LaunchParameter.cs │ ├── Launcher.cs │ ├── Services │ ├── ITaskDetailService.cs │ └── TaskDetailService.cs │ ├── TaskDetailComponent.cs │ ├── TaskDetailComponent.razor │ ├── TaskSchedulerComponent.cs │ ├── TaskSchedulerComponent.razor │ └── _Imports.razor └── tests └── HackSystem_Insomnia.yaml /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | 3 | # CS8632: 只能在 "#nullable" 注释上下文内的代码中使用可为 null 的引用类型的注释。 4 | dotnet_diagnostic.CS8632.severity = none 5 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [CuteLeon] 2 | custom: ["https://qr.alipay.com/tsx00464h3zvp7qjlahbs9b"] 3 | -------------------------------------------------------------------------------- /.github/workflows/dotnet-core.yml: -------------------------------------------------------------------------------- 1 | name: ".Net Build" 2 | 3 | on: 4 | push: 5 | branches: [] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | configuration: [Debug, Release] 14 | 15 | runs-on: windows-latest 16 | 17 | env: 18 | Solution_Name: IntelligentInvestor.sln 19 | 20 | steps: 21 | - name: Checkout 22 | uses: actions/checkout@v2 23 | with: 24 | fetch-depth: 0 25 | 26 | - name: Install .NET Core 27 | uses: actions/setup-dotnet@v1 28 | with: 29 | dotnet-version: 6.0.x 30 | include-prerelease: true 31 | 32 | - name: Install dependencies 33 | run: dotnet restore ./src/ 34 | 35 | - name: Build 36 | run: dotnet build /p:Configuration=$env:Configuration --no-restore ./src/ 37 | env: 38 | Configuration: ${{ matrix.configuration }} 39 | 40 | - name: Test 41 | run: dotnet test --no-restore --verbosity normal ./src/ 42 | -------------------------------------------------------------------------------- /HackSystem 2.0.md: -------------------------------------------------------------------------------- 1 | # Hack System 2.0 2 | 3 | [TOC] 4 | 5 | ## 前言 6 | 7 | ​ 经历了2020年的疫情,生活终于安定下来。最近几个月趁着远程办公的政策有了更多的时间学习感兴趣的新技术,还顺带写了几个 Demo,但是一直没有有点规模的项目拿新技术练练手,突然想起在我的 TODO List 躺了好久的 Hack System 2.0,现在是时间重新出发了 ... 8 | 9 | ​ 前期和小伙伴讨论下大概的技术架构,后面会使用业余的时间勤耕不辍。其实2019年中就启动这个2.0的新项目了,但是当时技术储备还是不够,跟前一版比起来算得上革新的新技术屈指可数,所以并没有特别强的动力驱使我写2.0的代码,希望这一次,斗志昂扬的我可以顺利地维护起2.0的HackSystem。 10 | 11 | ​ 2020/08/28 12 | 13 | ## 许可 14 | 15 | ​ 项目使用 GPL License。如果你使用 Hack System 2.0 做的修改或衍生,也请开源出来。 16 | -------------------------------------------------------------------------------- /desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=.\HackSystem.Web\wwwroot\favicon.ico,0 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /readme/DesktopDemo_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/readme/DesktopDemo_0.jpg -------------------------------------------------------------------------------- /readme/DesktopDemo_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/readme/DesktopDemo_1.jpg -------------------------------------------------------------------------------- /readme/DesktopDemo_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/readme/DesktopDemo_2.jpg -------------------------------------------------------------------------------- /readme/Login.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/readme/Login.jpg -------------------------------------------------------------------------------- /readme/MultipleWindowsScheduler.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/readme/MultipleWindowsScheduler.jpg -------------------------------------------------------------------------------- /readme/Register.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/readme/Register.jpg -------------------------------------------------------------------------------- /readme/StartUp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/readme/StartUp.jpg -------------------------------------------------------------------------------- /readme/TaskScheduler.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/readme/TaskScheduler.jpg -------------------------------------------------------------------------------- /readme/VideoSplash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/readme/VideoSplash.jpg -------------------------------------------------------------------------------- /resource/HackSystem-open-graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/resource/HackSystem-open-graph.png -------------------------------------------------------------------------------- /resource/HackSystem-open-graph.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/resource/HackSystem-open-graph.psd -------------------------------------------------------------------------------- /src/HackSystem.Common/CommonSense.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Common; 2 | 3 | public class CommonSense 4 | { 5 | /// 6 | /// Group is a collection of Users, 7 | /// Role is a collection of Claims. 8 | /// 9 | public class Roles 10 | { 11 | /// 12 | /// Commander Role 13 | /// 14 | public const string CommanderRole = "Commander"; 15 | 16 | /// 17 | /// Hacker Role 18 | /// 19 | public const string HackerRole = "Hacker"; 20 | } 21 | 22 | /// 23 | /// Group is a collection of Users, 24 | /// Role is a collection of Claims. 25 | /// 26 | public class Claims 27 | { 28 | /// 29 | /// Professional Claim 30 | /// 31 | public const string ProfessionalClaim = "Professional"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/HackSystem.Common/HackSystem.Common.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/HackSystem.Cryptography/Extensions/RSACryptographyExtension.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Cryptography.Options; 2 | using HackSystem.Cryptography.RSACryptography; 3 | 4 | namespace HackSystem.Cryptography; 5 | 6 | public static class RSACryptographyExtension 7 | { 8 | public static IServiceCollection AddRSACryptography(this IServiceCollection services, Action configure) 9 | { 10 | services 11 | .Configure(configure) 12 | .AddScoped() 13 | .AddScoped(); 14 | 15 | return services; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/HackSystem.Cryptography/HackSystem.Cryptography.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/HackSystem.Cryptography/Options/RSACryptographyOptions.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Cryptography.Options; 2 | 3 | public class RSACryptographyOptions 4 | { 5 | public string RSAKeyParameters { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.Cryptography/RSACryptography/IRSACryptographyService.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Cryptography.RSACryptography; 2 | 3 | public interface IRSACryptographyService : IDisposable 4 | { 5 | (string PublicKey, string PrivateKey) GenerateRSAKeys(); 6 | 7 | byte[] RSADecrypt(byte[] source); 8 | 9 | string RSADecrypt(string source); 10 | 11 | byte[] RSAEncrypt(byte[] source); 12 | 13 | string RSAEncrypt(string source); 14 | 15 | byte[] SignData(byte[] source); 16 | 17 | string SignData(string source); 18 | 19 | bool VerifyData(byte[] source, byte[] sign); 20 | 21 | bool VerifyData(string source, string sign); 22 | } 23 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Accounts/LoginRequest.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace HackSystem.DataTransferObjects.Accounts; 4 | 5 | public class LoginRequest 6 | { 7 | [Required(ErrorMessage = "User name is required")] 8 | public string UserName { get; set; } 9 | 10 | [Required(ErrorMessage = "Password is required")] 11 | public string Password { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Accounts/LoginResponse.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.Accounts; 2 | 3 | public class LoginResponse 4 | { 5 | public bool Successful { get; set; } 6 | 7 | public string Error { get; set; } 8 | 9 | public string Token { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Accounts/RegisterRequest.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace HackSystem.DataTransferObjects.Accounts; 4 | 5 | public class RegisterRequest 6 | { 7 | [Required(ErrorMessage = "User name is required")] 8 | public string UserName { get; set; } 9 | 10 | [EmailAddress(ErrorMessage ="User Email should match Email format")] 11 | [Required(ErrorMessage = "User Email is required")] 12 | public string Email { get; set; } 13 | 14 | [DataType(DataType.Password)] 15 | [Required(ErrorMessage = "Password is required")] 16 | public string Password { get; set; } 17 | 18 | [DataType(DataType.Password)] 19 | [Required(ErrorMessage = "Confirm password is required")] 20 | [Compare(nameof(Password), ErrorMessage = "Confirm password does not match with Password.")] 21 | public string ConfirmPassword { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Accounts/RegisterResponse.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.Accounts; 2 | 3 | public class RegisterResponse 4 | { 5 | public bool Successful { get; set; } 6 | 7 | public IEnumerable Errors { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Accounts/UserResponse.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.Programs; 2 | 3 | namespace HackSystem.DataTransferObjects.Accounts; 4 | 5 | public class UserResponse 6 | { 7 | public string UserName { get; set; } 8 | 9 | public string Email { get; set; } 10 | 11 | public string PhoneNumber { get; set; } 12 | 13 | public int ExperienceLevel { get; set; } 14 | 15 | public int ExperiencePoints { get; set; } 16 | 17 | public IList UserProgramMaps { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/HackSystem.DataTransferObjects.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/MockServer/MockRouteRequest.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.MockServer; 2 | 3 | public class MockRouteRequest 4 | { 5 | public int RouteID { get; set; } 6 | 7 | public string? RouteName { get; set; } 8 | 9 | public bool? Enabled { get; set; } 10 | 11 | public string? MockURI { get; set; } 12 | 13 | public string? MockMethod { get; set; } 14 | 15 | public string? MockSourceHost { get; set; } 16 | 17 | public int? DelayDuration { get; set; } 18 | 19 | public int? StatusCode { get; set; } 20 | 21 | public string? ResponseBodyTemplate { get; set; } 22 | 23 | public MockType? MockType { get; set; } 24 | 25 | public string? ForwardAddress { get; set; } 26 | 27 | public string? ForwardMethod { get; set; } 28 | 29 | public string? ForwardRequestBodyTemplate { get; set; } 30 | 31 | public MockType? ForwardMockType { get; set; } 32 | } -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/MockServer/MockRouteResponse.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.MockServer; 2 | 3 | public class MockRouteResponse 4 | { 5 | public int RouteID { get; set; } 6 | 7 | public string RouteName { get; set; } 8 | 9 | public bool Enabled { get; set; } 10 | 11 | public string MockURI { get; set; } 12 | 13 | public string? MockMethod { get; set; } 14 | 15 | public string? MockSourceHost { get; set; } 16 | 17 | public int DelayDuration { get; set; } 18 | 19 | public int StatusCode { get; set; } 20 | 21 | public string ResponseBodyTemplate { get; set; } 22 | 23 | public MockType MockType { get; set; } 24 | 25 | public string? ForwardAddress { get; set; } 26 | 27 | public string? ForwardMethod { get; set; } 28 | 29 | public string? ForwardRequestBodyTemplate { get; set; } 30 | 31 | public MockType? ForwardMockType { get; set; } 32 | } 33 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/MockServer/MockType.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.MockServer; 2 | 3 | public enum MockType 4 | { 5 | GenerateByTemplate, 6 | ReadFromPayload, 7 | } 8 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Programs/ProgramAssets/ProgramAssetPackageRequest.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.Programs.ProgramAssets; 2 | 3 | public class ProgramAssetPackageRequest 4 | { 5 | public string ProgramId { get; set; } 6 | 7 | public IEnumerable ProgramAssets { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Programs/ProgramAssets/ProgramAssetPackageResponse.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.Programs.ProgramAssets; 2 | 3 | public class ProgramAssetPackageResponse 4 | { 5 | public string ProgramId { get; set; } 6 | 7 | public IEnumerable ProgramAssets { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Programs/ProgramAssets/ProgramAssetRequest.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.Programs.ProgramAssets; 2 | 3 | public class ProgramAssetRequest 4 | { 5 | public string FileName { get; set; } 6 | 7 | public byte[] DLLBytes { get; set; } 8 | 9 | public byte[] PDBBytes { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Programs/ProgramAssets/ProgramAssetResponse.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.Programs.ProgramAssets; 2 | 3 | public class ProgramAssetResponse 4 | { 5 | public string FileName { get; set; } 6 | 7 | public byte[] DLLBytes { get; set; } 8 | 9 | public byte[] PDBBytes { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Programs/ProgramResponse.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.Programs; 2 | 3 | public class ProgramResponse 4 | { 5 | public string Id { get; set; } 6 | 7 | public string Name { get; set; } 8 | 9 | public string IconUri { get; set; } 10 | 11 | public bool Enabled { get; set; } 12 | 13 | public bool SingleInstance { get; set; } 14 | 15 | public string EntryAssemblyName { get; set; } 16 | 17 | public string EntryTypeName { get; set; } 18 | 19 | public string EntryParameter { get; set; } 20 | 21 | public bool Mandatory { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Programs/UserProgramMapRequest.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.Programs; 2 | 3 | public class UserProgramMapRequest 4 | { 5 | public string ProgramId { get; set; } 6 | 7 | public bool? PinToDesktop { get; set; } 8 | 9 | public bool? PinToDock { get; set; } 10 | 11 | public bool? PinToTop { get; set; } 12 | 13 | public string? Rename { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/Programs/UserProgramMapResponse.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.Programs; 2 | 3 | public class UserProgramMapResponse 4 | { 5 | public ProgramResponse Program { get; set; } 6 | 7 | public bool PinToDesktop { get; set; } 8 | 9 | public bool PinToDock { get; set; } 10 | 11 | public bool PinToTop { get; set; } 12 | 13 | public string? Rename { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/TaskServer/TaskDetailRequest.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.TaskServer; 2 | 3 | public class TaskDetailRequest 4 | { 5 | public int TaskID { get; set; } 6 | 7 | public string? TaskName { get; set; } 8 | 9 | public bool? Enabled { get; set; } 10 | 11 | public DateTime? ExecuteDateTime { get; set; } 12 | 13 | public TaskFrequency? TaskFrequency { get; set; } 14 | 15 | public TimeSpan? AutomaticInterval { get; set; } 16 | 17 | public string? Parameters { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/TaskServer/TaskDetailResponse.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.TaskServer; 2 | 3 | public class TaskDetailResponse 4 | { 5 | public int TaskID { get; set; } 6 | 7 | public string TaskName { get; set; } 8 | 9 | public bool Enabled { get; set; } 10 | 11 | public DateTime ExecuteDateTime { get; set; } 12 | 13 | public TaskFrequency TaskFrequency { get; set; } 14 | 15 | public TimeSpan AutomaticInterval { get; set; } 16 | 17 | public string ClassName { get; set; } 18 | 19 | public string ProcedureName { get; set; } 20 | 21 | public string Parameters { get; set; } 22 | 23 | public string Category { get; set; } 24 | } 25 | -------------------------------------------------------------------------------- /src/HackSystem.DataTransferObjects/TaskServer/TaskFrequency.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.DataTransferObjects.TaskServer; 2 | 3 | public enum TaskFrequency 4 | { 5 | Manually, 6 | Once, 7 | Automatically, 8 | Daily, 9 | Weekly, 10 | Monthly, 11 | Yearly 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.Host/Configs/HostConfigs.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | 3 | namespace HackSystem.Host.Configs 4 | { 5 | /// 6 | /// Configuration of Host 7 | /// 8 | public static class HostConfigs 9 | { 10 | private const string ConfigFileName = "HostConfigs.json"; 11 | 12 | public static readonly IConfigurationRoot Configuration; 13 | 14 | static HostConfigs() 15 | { 16 | var configBuilder = new ConfigurationBuilder(); 17 | configBuilder.AddJsonFile(ConfigFileName); 18 | Configuration = configBuilder.Build(); 19 | } 20 | 21 | public static string Title { get => Configuration["Title"]; } 22 | 23 | public static string RemoteURL { get => Configuration["RemoteURL"]; } 24 | 25 | public static string StartURI { get => Configuration["StartURI"]; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HackSystem.Host/EventHandlers/AppDomainExceptionHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HackSystem.Host.EventHandlers 4 | { 5 | public static class AppDomainExceptionHandler 6 | { 7 | public static void DoAppDomainException(object sender, UnhandledExceptionEventArgs e) 8 | => Console.WriteLine($"{nameof(AppDomainExceptionHandler)}: {nameof(DoAppDomainException)} => {(e.ExceptionObject as Exception).Message}"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.Host/EventHandlers/ApplicationExitHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HackSystem.Host.EventHandlers 4 | { 5 | public static class ApplicationExitHandler 6 | { 7 | public static void DoApplicationExit(object sender, EventArgs e) 8 | => Console.WriteLine($"{nameof(ApplicationExitHandler)}: {nameof(DoApplicationExit)}"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.Host/EventHandlers/ApplicationThreadExceptionHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace HackSystem.Host.EventHandlers 5 | { 6 | public static class ApplicationThreadExceptionHandler 7 | { 8 | public static void DoApplicationThreadException(object sender, ThreadExceptionEventArgs e) 9 | => Console.WriteLine($"{nameof(ApplicationThreadExceptionHandler)}: {nameof(DoApplicationThreadException)} => {e.Exception.Message}"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/HackSystem.Host/EventHandlers/ChromiumDisableMenuHandler.cs: -------------------------------------------------------------------------------- 1 | using CefSharp; 2 | 3 | namespace HackSystem.Host.EventHandlers 4 | { 5 | public class ChromiumDisableMenuHandler : IContextMenuHandler 6 | { 7 | void IContextMenuHandler.OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model) => model.Clear(); 8 | 9 | bool IContextMenuHandler.OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags) => false; 10 | 11 | void IContextMenuHandler.OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame) { } 12 | 13 | bool IContextMenuHandler.RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback) => false; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.Host/EventHandlers/ChromiumWebBrowserMessageHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using CefSharp; 3 | 4 | namespace HackSystem.Host.EventHandlers 5 | { 6 | public static class ChromiumWebBrowserMessageHandler 7 | { 8 | public static void DoConsoleMessage(object sender, ConsoleMessageEventArgs e) 9 | => Console.WriteLine($"{e.Source} [{e.Level}] {e.Line} => {e.Message}"); 10 | 11 | public static void DoJavascriptMessage(object sender, JavascriptMessageReceivedEventArgs e) 12 | => Console.WriteLine($"{e.Browser} => {e.Frame.Name} {e.Message}"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Host/Extensions/BitmapExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.IO; 4 | 5 | namespace HackSystem.Host.Extensions 6 | { 7 | public static class BitmapExtension 8 | { 9 | public static string ToBase64(this Bitmap bitmap) 10 | { 11 | using (var stream = new MemoryStream()) 12 | { 13 | bitmap.Save(stream, bitmap.RawFormat); 14 | byte[] bytes = new byte[stream.Length]; 15 | stream.Position = 0; 16 | stream.Read(bytes, 0, (int)stream.Length); 17 | stream.Close(); 18 | return Convert.ToBase64String(bytes); 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/HackSystem.Host/HostConfigs.json: -------------------------------------------------------------------------------- 1 | { 2 | "Title": "Hack System", 3 | "RemoteURL": "https://localhost:2473", 4 | "StartURI": "StartUp" 5 | } -------------------------------------------------------------------------------- /src/HackSystem.Host/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using HackSystem.Host.EventHandlers; 4 | 5 | namespace HackSystem.Host 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// Main entry of program 11 | /// 12 | [STAThread] 13 | static void Main() 14 | { 15 | Application.ApplicationExit += ApplicationExitHandler.DoApplicationExit; 16 | Application.ThreadException += ApplicationThreadExceptionHandler.DoApplicationThreadException; 17 | AppDomain.CurrentDomain.UnhandledException += AppDomainExceptionHandler.DoAppDomainException; 18 | 19 | Application.EnableVisualStyles(); 20 | Application.SetCompatibleTextRenderingDefault(false); 21 | Application.Run(new HostForm()); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/HackSystem.Host/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("HackSystem.Host")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("CuteLeon")] 11 | [assembly: AssemblyProduct("HackSystem.Host")] 12 | [assembly: AssemblyCopyright("Copyright © 2020")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 会使此程序集中的类型 17 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("6fdc3e30-9967-4efb-8366-6612d97930b9")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 32 | //通过使用 "*",如下所示: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /src/HackSystem.Host/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace HackSystem.Host.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/HackSystem.Host/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/HackSystem.Host/Resources/Logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Host/Resources/Logo.ico -------------------------------------------------------------------------------- /src/HackSystem.Host/Resources/LogoImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Host/Resources/LogoImage.png -------------------------------------------------------------------------------- /src/HackSystem.Host/Resources/LogoImageIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Host/Resources/LogoImageIcon.png -------------------------------------------------------------------------------- /src/HackSystem.Host/Resources/StartUpPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 |
10 |

{1}

11 |
{2}
12 |
13 | 14 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary.Abstractions/Application/DefaultIntermediaryEventHandler.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | 3 | namespace HackSystem.Intermediary.Application; 4 | 5 | public class DefaultIntermediaryEventHandler : IIntermediaryEventHandler 6 | where TEvent : IIntermediaryEvent 7 | { 8 | public event EventHandler EventRaised; 9 | 10 | public async Task Handle(TEvent eventArg, CancellationToken cancellationToken) 11 | { 12 | EventRaised?.Invoke(this, eventArg); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary.Abstractions/Application/IIntermediaryCommandHandler.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | 3 | namespace HackSystem.Intermediary.Application; 4 | 5 | public interface IIntermediaryCommandHandler : IIntermediaryRequestHandler 6 | where TCommand : IIntermediaryCommand 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary.Abstractions/Application/IIntermediaryEventHandler.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | 3 | namespace HackSystem.Intermediary.Application; 4 | 5 | public interface IIntermediaryEventHandler : INotificationHandler 6 | where TEvent : IIntermediaryEvent 7 | { 8 | event EventHandler EventRaised; 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary.Abstractions/Application/IIntermediaryNotificationHandler.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | 3 | namespace HackSystem.Intermediary.Application; 4 | 5 | public interface IIntermediaryNotificationHandler : INotificationHandler 6 | where TNotification : IIntermediaryNotification 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary.Abstractions/Application/IIntermediaryPublisher.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | 3 | namespace HackSystem.Intermediary.Application 4 | { 5 | public interface IIntermediaryPublisher 6 | { 7 | Task SendCommand(IIntermediaryCommand command, CancellationToken cancellationToken = default); 8 | 9 | Task SendRequest(IIntermediaryRequest request, CancellationToken cancellationToken = default); 10 | 11 | Task PublishNotification(IIntermediaryNotification notification, CancellationToken cancellationToken = default); 12 | 13 | Task PublishEvent(IIntermediaryEvent eventArg, CancellationToken cancellationToken = default); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary.Abstractions/Application/IIntermediaryRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | 3 | namespace HackSystem.Intermediary.Application; 4 | 5 | public interface IIntermediaryRequestHandler : IRequestHandler 6 | where TRequest : IIntermediaryRequest 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary.Abstractions/Domain/IIntermediaryCommand.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Intermediary.Domain; 2 | 3 | public interface IIntermediaryCommand : IIntermediaryRequest 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary.Abstractions/Domain/IIntermediaryEvent.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Intermediary.Domain; 2 | 3 | public interface IIntermediaryEvent : INotification 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary.Abstractions/Domain/IIntermediaryNotification.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Intermediary.Domain; 2 | 3 | public interface IIntermediaryNotification : INotification 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary.Abstractions/Domain/IIntermediaryRequest.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Intermediary.Domain; 2 | 3 | public interface IIntermediaryRequest : IRequest 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary/Extensions/HackSystemIntermediaryExtension.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Application; 2 | using HackSystem.Intermediary.Infrastructure; 3 | 4 | namespace HackSystem.Intermediary.Extensions; 5 | 6 | public static class HackSystemIntermediaryExtension 7 | { 8 | public static IServiceCollection AddHackSystemIntermediary(this IServiceCollection services) 9 | => services 10 | .AddMediatR(typeof(HackSystemIntermediaryExtension).Assembly) 11 | .AddTransient(typeof(IPipelineBehavior<,>), typeof(IntermediaryPipelineBehavior<,>)) 12 | .AddTransient(); 13 | } 14 | -------------------------------------------------------------------------------- /src/HackSystem.Intermediary/Infrastructure/IntermediaryPipelineBehavior.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Intermediary.Infrastructure; 2 | 3 | public class IntermediaryPipelineBehavior : IPipelineBehavior 4 | where TRequest : IRequest 5 | { 6 | private readonly ILogger> logger; 7 | 8 | public IntermediaryPipelineBehavior( 9 | ILogger> logger) 10 | { 11 | this.logger = logger; 12 | } 13 | 14 | public async Task Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate next) 15 | { 16 | this.logger.LogDebug($"Handling request of type {request.GetType().FullName}..."); 17 | var response = await next.Invoke(); 18 | this.logger.LogDebug($"Handled with response of type {response.GetType().FullName}..."); 19 | return response; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/HackSystem.LRU/HackSystem.LRU.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/HackSystem.LRUTests/HackSystem.LRUTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | 17 | 18 | 19 | all 20 | runtime; build; native; contentfiles; analyzers; buildtransitive 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/HackSystem.Observer/Extensions/HackSystemObserverExtension.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Observer.Publisher; 2 | using HackSystem.Observer.Subscriber; 3 | 4 | namespace HackSystem.Observer; 5 | 6 | [Obsolete] 7 | public static class HackSystemObserverExtension 8 | { 9 | [Obsolete] 10 | public static IServiceCollection AddHackSystemObserver(this IServiceCollection services) 11 | { 12 | services 13 | .AddSingleton(typeof(IPublisher<>), typeof(Publisher<>)) 14 | .AddScoped(typeof(ISubscriber<>), typeof(Subscriber<>)); 15 | 16 | return services; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/HackSystem.Observer/HackSystem.Observer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/HackSystem.Observer/Message/MessageBase.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Observer.Message; 2 | 3 | [Obsolete] 4 | public record MessageBase 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.Observer/Publisher/IPublisher.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Observer.Message; 2 | 3 | namespace HackSystem.Observer.Publisher; 4 | 5 | [Obsolete] 6 | public interface IPublisher : IObservable, IDisposable 7 | where TMessage : MessageBase 8 | { 9 | [Obsolete] 10 | void UnSubsciber(IObserver subscriber); 11 | 12 | [Obsolete] 13 | Task Publish(TMessage message); 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Observer/Subscriber/ISubscriber.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Observer.Message; 2 | 3 | namespace HackSystem.Observer.Subscriber; 4 | 5 | [Obsolete] 6 | public interface ISubscriber : IObserver, IDisposable 7 | where TMessage : MessageBase 8 | { 9 | [Obsolete] 10 | void Subscibe(); 11 | 12 | [Obsolete] 13 | void Unsubscibe(); 14 | 15 | [Obsolete] 16 | Func HandleMessage { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Application/Authentication/IAuthenticationService.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.Accounts; 2 | 3 | namespace HackSystem.Web.Application.Authentication; 4 | 5 | public interface IAuthenticationService 6 | { 7 | Task Register(RegisterRequest registerModel); 8 | 9 | Task Login(LoginRequest loginModel); 10 | 11 | Task GetAccountInfo(); 12 | 13 | Task Logout(); 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Application/HackSystem.Web.Application.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Application/Program/IProgramDetailService.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.Programs; 2 | 3 | namespace HackSystem.Web.Application.Program; 4 | 5 | public interface IProgramDetailService 6 | { 7 | Task> QueryUserProgramMaps(); 8 | 9 | Task UpdateUserProgram(UserProgramMapRequest request); 10 | 11 | Task DeleteUserProgramMap(string programId); 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Application/Program/ProgramAsset/IProgramAssetService.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.Programs.ProgramAssets; 2 | 3 | namespace HackSystem.Web.Application.Program.ProgramAsset; 4 | 5 | public interface IProgramAssetService 6 | { 7 | Task QueryProgramAssetList(string programId); 8 | 9 | Task QueryProgramAssetPackage(ProgramAssetPackageRequest packageRequest); 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Authentication.Abstractions/AuthorizationStateHandlers/IHackSystemAuthenticationStateProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | using Microsoft.AspNetCore.Components.Authorization; 3 | 4 | namespace HackSystem.Web.Authentication.AuthorizationStateHandlers; 5 | 6 | public interface IHackSystemAuthenticationStateProvider 7 | { 8 | Task GetAuthenticationStateAsync(); 9 | 10 | bool ParseValidateClaimsIdentity(string token, out ClaimsIdentity claimsIdentity); 11 | 12 | void NotifyAuthenticationStateChanged(AuthenticationState authenticationState); 13 | } 14 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Authentication.Abstractions/AuthorizationStateHandlers/IHackSystemAuthenticationStateUpdater.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Authentication.AuthorizationStateHandlers; 2 | 3 | public interface IHackSystemAuthenticationStateUpdater 4 | { 5 | Task UpdateAuthenticattionStateAsync(string token); 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Authentication.Abstractions/ClaimsIdentityHandlers/IHackSystemClaimsIdentityValidator.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | 3 | namespace HackSystem.Web.Authentication.ClaimsIdentityHandlers; 4 | 5 | public interface IHackSystemClaimsIdentityValidator 6 | { 7 | bool ValidateClaimsIdentity(ClaimsIdentity claimsIdentity); 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Authentication.Abstractions/Options/HackSystemAuthenticationOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | using Microsoft.AspNetCore.Components.Authorization; 3 | 4 | namespace HackSystem.Web.Authentication.Options; 5 | 6 | public class HackSystemAuthenticationOptions 7 | { 8 | public string AuthenticationURL { get; set; } 9 | 10 | public string ExpiryClaimType { get; set; } = "exp"; 11 | 12 | public string AuthenticationScheme { get; set; } = "bearer"; 13 | 14 | public int TokenExpiryInMinutes { get; set; } = 30; 15 | 16 | public int TokenRefreshInMinutes { get; set; } = 25; 17 | 18 | public readonly AuthenticationState AnonymousState = new(new ClaimsPrincipal(new[] 19 | { 20 | new ClaimsIdentity(new [] 21 | { 22 | new Claim(ClaimTypes.Name, "Anonymous") 23 | }) 24 | })); 25 | 26 | public string AuthTokenName { get; set; } = "AuthToken"; 27 | 28 | public string AuthenticationType { get; set; } = "jwt"; 29 | } 30 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Authentication.Abstractions/TokenHandlers/IHackSystemAuthenticationTokenHandler.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Authentication.TokenHandlers; 2 | 3 | public interface IHackSystemAuthenticationTokenHandler 4 | { 5 | ValueTask GetTokenAsync(); 6 | 7 | Task UpdateTokenAsync(string token); 8 | 9 | Task RemoveTokenAsync(); 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Authentication.Abstractions/TokenHandlers/IHackSystemAuthenticationTokenRefresher.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Authentication.TokenHandlers; 2 | 3 | public interface IHackSystemAuthenticationTokenRefresher 4 | { 5 | bool IsRunning { get; } 6 | 7 | void StartRefresher(); 8 | 9 | void StopRefresher(); 10 | 11 | Task RefreshTokenAsync(); 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Authentication.Abstractions/TokenHandlers/IJsonWebTokenParser.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | 3 | namespace HackSystem.Web.Authentication.TokenHandlers; 4 | 5 | public interface IJsonWebTokenParser 6 | { 7 | IEnumerable ParseJWTToken(string token); 8 | 9 | IEnumerable ParseJWTPayload(string token); 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Authentication.Abstractions/WebServices/AuthenticatedServiceBase.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Authentication.WebServices; 2 | 3 | public class AuthenticatedServiceBase 4 | { 5 | public const string AuthenticatedClientName = "AuthenticatedClient"; 6 | private readonly IHttpClientFactory httpClientFactory; 7 | protected readonly ILogger logger; 8 | 9 | protected HttpClient HttpClient { get; init; } 10 | 11 | public AuthenticatedServiceBase( 12 | ILogger logger, 13 | IHttpClientFactory httpClientFactory) 14 | { 15 | this.logger = logger; 16 | this.httpClientFactory = httpClientFactory; 17 | this.HttpClient = this.httpClientFactory.CreateClient(AuthenticatedClientName); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Authentication/ClaimsIdentityHandlers/HackSystemClaimsIdentityValidator.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | using HackSystem.Web.Authentication.Extensions; 3 | using HackSystem.Web.Authentication.Options; 4 | 5 | namespace HackSystem.Web.Authentication.ClaimsIdentityHandlers; 6 | 7 | public class HackSystemClaimsIdentityValidator : IHackSystemClaimsIdentityValidator 8 | { 9 | private readonly ILogger logger; 10 | private readonly IOptionsSnapshot options; 11 | 12 | public HackSystemClaimsIdentityValidator( 13 | ILogger logger, 14 | IOptionsSnapshot options) 15 | { 16 | this.logger = logger; 17 | this.options = options; 18 | } 19 | 20 | public bool ValidateClaimsIdentity(ClaimsIdentity claimsIdentity) 21 | { 22 | this.logger.LogDebug("HackSystem validate Claims Identity..."); 23 | return !claimsIdentity.Claims.IsExpired(this.options.Value.ExpiryClaimType); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Authentication/Extensions/ClaimsExtension.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | 3 | namespace HackSystem.Web.Authentication.Extensions; 4 | 5 | public static class ClaimsExtension 6 | { 7 | public static bool IsExpired(this IEnumerable claims, string expiryClaimType) 8 | { 9 | var expiryClaim = claims.FirstOrDefault(claim => string.Equals(claim.Type, expiryClaimType, StringComparison.OrdinalIgnoreCase)); 10 | if (expiryClaim == null) 11 | { 12 | return false; 13 | } 14 | 15 | if (!long.TryParse(expiryClaim.Value, out var expiryTimeStamp)) 16 | { 17 | return true; 18 | } 19 | 20 | var localExpiredTime = TimeZoneInfo.ConvertTimeFromUtc( 21 | new DateTime(1970, 1, 1) + TimeSpan.FromSeconds(expiryTimeStamp), 22 | TimeZoneInfo.Local); 23 | return DateTime.Now > localExpiredTime; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Authentication/HackSystem.Web.Authentication.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Common/HackSystem.Web.Common.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Common/WebCommonSense.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Common; 2 | 3 | public class WebCommonSense 4 | { 5 | 6 | public const string AuthTokenName = "AuthToken"; 7 | 8 | public const string AuthenticationType = "jwt"; 9 | 10 | public const string AuthenticationScheme = "bearer"; 11 | 12 | public const string ExpiryClaimType = "exp"; 13 | 14 | public class AuthorizationPolicy 15 | { 16 | public const string HackerPolicy = "HackerPolicy"; 17 | 18 | public const string ProfessionalHackerPolicy = "ProfessionalHackerPolicy"; 19 | 20 | public const string LeonPolicy = "LeonPolicy"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/Configurations/WebComponentTierConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Component.Configurations; 2 | 3 | public class WebComponentTierConfiguration 4 | { 5 | public int IconContainer { get; set; } = 49; 6 | 7 | public int InfoContainer { get; set; } = 149; 8 | 9 | public int ProgramDock { get; set; } = 199; 10 | 11 | public int BasicProgramEdge { get; set; } = 200; 12 | 13 | public int ProgramDivider { get; set; } = 799; 14 | 15 | public int TopProgramEdge { get; set; } = 999; 16 | 17 | public int Bootstrap_Dropdown { get; set; } = 1000; 18 | 19 | public int Bootstrap_Sticky { get; set; } = 1020; 20 | 21 | public int Bootstrap_Fixed { get; set; } = 1030; 22 | 23 | public int Bootstrap_Modal_Backdrop { get; set; } = 1040; 24 | 25 | public int Bootstrap_Modal { get; set; } = 1050; 26 | 27 | public int Bootstrap_Popover { get; set; } = 1060; 28 | 29 | public int Bootstrap_Tooltip { get; set; } = 1070; 30 | 31 | public int ToastContainer { get; set; } = 1080; 32 | 33 | public int TopBar { get; set; } = 1090; 34 | } 35 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/Contracts/Borders.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Component.Contracts; 2 | 3 | public enum Borders 4 | { 5 | None = 0b0000, 6 | Border = 0b1111, 7 | BorderTop = 0b1000, 8 | BorderBottom = 0b0100, 9 | BorderLeft = 0b0010, 10 | BorderRight = 0b0001, 11 | BorderNonTop = Border & ~BorderTop, 12 | BorderNonBottom = Border & ~BorderBottom, 13 | BorderNonLeft = Border & ~BorderLeft, 14 | BorderNonRight = Border & ~BorderRight, 15 | BorderTopBottom = BorderTop | BorderBottom, 16 | BorderLeftRight = BorderLeft | BorderRight, 17 | BorderTopLeft = BorderTop | BorderLeft, 18 | BorderTopRight = BorderTop | BorderRight, 19 | BorderBottomLeft = BorderBottom | BorderLeft, 20 | BorderBottomRight = BorderBottom | BorderRight, 21 | } 22 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/Contracts/Colors.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Component.Contracts; 2 | 3 | public enum Colors 4 | { 5 | None, 6 | Primary, 7 | Secondary, 8 | Success, 9 | Danger, 10 | Warning, 11 | Info, 12 | Light, 13 | Dark, 14 | White, 15 | Transparent, 16 | } 17 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/Extensions/BordersExtension.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using HackSystem.Web.Component.Contracts; 3 | 4 | namespace HackSystem.Web.Component.Extensions; 5 | 6 | public static class BordersExtension 7 | { 8 | public static string ToBorderStyle(this Borders border) 9 | { 10 | if (border == Borders.None) return "border-0"; 11 | else if (border == Borders.Border) return "border"; 12 | else 13 | { 14 | var borderStyleBuilder = new StringBuilder(64); 15 | if (!border.HasFlag(Borders.BorderTop)) borderStyleBuilder.Append("border-top-0 "); 16 | if (!border.HasFlag(Borders.BorderBottom)) borderStyleBuilder.Append("border-bottom-0 "); 17 | if (!border.HasFlag(Borders.BorderLeft)) borderStyleBuilder.Append("border-left-0 "); 18 | if (!border.HasFlag(Borders.BorderRight)) borderStyleBuilder.Append("border-right-0 "); 19 | return borderStyleBuilder.ToString(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/Popover/Entity/PopoverDetail.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Component.Popover; 2 | 3 | public class PopoverDetail 4 | { 5 | public string TargetElemantFilter { get; set; } 6 | 7 | public string Title { get; set; } = "Hack System"; 8 | 9 | public bool IsHtmlContent { get; set; } 10 | 11 | public string Content { get; set; } = "Hack System Popover Content."; 12 | 13 | public PopoverTriggers Trigger { get; set; } = PopoverTriggers.Hover; 14 | 15 | public PopoverPlacements Placement { get; set; } = PopoverPlacements.Top; 16 | 17 | public int Offset { get; set; } 18 | 19 | public int ShowDelay { get; set; } 20 | 21 | public int HideDelay { get; set; } 22 | 23 | public string? ContentSourceId { get; set; } 24 | 25 | public string? HeaderSourceId { get; set; } 26 | } 27 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/Popover/Enums/PopoverPlacement.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Component.Popover; 2 | 3 | public enum PopoverPlacements 4 | { 5 | Auto, 6 | Top, 7 | Bottom, 8 | Left, 9 | Right, 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/Popover/Enums/PopoverTriggers.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Component.Popover; 2 | 3 | public enum PopoverTriggers 4 | { 5 | Click, 6 | Hover, 7 | Focus, 8 | Manual 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/Popover/Handlers/IPopoverHandler.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Component.Popover; 2 | 3 | public interface IPopoverHandler 4 | { 5 | Task InitializeAsync(); 6 | 7 | Task SetupPopovers(string targetElementFilter); 8 | 9 | Task SetupPopover(PopoverDetail popoverDetail); 10 | 11 | Task UpdatePopover(string targetElementFilter, string action); 12 | 13 | Task RefreshReplacement(string popoverId, string contentSourceId, string headerSourceId); 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/ToastContainer/Entity/ToastDetail.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Component.ToastContainer; 2 | 3 | public class ToastDetail 4 | { 5 | public DateTime CreateTime { get; init; } = DateTime.Now; 6 | 7 | public string Id { get; init; } = $"toast_{Guid.NewGuid():N}"; 8 | 9 | public string Title { get; set; } = "Hack System"; 10 | 11 | public string Message { get; set; } = "Hack System Toast Message."; 12 | 13 | public ToastIcons Icon { get; set; } = ToastIcons.HackSystem; 14 | 15 | public bool AutoHide { get; set; } = true; 16 | 17 | public int HideDelay { get; set; } = 3000; 18 | } 19 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/ToastContainer/Enums/ToastIcons.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Component.ToastContainer; 2 | 3 | public enum ToastIcons 4 | { 5 | HackSystem = 0, 6 | Information = 1, 7 | Question = 2, 8 | Warning = 3, 9 | Error = 4 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/ToastContainer/Handlers/IToastHandler.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Component.ToastContainer; 2 | 3 | public interface IToastHandler 4 | { 5 | Task PopupToast(ToastDetail toastDetail); 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Abstractions/ToastContainer/Intermediary/ToastCommand.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | 3 | namespace HackSystem.Web.Component.ToastContainer; 4 | 5 | public class ToastEvent : IIntermediaryEvent 6 | { 7 | public ToastDetail ToastDetail { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Infrastructure/HackSystem.Web.Component.Infrastructure.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component.Infrastructure/ToastContainer/Handlers/ToastHandler.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Application; 2 | 3 | namespace HackSystem.Web.Component.ToastContainer; 4 | 5 | public class ToastHandler : IToastHandler 6 | { 7 | private readonly ILogger logger; 8 | private readonly IIntermediaryPublisher publisher; 9 | 10 | public ToastHandler( 11 | ILogger logger, 12 | IIntermediaryPublisher publisher) 13 | { 14 | this.logger = logger; 15 | this.publisher = publisher; 16 | } 17 | 18 | public async Task PopupToast(ToastDetail toastDetail) 19 | { 20 | this.logger.LogInformation($"Popup toast: {toastDetail.Title}..."); 21 | await this.publisher.PublishEvent(new ToastEvent { ToastDetail = toastDetail }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component/Extensions/HackSystemComponentExtension.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Extensions; 2 | using HackSystem.Web.Component.Popover; 3 | using HackSystem.Web.Component.ToastContainer; 4 | 5 | namespace HackSystem.Web.Component.Extensions; 6 | 7 | public static class HackSystemComponentExtension 8 | { 9 | public static IServiceCollection AddHackSystemComponent( 10 | this IServiceCollection services) 11 | => services 12 | .AddScoped() 13 | .AddSingleton() 14 | .AddIntermediaryEvent(); 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component/ToastContainer/ToastContainerComponent.razor: -------------------------------------------------------------------------------- 1 | @inject ILogger logger 2 | @inject IJSRuntime jsRuntime 3 | @inject IIntermediaryEventHandler toastEventHandler 4 | 5 |
6 | 7 | 8 | @foreach (var toast in this.Toasts.Values.OrderBy(detail => detail.CreateTime).ThenByDescending(detail => detail.Icon)) 9 | { 10 | var toastKey = $"toastKey_{toast.Id}"; 11 | 12 | } 13 | 14 | 15 |
16 | 17 | @code { 18 | private readonly Dictionary Toasts = new Dictionary(); 19 | } 20 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Component/wwwroot/hacksystem.toast.js: -------------------------------------------------------------------------------- 1 | export let toasts = { 2 | popToast: function (interop, id, autohide = true, delay = 3000) { 3 | let toast = $(`#${id}`); 4 | toast.toast({ 5 | animation: true, 6 | autohide: autohide, 7 | delay: delay 8 | }); 9 | toast.on('hide.bs.toast', function (e) { 10 | $(e.target).slideUp(150); 11 | }); 12 | toast.on('hidden.bs.toast', function (e) { 13 | let toastId = e.target.id; 14 | let reference = interop; 15 | reference.invokeMethodAsync('CloseToast', toastId); 16 | }); 17 | toast.toast('show'); 18 | } 19 | }; -------------------------------------------------------------------------------- /src/HackSystem.Web.CookieStorage/Application/ICookieStorageHandler.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.CookieStorage; 2 | 3 | public interface ICookieStorageHandler : IAsyncDisposable 4 | { 5 | event EventHandler CookieChanged; 6 | 7 | ValueTask RemoveCookieAsync(string name); 8 | 9 | ValueTask> GetCookiesAsync(); 10 | 11 | ValueTask SaveCookieAsync(string name, string value, long expiresInSecond = -1); 12 | 13 | ValueTask GetCookieAsync(string name); 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Web.CookieStorage/Domain/CookieChangeEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.CookieStorage; 2 | 3 | public class CookieChangedEventArgs : EventArgs 4 | { 5 | public CookieChangedEventArgs(string name, string newValue, string oldValue) 6 | { 7 | this.Name = name; 8 | this.NewValue = newValue; 9 | this.OldValue = oldValue; 10 | } 11 | 12 | public string Name { get; set; } 13 | 14 | public string NewValue { get; set; } 15 | 16 | public string OldValue { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/HackSystem.Web.CookieStorage/Extension/CookieStorageExtension.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.CookieStorage; 2 | 3 | public static class CookieStorageExtension 4 | { 5 | public static IServiceCollection AddCookieStorage(this IServiceCollection services) 6 | => services 7 | .AddSingleton(); 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Domain/Configurations/WebServiceOptions.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Domain.Configurations; 2 | 3 | public class WebServiceOptions 4 | { 5 | public string APIHost { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Domain/EventArgs/ProgramIconMouseEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using HackSystem.Web.ProgramSchedule.Entity; 3 | using Microsoft.AspNetCore.Components.Web; 4 | 5 | namespace HackSystem.Web.ProgramDrawer.ProgramDrawerEventArgs; 6 | 7 | public class ProgramIconEventArgs : EventArgs 8 | { 9 | public ProgramIconEventArgs( 10 | UserProgramMap userProgramMap, 11 | MouseEventArgs args) 12 | { 13 | this.UserProgramMap = userProgramMap; 14 | Position = new Point((int)args.ClientX, (int)args.ClientY); 15 | } 16 | 17 | public ProgramIconEventArgs( 18 | UserProgramMap userProgramMap, 19 | TouchEventArgs args) 20 | { 21 | this.UserProgramMap = userProgramMap; 22 | Position = args.Touches.Any() ? 23 | new Point((int)args.Touches.First().ClientX, (int)args.Touches.First().ClientY) : null; 24 | } 25 | 26 | public ProgramIconEventArgs( 27 | UserProgramMap userProgramMap, 28 | Point? position) 29 | { 30 | this.UserProgramMap = userProgramMap; 31 | Position = position; 32 | } 33 | 34 | public Point? Position { get; init; } 35 | 36 | public UserProgramMap UserProgramMap { get; init; } 37 | } 38 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Domain/HackSystem.Web.Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Domain/Intermediary/LogoutCommand.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | 3 | namespace HackSystem.Web.Domain.Intermediary; 4 | 5 | public class LogoutCommand : IIntermediaryCommand 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Domain/Intermediary/UserProgramMapCommand.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.Programs; 2 | using HackSystem.Intermediary.Domain; 3 | 4 | namespace HackSystem.Web.Domain.Intermediary; 5 | 6 | public class UserProgramMapCommand : IIntermediaryCommand 7 | { 8 | public UserProgramMapCommand( 9 | UserProgramMapRequest userProgramMap) 10 | { 11 | UserProgramMap = userProgramMap; 12 | } 13 | 14 | public UserProgramMapRequest UserProgramMap { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.Web.Domain/Intermediary/UserProgramMapEvent.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.Programs; 2 | using HackSystem.Intermediary.Domain; 3 | 4 | namespace HackSystem.Web.Domain.Intermediary; 5 | 6 | public class UserProgramMapEvent : IIntermediaryEvent 7 | { 8 | public UserProgramMapEvent( 9 | UserProgramMapRequest userProgramMap) 10 | { 11 | UserProgramMap = userProgramMap; 12 | } 13 | 14 | public UserProgramMapRequest UserProgramMap { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 | 5 | 6 | 7 | @code { 8 | Type ProgramType { get; set; } 9 | ProcessDetail ProcessDetail { get; set; } 10 | Dictionary ComponentParameter { get; set; } 11 | 12 | protected override void OnInitialized() 13 | { 14 | var programDetail = new ProgramDetail(default, this.ProgramType.Name, default, default, default, default, default, default, default) 15 | { 16 | ProgramEntryType = this.ProgramType 17 | }; 18 | this.ProcessDetail = new ProcessDetail(1, programDetail); 19 | 20 | this.ComponentParameter = new() 21 | { 22 | { nameof(ProgramComponentBase.ProcessDetail), this.ProcessDetail }, 23 | }; 24 | 25 | base.OnInitialized(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "HackSystem.Web.ProgramDevelopmentKit": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": true, 6 | "launchBrowser": true, 7 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 8 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 9 | "environmentVariables": { 10 | "ASPNETCORE_ENVIRONMENT": "Development" 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/Shared/DesktopLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | @inject ILogger logger 3 | 4 |
7 | @Body 8 |
9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Net.Http 3 | @using System.Net.Http.Json 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 9 | @using Microsoft.JSInterop 10 | @using HackSystem.Web.ProgramDevelopmentKit 11 | @using HackSystem.Web.ProgramDevelopmentKit.Shared 12 | @using HackSystem.Web.ProgramPlatform.Components.ProgramComponent 13 | @using HackSystem.Web.ProgramSchedule.Entity -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/libman.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "defaultProvider": "cdnjs", 4 | "libraries": [ 5 | { 6 | "library": "twitter-bootstrap@4.5.2", 7 | "destination": "wwwroot/libs/twitter-bootstrap/" 8 | }, 9 | { 10 | "library": "font-awesome@5.14.0", 11 | "destination": "wwwroot/libs/font-awesome/" 12 | }, 13 | { 14 | "library": "jquery@3.5.1", 15 | "destination": "wwwroot/libs/jquery/" 16 | }, 17 | { 18 | "library": "bootstrap-submenu@3.0.1", 19 | "destination": "wwwroot/libs/bootstrap-submenu/" 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/LogoImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/LogoImage.png -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/css/app.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 3 | } 4 | 5 | .gradual-background { 6 | background: linear-gradient(to bottom, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.15) 100%), radial-gradient(at top center, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.40) 120%) #989898; 7 | background-blend-mode: multiply; 8 | background-attachment: fixed; 9 | background-repeat: no-repeat; 10 | background-size: cover; 11 | } 12 | 13 | .valid.modified:not([type=checkbox]) { 14 | outline: 1px solid #26b050; 15 | } 16 | 17 | .invalid { 18 | outline: 1px solid red; 19 | } 20 | 21 | .validation-message { 22 | color: red; 23 | } 24 | 25 | #blazor-error-ui { 26 | background: lightyellow; 27 | bottom: 0; 28 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 29 | display: none; 30 | left: 0; 31 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 32 | position: fixed; 33 | width: 100%; 34 | z-index: 1000; 35 | } 36 | 37 | #blazor-error-ui .dismiss { 38 | cursor: pointer; 39 | position: absolute; 40 | right: 0.75rem; 41 | top: 0.5rem; 42 | } 43 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/images/Wallpapers/DesktopBackground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/images/Wallpapers/DesktopBackground.jpg -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/js/blazor.jsTools.js: -------------------------------------------------------------------------------- 1 | window.blazorJSTools = { 2 | loaded: [], 3 | importJavaScript: function (url) { 4 | if (blazorJSTools.loaded[url]) { 5 | console.log(`script ${url} already loaded.`); 6 | return; 7 | } 8 | 9 | var script = document.createElement('script'); 10 | script.type = 'text/javascript'; 11 | script.async = true; 12 | script.src = url; 13 | script.onload = function () { 14 | blazorJSTools.loaded[url] = true; 15 | console.log(`load script ${url} successfully.`); 16 | }; 17 | script.onerror = function () { 18 | console.log(`load script ${url} failed.`); 19 | reject(scriptPath); 20 | } 21 | document.body.appendChild(script); 22 | console.log(`loading script ${url}.`); 23 | } 24 | } -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/js/bootstrap.wrap.js: -------------------------------------------------------------------------------- 1 | window.tooltips = { 2 | initTooltips: function () { 3 | $('[data-toggle="tooltip"]').tooltip(); 4 | }, 5 | hideTooltips: function () { 6 | $('[data-toggle="tooltip"]').tooltip('hide'); 7 | }, 8 | }; 9 | 10 | window.submenus = { 11 | initSubMenus: function () { 12 | $('[data-submenu]').submenupicker(); 13 | } 14 | }; -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/js/hacksystem.launch.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | }); -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/js/hacksystem.programdock.js: -------------------------------------------------------------------------------- 1 | var dockEvents = { 2 | mouseOverIcon: function (e) { 3 | $(e).prev().animate({ 4 | width: '100px', 5 | height: '100px', 6 | margin: '-25px 0 0 0', 7 | }, 150); 8 | }, 9 | mouseOutIcon: function (e) { 10 | $(e).prev().animate({ 11 | width: '75px', 12 | height: '75px', 13 | margin: '0px 0 0 0', 14 | }, 150); 15 | }, 16 | mouseDownIcon: function (e) { 17 | $(e).prev().animate({ 18 | opacity: 1, 19 | margin: '-50px 0 0 0', 20 | }, 150); 21 | }, 22 | mouseUpIcon: function (e) { 23 | $(e).prev().animate({ 24 | opacity: 1, 25 | margin: '-25px 0 0 0', 26 | }, 150); 27 | } 28 | }; -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/js/hacksystem.toast.js: -------------------------------------------------------------------------------- 1 | export let toasts = { 2 | popToast: function (interop, id, autohide = true, delay = 3000) { 3 | let toast = $(`#${id}`); 4 | toast.toast({ 5 | animation: true, 6 | autohide: autohide, 7 | delay: delay 8 | }); 9 | toast.on('hide.bs.toast', function (e) { 10 | $(e.target).slideUp(150); 11 | }); 12 | toast.on('hidden.bs.toast', function (e) { 13 | let toastId = e.target.id; 14 | let reference = interop; 15 | reference.invokeMethodAsync('CloseToast', toastId); 16 | }); 17 | toast.toast('show'); 18 | } 19 | }; -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramDevelopmentKit/wwwroot/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HackSystem.Web.ProgramDevelopmentKit", 3 | "short_name": "HackSystem.Web.ProgramDevelopmentKit", 4 | "start_url": "./", 5 | "display": "standalone", 6 | "background_color": "#ffffff", 7 | "theme_color": "#03173d", 8 | "icons": [ 9 | { 10 | "src": "LogoImage.png", 11 | "type": "image/png", 12 | "sizes": "512x512" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramPlatform.Abstractions/Components/IDraggableComponent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.JSInterop; 2 | 3 | namespace HackSystem.Web.ProgramPlatform.Components; 4 | 5 | public interface IDraggableComponent 6 | { 7 | [JSInvokable] 8 | void UpdatePosition(double left, double top); 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramPlatform.Abstractions/Components/IResizeableComponent.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.ProgramPlatform.Components; 2 | 3 | public interface IResizeableComponent 4 | { 5 | void UpdateSize(double left, double top, double width, double height); 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramPlatform.Abstractions/Contracts/ComponentContract.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.ProgramPlatform.Contracts; 2 | 3 | public class ComponentContract 4 | { 5 | public const int TopBarHeight = 30; 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramPlatform/Components/ProgramComponent/ProgramComponentBase.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.Component.ToastContainer; 2 | using HackSystem.Web.ProgramSchedule.Entity; 3 | 4 | namespace HackSystem.Web.ProgramPlatform.Components.ProgramComponent; 5 | 6 | public abstract class ProgramComponentBase : ComponentBase, IDisposable 7 | { 8 | public ProgramDetail ProgramDetail { get => this.ProcessDetail.ProgramDetail; } 9 | 10 | public ProcessDetail ProcessDetail { get => this.ProgramWindowDetail.ProcessDetail; } 11 | 12 | [CascadingParameter] 13 | public ProgramWindowDetail ProgramWindowDetail { get; init; } 14 | 15 | [Inject] 16 | protected IToastHandler ToastHandler { get; init; } 17 | 18 | public ProgramComponentBase() : base() 19 | { 20 | } 21 | 22 | public abstract void Dispose(); 23 | } 24 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramPlatform/Windows/ProgramWindow/ProgramWindowStyle.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.Component.Contracts; 2 | 3 | namespace HackSystem.Web.ProgramPlatform.Windows.ProgramWindow; 4 | 5 | public class ProgramWindowStyle 6 | { 7 | public Borders Border { get; set; } = Borders.Border; 8 | 9 | public Colors BorderColor { get; set; } = Colors.Light; 10 | 11 | public Colors BackgroundColor { get; set; } = Colors.White; 12 | 13 | public Colors CaptionBackgroundColor { get; set; } = Colors.Light; 14 | 15 | public Colors CaptionTextColor { get; set; } = Colors.Dark; 16 | } 17 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/AssemblyLoader/IProgramAssemblyLoader.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace HackSystem.Web.ProgramSchedule.AssemblyLoader; 4 | 5 | public interface IProgramAssemblyLoader 6 | { 7 | bool CheckAssemblyLoaded(string assemblyName); 8 | 9 | Task> LoadProgramAssembly(string programId); 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Container/IProcessContainer.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.Entity; 2 | 3 | namespace HackSystem.Web.ProgramSchedule.Container; 4 | 5 | public interface IProcessContainer 6 | { 7 | IEnumerable GetProcesses(); 8 | 9 | bool LaunchProcess(ProcessDetail processDetail); 10 | 11 | ProcessDetail? GetProcess(int processID); 12 | 13 | bool DestroyProcess(int processID, out ProcessDetail? processDetail); 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Destroyer/IProcessDestroyer.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.Entity; 2 | 3 | namespace HackSystem.Web.ProgramSchedule.Destroyer; 4 | 5 | public interface IProcessDestroyer 6 | { 7 | Task DestroyProcess(int processID); 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Destroyer/IWindowDestroyer.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.Entity; 2 | 3 | namespace HackSystem.Web.ProgramSchedule.Destroyer; 4 | 5 | public interface IWindowDestroyer 6 | { 7 | Task DestroyWindow(ProgramWindowDetail windowDetail); 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Entity/UserProgramMap.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.ProgramSchedule.Entity; 2 | 3 | public class UserProgramMap 4 | { 5 | public UserProgramMap(ProgramDetail program) 6 | { 7 | this.Program = program; 8 | } 9 | 10 | public ProgramDetail Program { get; init; } 11 | 12 | public bool PinToDesktop { get; set; } 13 | 14 | public bool PinToDock { get; set; } 15 | 16 | public bool PinToTop { get; set; } 17 | 18 | public string? Rename { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Enums/ModalWindowResults.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.ProgramSchedule.Enums; 2 | 3 | public enum ModalWindowResults 4 | { 5 | None, 6 | OK, 7 | Cancel, 8 | Abort, 9 | Retry, 10 | Ignore, 11 | Yes, 12 | No, 13 | } 14 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Enums/ProcessChangeStates.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.ProgramSchedule.Enums; 2 | 3 | public enum ProcessChangeStates 4 | { 5 | Launch = 0, 6 | Destroy = 1, 7 | } 8 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Enums/ProgramWindowStates.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.ProgramSchedule.Enums; 2 | 3 | public enum ProgramWindowStates 4 | { 5 | Normal, 6 | Minimized, 7 | Maximized 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Enums/WindowChangeStates.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.ProgramSchedule.Enums; 2 | 3 | public enum WindowChangeStates 4 | { 5 | Launch, 6 | BringToHead, 7 | Active, 8 | Inactive, 9 | ToggleActive, 10 | TopTier, 11 | NonTopTier, 12 | ToggleTopTier, 13 | Destroy, 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/IDGenerator/IPIDGenerator.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.ProgramSchedule.IDGenerator; 2 | 3 | public interface IPIDGenerator 4 | { 5 | int GetAvailablePID(); 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Intermediary/ProcessChangeEvent.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | using HackSystem.Web.ProgramSchedule.Entity; 3 | using HackSystem.Web.ProgramSchedule.Enums; 4 | 5 | namespace HackSystem.Web.ProgramSchedule.Intermediary; 6 | 7 | public class ProcessChangeEvent : IIntermediaryEvent 8 | { 9 | public ProcessChangeEvent( 10 | ProcessChangeStates changeState, 11 | ProcessDetail processDetail) 12 | { 13 | this.ChangeState = changeState; 14 | this.ProcessDetail = processDetail; 15 | } 16 | 17 | public ProcessChangeStates ChangeState { get; init; } 18 | 19 | public ProcessDetail ProcessDetail { get; init; } 20 | } 21 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Intermediary/ProcessDestroyCommand.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | using HackSystem.Web.ProgramSchedule.Entity; 3 | 4 | namespace HackSystem.Web.ProgramSchedule.Intermediary; 5 | 6 | public class ProcessDestroyCommand : IIntermediaryCommand 7 | { 8 | public ProcessDestroyCommand(ProcessDetail processDetail) 9 | { 10 | this.ProcessDetail = processDetail; 11 | } 12 | 13 | public ProcessDetail ProcessDetail { get; init; } 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Intermediary/ProgramLaunchRequest.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | using HackSystem.Web.ProgramSchedule.Entity; 3 | 4 | namespace HackSystem.Web.ProgramSchedule.Intermediary; 5 | 6 | public class ProgramLaunchRequest : IIntermediaryRequest 7 | { 8 | public ProgramLaunchRequest(ProgramDetail programDetail) 9 | { 10 | this.ProgramDetail = programDetail; 11 | } 12 | 13 | public ProgramDetail ProgramDetail { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Intermediary/ProgramLaunchResponse.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.Entity; 2 | 3 | namespace HackSystem.Web.ProgramSchedule.Intermediary; 4 | 5 | public class ProgramLaunchResponse 6 | { 7 | public ProgramLaunchResponse(ProcessDetail processDetail) 8 | { 9 | this.ProcessDetail = processDetail; 10 | } 11 | 12 | public ProcessDetail ProcessDetail { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Intermediary/WindowChangeEvent.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | using HackSystem.Web.ProgramSchedule.Enums; 3 | using HackSystem.Web.ProgramSchedule.Entity; 4 | 5 | namespace HackSystem.Web.ProgramSchedule.Intermediary; 6 | 7 | public class WindowChangeEvent : IIntermediaryEvent 8 | { 9 | public WindowChangeEvent( 10 | WindowChangeStates changeState, 11 | ProgramWindowDetail windowDetail) 12 | { 13 | this.ChangeState = changeState; 14 | this.WindowDetail = windowDetail; 15 | } 16 | 17 | public WindowChangeStates ChangeState { get; init; } 18 | 19 | public ProgramWindowDetail WindowDetail { get; init; } 20 | } 21 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Intermediary/WindowDestroyCommand.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | using HackSystem.Web.ProgramSchedule.Entity; 3 | 4 | namespace HackSystem.Web.ProgramSchedule.Intermediary; 5 | 6 | public class WindowDestroyCommand : IIntermediaryCommand 7 | { 8 | public WindowDestroyCommand(ProgramWindowDetail programWindowDetail) 9 | { 10 | this.ProgramWindowDetail = programWindowDetail; 11 | } 12 | 13 | public ProgramWindowDetail ProgramWindowDetail { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Intermediary/WindowScheduleRequest.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | using HackSystem.Web.ProgramSchedule.Enums; 3 | using HackSystem.Web.ProgramSchedule.Entity; 4 | 5 | namespace HackSystem.Web.ProgramSchedule.Intermediary; 6 | 7 | public class WindowScheduleRequest : IIntermediaryRequest 8 | { 9 | public WindowScheduleRequest( 10 | ProgramWindowDetail programWindowDetail, 11 | WindowChangeStates changeState) 12 | { 13 | this.ProgramWindowDetail = programWindowDetail; 14 | this.ChangeState = changeState; 15 | } 16 | 17 | public ProgramWindowDetail ProgramWindowDetail { get; init; } 18 | 19 | public WindowChangeStates ChangeState { get; init; } 20 | } 21 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Intermediary/WindowScheduleResponse.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.Enums; 2 | 3 | namespace HackSystem.Web.ProgramSchedule.Intermediary; 4 | 5 | public class WindowScheduleResponse 6 | { 7 | public WindowScheduleResponse( 8 | WindowChangeStates changeState, 9 | bool scheduled) 10 | { 11 | this.ChangeState = changeState; 12 | this.Scheduled = scheduled; 13 | } 14 | 15 | public WindowChangeStates ChangeState { get; init; } 16 | 17 | public bool Scheduled { get; init; } 18 | } 19 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/IntermediaryHandler/IWindowScheduleRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Application; 2 | using HackSystem.Web.ProgramSchedule.Intermediary; 3 | 4 | namespace HackSystem.Web.ProgramSchedule.IntermediaryHandler; 5 | 6 | public interface IWindowScheduleRequestHandler : IIntermediaryRequestHandler 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Launcher/IProgramLauncher.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.Entity; 2 | 3 | namespace HackSystem.Web.ProgramSchedule.Launcher; 4 | 5 | public interface IProgramLauncher 6 | { 7 | Task LaunchProgram(ProgramDetail programDetail); 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Launcher/IWindowLauncher.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.Entity; 2 | 3 | namespace HackSystem.Web.ProgramSchedule.Launcher; 4 | 5 | public interface IWindowLauncher 6 | { 7 | Task LaunchWindow(ProcessDetail process, Type windowComponentType, ProgramWindowDetail? parentWindowDetail = null); 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Options/ProgramSchedulerOptions.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.ProgramSchedule.Options; 2 | 3 | public class ProgramSchedulerOptions 4 | { 5 | public int ProgramLayerStart { get; set; } = 200; 6 | 7 | public int TopProgramLayerStart { get; set; } = 850; 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Scheduler/IWindowScheduleContainer.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.Entity; 2 | using HackSystem.Web.ProgramSchedule.Enums; 3 | 4 | namespace HackSystem.Web.ProgramSchedule.Scheduler; 5 | 6 | public interface IWindowScheduleContainer 7 | { 8 | int WindowTierIndexLowEdge { get; set; } 9 | 10 | int WindowTierIndexHighEdge { get; set; } 11 | 12 | ProgramWindowDetail? ActivatedWindow { get; } 13 | 14 | bool WindowExist(ProgramWindowDetail windowDetail); 15 | 16 | Task Schedule(ProgramWindowDetail windowDetail, WindowChangeStates changeState); 17 | } 18 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Abstractions/Scheduler/IWindowScheduler.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.Entity; 2 | using HackSystem.Web.ProgramSchedule.Enums; 3 | 4 | namespace HackSystem.Web.ProgramSchedule.Scheduler; 5 | 6 | public interface IWindowScheduler 7 | { 8 | Task Schedule(ProgramWindowDetail windowDetail, WindowChangeStates changeState); 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.Infrastructure/IDGenerator/PIDGenerator.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.IDGenerator; 2 | 3 | namespace HackSystem.Web.ProgramSchedule.Infrastructure.IDGenerator; 4 | 5 | public class PIDGenerator : IPIDGenerator 6 | { 7 | private int availablePID = 0; 8 | 9 | public int GetAvailablePID() 10 | => Interlocked.Increment(ref availablePID); 11 | } 12 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramSchedule.InfrastructureTests/Container/ProcessContainerTests.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.Container; 2 | using HackSystem.Web.ProgramSchedule.Entity; 3 | using Xunit; 4 | 5 | namespace HackSystem.Web.ProgramSchedule.Infrastructure.Container.Tests; 6 | 7 | public class ProcessContainerTests 8 | { 9 | [Fact()] 10 | public void ProcessContainerTest() 11 | { 12 | IProcessContainer container = new ProcessContainer(new Mock>().Object); 13 | for (int index = 0; index < 5; index++) 14 | { 15 | container.LaunchProcess(new ProcessDetail(index, default)); 16 | Assert.NotNull(container.GetProcess(index)); 17 | } 18 | Assert.Equal(5, container.GetProcesses().Count()); 19 | 20 | Assert.True(container.DestroyProcess(2, out var process)); 21 | Assert.NotNull(process); 22 | 23 | Assert.True(container.DestroyProcess(4, out process)); 24 | Assert.NotNull(process); 25 | 26 | Assert.False(container.DestroyProcess(6, out process)); 27 | Assert.Null(process); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/HackSystem.Web.ProgramScheduleTests/IDGenerator/PIDGeneratorTests.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.IDGenerator; 2 | using HackSystem.Web.ProgramSchedule.Infrastructure.IDGenerator; 3 | using Xunit; 4 | 5 | namespace HackSystem.Web.ProgramSchedule.IDGenerator.Tests; 6 | 7 | public class PIDGeneratorTests 8 | { 9 | [Fact()] 10 | public void GetAvailablePIDTest() 11 | { 12 | IPIDGenerator generator = new PIDGenerator(); 13 | var pidPool = new HashSet(); 14 | 15 | Parallel.For(0, 10000, x => 16 | { 17 | var pid = generator.GetAvailablePID(); 18 | lock (pidPool) 19 | { 20 | Assert.DoesNotContain(pid, pidPool); 21 | pidPool.Add(pid); 22 | } 23 | }); 24 | 25 | Assert.Equal(10000, pidPool.Count); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Account/LoginComponent.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Account; 2 | 3 | public partial class LoginComponent 4 | { 5 | public LoginComponent() 6 | { 7 | } 8 | 9 | private async Task OnLogin() 10 | { 11 | this.Logging = true; 12 | this.ShowErrors = false; 13 | this.logger.LogDebug($"User try to Login: {this.loginRequest.UserName}"); 14 | 15 | try 16 | { 17 | var result = await this.authenticationService.Login(this.loginRequest); 18 | this.logger.LogDebug($"Login result: {(result.Successful ? "Success" : "Fail")}"); 19 | 20 | if (result.Successful) 21 | { 22 | this.navigationManager.NavigateTo("/Desktop"); 23 | } 24 | else 25 | { 26 | this.logger.LogWarning($"Login Error: {result.Error}"); 27 | this.Error = result.Error; 28 | this.ShowErrors = true; 29 | } 30 | } 31 | catch (Exception ex) 32 | { 33 | this.logger.LogError($"Login Exception: {ex.Message}"); 34 | this.Error = ex.Message; 35 | this.ShowErrors = true; 36 | } 37 | 38 | this.Logging = false; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Account/LogoutComponent.razor: -------------------------------------------------------------------------------- 1 | @page "/Logout" 2 | @inject IAuthenticationService AuthenticationService 3 | @inject NavigationManager NavigationManager 4 | @inject IIntermediaryPublisher publisher 5 | 6 | @code { 7 | protected override async Task OnInitializedAsync() 8 | { 9 | await AuthenticationService.Logout(); 10 | await this.publisher.SendCommand(new LogoutCommand()); 11 | NavigationManager.NavigateTo("/StartUp"); 12 | } 13 | } -------------------------------------------------------------------------------- /src/HackSystem.Web/Account/UserStatusComponent.razor: -------------------------------------------------------------------------------- 1 | @inject IJSRuntime jsRuntime 2 | 3 | 4 | 5 |

6 | @context.User.Identity.Name 7 |

8 | 9 |
10 | 11 | 12 | 13 | 14 |
-------------------------------------------------------------------------------- /src/HackSystem.Web/App.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components.Routing; 2 | 3 | namespace HackSystem.Web; 4 | 5 | public partial class App 6 | { 7 | protected override async Task OnInitializedAsync() 8 | { 9 | this.logger.LogInformation($"Initialize App..."); 10 | await base.OnInitializedAsync(); 11 | } 12 | 13 | protected async Task OnNavigateAsync(NavigationContext navigationContext) 14 | { 15 | this.logger.LogInformation($"Navigating to {navigationContext.Path}"); 16 | await Task.CompletedTask; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/HackSystem.Web/App.razor: -------------------------------------------------------------------------------- 1 | @inject ILogger logger 2 | @inject LazyAssemblyLoader lazyAssemblyLoader 3 | 4 | 5 | 6 | @* component is from Microsoft.AspNetCore.Components.Authorization Nuget 7 | * It offers a parameter type of Task, component use this parameter to identity authorize status 8 | *@ 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | @code{ 24 | protected HashSet AdditionalAssemblies = new HashSet(); 25 | } 26 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Configurations/APIConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Configurations; 2 | 3 | public class APIConfiguration 4 | { 5 | public string APIHost { get; set; } 6 | 7 | public int TokenExpiryInMinutes { get; set; } 8 | 9 | public int TokenRefreshInMinutes { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Configurations/SecurityConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Configurations; 2 | 3 | public class SecurityConfiguration 4 | { 5 | public string RSAPublicKey { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Configurations/WebComponentTierConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Configurations; 2 | 3 | public class WebComponentTierConfiguration 4 | { 5 | public int IconContainer { get; set; } = 49; 6 | 7 | public int InfoContainer { get; set; } = 149; 8 | 9 | public int ProgramDock { get; set; } = 199; 10 | 11 | public int BasicProgram { get; set; } = 849; 12 | 13 | public int TopProgram { get; set; } = 999; 14 | 15 | public int Bootstrap_Dropdown { get; set; } = 1000; 16 | 17 | public int Bootstrap_Sticky { get; set; } = 1020; 18 | 19 | public int Bootstrap_Fixed { get; set; } = 1030; 20 | 21 | public int Bootstrap_Modal_Backdrop { get; set; } = 1040; 22 | 23 | public int Bootstrap_Modal { get; set; } = 1050; 24 | 25 | public int Bootstrap_Popover { get; set; } = 1060; 26 | 27 | public int Bootstrap_Tooltip { get; set; } = 1070; 28 | 29 | public int ToastContainer { get; set; } = 1080; 30 | 31 | public int TopBar { get; set; } = 1090; 32 | } 33 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Desktop/DesktopMenuComponent.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Desktop; 2 | 3 | public partial class DesktopMenuComponent 4 | { 5 | protected override async Task OnAfterRenderAsync(bool firstRender) 6 | { 7 | await base.OnAfterRenderAsync(firstRender); 8 | 9 | await this.jsRuntime.InvokeVoidAsync("submenus.initSubMenus"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Extensions/HackSystemWebIntermediaryExtension.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Extensions; 2 | using HackSystem.Web.ProgramLayer; 3 | 4 | namespace HackSystem.Web.Extensions; 5 | 6 | public static class HackSystemWebIntermediaryExtension 7 | { 8 | public static IServiceCollection AddHackSystemWebIntermediary(this IServiceCollection services) 9 | => services.AddHackSystemIntermediary(); 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Extensions/LaunchBasicServicesExtension.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.Authentication.TokenHandlers; 2 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 3 | 4 | namespace HackSystem.Web.Extensions; 5 | 6 | /// 7 | /// Launch basic services 8 | /// 9 | /// 10 | /// Each of tab of browser has a WebAssembly runtime which the Blazor WebAssembly application runs in. 11 | /// A new WebAssembly runtime instance will be create when start a new tab of browser or refresh current tab. 12 | /// Navigating to a new page address of current applicaiotn will keep current WebAssembly runtime instance in this tab. 13 | /// 14 | public static class LaunchBasicServicesExtension 15 | { 16 | public static WebAssemblyHost LaunchBasicServices(this WebAssemblyHost host) 17 | { 18 | return host; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/HackSystem.Web/InfoPanel/InfoPanelContainerComponent.razor: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /src/HackSystem.Web/InfoPanel/MainInfoPanelComponent.razor: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 |

7 |
8 |

Info Panel

9 |
10 | 11 | @code{ 12 | bool showBorderFlag = false; 13 | bool showRefreshingFlag = true; 14 | } -------------------------------------------------------------------------------- /src/HackSystem.Web/Layout/DesktopLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | @inject ILogger logger 3 | 4 |
7 | @Body 8 |
9 | 10 | @code { 11 | protected override async Task OnInitializedAsync() 12 | { 13 | this.logger.LogInformation("Initialize Desktop Layout ..."); 14 | await base.OnInitializedAsync(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Layout/FullLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 | @Body 5 |
6 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Mappers/ProgramAsserts/ProgramAssertMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.Programs.ProgramAssets; 2 | 3 | namespace HackSystem.Web.Mappers.ProgramAsserts; 4 | 5 | public class ProgramAssertMapperProfile : Profile 6 | { 7 | public ProgramAssertMapperProfile() 8 | { 9 | this.CreateMap(); 10 | this.CreateMap(); 11 | this.CreateMap(); 12 | this.CreateMap(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Mappers/ProgramSchedules/ProgramDetailMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.Programs; 2 | using HackSystem.Web.ProgramSchedule.Entity; 3 | 4 | namespace HackSystem.Web.Mappers.ProgramSchedules; 5 | 6 | public class ProgramDetailMapperProfile : Profile 7 | { 8 | public ProgramDetailMapperProfile() 9 | { 10 | this.CreateMap(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.Web/Mappers/ProgramSchedules/UserProgramMapMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.Programs; 2 | using HackSystem.Web.ProgramSchedule.Entity; 3 | 4 | namespace HackSystem.Web.Mappers.ProgramSchedules; 5 | 6 | public class UserProgramMapMapperProfile : Profile 7 | { 8 | public UserProgramMapMapperProfile() 9 | { 10 | this.CreateMap(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.Web/ProgramDrawer/ProgramDrawerComponent.razor: -------------------------------------------------------------------------------- 1 | @inject ILogger logger 2 | @inject IIntermediaryPublisher publisher 3 | @inject IIntermediaryEventHandler programMapEventHandler 4 | 5 |
6 | @foreach (var programMap in this.UserProgramMaps.Values.OrderByDescending(map => map.PinToTop)) 7 | { 8 | var programDrawerKey = $"programDrawerKey_{programMap.Program.Id}"; 9 | 11 | } 12 | 15 | 16 |
17 | 18 | @code { 19 | protected Dictionary UserProgramMaps { get; init; } = new(); 20 | 21 | protected ProgramDrawerIconContextMenuComponent IconContextMenuComponent { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /src/HackSystem.Web/ProgramDrawer/ProgramDrawerComponent.razor.css: -------------------------------------------------------------------------------- 1 | ::deep figure.drawer-icon { 2 | } 3 | 4 | ::deep figure.drawer-icon-hover { 5 | background: rgba(255, 255, 255, 0.2); 6 | backdrop-filter: blur(5px); 7 | } 8 | 9 | ::deep figure.drawer-icon-active { 10 | background: rgba(255, 255, 255, 0.5); 11 | backdrop-filter: blur(10px); 12 | } 13 | 14 | ::deep figcaption { 15 | text-shadow: 0px 0px 3px #000, 0px 1px 3px #000, 0px 1px 5px #222; 16 | } 17 | -------------------------------------------------------------------------------- /src/HackSystem.Web/ProgramDrawer/ProgramDrawerIconComponent.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramDrawer.ProgramDrawerEventArgs; 2 | using Microsoft.AspNetCore.Components.Web; 3 | 4 | namespace HackSystem.Web.ProgramDrawer; 5 | 6 | public partial class ProgramDrawerIconComponent 7 | { 8 | protected async Task OnDbClick(MouseEventArgs args) 9 | { 10 | if (!this.OnIconSelect.HasDelegate) return; 11 | 12 | var eventArgs = new ProgramIconEventArgs(this.UserProgramMap, args); 13 | await this.OnIconSelect.InvokeAsync(eventArgs); 14 | } 15 | 16 | protected async Task OnTouchEnd(TouchEventArgs args) 17 | { 18 | if (!this.OnIconSelect.HasDelegate) return; 19 | 20 | var eventArgs = new ProgramIconEventArgs(this.UserProgramMap, args); 21 | await this.OnIconSelect.InvokeAsync(eventArgs); 22 | } 23 | 24 | public async Task OnContextMenu(MouseEventArgs args) 25 | { 26 | if (!this.OnIconContextMenu.HasDelegate) return; 27 | 28 | var eventArgs = new ProgramIconEventArgs(this.UserProgramMap, args); 29 | await this.OnIconContextMenu.InvokeAsync(eventArgs); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/HackSystem.Web/ProgramLayer/ProgramContainerComponent.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Web.ProgramSchedule.Intermediary; 2 | 3 | namespace HackSystem.Web.ProgramLayer; 4 | 5 | /// 6 | /// Program container component 7 | /// 8 | /// 9 | /// Reference external Razor components from a .Net Core Razor Class Library 10 | /// For more details https://github.com/dotnet/aspnetcore/issues/26228 11 | /// 12 | public partial class ProgramContainerComponent : IDisposable 13 | { 14 | protected async override Task OnInitializedAsync() 15 | { 16 | this.windowChangeEventHandler.EventRaised += this.OnWindowChangeEvent; 17 | await base.OnInitializedAsync(); 18 | } 19 | 20 | private void OnWindowChangeEvent(object sender, WindowChangeEvent args) 21 | { 22 | this.logger.LogInformation($"Render program layer when window schedule: {args.WindowDetail.Caption}..."); 23 | this.StateHasChanged(); 24 | } 25 | 26 | public void Dispose() 27 | { 28 | this.windowChangeEventHandler.EventRaised -= this.OnWindowChangeEvent; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/HackSystem.Web/ProgramLayer/ProgramContainerComponent.razor: -------------------------------------------------------------------------------- 1 | @inject ILogger logger 2 | @inject IProcessContainer processContainer 3 | @inject IIntermediaryEventHandler windowChangeEventHandler 4 | 5 |
6 | @foreach (var process in this.processContainer.GetProcesses()) 7 | { 8 | 9 | @foreach (var window in process.GetWindowDetails()) 10 | { 11 | var windowKey = $"window_{window.WindowId}"; 12 | 13 | } 14 | } 15 |
-------------------------------------------------------------------------------- /src/HackSystem.Web/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "HackSystem.Web": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": true, 6 | "launchBrowser": true, 7 | "launchUrl": "https://localhost:2473", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | }, 11 | "applicationUrl": "https://localhost:2473", 12 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.Web/SystemPage/AccessDenied.razor: -------------------------------------------------------------------------------- 1 | @page "/AccessDenied" 2 | @page "/AccessDenied/{Message}" 3 | 4 | 5 | 6 | @code{ 7 | private string message = "Access Denied"; 8 | 9 | [Parameter] 10 | public string Message { get => message; set => message = value; } 11 | } -------------------------------------------------------------------------------- /src/HackSystem.Web/SystemPage/HackSystemMessage.razor: -------------------------------------------------------------------------------- 1 | @page "/HackSystemMessage" 2 | @page "/HackSystemMessage/{Message}" 3 | 4 |
5 |
6 | 7 |

@message

8 | @ChildContent 9 | 10 |
11 | Hack System 12 |
13 |
14 | 15 | @code{ 16 | private string message = "Hack System Message"; 17 | 18 | [Parameter] 19 | public string Message { get => message; set => message = value; } 20 | 21 | [Parameter] 22 | public RenderFragment ChildContent { get; set; } 23 | } -------------------------------------------------------------------------------- /src/HackSystem.Web/SystemPage/NotFound.razor: -------------------------------------------------------------------------------- 1 | @page "/NotFound" 2 | @page "/NotFound/{Message}" 3 | 4 | 5 | 6 | @code{ 7 | private string message = "Not Found"; 8 | 9 | [Parameter] 10 | public string Message { get => message; set => message = value; } 11 | } -------------------------------------------------------------------------------- /src/HackSystem.Web/SystemPage/StartUp.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @page "/StartUp" 3 | @inject NavigationManager NavigationManager 4 | 5 | @code{ 6 | // Cascading parameter from component, component use this to check authorization state. 7 | [CascadingParameter] 8 | private Task authenticationStateTask { get; set; } 9 | 10 | protected async override Task OnInitializedAsync() 11 | { 12 | if (authenticationStateTask == null || 13 | (!(await authenticationStateTask)?.User?.Identity?.IsAuthenticated ?? false)) 14 | { 15 | this.NavigationManager.NavigateTo("Login"); 16 | return; 17 | } 18 | 19 | this.NavigationManager.NavigateTo("Desktop"); 20 | } 21 | } -------------------------------------------------------------------------------- /src/HackSystem.Web/TopBar/MenuBar/MenuBarComponent.razor: -------------------------------------------------------------------------------- 1 | 10 | 11 | @code{ 12 | [CascadingParameter(Name = "DesktopTopBarView")] 13 | protected TopBarView DesktopTopBarView { get; set; } 14 | } -------------------------------------------------------------------------------- /src/HackSystem.Web/TopBar/StatusBar/StatusBarComponent.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.TopBar.StatusBar; 2 | 3 | public partial class StatusBarComponent 4 | { 5 | protected override async Task OnAfterRenderAsync(bool firstRender) 6 | { 7 | await base.OnAfterRenderAsync(firstRender); 8 | 9 | await this.jsRuntime.InvokeVoidAsync("tooltips.initTooltips"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/HackSystem.Web/TopBar/StatusBar/StatusBarComponent.razor: -------------------------------------------------------------------------------- 1 | @inject IJSRuntime jsRuntime 2 | 3 |
4 |
5 | @DesktopTopBarView?.ProgramStatusView 6 | 7 |

8 |

9 |

@DateTime.Now.ToString("HH:mm")

10 | 11 |

12 |
13 |
14 | 15 | @code{ 16 | [CascadingParameter(Name = "DesktopTopBarView")] 17 | protected TopBarView DesktopTopBarView { get; set; } 18 | } -------------------------------------------------------------------------------- /src/HackSystem.Web/TopBar/TopBarComponent.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.TopBar; 2 | 3 | public partial class TopBarComponent 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/HackSystem.Web/TopBar/TopBarComponent.razor: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
5 | 6 |
7 | 8 | 9 |
10 | 11 | @code { 12 | [Parameter] 13 | public int BarHeight { get; set; } = 30; 14 | } -------------------------------------------------------------------------------- /src/HackSystem.Web/TopBar/TopBarView.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components; 2 | 3 | namespace HackSystem.Web.TopBar; 4 | 5 | public class TopBarView : IComponent 6 | { 7 | private RenderHandle renderHandle; 8 | 9 | [Parameter] 10 | public RenderFragment ProgramMenuView { get; set; } 11 | 12 | [Parameter] 13 | public RenderFragment ProgramStatusView { get; set; } 14 | 15 | public void Attach(RenderHandle renderHandle) 16 | { 17 | this.renderHandle = renderHandle; 18 | } 19 | 20 | public Task SetParametersAsync(ParameterView parameters) 21 | { 22 | this.ProgramMenuView = parameters.GetValueOrDefault(nameof(this.ProgramMenuView), null); 23 | this.ProgramStatusView = parameters.GetValueOrDefault(nameof(this.ProgramStatusView), null); 24 | 25 | return Task.CompletedTask; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HackSystem.Web/libman.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "defaultProvider": "cdnjs", 4 | "libraries": [ 5 | { 6 | "library": "twitter-bootstrap@4.5.2", 7 | "destination": "wwwroot/libs/twitter-bootstrap/" 8 | }, 9 | { 10 | "library": "font-awesome@5.14.0", 11 | "destination": "wwwroot/libs/font-awesome/" 12 | }, 13 | { 14 | "library": "jquery@3.5.1", 15 | "destination": "wwwroot/libs/jquery/" 16 | }, 17 | { 18 | "library": "bootstrap-submenu@3.0.1", 19 | "destination": "wwwroot/libs/bootstrap-submenu/" 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/LogoImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Web/wwwroot/LogoImage.png -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/LogoImageIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Web/wwwroot/LogoImageIcon.png -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/LogoImageSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Web/wwwroot/LogoImageSmall.png -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "APIConfiguration": { 3 | "APIHost": "https://localhost:4237" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "APIConfiguration": { 3 | "APIHost": "https://localhost:4237", 4 | "TokenExpiryInMinutes": 30, 5 | "TokenRefreshInMinutes": 25 6 | }, 7 | "SecurityConfiguration": { 8 | "RSAPublicKey": "5OskkdZbbGjeya//2X5Sff1zjxI1AsPwth9YmJVdrQ68a4ENOaFAjN1tac7lzVXX78lLGI/G/2NpjNdPUQPrfomoZ1vEk0IO6vgEHgoeMESwSGlAzOjs9oz6cx4/QvPCvYJ4wlHJzVylEeu2pr7F54ZqWGzKFDBLcl3xtB610rE=AQAB" 9 | }, 10 | "WebComponentTierConfiguration": { 11 | "IconContainer": 49, 12 | "InfoContainer": 149, 13 | "ProgramDock": 199, 14 | "BasicProgramEdge": 200, 15 | "ProgramDivider": 799, 16 | "TopProgramEdge": 999, 17 | "Bootstrap_Dropdown": 1000, 18 | "Bootstrap_Sticky": 1020, 19 | "Bootstrap_Fixed": 1030, 20 | "Bootstrap_Modal_Backdrop": 1040, 21 | "Bootstrap_Modal": 1050, 22 | "Bootstrap_Popover": 1060, 23 | "Bootstrap_Tooltip": 1070, 24 | "ToastContainer": 1080, 25 | "TopBar": 1090 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/css/app.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 3 | } 4 | 5 | .gradual-background { 6 | background: linear-gradient(to bottom, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.15) 100%), radial-gradient(at top center, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.40) 120%) #989898; 7 | background-blend-mode: multiply; 8 | background-attachment: fixed; 9 | background-repeat: no-repeat; 10 | background-size: cover; 11 | } 12 | 13 | .valid.modified:not([type=checkbox]) { 14 | outline: 1px solid #26b050; 15 | } 16 | 17 | .invalid { 18 | outline: 1px solid red; 19 | } 20 | 21 | .validation-message { 22 | color: red; 23 | } 24 | 25 | #blazor-error-ui { 26 | background: lightyellow; 27 | bottom: 0; 28 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 29 | display: none; 30 | left: 0; 31 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 32 | position: fixed; 33 | width: 100%; 34 | z-index: 1000; 35 | } 36 | 37 | #blazor-error-ui .dismiss { 38 | cursor: pointer; 39 | position: absolute; 40 | right: 0.75rem; 41 | top: 0.5rem; 42 | } 43 | -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Web/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/images/Dock/DockDivider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Web/wwwroot/images/Dock/DockDivider.png -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/images/Wallpapers/DesktopBackground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Web/wwwroot/images/Wallpapers/DesktopBackground.jpg -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/images/Wallpapers/LoginBackground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Web/wwwroot/images/Wallpapers/LoginBackground.jpg -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/images/Wallpapers/RegisterBackground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.Web/wwwroot/images/Wallpapers/RegisterBackground.jpg -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/js/blazor.jsTools.js: -------------------------------------------------------------------------------- 1 | window.blazorJSTools = { 2 | loaded: [], 3 | importJavaScript: function (url) { 4 | if (blazorJSTools.loaded[url]) { 5 | console.log(`script ${url} already loaded.`); 6 | return; 7 | } 8 | 9 | var script = document.createElement('script'); 10 | script.type = 'text/javascript'; 11 | script.async = true; 12 | script.src = url; 13 | script.onload = function () { 14 | blazorJSTools.loaded[url] = true; 15 | console.log(`load script ${url} successfully.`); 16 | }; 17 | script.onerror = function () { 18 | console.log(`load script ${url} failed.`); 19 | reject(scriptPath); 20 | } 21 | document.body.appendChild(script); 22 | console.log(`loading script ${url}.`); 23 | } 24 | } -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/js/bootstrap.wrap.js: -------------------------------------------------------------------------------- 1 | window.tooltips = { 2 | initTooltips: function () { 3 | $('[data-toggle="tooltip"]').tooltip(); 4 | }, 5 | hideTooltips: function () { 6 | $('[data-toggle="tooltip"]').tooltip('hide'); 7 | }, 8 | }; 9 | 10 | window.submenus = { 11 | initSubMenus: function () { 12 | $('[data-submenu]').submenupicker(); 13 | } 14 | }; -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/js/hacksystem.launch.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | }); -------------------------------------------------------------------------------- /src/HackSystem.Web/wwwroot/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HackSystem.Web", 3 | "short_name": "HackSystem.Web", 4 | "start_url": "./", 5 | "display": "standalone", 6 | "background_color": "#ffffff", 7 | "theme_color": "#03173d", 8 | "icons": [ 9 | { 10 | "src": "LogoImage.png", 11 | "type": "image/png", 12 | "sizes": "512x512" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Application/HackSystem.WebAPI.Application.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Application/Repository/IGenericOptionRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.Domain.Entity; 3 | 4 | namespace HackSystem.WebAPI.Application.Repository; 5 | 6 | public interface IGenericOptionRepository : IRepositoryBase 7 | { 8 | Task QueryGenericOption(string optionName, string owner = null, string category = null); 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Application/Repository/IWebAPILogRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.Domain.Entity; 3 | 4 | namespace HackSystem.WebAPI.Application.Repository; 5 | 6 | public interface IWebAPILogRepository : IRepositoryBase 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Authentication/Configurations/JwtAuthenticationOptions.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.Authentication.Configurations; 2 | 3 | public class JwtAuthenticationOptions 4 | { 5 | public string JwtSecurityKey { get; set; } 6 | 7 | public string JwtIssuer { get; set; } 8 | 9 | public string JwtAudience { get; set; } 10 | 11 | public int JwtExpiryInMinutes { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Authentication/HackSystem.WebAPI.Authentication.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Authentication/Services/ITokenGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | 3 | namespace HackSystem.WebAPI.Authentication.Services; 4 | 5 | public interface ITokenGenerator 6 | { 7 | string GenerateSecurityToken(IEnumerable claims); 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Domain/Configuration/HackSystemDbContextOptions.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.Domain.Configuration; 2 | 3 | public class HackSystemDbContextOptions 4 | { 5 | public string ConnectionString { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Domain/Entity/GenericOption.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.Domain.Entity; 2 | 3 | public class GenericOption 4 | { 5 | [Key] 6 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 7 | public int OptionID { get; set; } 8 | 9 | public string OptionName { get; set; } 10 | 11 | public string OptionValue { get; set; } 12 | 13 | public string? Category { get; set; } 14 | 15 | public string? OwnerLevel { get; set; } 16 | 17 | public DateTime CreateTime { get; set; } 18 | 19 | public DateTime ModifyTime { get; set; } 20 | } 21 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Domain/Entity/Identity/HackSystemRole.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.Domain.Entity.Identity; 2 | 3 | public class HackSystemRole : IdentityRole 4 | { 5 | public HackSystemRole() 6 | : base() 7 | { 8 | } 9 | 10 | public HackSystemRole(string roleName) 11 | : base(roleName) 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Domain/Entity/Identity/HackSystemUser.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.Domain.Entity.Identity; 2 | 3 | public class HackSystemUser : IdentityUser 4 | { 5 | public HackSystemUser() 6 | : base() 7 | { 8 | } 9 | 10 | public HackSystemUser(string userName) 11 | : base(userName) 12 | { 13 | } 14 | 15 | [DefaultValue(0)] 16 | public int ExperienceLevel { get; set; } 17 | 18 | [DefaultValue(0)] 19 | public int ExperiencePoints { get; set; } 20 | } 21 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Domain/Entity/WebAPILog.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.Domain.Entity; 2 | 3 | public class WebAPILog 4 | { 5 | [Key] 6 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 7 | public int WebAPILogID { get; set; } 8 | 9 | public string RequestURI { get; set; } 10 | 11 | public string QueryString { get; set; } 12 | 13 | public string Method { get; set; } 14 | 15 | public string SourceHost { get; set; } 16 | 17 | public string UserAgent { get; set; } 18 | 19 | public string TraceIdentifier { get; set; } 20 | 21 | public bool IsAuthenticated { get; set; } 22 | 23 | public string? IdentityName { get; set; } 24 | 25 | public string? RequestBody { get; set; } 26 | 27 | public string? ResponseBody { get; set; } 28 | 29 | public int StatusCode { get; set; } 30 | 31 | public DateTime StartDateTime { get; set; } 32 | 33 | public DateTime FinishDateTime { get; set; } 34 | 35 | public long ElapsedTime { get; set; } 36 | 37 | public string? Exception { get; set; } 38 | } 39 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Domain/HackSystem.WebAPI.Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Domain/Notifications/CreateAccountNotification.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.Intermediary.Domain; 2 | using HackSystem.WebAPI.Domain.Entity.Identity; 3 | 4 | namespace HackSystem.WebAPI.Domain.Notifications 5 | { 6 | public class CreateAccountNotification : IIntermediaryNotification 7 | { 8 | public HackSystemUser User { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Infrastructure/Repository/GenericOptionRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository; 2 | using HackSystem.WebAPI.Application.Repository.Abstractions; 3 | using HackSystem.WebAPI.Domain.Entity; 4 | 5 | namespace HackSystem.WebAPI.Infrastructure.Repository; 6 | 7 | public class GenericOptionRepository : RepositoryBase, IGenericOptionRepository 8 | { 9 | public GenericOptionRepository( 10 | ILogger logger, 11 | DbContext dbContext) 12 | : base(logger, dbContext) 13 | { 14 | } 15 | 16 | public async Task QueryGenericOption(string optionName, string owner = null, string category = null) 17 | => await this 18 | .AsQueryable() 19 | .Where( 20 | o => (o.OptionName == optionName) && 21 | (string.IsNullOrEmpty(o.OwnerLevel) || o.OwnerLevel == owner) && 22 | (string.IsNullOrEmpty(o.Category) || o.Category == category)) 23 | .OrderByDescending(o => o.OwnerLevel) 24 | .ThenByDescending(o => o.Category) 25 | .FirstOrDefaultAsync(); 26 | } 27 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Infrastructure/Repository/WebAPILogRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository; 2 | using HackSystem.WebAPI.Application.Repository.Abstractions; 3 | using HackSystem.WebAPI.Domain.Entity; 4 | 5 | namespace HackSystem.WebAPI.Infrastructure.Repository; 6 | 7 | public class WebAPILogRepository : RepositoryBase, IWebAPILogRepository 8 | { 9 | public WebAPILogRepository( 10 | ILogger logger, 11 | DbContext dbContext) 12 | : base(logger, dbContext) 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Application/HackSystem.WebAPI.MockServer.Application.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Application/Repository/IMockRouteLogRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.MockServer.Domain.Entity; 3 | 4 | namespace HackSystem.WebAPI.MockServer.Application.Repository; 5 | 6 | public interface IMockRouteLogRepository : IRepositoryBase 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Application/Repository/IMockRouteRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.MockServer.Domain.Entity; 3 | 4 | namespace HackSystem.WebAPI.MockServer.Application.Repository; 5 | 6 | public interface IMockRouteRepository : IRepositoryBase 7 | { 8 | Task> QueryMockRoutes(); 9 | 10 | Task QueryMockRoute(string uri, string method, string sourceHost); 11 | } 12 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Application/Wrappers/IMockForwardRequestWrapper.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.MockServer.Domain.Entity; 2 | using Microsoft.AspNetCore.Http; 3 | 4 | namespace HackSystem.WebAPI.MockServer.Application.Wrappers; 5 | 6 | public interface IMockForwardRequestWrapper 7 | { 8 | HttpRequestMessage WrapForwardRequest(HttpContext context, MockRouteDetail mockRoute, in string requestContent, out string forwardRequestContent); 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Application/Wrappers/IMockRouteResponseWrapper.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.MockServer.Domain.Entity; 2 | using Microsoft.AspNetCore.Http; 3 | 4 | namespace HackSystem.WebAPI.MockServer.Application.Wrappers; 5 | 6 | public interface IMockRouteResponseWrapper 7 | { 8 | void WrapMockResponse(HttpContext context, MockRouteDetail mockRoute, in string requestContent, out string responseContent); 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Domain/Configurations/MockServerOptions.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.MockServer.Domain.Configurations; 2 | 3 | public class MockServerOptions 4 | { 5 | public string? MockServerHost { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Domain/Entity/MockRouteDetail.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.MockServer.Domain.Entity; 2 | 3 | public class MockRouteDetail 4 | { 5 | [Key] 6 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 7 | public int RouteID { get; set; } 8 | 9 | public string RouteName { get; set; } 10 | 11 | public bool Enabled { get; set; } 12 | 13 | public string MockURI { get; set; } 14 | 15 | public string? MockMethod { get; set; } 16 | 17 | public string? MockSourceHost { get; set; } 18 | 19 | public int DelayDuration { get; set; } 20 | 21 | public int StatusCode { get; set; } 22 | 23 | public string ResponseBodyTemplate { get; set; } 24 | 25 | public MockType MockType { get; set; } 26 | 27 | public string? ForwardAddress { get; set; } 28 | 29 | public string? ForwardMethod { get; set; } 30 | 31 | public string? ForwardRequestBodyTemplate { get; set; } 32 | 33 | public MockType? ForwardMockType { get; set; } 34 | } 35 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Domain/Entity/MockRouteLogStatus.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.MockServer.Domain.Entity; 2 | 3 | public enum MockRouteLogStatus 4 | { 5 | Received, 6 | Processing, 7 | Failed, 8 | Complete, 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Domain/Entity/MockType.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.MockServer.Domain.Entity; 2 | 3 | public enum MockType 4 | { 5 | GenerateByTemplate, 6 | ReadFromPayload, 7 | } 8 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Domain/HackSystem.WebAPI.MockServer.Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Infrastructure/HackSystem.WebAPI.MockServer.Infrastructure.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Infrastructure/Repository/MockRouteLogRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.MockServer.Application.Repository; 3 | using HackSystem.WebAPI.MockServer.Domain.Entity; 4 | using Microsoft.EntityFrameworkCore; 5 | 6 | namespace HackSystem.WebAPI.MockServer.Infrastructure.Repository; 7 | 8 | public class MockRouteLogRepository : RepositoryBase, IMockRouteLogRepository 9 | { 10 | public MockRouteLogRepository( 11 | ILogger logger, 12 | DbContext dbContext) 13 | : base(logger, dbContext) 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Infrastructure/Wrappers/MockForwardRequestWrapper.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.MockServer.Application.Wrappers; 2 | using HackSystem.WebAPI.MockServer.Domain.Entity; 3 | using Microsoft.AspNetCore.Http; 4 | 5 | namespace HackSystem.WebAPI.MockServer.Infrastructure.Wrappers; 6 | 7 | public class MockForwardRequestWrapper : IMockForwardRequestWrapper 8 | { 9 | public HttpRequestMessage WrapForwardRequest(HttpContext context, MockRouteDetail mockRoute, in string requestContent, out string forwardRequestContent) 10 | { 11 | forwardRequestContent = string.Empty; 12 | if (mockRoute.ForwardMockType == MockType.GenerateByTemplate) 13 | { 14 | forwardRequestContent = mockRoute.ForwardRequestBodyTemplate; 15 | } 16 | else if (mockRoute.ForwardMockType == MockType.ReadFromPayload) 17 | { 18 | forwardRequestContent = requestContent; 19 | } 20 | 21 | var request = new HttpRequestMessage() 22 | { 23 | Method = new HttpMethod(mockRoute.ForwardMethod), 24 | RequestUri = new Uri(mockRoute.ForwardAddress), 25 | Content = new StringContent(forwardRequestContent), 26 | }; 27 | return request; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer.Infrastructure/Wrappers/MockRouteResponseWrapper.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.MockServer.Application.Wrappers; 2 | using HackSystem.WebAPI.MockServer.Domain.Entity; 3 | using Microsoft.AspNetCore.Http; 4 | 5 | namespace HackSystem.WebAPI.MockServer.Infrastructure.Wrappers; 6 | 7 | public class MockRouteResponseWrapper : IMockRouteResponseWrapper 8 | { 9 | public void WrapMockResponse(HttpContext context, MockRouteDetail mockRoute, in string requestContent, out string responseContent) 10 | { 11 | context.Response.StatusCode = mockRoute.StatusCode; 12 | 13 | responseContent = string.Empty; 14 | if (mockRoute.MockType == MockType.GenerateByTemplate) 15 | { 16 | responseContent = mockRoute.ResponseBodyTemplate; 17 | } 18 | else if (mockRoute.MockType == MockType.ReadFromPayload) 19 | { 20 | responseContent = requestContent; 21 | } 22 | context.Response.WriteAsync(responseContent).ConfigureAwait(false); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.MockServer/HackSystem.WebAPI.MockServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Application/HackSystem.WebAPI.ProgramServer.Application.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Application/Repository/IProgramDetailRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.ProgramServer.Domain.Entity.Programs; 3 | 4 | namespace HackSystem.WebAPI.ProgramServer.Application.Repository; 5 | 6 | public interface IProgramDetailRepository : IRepositoryBase 7 | { 8 | Task> QueryMandatoryPrograms(); 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Application/Repository/IProgramUserRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.ProgramServer.Domain.Entity; 3 | 4 | namespace HackSystem.WebAPI.ProgramServer.Application.Repository 5 | { 6 | public interface IProgramUserRepository : IRepositoryBase 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Application/Repository/IUserProgramMapRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.ProgramServer.Domain.Entity.Maps; 3 | 4 | namespace HackSystem.WebAPI.ProgramServer.Application.Repository; 5 | 6 | public interface IUserProgramMapRepository : IRepositoryBase 7 | { 8 | Task CheckUserProgramMap(string userId, string programId); 9 | 10 | Task> QueryUserProgramMaps(string userId); 11 | 12 | Task DeleteUserProgramMap(string userId, string programId); 13 | } 14 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Application/Repository/ProgramAssets/IProgramAssetService.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.ProgramServer.Domain.Entity.ProgramAssets; 2 | 3 | namespace HackSystem.WebAPI.ProgramServer.Application.Repository.ProgramAssets; 4 | 5 | public interface IProgramAssetService 6 | { 7 | Task QueryProgramAssetList(string programId); 8 | 9 | Task QueryProgramIcon(string programId); 10 | 11 | Task QueryProgramAssetPackage(string programId); 12 | 13 | Task QueryProgramAssetPackage(ProgramAssetPackage package); 14 | } 15 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Domain/Configurations/ProgramAssetOptions.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.ProgramServer.Domain.Configurations; 2 | 3 | public class ProgramAssetOptions 4 | { 5 | public string FolderPath { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Domain/Entity/Maps/UserProgramMap.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.ProgramServer.Domain.Entity.Programs; 2 | 3 | namespace HackSystem.WebAPI.ProgramServer.Domain.Entity.Maps; 4 | 5 | public class UserProgramMap 6 | { 7 | public string UserId { get; set; } 8 | 9 | public virtual ProgramUser ProgramUser { get; set; } 10 | 11 | public string ProgramId { get; set; } 12 | 13 | public virtual ProgramDetail Program { get; set; } 14 | 15 | [DefaultValue(true)] 16 | public bool PinToDesktop { get; set; } 17 | 18 | [DefaultValue(false)] 19 | public bool PinToDock { get; set; } 20 | 21 | [DefaultValue(false)] 22 | public bool PinToTop { get; set; } 23 | 24 | [DefaultValue(null)] 25 | public string? Rename { get; set; } 26 | } 27 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Domain/Entity/ProgramAssets/ProgramAsset.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.ProgramServer.Domain.Entity.ProgramAssets; 2 | 3 | public class ProgramAsset 4 | { 5 | public string FileName { get; set; } 6 | 7 | public byte[] DLLBytes { get; set; } 8 | 9 | public byte[] PDBBytes { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Domain/Entity/ProgramAssets/ProgramAssetPackage.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.ProgramServer.Domain.Entity.ProgramAssets; 2 | 3 | public class ProgramAssetPackage 4 | { 5 | public string ProgramId { get; set; } 6 | 7 | public IEnumerable ProgramAssets { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Domain/Entity/ProgramUser.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.ProgramServer.Domain.Entity.Maps; 2 | 3 | namespace HackSystem.WebAPI.ProgramServer.Domain.Entity; 4 | 5 | public class ProgramUser 6 | { 7 | [Key] 8 | public string Id { get; set; } 9 | 10 | public virtual IList UserProgramMaps { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Domain/Entity/Programs/ProgramBase.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.ProgramServer.Domain.Entity.Maps; 2 | 3 | namespace HackSystem.WebAPI.ProgramServer.Domain.Entity.Programs; 4 | 5 | public class ProgramBase 6 | { 7 | [Key] 8 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 9 | public string Id { get; set; } 10 | 11 | public string Name { get; set; } 12 | 13 | [DefaultValue(true)] 14 | public bool Enabled { get; set; } 15 | 16 | public bool SingleInstance { get; set; } 17 | 18 | public string EntryAssemblyName { get; set; } 19 | 20 | public string EntryTypeName { get; set; } 21 | 22 | public string? EntryParameter { get; set; } 23 | 24 | public bool Mandatory { get; set; } 25 | 26 | public virtual IList UserProgramMaps { get; set; } 27 | } 28 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Domain/Entity/Programs/ProgramDetail.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.ProgramServer.Domain.Entity.Programs; 2 | 3 | public class ProgramDetail : ProgramBase 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Domain/HackSystem.WebAPI.ProgramServer.Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Infrastructure/HackSystem.WebAPI.ProgramServer.Infrastructure.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Infrastructure/Repository/ProgramDetailRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.ProgramServer.Application.Repository; 3 | using HackSystem.WebAPI.ProgramServer.Domain.Entity.Programs; 4 | using Microsoft.EntityFrameworkCore; 5 | 6 | namespace HackSystem.WebAPI.ProgramServer.Infrastructure.Repository; 7 | 8 | public class ProgramDetailRepository : RepositoryBase, IProgramDetailRepository 9 | { 10 | public ProgramDetailRepository( 11 | ILogger logger, 12 | DbContext dbContext) 13 | : base(logger, dbContext) 14 | { 15 | } 16 | 17 | public async Task> QueryMandatoryPrograms() 18 | => this.AsQueryable().Where(p => p.Mandatory); 19 | } 20 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer.Infrastructure/Repository/ProgramUserRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.ProgramServer.Application.Repository; 3 | using HackSystem.WebAPI.ProgramServer.Domain.Entity; 4 | using Microsoft.EntityFrameworkCore; 5 | 6 | namespace HackSystem.WebAPI.ProgramServer.Infrastructure.Repository; 7 | 8 | public class ProgramUserRepository : RepositoryBase, IProgramUserRepository 9 | { 10 | public ProgramUserRepository( 11 | ILogger logger, 12 | DbContext dbContext) 13 | : base(logger, dbContext) 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.ProgramServer/HackSystem.WebAPI.ProgramServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Application/HackSystem.WebAPI.TaskServer.Application.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Application/Jobs/ITaskGenericJob.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.TaskServer.Application.Jobs; 2 | 3 | public interface ITaskGenericJob : ITaskJobBase 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Application/Jobs/ITaskJobBase.cs: -------------------------------------------------------------------------------- 1 | using FluentScheduler; 2 | using HackSystem.WebAPI.TaskServer.Domain.Entity; 3 | 4 | namespace HackSystem.WebAPI.TaskServer.Application.Jobs; 5 | 6 | public interface ITaskJobBase : IJob 7 | { 8 | TaskDetail TaskDetail { get; set; } 9 | 10 | string Trigger { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Application/ParameterWrappers/ITaskJsonParameterWrapper.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.TaskServer.Application.ParameterWrappers; 2 | 3 | public interface ITaskJsonParameterWrapper : ITaskParameterWrapper 4 | { 5 | object? WrapTaskParameters(string taskParameters, Type type); 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Application/ParameterWrappers/ITaskPairParameterWrapper.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.TaskServer.Application.ParameterWrappers; 2 | 3 | public interface ITaskPairParameterWrapper : ITaskParameterWrapper 4 | { 5 | IDictionary? WrapTaskParameters(string taskParameters); 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Application/ParameterWrappers/ITaskParameterWrapper.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.TaskServer.Application.ParameterWrappers; 2 | 3 | public interface ITaskParameterWrapper 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Application/Repository/ITaskLogRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.TaskServer.Domain.Entity; 3 | 4 | namespace HackSystem.WebAPI.TaskServer.Application.Repository; 5 | 6 | public interface ITaskLogRepository : IRepositoryBase 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Application/Repository/ITaskRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.TaskServer.Domain.Entity; 3 | 4 | namespace HackSystem.WebAPI.TaskServer.Application.Repository; 5 | 6 | public interface ITaskRepository : IRepositoryBase 7 | { 8 | Task> QueryTasks(); 9 | 10 | Task> QuerySchedulableTasks(); 11 | } 12 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Application/ScheduleWrappers/ITaskScheduleWrapper.cs: -------------------------------------------------------------------------------- 1 | using FluentScheduler; 2 | using HackSystem.WebAPI.TaskServer.Domain.Entity; 3 | 4 | namespace HackSystem.WebAPI.TaskServer.Application.ScheduleWrappers; 5 | 6 | public interface ITaskScheduleWrapper 7 | { 8 | IEnumerable<(TaskDetail TaskDetail, Action ScheduleAction)> WrapTaskSchedules(IEnumerable taskDetails); 9 | 10 | (TaskDetail TaskDetail, Action ScheduleAction) WrapTaskSchedule(TaskDetail taskDetail); 11 | } 12 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Application/Services/IHackSystemTaskServer.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.TaskServer.Domain.Entity; 2 | 3 | namespace HackSystem.WebAPI.TaskServer.Application.Services; 4 | 5 | public interface IHackSystemTaskServer 6 | { 7 | void Launch(); 8 | 9 | void LoadTasks(); 10 | 11 | void LoadTask(TaskDetail taskDetail); 12 | 13 | void UnloadTask(TaskDetail taskDetail); 14 | 15 | void UnloadTasks(); 16 | 17 | void Shutdown(); 18 | 19 | void ExecuteTask(TaskDetail taskDetail, string trigger); 20 | } 21 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Application/Services/ITaskLoader.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.TaskServer.Domain.Entity; 2 | 3 | namespace HackSystem.WebAPI.TaskServer.Application.Services; 4 | 5 | public interface ITaskLoader 6 | { 7 | IEnumerable GetTaskDetails(); 8 | } 9 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Domain/Configuration/TaskServerOptions.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.TaskServer.Domain.Configuration; 2 | 3 | public class TaskServerOptions 4 | { 5 | public string? TaskServerHost { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Domain/Entity/TaskDetail.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.TaskServer.Domain.Entity; 2 | 3 | public class TaskDetail 4 | { 5 | [Key] 6 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 7 | public int TaskID { get; set; } 8 | 9 | public string TaskName { get; set; } 10 | 11 | [DefaultValue(true)] 12 | public bool Enabled { get; set; } 13 | 14 | public DateTime ExecuteDateTime { get; set; } 15 | 16 | public TimeSpan FirstInterval { get; set; } 17 | 18 | public TimeSpan AutomaticInterval { get; set; } 19 | 20 | public TaskFrequency TaskFrequency { get; set; } 21 | 22 | public bool Reentrant { get; set; } 23 | 24 | public string AssemblyName { get; set; } 25 | 26 | public string ClassName { get; set; } 27 | 28 | public string ProcedureName { get; set; } 29 | 30 | public string? Parameters { get; set; } 31 | 32 | public string? Category { get; set; } 33 | 34 | public DateTime CreateTime { get; set; } 35 | } 36 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Domain/Entity/TaskFrequency.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.TaskServer.Domain.Entity; 2 | 3 | public enum TaskFrequency 4 | { 5 | Manually, 6 | Once, 7 | Automatically, 8 | Daily, 9 | Weekly, 10 | Monthly, 11 | Yearly 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Domain/Entity/TaskLogDetail.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.TaskServer.Domain.Entity; 2 | 3 | public class TaskLogDetail 4 | { 5 | [Key] 6 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 7 | public int TaskLogID { get; set; } 8 | 9 | public int TaskID { get; set; } 10 | 11 | public string? Parameters { get; set; } 12 | 13 | public DateTime TriggerDateTime { get; set; } 14 | 15 | public DateTime StartDateTime { get; set; } 16 | 17 | public DateTime FinishDateTime { get; set; } 18 | 19 | public TaskLogStatus TaskLogStatus { get; set; } 20 | 21 | public string Trigger { get; set; } 22 | 23 | public string? Exception { get; set; } 24 | } 25 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Domain/Entity/TaskLogStatus.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.TaskServer.Domain.Entity; 2 | 3 | public enum TaskLogStatus 4 | { 5 | Pending, 6 | Allocated, 7 | Running, 8 | Cancelled, 9 | Failed, 10 | Complete, 11 | } 12 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Domain/HackSystem.WebAPI.TaskServer.Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Infrastructure/Extensions/HackSystemTaskServerInfrastructureExtension.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.TaskServer.Application.ParameterWrappers; 2 | using HackSystem.WebAPI.TaskServer.Infrastructure.ParameterWrappers; 3 | 4 | namespace HackSystem.WebAPI.TaskServer.Infrastructure.Extensions; 5 | 6 | public static class HackSystemTaskServerInfrastructureExtension 7 | { 8 | public static IServiceCollection AttachTaskServerInfrastructure( 9 | this IServiceCollection services) 10 | { 11 | services 12 | .AddTransient() 13 | .AddTransient(); 14 | 15 | return services; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Infrastructure/ParameterWrappers/TaskJsonParameterWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | using HackSystem.WebAPI.TaskServer.Application.ParameterWrappers; 3 | 4 | namespace HackSystem.WebAPI.TaskServer.Infrastructure.ParameterWrappers; 5 | 6 | public class TaskJsonParameterWrapper : ITaskJsonParameterWrapper 7 | { 8 | public object? WrapTaskParameters(string taskParameters, Type type) 9 | { 10 | try 11 | { 12 | var result = JsonSerializer.Deserialize(taskParameters, type); 13 | return result; 14 | } 15 | catch 16 | { 17 | return default; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Infrastructure/Repository/TaskLogRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.TaskServer.Application.Repository; 3 | using HackSystem.WebAPI.TaskServer.Domain.Entity; 4 | using Microsoft.EntityFrameworkCore; 5 | 6 | namespace HackSystem.WebAPI.TaskServer.Infrastructure.Repository; 7 | 8 | public class TaskLogRepository : RepositoryBase, ITaskLogRepository 9 | { 10 | public TaskLogRepository( 11 | ILogger logger, 12 | DbContext dbContext) 13 | : base(logger, dbContext) 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Infrastructure/Repository/TaskRepository.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Application.Repository.Abstractions; 2 | using HackSystem.WebAPI.TaskServer.Application.Repository; 3 | using HackSystem.WebAPI.TaskServer.Domain.Entity; 4 | using Microsoft.EntityFrameworkCore; 5 | 6 | namespace HackSystem.WebAPI.TaskServer.Infrastructure.Repository; 7 | 8 | public class TaskRepository : RepositoryBase, ITaskRepository 9 | { 10 | public TaskRepository( 11 | ILogger logger, 12 | DbContext dbContext) 13 | : base(logger, dbContext) 14 | { 15 | } 16 | 17 | public async Task> QueryTasks() 18 | { 19 | return this.AsEnumerable(); 20 | } 21 | 22 | public async Task> QuerySchedulableTasks() 23 | { 24 | return this.AsQueryable().Where(task => task.Enabled && task.TaskFrequency != TaskFrequency.Manually); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.TaskServer.Infrastructure/Services/TaskLoader.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.TaskServer.Application.Repository; 2 | using HackSystem.WebAPI.TaskServer.Application.Services; 3 | using HackSystem.WebAPI.TaskServer.Domain.Entity; 4 | 5 | namespace HackSystem.WebAPI.TaskServer.Infrastructure.Services; 6 | 7 | public class TaskLoader : ITaskLoader 8 | { 9 | private readonly ILogger logger; 10 | private readonly ITaskRepository taskRepository; 11 | 12 | public TaskLoader( 13 | ILogger logger, 14 | ITaskRepository taskRepository) 15 | { 16 | this.logger = logger; 17 | this.taskRepository = taskRepository; 18 | } 19 | 20 | public IEnumerable GetTaskDetails() 21 | { 22 | this.logger.LogInformation($"Get task details..."); 23 | var taskDetails = this.taskRepository.QuerySchedulableTasks().Result; 24 | this.logger.LogInformation($"Get {taskDetails.Count()} Task details."); 25 | return taskDetails; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Tasks/DatabaseBackup/IDatabaseBackupTask.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.Tasks.DatabaseBackup; 2 | 3 | public interface IDatabaseBackupTask 4 | { 5 | void Execute(Dictionary parameters); 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Tasks/Extensions/HackSystemTaskExtension.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Tasks.DatabaseBackup; 2 | 3 | namespace HackSystem.WebAPI.Tasks; 4 | 5 | public static class HackSystemTaskExtension 6 | { 7 | public static IServiceCollection AddWebAPITasks( 8 | this IServiceCollection services) 9 | { 10 | services 11 | .AddTransient(); 12 | 13 | return services; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI.Tasks/HackSystem.WebAPI.Tasks.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "dotnet-ef": { 6 | "version": "5.0.11", 7 | "commands": [ 8 | "dotnet-ef" 9 | ] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Configurations/SecurityConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.WebAPI.Configurations; 2 | 3 | public class SecurityConfiguration 4 | { 5 | public string RSAPrivateKey { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | 4 | namespace HackSystem.WebAPI.Controllers; 5 | 6 | public class HomeController : Controller 7 | { 8 | private readonly ILogger logger; 9 | 10 | public HomeController(ILogger logger) 11 | { 12 | this.logger = logger; 13 | } 14 | 15 | public IActionResult Index() 16 | { 17 | return this.View(); 18 | } 19 | 20 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 21 | public IActionResult HackSystemError() 22 | { 23 | return this.Problem( 24 | detail: Activity.Current?.Id ?? this.HttpContext.TraceIdentifier, 25 | title: "Hack System Error"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/HackSystem.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.WebAPI/HackSystem.db -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Mappers/Accounts/AccountMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.Domain.Entity.Identity; 2 | using HackSystem.DataTransferObjects.Accounts; 3 | 4 | namespace HackSystem.WebAPI.Mappers.Accounts; 5 | 6 | public class AccountMapperProfile : Profile 7 | { 8 | public AccountMapperProfile() 9 | { 10 | this.CreateMap(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Mappers/MockServer/MockServerMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.MockServer.Domain.Entity; 2 | using HackSystem.DataTransferObjects.MockServer; 3 | 4 | namespace HackSystem.WebAPI.Mappers.TaskServer; 5 | 6 | public class MockServerMapperProfile : Profile 7 | { 8 | public MockServerMapperProfile() 9 | { 10 | this.CreateMap(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Mappers/Programs/ProgramAsserts/ProgramAssertMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.ProgramServer.Domain.Entity.ProgramAssets; 2 | using HackSystem.DataTransferObjects.Programs.ProgramAssets; 3 | 4 | namespace HackSystem.WebAPI.Mappers.ProgramMapper.ProgramAsserts; 5 | 6 | public class ProgramAssertMapperProfile : Profile 7 | { 8 | public ProgramAssertMapperProfile() 9 | { 10 | this.CreateMap(); 11 | this.CreateMap(); 12 | this.CreateMap(); 13 | this.CreateMap(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Mappers/Programs/ProgramDetailMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.ProgramServer.Domain.Entity.Maps; 2 | using HackSystem.WebAPI.ProgramServer.Domain.Entity.Programs; 3 | using HackSystem.DataTransferObjects.Programs; 4 | 5 | namespace HackSystem.WebAPI.Mappers.Programs; 6 | 7 | public class ProgramDetailMapperProfile : Profile 8 | { 9 | public ProgramDetailMapperProfile() 10 | { 11 | this.CreateMap(); 12 | this.CreateMap(); 13 | this.CreateMap(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Mappers/TaskServer/TaskDetailMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.WebAPI.TaskServer.Domain.Entity; 2 | using HackSystem.DataTransferObjects.TaskServer; 3 | 4 | namespace HackSystem.WebAPI.Mappers.TaskServer; 5 | 6 | public class TaskDetailMapperProfile : Profile 7 | { 8 | public TaskDetailMapperProfile() 9 | { 10 | this.CreateMap(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "HackSystem.WebAPI": { 4 | "commandName": "Project", 5 | "launchUrl": "https://localhost:4237", 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development", 8 | "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" 9 | }, 10 | "dotnetRunMessages": "true", 11 | "applicationUrl": "https://0:4237" 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Hack System Admin"; 3 | } 4 | 5 |
6 |

Welcome to Hack System.

7 |
8 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using HackSystem.WebAPI 2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 3 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Trace", 5 | "Microsoft": "Debug", 6 | "Microsoft.Hosting.Lifetime": "Debug" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "urls": "https://0:4237", 3 | 4 | "ProgramAssetConfiguration": { 5 | "FolderPath": "C:\\ProgramAssets" 6 | }, 7 | 8 | "Logging": { 9 | "LogLevel": { 10 | "Default": "Trace", 11 | "Microsoft": "Debug", 12 | "Microsoft.Hosting.Lifetime": "Debug" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/libman.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "defaultProvider": "cdnjs", 4 | "libraries": [ 5 | { 6 | "library": "twitter-bootstrap@4.5.2", 7 | "destination": "wwwroot/libs/twitter-bootstrap/" 8 | }, 9 | { 10 | "library": "jquery@3.5.1", 11 | "destination": "wwwroot/libs/jquery/" 12 | }, 13 | { 14 | "library": "font-awesome@5.14.0", 15 | "destination": "wwwroot/libs/font-awesome/" 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/wwwroot/LogoImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.WebAPI/wwwroot/LogoImage.png -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/wwwroot/LogoImageIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.WebAPI/wwwroot/LogoImageIcon.png -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.WebAPI/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/wwwroot/images/HackSystemDefaultProgramIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.WebAPI/wwwroot/images/HackSystemDefaultProgramIcon.png -------------------------------------------------------------------------------- /src/HackSystem.WebAPI/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | // for details on configuring this project to bundle and minify static web assets. 3 | 4 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /src/HackSystem.WebHost/.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "dotnet-ef": { 6 | "version": "5.0.11", 7 | "commands": [ 8 | "dotnet-ef" 9 | ] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/HackSystem.WebHost/HackSystem.WebHost.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 201558c0-ef31-4abd-98e8-74fae33e2f73 6 | enable 7 | icon.ico 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/HackSystem.WebHost/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.HttpLogging; 2 | 3 | var builder = WebApplication.CreateBuilder(args); 4 | var env = builder.Environment; 5 | builder.Services 6 | .AddLogging() 7 | .AddHttpLogging(options => 8 | { 9 | options.LoggingFields = HttpLoggingFields.All; 10 | }); 11 | 12 | builder.Configuration 13 | .AddJsonFile("appsettings.json", true, true) 14 | .AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, true); 15 | 16 | var app = builder.Build(); 17 | if (env.IsDevelopment()) 18 | { 19 | app.UseDeveloperExceptionPage() 20 | .UseWebAssemblyDebugging(); 21 | } 22 | 23 | app.UseRouting() 24 | .UseBlazorFrameworkFiles() 25 | .UseStaticFiles() 26 | .UseEndpoints(endpoints => 27 | { 28 | endpoints.MapFallbackToFile("index.html"); 29 | }); 30 | 31 | app.Run(); 32 | -------------------------------------------------------------------------------- /src/HackSystem.WebHost/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "HackSystem.WebHost": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "dotnetRunMessages": true, 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | }, 10 | "applicationUrl": "https://localhost:2473", 11 | "launchUrl": "https://localhost:2473/StartUp", 12 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/HackSystem.WebHost/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "Microsoft": "Information", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/HackSystem.WebHost/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "urls": "https://0:2473", 3 | 4 | "Logging": { 5 | "LogLevel": { 6 | "Default": "Information", 7 | "Microsoft": "Warning", 8 | "Microsoft.Hosting.Lifetime": "Information" 9 | } 10 | }, 11 | "AllowedHosts": "*" 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.WebHost/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "urls": "https://0:2473", 3 | 4 | "Logging": { 5 | "LogLevel": { 6 | "Default": "Information", 7 | "Microsoft": "Warning", 8 | "Microsoft.Hosting.Lifetime": "Information" 9 | } 10 | }, 11 | "AllowedHosts": "*" 12 | } 13 | -------------------------------------------------------------------------------- /src/HackSystem.WebHost/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/HackSystem.WebHost/icon.ico -------------------------------------------------------------------------------- /src/HackSystem.WebTests/Mocks/MockNavigationManager.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components; 2 | 3 | namespace HackSystem.WebTests.Mocks; 4 | 5 | public class MockNavigationManager : NavigationManager 6 | { 7 | public MockNavigationManager(string baseUri, string uri) 8 | { 9 | this.Initialize(baseUri, uri); 10 | } 11 | 12 | public List NavigationHistory { get; init; } = new List(); 13 | 14 | public bool HasNavigated { get => this.NavigationHistory.Any(); } 15 | 16 | protected override void NavigateToCore(string uri, bool forceLoad) 17 | { 18 | this.Uri = this.ToAbsoluteUri(uri).AbsoluteUri; 19 | this.NavigationHistory.Add(uri); 20 | } 21 | 22 | public void ClearHistory() => this.NavigationHistory.Clear(); 23 | } 24 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.AppStore/AppStoreComponent.razor: -------------------------------------------------------------------------------- 1 | @inherits ProgramComponentBase 2 | 3 |
4 | 5 |

Welcome to APP Store !

6 |
7 | 8 | @code { 9 | public override void Dispose() 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.AppStore/Index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/programs/HackSystem.Web.AppStore/Index.png -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.AppStore/Launcher.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.AppStore; 2 | 3 | public static class Launcher 4 | { 5 | public static Type Launch() 6 | { 7 | return typeof(AppStoreComponent); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.AppStore/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Collections.ObjectModel 3 | @using System.Net.Http 4 | @using System.Net.Http.Json 5 | @using Microsoft.AspNetCore.Authorization 6 | @using Microsoft.AspNetCore.Components.Authorization 7 | @using Microsoft.AspNetCore.Components.Forms 8 | @using Microsoft.AspNetCore.Components.Routing 9 | @using Microsoft.AspNetCore.Components.Web 10 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 11 | @using Microsoft.Extensions.Configuration 12 | @using Microsoft.Extensions.DependencyInjection 13 | @using Microsoft.Extensions.Logging 14 | @using Microsoft.Extensions.Options 15 | @using Microsoft.JSInterop 16 | @using HackSystem.Web.ProgramPlatform.Components.DraggableHandleComponent 17 | @using HackSystem.Web.ProgramPlatform.Components.ProgramComponent 18 | @using HackSystem.Web.ProgramPlatform.Components.ResizeableBorderComponent 19 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Explorer/ExplorerComponent.razor: -------------------------------------------------------------------------------- 1 | @inherits ProgramComponentBase 2 | 3 |
4 |
5 |
6 | 14 |
15 |
16 | 17 |

Explorer

18 |
19 |
20 |
21 | 22 | @code { 23 | public override void Dispose() 24 | { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Explorer/Index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/programs/HackSystem.Web.Explorer/Index.png -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Explorer/Launcher.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Explorer; 2 | 3 | public static class Launcher 4 | { 5 | public static Type Launch() 6 | { 7 | return typeof(ExplorerComponent); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Explorer/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Collections.ObjectModel 3 | @using System.Net.Http 4 | @using System.Net.Http.Json 5 | @using Microsoft.AspNetCore.Authorization 6 | @using Microsoft.AspNetCore.Components.Authorization 7 | @using Microsoft.AspNetCore.Components.Forms 8 | @using Microsoft.AspNetCore.Components.Routing 9 | @using Microsoft.AspNetCore.Components.Web 10 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 11 | @using Microsoft.Extensions.Configuration 12 | @using Microsoft.Extensions.DependencyInjection 13 | @using Microsoft.Extensions.Logging 14 | @using Microsoft.Extensions.Options 15 | @using Microsoft.JSInterop 16 | @using HackSystem.Web.ProgramPlatform.Components.DraggableHandleComponent 17 | @using HackSystem.Web.ProgramPlatform.Components.ProgramComponent 18 | @using HackSystem.Web.ProgramPlatform.Components.ResizeableBorderComponent 19 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Home/ChildWindowComponent.razor: -------------------------------------------------------------------------------- 1 | @inherits ProgramComponentBase 2 | 3 |
4 |

Child Window

5 | 6 |
7 | 8 | @code { 9 | public override void Dispose() 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Home/Index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/programs/HackSystem.Web.Home/Index.png -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Home/Launcher.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Home; 2 | 3 | public static class Launcher 4 | { 5 | public static Type Launch() 6 | { 7 | return typeof(HomeComponent); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Home/ModalWindowComponent.razor: -------------------------------------------------------------------------------- 1 | @inherits ProgramComponentBase 2 | 3 |
4 |

Modal Window

5 | 6 |
7 | 8 | @code { 9 | public override void Dispose() 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Home/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Collections.ObjectModel 3 | @using System.Net.Http 4 | @using System.Net.Http.Json 5 | @using Microsoft.AspNetCore.Authorization 6 | @using Microsoft.AspNetCore.Components.Authorization 7 | @using Microsoft.AspNetCore.Components.Forms 8 | @using Microsoft.AspNetCore.Components.Routing 9 | @using Microsoft.AspNetCore.Components.Web 10 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 11 | @using Microsoft.Extensions.Configuration 12 | @using Microsoft.Extensions.DependencyInjection 13 | @using Microsoft.Extensions.Logging 14 | @using Microsoft.Extensions.Options 15 | @using Microsoft.JSInterop 16 | @using HackSystem.Web.ProgramPlatform.Components.DraggableHandleComponent 17 | @using HackSystem.Web.ProgramPlatform.Components.ProgramComponent 18 | @using HackSystem.Web.ProgramPlatform.Components.ResizeableBorderComponent 19 | @using HackSystem.Web.ProgramSchedule.Entity 20 | @using HackSystem.Web.ProgramSchedule.Launcher -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.MockServer/Index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/programs/HackSystem.Web.MockServer/Index.png -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.MockServer/Launcher.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.MockServer; 2 | 3 | public static class Launcher 4 | { 5 | public static Type Launch() 6 | { 7 | return typeof(MockServerComponent); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.MockServer/MockRouteComponent.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.MockServer; 2 | 3 | public partial class MockRouteComponent 4 | { 5 | public MockRouteComponent() 6 | { 7 | } 8 | 9 | private async Task SwitchMockRouteEnable(bool enable) 10 | { 11 | this.Logger.LogInformation($"Switch Task {this.MockRoute.RouteName} ({this.MockRoute.RouteID}) Enable to {(enable ? "Enabled" : "Disabled")}..."); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.MockServer/Services/IMockRouteService.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.MockServer; 2 | 3 | namespace HackSystem.Web.MockServer.Services; 4 | 5 | public interface IMockRouteService 6 | { 7 | Task> QueryMockRoutes(); 8 | } 9 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.MockServer/Services/MockRouteService.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http.Json; 2 | using HackSystem.DataTransferObjects.MockServer; 3 | using HackSystem.Web.Authentication.WebServices; 4 | 5 | namespace HackSystem.Web.MockServer.Services; 6 | 7 | public class MockRouteService : AuthenticatedServiceBase, IMockRouteService 8 | { 9 | public MockRouteService( 10 | ILogger logger, 11 | IHttpClientFactory httpClientFactory) 12 | : base(logger, httpClientFactory) 13 | { 14 | } 15 | 16 | public async Task> QueryMockRoutes() 17 | { 18 | var result = await this.HttpClient.GetFromJsonAsync>("api/mockserver/QueryMockRoutes"); 19 | return result; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.MockServer/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Collections.ObjectModel 3 | @using System.Net 4 | @using System.Net.Http 5 | @using System.Net.Http.Json 6 | @using Microsoft.AspNetCore.Authorization 7 | @using Microsoft.AspNetCore.Components.Authorization 8 | @using Microsoft.AspNetCore.Components.Forms 9 | @using Microsoft.AspNetCore.Components.Routing 10 | @using Microsoft.AspNetCore.Components.Web 11 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 12 | @using Microsoft.Extensions.Configuration 13 | @using Microsoft.Extensions.DependencyInjection 14 | @using Microsoft.Extensions.Logging 15 | @using Microsoft.Extensions.Options 16 | @using Microsoft.JSInterop 17 | @using HackSystem.Common 18 | @using HackSystem.Web.ProgramPlatform.Components.DraggableHandleComponent 19 | @using HackSystem.Web.ProgramPlatform.Components.ProgramComponent 20 | @using HackSystem.Web.ProgramPlatform.Components.ResizeableBorderComponent 21 | @using HackSystem.Web.MockServer.Services 22 | @using HackSystem.DataTransferObjects.MockServer -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Profile/Index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/programs/HackSystem.Web.Profile/Index.png -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Profile/Launcher.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Profile; 2 | 3 | public static class Launcher 4 | { 5 | public static Type Launch() 6 | { 7 | return typeof(ProfileComponent); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Profile/ProfileComponent.razor: -------------------------------------------------------------------------------- 1 | @inherits ProgramComponentBase 2 | 3 |
4 |

5 |

Profile

6 |
7 | 8 | @code { 9 | public override void Dispose() 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Profile/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Collections.ObjectModel 3 | @using System.Net.Http 4 | @using System.Net.Http.Json 5 | @using Microsoft.AspNetCore.Authorization 6 | @using Microsoft.AspNetCore.Components.Authorization 7 | @using Microsoft.AspNetCore.Components.Forms 8 | @using Microsoft.AspNetCore.Components.Routing 9 | @using Microsoft.AspNetCore.Components.Web 10 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 11 | @using Microsoft.Extensions.Configuration 12 | @using Microsoft.Extensions.DependencyInjection 13 | @using Microsoft.Extensions.Logging 14 | @using Microsoft.Extensions.Options 15 | @using Microsoft.JSInterop 16 | @using HackSystem.Web.ProgramPlatform.Components.DraggableHandleComponent 17 | @using HackSystem.Web.ProgramPlatform.Components.ProgramComponent 18 | @using HackSystem.Web.ProgramPlatform.Components.ResizeableBorderComponent 19 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Setting/Index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/programs/HackSystem.Web.Setting/Index.png -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Setting/Launcher.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.Setting; 2 | 3 | public static class Launcher 4 | { 5 | public static Type Launch() 6 | { 7 | return typeof(SettingComponent); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Setting/SettingComponent.razor: -------------------------------------------------------------------------------- 1 | @inherits ProgramComponentBase 2 | @inject ILogger logger 3 | 4 |
5 |
6 |
7 | 15 |
16 |
17 | 18 |

Settings

19 |
20 |
21 |
22 | 23 | @code { 24 | public override void Dispose() 25 | { 26 | this.logger.LogInformation($"Dispose Setting component..."); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.Setting/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Collections.ObjectModel 3 | @using System.Net.Http 4 | @using System.Net.Http.Json 5 | @using Microsoft.AspNetCore.Authorization 6 | @using Microsoft.AspNetCore.Components.Authorization 7 | @using Microsoft.AspNetCore.Components.Forms 8 | @using Microsoft.AspNetCore.Components.Routing 9 | @using Microsoft.AspNetCore.Components.Web 10 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 11 | @using Microsoft.Extensions.Configuration 12 | @using Microsoft.Extensions.DependencyInjection 13 | @using Microsoft.Extensions.Logging 14 | @using Microsoft.Extensions.Options 15 | @using Microsoft.JSInterop 16 | @using HackSystem.Web.ProgramPlatform.Components.DraggableHandleComponent 17 | @using HackSystem.Web.ProgramPlatform.Components.ProgramComponent 18 | @using HackSystem.Web.ProgramPlatform.Components.ResizeableBorderComponent 19 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.TaskSchedule/Index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CuteLeon/HackSystem/HEAD/src/programs/HackSystem.Web.TaskSchedule/Index.png -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.TaskSchedule/LaunchParameter.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.TaskSchedule; 2 | 3 | public class LaunchParameter 4 | { 5 | public string Developer { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.TaskSchedule/Launcher.cs: -------------------------------------------------------------------------------- 1 | namespace HackSystem.Web.TaskSchedule; 2 | 3 | public static class Launcher 4 | { 5 | public static Type Launch(LaunchParameter parameter) 6 | { 7 | return typeof(TaskSchedulerComponent); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.TaskSchedule/Services/ITaskDetailService.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.TaskServer; 2 | 3 | namespace HackSystem.Web.TaskSchedule.Services; 4 | 5 | public interface ITaskDetailService 6 | { 7 | Task> QueryTasks(); 8 | 9 | Task ExecuteTask(TaskDetailRequest taskDetail); 10 | 11 | Task UpdateTask(TaskDetailRequest taskDetail); 12 | } 13 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.TaskSchedule/TaskDetailComponent.cs: -------------------------------------------------------------------------------- 1 | using HackSystem.DataTransferObjects.TaskServer; 2 | 3 | namespace HackSystem.Web.TaskSchedule; 4 | 5 | public partial class TaskDetailComponent 6 | { 7 | public TaskDetailComponent() 8 | { 9 | } 10 | 11 | private async Task ExecuteTask() 12 | { 13 | if (executing) return; 14 | 15 | this.executing = true; 16 | this.StateHasChanged(); 17 | 18 | if (this.OnExecuteTask.HasDelegate) 19 | await this.OnExecuteTask.InvokeAsync(this.TaskDetail); 20 | 21 | this.executing = false; 22 | this.StateHasChanged(); 23 | } 24 | 25 | private async Task DeleteTask() 26 | { 27 | } 28 | 29 | private async Task EditTask() 30 | { 31 | } 32 | 33 | private async Task SwitchTaskEnable(bool enable) 34 | { 35 | if (this.OnUpdateTask.HasDelegate) 36 | await this.OnUpdateTask.InvokeAsync(new TaskDetailRequest() { TaskID = this.TaskDetail.TaskID, Enabled = enable }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/programs/HackSystem.Web.TaskSchedule/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System 2 | @using System.Collections.ObjectModel 3 | @using System.Net.Http 4 | @using System.Net.Http.Json 5 | @using Microsoft.AspNetCore.Authorization 6 | @using Microsoft.AspNetCore.Components.Authorization 7 | @using Microsoft.AspNetCore.Components.Forms 8 | @using Microsoft.AspNetCore.Components.Routing 9 | @using Microsoft.AspNetCore.Components.Web 10 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 11 | @using Microsoft.Extensions.Configuration 12 | @using Microsoft.Extensions.DependencyInjection 13 | @using Microsoft.Extensions.Logging 14 | @using Microsoft.Extensions.Options 15 | @using Microsoft.JSInterop 16 | @using HackSystem.Common 17 | @using HackSystem.Web.ProgramPlatform.Components.DraggableHandleComponent 18 | @using HackSystem.Web.ProgramPlatform.Components.ProgramComponent 19 | @using HackSystem.Web.ProgramPlatform.Components.ResizeableBorderComponent 20 | @using HackSystem.Web.TaskSchedule.Services 21 | @using HackSystem.DataTransferObjects.TaskServer --------------------------------------------------------------------------------