コード例 #1
0
            public void Start(OperationContext context)
            {
                HasStarted = true;

                var task = runAsync();

                Analysis.IgnoreArgument(task);

                async Task runAsync()
                {
                    try
                    {
                        IsRunningService = true;

                        foreach (var envVar in StartInfo.Environment)
                        {
                            Environment.SetEnvironmentVariable(envVar.Key, envVar.Value);
                        }

                        var args     = AbstractParser.CommonSplitArgs(StartInfo.Arguments);
                        var exitCode = StartInfo.FileName.EndsWith("DepSvc.exe", StringComparison.OrdinalIgnoreCase)
                            ? await RunDeploymentProxyWithCacheServiceAsync(args)
                            : await RunCacheServiceAsync(args);

                        Exit(exitCode);
                    }
                    catch (Exception ex)
                    {
                        Exit(-2);
                        Analysis.IgnoreArgument(ex);
                    }
                    finally
                    {
                        IsRunningService = false;
                    }
                }
            }
コード例 #2
0
        public void SplitArgsTests(string input, string[] expectedArgs)
        {
            var actualArgs = AbstractParser.CommonSplitArgs(input);

            Assert.Equal(expectedArgs, actualArgs);
        }