Skip to content

PR: Sub Issue 2 - Merge Common + ClientCore + Core into unified GeneralUpdate.Core - #312

Merged
JusterZhu merged 3 commits into
masterfrom
feature/unified-core
May 23, 2026
Merged

JusterZhu merged 3 commits into
masterfrom
feature/unified-core

Conversation

@JusterZhu

Copy link
Copy Markdown
Collaborator

Summary

Closes #310

Changes

  • Merge all source files from \GeneralUpdate.Common\ + \GeneralUpdate.ClientCore\ + \GeneralUpdate.Core\ into a single \GeneralUpdate.Core\ project
  • 78 files changed, 5218 insertions
  • Eliminated all duplicate code: CompressMiddleware, HashMiddleware, PatchMiddleware, WindowsStrategy, LinuxStrategy (was 2 copies each)

New Structure

\
GeneralUpdate.Core/
├── Bootstrap/ # GeneralUpdateBootstrap + GeneralClientBootstrap
├── Configuration/ # UpdateOptions, Configinfo, enums, ProcessInfo, DTOs
├── Strategy/ # Windows/Linux/OSS + AbstractStrategy
├── Pipeline/ # Hash/Compress/Patch/Drivelution + PipelineBuilder
├── Download/ # DownloadManager, DownloadTask
├── Hubs/ # SignalR Hub (from ClientCore)
├── Silent/ # SilentUpdateMode (from ClientCore)
├── Network/ # VersionService
├── FileSystem/ # StorageManager, BlackListManager, FileTree
├── Event/ # EventManager
├── Tracer/ # GeneralTracer
├── JsonContext/ # JSON source generators
├── Compress/ # Compression
└── HashAlgorithms/ # SHA256
\\

Namespace Migration

Old New
\GeneralUpdate.Common.*\ \GeneralUpdate.Core.*\
\GeneralUpdate.ClientCore\ \GeneralUpdate.Core\
\GeneralUpdate.Core.Strategys\ \GeneralUpdate.Core.Strategy\

Build

✅ 0 errors — net8.0 + net10.0

Copilot AI review requested due to automatic review settings May 23, 2026 23:28
@JusterZhu
JusterZhu force-pushed the feature/unified-core branch from ad6180c to ea8a558 Compare May 23, 2026 23:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates the previously split C# code (Common + ClientCore + Core) into a unified GeneralUpdate.Core project, reorganizing the code into a new folder structure and migrating namespaces to match the v2 refactor plan.

Changes:

  • Merged update bootstrap, download, pipeline, strategy, filesystem, tracing, and configuration code into a single GeneralUpdate.Core project targeting net8.0;net10.0.
  • Introduced/ported additional capabilities into the unified project (SignalR hub client, silent update mode, JSON source-generator contexts).
  • Updated/added pipeline + strategy abstractions and removed old project-local dev artifacts (launchSettings.json, AssemblyInfo.cs).

Reviewed changes

Copilot reviewed 78 out of 78 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
src/c#/GeneralUpdate.Core/Tracer/WindowsOutputDebugListener.cs Adds Windows OutputDebugString trace listener (namespace migration needs alignment).
src/c#/GeneralUpdate.Core/Tracer/TextTraceListener.cs Adds async file trace listener (missing namespace).
src/c#/GeneralUpdate.Core/Tracer/GeneralTracer.cs Adds unified tracing facade (namespace migration needs alignment).
src/c#/GeneralUpdate.Core/Strategy/WindowsStrategy.cs Updates Windows strategy imports + integrates pipeline builder.
src/c#/GeneralUpdate.Core/Strategy/OSSStrategy.cs Updates OSS strategy imports + namespace migration.
src/c#/GeneralUpdate.Core/Strategy/LinuxStrategy.cs Updates Linux strategy imports + namespace migration.
src/c#/GeneralUpdate.Core/Strategy/IStrategy.cs Introduces strategy interface for sync/async execution + creation.
src/c#/GeneralUpdate.Core/Strategy/AbstractStrategy.cs Introduces shared strategy base with pipeline orchestration and reporting.
src/c#/GeneralUpdate.Core/Silent/SilentUpdateMode.cs Adds background polling + prepare-and-run silent update flow.
src/c#/GeneralUpdate.Core/Properties/launchSettings.json Removes launch settings from the library project.
src/c#/GeneralUpdate.Core/Properties/AssemblyInfo.cs Removes old AssemblyInfo (likely relying on SDK-generated assembly info).
src/c#/GeneralUpdate.Core/Pipeline/PipelineContext.cs Adds concurrent context bag for middleware.
src/c#/GeneralUpdate.Core/Pipeline/PipelineBuilder.cs Adds middleware stack builder and execution routine.
src/c#/GeneralUpdate.Core/Pipeline/PatchMiddleware.cs Updates middleware references to unified pipeline namespace.
src/c#/GeneralUpdate.Core/Pipeline/IMiddleware.cs Adds middleware abstraction.
src/c#/GeneralUpdate.Core/Pipeline/HashMiddleware.cs Updates middleware references to unified hash/pipeline namespaces.
src/c#/GeneralUpdate.Core/Pipeline/DrivelutionMiddleware.cs Updates middleware references to unified pipeline namespace.
src/c#/GeneralUpdate.Core/Pipeline/CompressMiddleware.cs Updates middleware references to unified compress/pipeline namespaces.
src/c#/GeneralUpdate.Core/Network/VersionService.cs Ports API client for Validate/Report (TLS validation + rethrow behavior need review).
src/c#/GeneralUpdate.Core/JsonContext/VersionRespJsonContext.cs Adds source-gen JSON context for VersionRespDTO.
src/c#/GeneralUpdate.Core/JsonContext/VersionOSSJsonContext.cs Adds source-gen JSON context for VersionOSS list.
src/c#/GeneralUpdate.Core/JsonContext/ReportRespJsonContext.cs Adds source-gen JSON context for report response DTO.
src/c#/GeneralUpdate.Core/JsonContext/ProcessInfoJsonContext.cs Adds source-gen JSON context for ProcessInfo.
src/c#/GeneralUpdate.Core/JsonContext/PacketJsonContext.cs Adds source-gen JSON context for Packet.
src/c#/GeneralUpdate.Core/JsonContext/HttpParameterJsonContext.cs Adds source-gen JSON context for HTTP parameter dictionary.
src/c#/GeneralUpdate.Core/JsonContext/GlobalConfigInfoOSSJsonContext.cs Adds source-gen JSON context for GlobalConfigInfoOSS.
src/c#/GeneralUpdate.Core/JsonContext/FileNodesJsonContext.cs Adds source-gen JSON context for FileNode lists.
src/c#/GeneralUpdate.Core/Hubs/UpgradeHubService.cs Adds SignalR hub client wrapper for upgrade push.
src/c#/GeneralUpdate.Core/Hubs/RandomRetryPolicy.cs Adds reconnect retry policy implementation.
src/c#/GeneralUpdate.Core/Hubs/IUpgradeHubService.cs Adds hub service interface.
src/c#/GeneralUpdate.Core/HashAlgorithms/Sha256HashAlgorithm.cs Adds SHA256 algorithm implementation.
src/c#/GeneralUpdate.Core/HashAlgorithms/HashAlgorithmBase.cs Adds shared hash computation base.
src/c#/GeneralUpdate.Core/GeneralUpdate.Core.csproj Replaces linked Compile includes with direct project refs + net8/net10 targets.
src/c#/GeneralUpdate.Core/FileSystem/StorageManager.cs Ports storage + backup + hashing + JSON helpers (some error-path returns need cleanup).
src/c#/GeneralUpdate.Core/FileSystem/FileTree.cs Ports file tree comparison structure (has encoding artifacts in log text).
src/c#/GeneralUpdate.Core/FileSystem/FileNode.cs Ports file tree node model.
src/c#/GeneralUpdate.Core/FileSystem/ComparisonResult.cs Adds comparison result DTO for directory compare.
src/c#/GeneralUpdate.Core/FileSystem/BlackListManager.cs Ports blacklist manager for files/formats/dirs.
src/c#/GeneralUpdate.Core/Event/IEventManager.cs Adds event manager interface.
src/c#/GeneralUpdate.Core/Event/ExceptionEventArgs.cs Ports exception event args (namespace migration + nullability need alignment).
src/c#/GeneralUpdate.Core/Event/EventManager.cs Ports event manager singleton.
src/c#/GeneralUpdate.Core/Download/MultiEventArgs/UpdateInfoEventArgs.cs Ports update info event args.
src/c#/GeneralUpdate.Core/Download/MultiEventArgs/MutiDownloadStatisticsEventArgs.cs Ports download statistics event args.
src/c#/GeneralUpdate.Core/Download/MultiEventArgs/MutiDownloadErrorEventArgs.cs Ports download error event args.
src/c#/GeneralUpdate.Core/Download/MultiEventArgs/MutiDownloadCompletedEventArgs.cs Ports download completed event args.
src/c#/GeneralUpdate.Core/Download/MultiEventArgs/MutiAllDownloadCompletedEventArgs.cs Ports all-download-completed event args.
src/c#/GeneralUpdate.Core/Download/DownloadTask.cs Ports resumable download task (initial stats timing + range size accounting need review).
src/c#/GeneralUpdate.Core/Download/DownloadManager.cs Ports multi-download manager with aggregation events.
src/c#/GeneralUpdate.Core/Configuration/VersionRespDTO.cs Adds response DTO type alias.
src/c#/GeneralUpdate.Core/Configuration/VersionOSS.cs Ports OSS version record model.
src/c#/GeneralUpdate.Core/Configuration/VersionInfo.cs Ports VersionInfo model + adds auth fields for downloads.
src/c#/GeneralUpdate.Core/Configuration/UpdateOptionValue.cs Ports option value wrapper for bootstrap options.
src/c#/GeneralUpdate.Core/Configuration/UpdateOption.cs Ports option constants/pool implementation.
src/c#/GeneralUpdate.Core/Configuration/UpdateMode.cs Adds update mode enum.
src/c#/GeneralUpdate.Core/Configuration/ReportType.cs Adds report status constants.
src/c#/GeneralUpdate.Core/Configuration/ProcessInfo.cs Ports IPC DTO with validation (timeout validation mismatch).
src/c#/GeneralUpdate.Core/Configuration/PlatformType.cs Adds platform constants.
src/c#/GeneralUpdate.Core/Configuration/Packet.cs Ports push packet DTO.
src/c#/GeneralUpdate.Core/Configuration/ObjectTranslator.cs Ports helper for trace formatting.
src/c#/GeneralUpdate.Core/Configuration/GlobalConfigInfoOSS.cs Ports OSS config model.
src/c#/GeneralUpdate.Core/Configuration/GlobalConfigInfo.cs Ports runtime config state model.
src/c#/GeneralUpdate.Core/Configuration/Format.cs Ports format constants.
src/c#/GeneralUpdate.Core/Configuration/Environments.cs Ports environment IPC helper (namespace migration needs alignment).
src/c#/GeneralUpdate.Core/Configuration/ConfigurationMapper.cs Adds centralized config mapping helpers.
src/c#/GeneralUpdate.Core/Configuration/ConfiginfoBuilder.cs Ports builder that loads update_config.json config.
src/c#/GeneralUpdate.Core/Configuration/ConfiginfoBuilder-Example.cs Adds an in-library example program (should likely move to samples).
src/c#/GeneralUpdate.Core/Configuration/Configinfo.cs Ports user-facing config + validation.
src/c#/GeneralUpdate.Core/Configuration/BaseResponseDTO.cs Ports base HTTP response DTO.
src/c#/GeneralUpdate.Core/Configuration/BaseConfigInfo.cs Ports shared config base fields.
src/c#/GeneralUpdate.Core/Configuration/AppType.cs Ports app type constants.
src/c#/GeneralUpdate.Core/Configuration/AbstractBootstrap.cs Ports bootstrap base with option handling.
src/c#/GeneralUpdate.Core/Compress/ZipCompressionStrategy.cs Ports ZIP compress/decompress implementation.
src/c#/GeneralUpdate.Core/Compress/ICompressionStrategy.cs Ports compression strategy interface.
src/c#/GeneralUpdate.Core/Compress/CompressProvider.cs Ports compression provider/factory.
src/c#/GeneralUpdate.Core/Bootstrap/GeneralUpdateOSS.cs Updates OSS bootstrap imports + namespace migration.
src/c#/GeneralUpdate.Core/Bootstrap/GeneralUpdateBootstrap.cs Updates upgrade bootstrap imports + unified wiring.
src/c#/GeneralUpdate.Core/Bootstrap/GeneralClientOSS.cs Adds OSS client bootstrap entrypoint.
src/c#/GeneralUpdate.Core/Bootstrap/GeneralClientBootstrap.cs Adds client bootstrap entrypoint including silent update support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +8

namespace GeneralUpdate.Core;

public static class GeneralTracer
Comment on lines +5 to +8
namespace GeneralUpdate.Core;

public class WindowsOutputDebugListener : TraceListener
{
Comment on lines +6 to +10

public class TextTraceListener : TraceListener, IDisposable
{
private readonly string _filePath;
private readonly BlockingCollection<string> _messageQueue;
Comment on lines +1 to +6
using System.IO;

namespace GeneralUpdate.Core.Configuration;

public static class Environments
{
Comment on lines +1 to +5
using System;

namespace GeneralUpdate.Core.Event;

public class ExceptionEventArgs(Exception? exception = null, string? message = null) : EventArgs
Comment on lines +38 to +42
new AuthenticationHeaderValue(version.AuthScheme, version.AuthToken);
}

_timer = new Timer(_=> Statistics(), null, 0, 1000);
}
Comment on lines +73 to +83
using var response = await _httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead);
if (!response.IsSuccessStatusCode)
throw new HttpRequestException($"Failed to download file: {response.ReasonPhrase}");

var totalBytes = response.Content.Headers.ContentLength ?? 0;
Interlocked.Exchange(ref _totalBytes, totalBytes);

if (startPos >= totalBytes)
{
if (File.Exists(path))
{
Comment on lines +154 to +158
catch (Exception)
{
return null;
}
}
// Validate and set compression parameters
CompressEncoding = compressEncoding.WebName;
CompressFormat = compressFormat;
if (downloadTimeOut < 0) throw new ArgumentException("Timeout must be greater than 0 !");
Comment on lines +9 to +13
/// Example demonstrating the ConfiginfoBuilder usage with JSON configuration
/// </summary>
class Program
{
static void Main(string[] args)
JusterZhu added 2 commits May 24, 2026 07:40
…te.Core

- Physically move ALL source files from Common, ClientCore, and old Core
  into a single GeneralUpdate.Core project
- Eliminate ALL duplicate code:
  - Pipeline: CompressMiddleware, HashMiddleware, PatchMiddleware (was 2 copies)
  - Strategy: WindowsStrategy, LinuxStrategy (was 2 copies)
  - Keep DrivelutionMiddleware (Core-only) and Hub files (ClientCore-only)

- New directory structure:
  Bootstrap/ Configuration/ Strategy/ Pipeline/ Download/ Hubs/
  Silent/ Network/ FileSystem/ Event/ Tracer/ JsonContext/
  Compress/ HashAlgorithms/

- Namespace migration:
  GeneralUpdate.Common.* → GeneralUpdate.Core.*
  GeneralUpdate.ClientCore → GeneralUpdate.Core

- New csproj: net8.0;net10.0, IsAotCompatible=true
- ProjectReferences: Differential + Drivelution + SignalR.Client

- Build: 0 errors (net8.0 + net10.0)

Closes #310
All source files have been physically merged into the unified GeneralUpdate.Core project.
@JusterZhu
JusterZhu force-pushed the feature/unified-core branch from ea8a558 to 5a7d7b2 Compare May 23, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sub Issue 2: Merge Common + ClientCore + Core into unified GeneralUpdate.Core

2 participants