Skip to content

Code cleanup: remove dead code and fix bugs in GeneralUpdate.Core #404

@JusterZhu

Description

@JusterZhu

Summary

Systematic code review and cleanup of GeneralUpdate.Core — removing dead code, fixing bugs, and reducing duplication.

Changes

Bug Fixes

  • WindowsStrategy.Execute(): Added missing override — previously inherited NotImplementedException from base class
  • MacStrategy.Execute(): Fixed to delegate to ExecuteAsync() instead of skipping the entire update pipeline
  • DownloadProgressReporter: Moved "all completed" event to orchestrator — previously fired on every single-asset completion instead of once after all downloads finish
  • StorageManager.GetAllfiles: Returns empty list instead of null on exception, preventing NullReferenceException
  • FileNode.GetHashCode(): Fixed to use Name + Hash instead of object identity, respecting Equals/GetHashCode contract
  • ObjectTranslator.GetPacketHash(): Safe pattern-match cast replacing unsafe cast that could NRE
  • MutiDownloadCompletedEventArgs: Fixed typo IsComplated to IsCompleted

Dead Code Removal

  • Deleted FileTreeCore\FileTreeEnumerator.cs — 5 duplicate types in unused namespace
  • Deleted IEventManager.cs — interface not implemented by EventManager, no references
  • Removed unused _diffMode field from ClientUpdateStrategy
  • Removed unused _script field and SetScript() from ConfiginfoBuilder
  • Removed redundant DriverDirectory hiding base class property in GlobalConfigInfo
  • Removed dead static field _compressionStrategy from CompressProvider
  • Removed unused private constructor from VersionService
  • Removed dead _hooks/_reporter fields from SilentPollOrchestrator
  • Removed empty InfixOrder() methods from FileNode and FileTree

Code Deduplication

  • Extracted StreamDownloadAsync() shared download loop, eliminating ~50 lines of duplicate code
  • Added Hooks and Reporter properties to AbstractStrategy base class for subclass reuse
  • Wired _customSkipOption in GeneralUpdateBootstrap to actual execution flow

Documentation

  • Fixed corrupted UTF-8 character in UpdateOption.cs XML doc
  • Removed stale script parameter from ProcessInfo.cs XML doc

Build: 0 errors, 0 warnings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions