comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:961030992bd2
1 using System;
2 using System.IO;
3
4 namespace IBBoard
5 {
6 /// <summary>
7 /// Summary description for Constants.
8 /// </summary>
9 public class Constants
10 {
11 public static readonly char DirectoryChar = Path.DirectorySeparatorChar;
12 public static readonly string DirectoryString = Path.DirectorySeparatorChar.ToString();
13 private static string executablePath = AppDomain.CurrentDomain.BaseDirectory.TrimEnd(DirectoryChar);
14
15 static Constants()
16 {
17 string exe = Environment.GetCommandLineArgs()[0];
18 int slash = exe.LastIndexOf(DirectoryChar) + 1;
19 int dot = exe.LastIndexOf('.');
20
21 if (dot > slash)
22 {
23 exe = exe.Substring(slash, dot - slash);
24 }
25 else
26 {
27 exe = exe.Substring(slash);
28 }
29
30 userDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).TrimEnd(DirectoryChar) + DirectoryChar + "IBBoard" + DirectoryChar + exe;
31 }
32
33 public static string ExecutablePath
34 {
35 get { return executablePath; }
36 }
37
38 private static string userDataPath;
39
40 public static string UserDataPath
41 {
42 get { return userDataPath; }
43 }
44
45 /*public static void RecreateUserDataPath(string path)
46 {
47 if (path!=null && path!="")
48 {
49 userDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)+DirectoryChar+path.Trim(DirectoryChar);
50 }
51 }*/
52 }
53 }