Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
63 lines (58 loc) · 2.04 KB
/
Copy pathProgram.cs
File metadata and controls
63 lines (58 loc) · 2.04 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
using System;
using System.Linq;
using System.Windows.Forms;
using System.ComponentModel.Composition.Hosting;
namespace AudioFileInspector;
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static int Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.SetCompatibleTextRenderingDefault(false);
var catalog = new AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly());
var container = new CompositionContainer(catalog);
var inspectors = container.GetExportedValues<IAudioFileInspector>();
if (args.Length > 0)
{
if (args[0] == "-install")
{
try
{
OptionsForm.Associate(inspectors);
Console.WriteLine("Created {0} file associations", inspectors.Count());
}
catch (Exception e)
{
Console.WriteLine("Unable to create file associations");
Console.WriteLine(e.ToString());
return -1;
}
return 0;
}
else if (args[0] == "-uninstall")
{
try
{
OptionsForm.Disassociate(inspectors);
Console.WriteLine("Removed {0} file associations", inspectors.Count());
}
catch (Exception e)
{
Console.WriteLine("Unable to remove file associations");
Console.WriteLine(e.ToString());
return -1;
}
return 0;
}
}
var mainForm = container.GetExportedValue<AudioFileInspectorForm>();
mainForm.CommandLineArguments = args;
Application.Run(mainForm);
return 0;
}
}