diff ARClient/Program.cs @ 0:90ea68d4f92f

First release
author Ivo Smits <Ivo@UCIS.nl>
date Sat, 08 Nov 2014 22:43:51 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ARClient/Program.cs	Sat Nov 08 22:43:51 2014 +0100
@@ -0,0 +1,31 @@
+using System;
+using System.IO;
+using System.Reflection;
+using System.Windows.Forms;
+
+namespace ARClient {
+	static class Program {
+		/// <summary>
+		/// The main entry point for the application.
+		/// </summary>
+		[STAThread]
+		static void Main() {
+			AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly;
+			Main2();
+		}
+		static void Main2() {
+			Application.EnableVisualStyles();
+			try { Application.SetCompatibleTextRenderingDefault(false); } catch { }
+			Application.Run(new Form1());
+		}
+		private static Assembly ResolveAssembly(Object sender, ResolveEventArgs e) {
+			String resourceName = "ARClient." + new AssemblyName(e.Name).Name + ".dll";
+			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) {
+				if (stream == null) return null;
+				Byte[] assemblyData = new Byte[stream.Length];
+				stream.Read(assemblyData, 0, assemblyData.Length);
+				return Assembly.Load(assemblyData);
+			}
+		}
+	}
+}