public MacScalarService(
            ITracer tracer,
            string serviceName,
            IScalarRepoRegistry repoRegistry)
        {
            this.tracer       = tracer;
            this.repoRegistry = repoRegistry;
            this.serviceName  = serviceName;

            this.serviceStopped = new ManualResetEvent(false);
            this.serviceThread  = new Thread(this.ServiceThreadMain);
            this.requestHandler = new RequestHandler(this.tracer, EtwArea);
        }
Exemple #2
0
 public MaintenanceTaskScheduler(
     ITracer tracer,
     PhysicalFileSystem fileSystem,
     IScalarVerbRunner scalarVerb,
     IScalarRepoRegistry repoRegistry)
 {
     this.tracer       = tracer;
     this.fileSystem   = fileSystem;
     this.scalarVerb   = scalarVerb;
     this.repoRegistry = repoRegistry;
     this.taskTimers   = new List <Timer>();
     this.taskQueue    = new ServiceTaskQueue(this.tracer);
 }
Exemple #3
0
 public MaintenanceTask(
     ITracer tracer,
     PhysicalFileSystem fileSystem,
     IScalarVerbRunner scalarVerb,
     IScalarRepoRegistry repoRegistry,
     IRegisteredUserStore registeredUserStore,
     MaintenanceTasks.Task task,
     bool ignorePause = true)
 {
     this.tracer              = tracer;
     this.fileSystem          = fileSystem;
     this.scalarVerb          = scalarVerb;
     this.repoRegistry        = repoRegistry;
     this.registeredUserStore = registeredUserStore;
     this.task        = task;
     this.ignorePause = ignorePause;
 }
Exemple #4
0
        public void Run()
        {
            try
            {
                EventMetadata metadata = new EventMetadata();
                metadata.Add("Version", ProcessHelper.GetCurrentProcessVersion());
                this.tracer.RelatedEvent(EventLevel.Informational, $"ScalarService_{nameof(this.Run)}", metadata);

                PhysicalFileSystem fileSystem = new PhysicalFileSystem();
                this.repoRegistry = new ScalarRepoRegistry(
                    this.tracer,
                    fileSystem,
                    this.repoRegistryLocation);

                this.maintenanceTaskScheduler = new MaintenanceTaskScheduler(this.tracer, fileSystem, new WindowsScalarVerbRunner(this.tracer), this.repoRegistry);

                this.AssignCurrentLoggedOnUser();
                this.maintenanceTaskScheduler.ScheduleRecurringTasks();

                this.requestHandler = new RequestHandler(this.tracer, EtwArea);

                string pipeName = ScalarPlatform.Instance.GetScalarServiceNamedPipeName(this.serviceName);
                this.tracer.RelatedInfo("Starting pipe server with name: " + pipeName);

                using (NamedPipeServer pipeServer = NamedPipeServer.StartNewServer(
                           pipeName,
                           this.tracer,
                           this.requestHandler.HandleRequest))
                {
                    this.productUpgradeTimer.Start();

                    this.serviceStopped.WaitOne();
                }
            }
            catch (Exception e)
            {
                this.LogExceptionAndExit(e, nameof(this.Run));
            }
        }