This repository was archived by the owner on Jun 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathProgram.cs
More file actions
102 lines (96 loc) · 3.64 KB
/
Program.cs
File metadata and controls
102 lines (96 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//---------------------------------------------------------------------
// <copyright file="Program.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
// FITNESS FOR A PARTICULAR PURPOSE.
// </copyright>
// <summary>The main program.</summary>
//---------------------------------------------------------------------
namespace Microsoft.WcfUnit
{
using System;
using System.IO;
using Microsoft.WcfUnit.Library;
/// <summary>
/// The main program.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry point.
/// </summary>
/// <param name="args">Command line parameters.</param>
public static void Main(string[] args)
{
Console.WriteLine(Resources.ProgramTitle, Utility.ReadVersion());
if (args == null || (args.Length != 3 && args.Length != 4))
{
Console.WriteLine(Resources.ProgramUsage);
Console.WriteLine(Resources.ProgramUsageExample);
}
else
{
string scenarioName = args[0];
string traceFile = args[1];
string configFile = args[2];
string timingsFile = (args.Length == 4) ? args[3] : null;
Stream timings = null;
try
{
if (timingsFile != null)
{
if (File.Exists(timingsFile))
{
try
{
timings = new FileStream(timingsFile, FileMode.Open, FileAccess.Read, FileShare.Read);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
else
{
Console.WriteLine(Resources.TimingsFileDoesNotExist, timingsFile);
}
}
if (Utility.IsValidIdentifier(scenarioName))
{
try
{
WcfUnitConfiguration config = ConfigurationReader.Read(configFile);
TraceFileProcessor tfp = new TraceFileProcessor();
tfp.ProcessTraceFile(scenarioName, traceFile, timings, config);
}
catch (UserException ue)
{
Console.WriteLine(ue.Message);
Exception e = ue.InnerException;
while (e != null)
{
Console.WriteLine(e.Message);
e = e.InnerException;
}
Environment.Exit(1);
}
}
else
{
Console.WriteLine(Resources.InvalidScenarioName);
Environment.Exit(1);
}
}
finally
{
if (timings != null)
{
timings.Dispose();
}
}
}
}
}
}