Esempio n. 1
0
        public ServiceBase()
        {
            var attributes = this.GetType().GetCustomAttributes <ServiceAttribute>(true);

            foreach (var info in attributes)
            {
                this.Name                = info.Name;
                this.DisplayName         = info.DisplayName;
                this.Description         = info.Description;
                this.Run                 = info.Run;
                this.ServiceType         = info.ServiceType;
                this.ServiceAccessType   = info.ServiceAccessType;
                this.ServiceStartType    = info.ServiceStartType;
                this.ServiceErrorControl = info.ServiceErrorControl;
                this.ServiceControls     = info.ServiceControls;
                this.LogName             = info.LogName;
                this.IServiceLoggerType  = info.IServiceLoggerType;
                this.Debug               = false;
            }
            this._servCtrlHandlerProc = new ServicesAPI.ServiceCtrlHandlerProcEx(this.baseServiceControlHandler);
            this._servStatus          = new ServicesAPI.SERVICE_STATUS();
            this.ServiceState         = ServiceState.Stopped;
            this.args = null;
        }
Esempio n. 2
0
 public ServiceBase() {
     var attributes = this.GetType().GetCustomAttributes < ServiceAttribute>( true);
     foreach(var info in attributes) {
         this.Name = info.Name;
         this.DisplayName = info.DisplayName;
         this.Description = info.Description;
         this.Run = info.Run;
         this.ServiceType = info.ServiceType;
         this.ServiceAccessType = info.ServiceAccessType;
         this.ServiceStartType = info.ServiceStartType;
         this.ServiceErrorControl = info.ServiceErrorControl;
         this.ServiceControls = info.ServiceControls;
         this.LogName = info.LogName;
         this.IServiceLoggerType = info.IServiceLoggerType;
         this.Debug = false;
     }
     this._servCtrlHandlerProc = new ServicesAPI.ServiceCtrlHandlerProcEx(this.baseServiceControlHandler);
     this._servStatus = new ServicesAPI.SERVICE_STATUS();
     this.ServiceState = ServiceState.Stopped;
     this.args = null;
 }