diff Constants.cs @ 0:961030992bd2

Initial commit of IBBoard libraries
author IBBoard <dev@ibboard.co.uk>
date Fri, 19 Dec 2008 11:13:48 +0000
parents
children 0352fa33ee8f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Constants.cs	Fri Dec 19 11:13:48 2008 +0000
@@ -0,0 +1,53 @@
+using System;
+using System.IO;
+
+namespace IBBoard
+{
+	/// <summary>
+	/// Summary description for Constants.
+	/// </summary>
+	public class Constants
+	{
+		public static readonly char DirectoryChar = Path.DirectorySeparatorChar;
+		public static readonly string DirectoryString = Path.DirectorySeparatorChar.ToString();
+		private static string executablePath = AppDomain.CurrentDomain.BaseDirectory.TrimEnd(DirectoryChar);
+
+		static Constants()
+		{
+            string exe = Environment.GetCommandLineArgs()[0];
+            int slash = exe.LastIndexOf(DirectoryChar) + 1;
+            int dot = exe.LastIndexOf('.');
+
+            if (dot > slash)
+            {
+                exe = exe.Substring(slash, dot - slash);
+            }
+            else
+            {
+                exe = exe.Substring(slash);
+            }
+
+            userDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).TrimEnd(DirectoryChar) + DirectoryChar + "IBBoard" + DirectoryChar + exe;
+		}
+
+		public static string ExecutablePath
+		{
+			get { return executablePath; }
+		}
+		
+		private static string userDataPath;
+		
+		public static string UserDataPath
+		{
+			get { return userDataPath; }
+		}
+		
+		/*public static void RecreateUserDataPath(string path)
+		{
+			if (path!=null && path!="")
+			{
+				userDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)+DirectoryChar+path.Trim(DirectoryChar);
+			}
+		}*/
+	}
+}