3.2 KiB
3.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||
|---|---|---|---|---|---|---|---|---|---|
|
2026-04-17T16:02:06.149898+00:00 | zai-org/GLM-5-FP8 | 1 | c917bed8fd5b39aa |
DTS.Common.Service
Purpose
This module implements a generic Windows Service application template for DTS (Diversified Technical Systems) common services. It provides a reusable service infrastructure with event logging, configurable monitoring via timers, and support for custom commands. The service is configured to run under the LocalSystem account with automatic startup.
Public Interface
ProjectInstaller (class)
ProjectInstaller()- Constructor that initializes the service installer components. Marked with[RunInstaller(true)]for InstallUtil.exe deployment.
Program (static class)
static void Main()- Application entry point that creates and runs aDTSServiceinstance viaServiceBase.Run().
DTSService (class, inherits ServiceBase)
DTSService()- Constructor that initializes the event log source, configures logging, and optionally starts a monitoring timer ifSettings.Default.Monitoringis enabled with interval fromSettings.Default.Interval.void OnTimer(object sender, ElapsedEventArgs args)- Timer callback that writes "Monitoring the System" to the event log. Contains a TODO comment for monitoring activities.protected override void OnStart(string[] args)- Writes a service started entry to the event log.protected override void OnStop()- Writes a service stopped entry to the event log.protected override void OnCustomCommand(int command)- Handles custom service commands. SupportsCommand1(128),Command2(129), andCommand3(130) via theCustomCommandsenum.CustomCommands(enum) - Defines custom command values:Command1 = 128,Command2 = 129,Command3 = 130.eventLog(public field,System.Diagnostics.EventLog) - Event log instance for writing service entries.
Invariants
- The event log source must exist before being used; the constructor creates it if it doesn't exist.
- The timer is only created and started if
Settings.Default.Monitoringistrue. - Custom commands use values starting at 128.
- The service is installed with
ServiceAccount.LocalSystem,ServiceStartMode.Automatic, andServiceName = "DTSService".
Dependencies
- Depends on:
System.Configuration.Install,System.ServiceProcess,System.Diagnostics,System.Timers,DTS.Common.Service.Properties(Settings). - Depended on by: Not evident from source alone; this is a top-level executable service application.
Gotchas
- The
OnTimermethod contains only a TODO comment and event log write; actual monitoring logic is not implemented. - The
OnCustomCommandswitch cases are empty—no actual command handling logic exists. - The timer variable in the constructor is a local variable, not a class field, which could lead to garbage collection issues.
- The designer file comment references "CPUService" but the actual class is
DTSService, suggesting copy-paste history.