Repository navigation
Abstract core logic from MainViewModel into CoreLib; add Console sub-project - #5
Merged
Merged
Conversation
…oject Co-authored-by: jindongjie <141336798+jindongjie@users.noreply.github.com> Agent-Logs-Url: https://github.com/jindongjie/SoftwareCopyrightSourceCodeCollector/sessions/13436a72-6b69-4249-8e54-a43aef93335a
Copilot
AI
changed the title
[WIP] Abstract core logic from MainViewModel to Core class
Abstract core logic from MainViewModel into CoreLib; add Console sub-project
Mar 23, 2026
jindongjie
requested changes
Mar 23, 2026
jindongjie
left a comment
Owner
There was a problem hiding this comment.
please contain last commit edit in this pr
… CoreLib stub Co-authored-by: jindongjie <141336798+jindongjie@users.noreply.github.com> Agent-Logs-Url: https://github.com/jindongjie/SoftwareCopyrightSourceCodeCollector/sessions/4b05e8b4-3e4c-45aa-9e11-f035c618ce5b
Contributor
Author
Done in
The Console CLI also gained an exclude-patterns prompt matching the new GUI field. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
jindongjie
approved these changes
Mar 23, 2026
|
jindongjie
marked this pull request as ready for review
March 23, 2026 11:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



All business logic (file scanning, DOCX/TXT export, line counting) was embedded directly in
MainViewModel.cs, making it unusable outside the Avalonia GUI.New:
SoftwareCopyrightSourceCodeCollector.CoreLibPlatform-agnostic class library. No UI framework dependencies.
FileItem— POCO for scanned source filesSoftwareInfo— POCO for all software metadata; ComboBox-driven fields are plainstringCore(static) — extracted business logic:GetCodeCount(file)— binary detection + line countScanFilesAsync(folder, extensions, excludePatterns?)— parallel recursive scan with optional glob-based path exclusion viaMicrosoft.Extensions.FileSystemGlobbing→List<FileItem>ExportToDocxAsync(stream, info, files, maxPage)— full DOCX generation with page trimming; throwsArgumentExceptionon bad input, returns per-file warning listBuildTxtLines(info)— assembles copyright registration TXT linesExportToTxtAsync(outputPath, info)— writes TXT to diskNew:
SoftwareCopyrightSourceCodeCollector.ConsoleInteractive CLI referencing CoreLib only. Two workflows:
Updated:
MainViewModel.csDelegates to
Core; removesGetCodeCount,GetDocxPageCount,RemoveMiddlePages,IsExcluded, and the inline TXT-building block.ComboBoxItemfields are projected tostringwhen constructingSoftwareInfobefore passing to Core. TheExcludeFilesobservable property is passed toCore.ScanFilesAsyncas glob exclude patterns.Merged from
masterExcludeFilesUI field inMainView.axamland supportingIsExcludedlogic (now inCore) usingMicrosoft.Extensions.FileSystemGlobbingCoreLib/stub project — emptyCoreLib/core.csskeleton added alongside the fullSoftwareCopyrightSourceCodeCollector.CoreLibimplementationOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.