hytos / DTI_PID / ID2PSN / Object / ID2Info.cs @ dfb9a03c
이력 | 보기 | 이력해설 | 다운로드 (3.25 KB)
1 | 6b9e7a56 | gaqhf | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Threading.Tasks; |
||
6 | using System.IO; |
||
7 | |||
8 | namespace ID2PSN |
||
9 | { |
||
10 | public enum ID2DB_Type |
||
11 | { |
||
12 | 757ab2f2 | LJIYEON | None, //ID2와 숫자 동일하게 하기위해 None은 의미 없음 |
13 | MSSQL, |
||
14 | SQLite |
||
15 | 6b9e7a56 | gaqhf | } |
16 | abee404a | LJIYEON | |
17 | 6b9e7a56 | gaqhf | public class ID2Info |
18 | { |
||
19 | private static ID2Info projectInfo; |
||
20 | private string _DefaultPath; |
||
21 | private string _Name; |
||
22 | private string _DBFilePath; |
||
23 | private string _TempDirPath; |
||
24 | private string _ImageDirPath; |
||
25 | private string _SvgImageDirPath; |
||
26 | 673075e0 | LJIYEON | private string _ProgramName; |
27 | 757ab2f2 | LJIYEON | private string _ProgramErrorName; |
28 | private ID2DB_Type _ID2DBType; |
||
29 | |||
30 | public string ServerIP { get; set; } |
||
31 | public string Port { get; set; } |
||
32 | public string DBUser { get; set; } |
||
33 | public string DBPassword { get; set; } |
||
34 | 23a96301 | humkyung | public string Database { get; set; } |
35 | 6b9e7a56 | gaqhf | |
36 | 3610fd3f | LJIYEON | public string DefaultPath |
37 | { |
||
38 | 6b9e7a56 | gaqhf | get { return _DefaultPath; } |
39 | 3610fd3f | LJIYEON | set |
40 | { |
||
41 | 6b9e7a56 | gaqhf | _DefaultPath = value; |
42 | _Name = Path.GetFileName(value); |
||
43 | _DBFilePath = value + @"\db\ITI_PID.db"; |
||
44 | _TempDirPath = value + @"\Temp\"; |
||
45 | _ImageDirPath = value + @"\image\"; |
||
46 | _SvgImageDirPath = value + @"\svg\"; |
||
47 | } |
||
48 | } |
||
49 | |||
50 | 673075e0 | LJIYEON | public string ProgramName |
51 | { |
||
52 | get { return _ProgramName; } |
||
53 | set { _ProgramName = value; } |
||
54 | } |
||
55 | |||
56 | 757ab2f2 | LJIYEON | public ID2DB_Type ID2DBType |
57 | { |
||
58 | get { return _ID2DBType; } |
||
59 | set { _ID2DBType = value; } |
||
60 | } |
||
61 | |||
62 | 6b9e7a56 | gaqhf | public string Name |
63 | { |
||
64 | get { return _Name; } |
||
65 | } |
||
66 | |||
67 | public string DBFilePath |
||
68 | { |
||
69 | get { return _DBFilePath; } |
||
70 | } |
||
71 | |||
72 | public string TempDirPath |
||
73 | { |
||
74 | get { return _TempDirPath; } |
||
75 | } |
||
76 | |||
77 | public string ImageDirPath |
||
78 | { |
||
79 | get { return _ImageDirPath; } |
||
80 | } |
||
81 | |||
82 | public string SvgImageDirPath |
||
83 | { |
||
84 | get { return _SvgImageDirPath; } |
||
85 | } |
||
86 | |||
87 | public static ID2Info GetInstance() |
||
88 | { |
||
89 | if (projectInfo == null) |
||
90 | projectInfo = new ID2Info(); |
||
91 | |||
92 | return projectInfo; |
||
93 | } |
||
94 | 23a96301 | humkyung | |
95 | 3610fd3f | LJIYEON | public IAbstractDatabase CreateConnection(ID2DB_Type type = ID2DB_Type.None) |
96 | 23a96301 | humkyung | { |
97 | c4a35107 | humkyung | if (type == ID2DB_Type.None) |
98 | 23a96301 | humkyung | { |
99 | c4a35107 | humkyung | if (this.ID2DBType == ID2DB_Type.SQLite) |
100 | { |
||
101 | return new AppSQLiteDatabase() { FilePath = this.DBFilePath }; |
||
102 | } |
||
103 | else if (this.ID2DBType == ID2DB_Type.MSSQL) |
||
104 | { |
||
105 | return new AppMSSqlDatabase() |
||
106 | { |
||
107 | Host = this.ServerIP, |
||
108 | Id = this.DBUser, |
||
109 | Password = this.DBPassword, |
||
110 | d36e2fe0 | esham21 | Database = this.Database, |
111 | SqlAuthentication = AppMSSqlDatabase.SERVER_Authen |
||
112 | c4a35107 | humkyung | }; |
113 | } |
||
114 | 23a96301 | humkyung | } |
115 | 3610fd3f | LJIYEON | else if (type == ID2DB_Type.SQLite) |
116 | 23a96301 | humkyung | { |
117 | c4a35107 | humkyung | return new AppSQLiteDatabase() { FilePath = this.DBFilePath }; |
118 | 23a96301 | humkyung | } |
119 | |||
120 | throw new NotSupportedException(); |
||
121 | } |
||
122 | 6b9e7a56 | gaqhf | } |
123 | } |