-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
42 lines (34 loc) · 1.26 KB
/
Copy pathProgram.cs
File metadata and controls
42 lines (34 loc) · 1.26 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
using CSharpCompression.App;
using CSharpCompression.App.Compressor;
using CSharpCompression.Compressor;
using System.Reflection;
namespace CSharpCompression
{
internal class Program
{
static void Main(string[] args)
{
Console.Title = "Compression Performance Tester";
int sizeInMB;
string input;
do
{
Console.Clear();
Console.WriteLine("Enter the size of the byte array in MB:");
input = Console.ReadLine();
}
while (!int.TryParse(input, out sizeInMB) || sizeInMB <= 0);
byte[] testData = new byte[sizeInMB * 1024 * 1024];
new Random().NextBytes(testData);
Console.Clear();
var typesInAssembly = Assembly.GetExecutingAssembly().GetTypes();
var compressorTypes = typesInAssembly.Where(type => typeof(ICompressor).IsAssignableFrom(type) && !type.IsAbstract).ToList();
foreach (var type in compressorTypes)
{
var compressorInstance = (ICompressor)Activator.CreateInstance(type);
new TestCompressor(compressorInstance, testData, type.Name).RunTests();
}
Console.ReadKey();
}
}
}