Mercurial > hg > marc.net
comparison ARClient/Program.cs @ 0:90ea68d4f92f
First release
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Sat, 08 Nov 2014 22:43:51 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:90ea68d4f92f |
---|---|
1 using System; | |
2 using System.IO; | |
3 using System.Reflection; | |
4 using System.Windows.Forms; | |
5 | |
6 namespace ARClient { | |
7 static class Program { | |
8 /// <summary> | |
9 /// The main entry point for the application. | |
10 /// </summary> | |
11 [STAThread] | |
12 static void Main() { | |
13 AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly; | |
14 Main2(); | |
15 } | |
16 static void Main2() { | |
17 Application.EnableVisualStyles(); | |
18 try { Application.SetCompatibleTextRenderingDefault(false); } catch { } | |
19 Application.Run(new Form1()); | |
20 } | |
21 private static Assembly ResolveAssembly(Object sender, ResolveEventArgs e) { | |
22 String resourceName = "ARClient." + new AssemblyName(e.Name).Name + ".dll"; | |
23 using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) { | |
24 if (stream == null) return null; | |
25 Byte[] assemblyData = new Byte[stream.Length]; | |
26 stream.Read(assemblyData, 0, assemblyData.Length); | |
27 return Assembly.Load(assemblyData); | |
28 } | |
29 } | |
30 } | |
31 } |