프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / ID2PSN / Object / ID2Info.cs @ bfb338d6

이력 | 보기 | 이력해설 | 다운로드 (3.22 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
        public string DefaultPath {
37
            get { return _DefaultPath; }
38
            set {
39
                _DefaultPath = value;
40
                _Name = Path.GetFileName(value);
41
                _DBFilePath = value + @"\db\ITI_PID.db";
42
                _TempDirPath = value + @"\Temp\";
43
                _ImageDirPath = value + @"\image\";
44
                _SvgImageDirPath = value + @"\svg\";
45
            }
46
        }
47
48 673075e0 LJIYEON
        public string ProgramName
49
        {
50
            get { return _ProgramName; }
51
            set { _ProgramName = value; }
52
        }
53
54 757ab2f2 LJIYEON
        public ID2DB_Type ID2DBType
55
        {
56
            get { return _ID2DBType; }
57
            set { _ID2DBType = value; }
58
        }
59
60 6b9e7a56 gaqhf
        public string Name
61
        {
62
            get { return _Name; }
63
        }
64
65
        public string DBFilePath
66
        {
67
            get { return _DBFilePath; }
68
        }
69
70
        public string TempDirPath
71
        {
72
            get { return _TempDirPath; }
73
        }
74
75
        public string ImageDirPath
76
        {
77
            get { return _ImageDirPath; }
78
        }
79
80
        public string SvgImageDirPath
81
        {
82
            get { return _SvgImageDirPath; }
83
        }
84
85
        public static ID2Info GetInstance()
86
        {
87
            if (projectInfo == null)
88
                projectInfo = new ID2Info();
89
90
            return projectInfo;
91
        }
92 23a96301 humkyung
93 c4a35107 humkyung
        public IAbstractDatabase CreateConnection(ID2DB_Type type=ID2DB_Type.None)
94 23a96301 humkyung
        {
95 c4a35107 humkyung
            if (type == ID2DB_Type.None)
96 23a96301 humkyung
            {
97 c4a35107 humkyung
                if (this.ID2DBType == ID2DB_Type.SQLite)
98
                {
99
                    return new AppSQLiteDatabase() { FilePath = this.DBFilePath };
100
                }
101
                else if (this.ID2DBType == ID2DB_Type.MSSQL)
102
                {
103
                    return new AppMSSqlDatabase()
104
                    {
105
                        Host = this.ServerIP,
106
                        Id = this.DBUser,
107
                        Password = this.DBPassword,
108 d36e2fe0 esham21
                        Database = this.Database,
109
                        SqlAuthentication = AppMSSqlDatabase.SERVER_Authen
110 c4a35107 humkyung
                    };
111
                }
112 23a96301 humkyung
            }
113 c4a35107 humkyung
            else if(type == ID2DB_Type.SQLite)
114 23a96301 humkyung
            {
115 c4a35107 humkyung
                return new AppSQLiteDatabase() { FilePath = this.DBFilePath };
116 23a96301 humkyung
            }
117
118
            throw new NotSupportedException();
119
        }
120 6b9e7a56 gaqhf
    }
121
}
클립보드 이미지 추가 (최대 크기: 500 MB)