개정판 fab4f207
dev issue #000 : minor
Change-Id: Iac715292affae9b604f4003f1075bb0fa7505a14
DTI_PID/SPPIDConverter_AutoModeling/Util/SPPIDUtil.cs | ||
---|---|---|
13 | 13 |
{ |
14 | 14 |
public class SPPIDUtil |
15 | 15 |
{ |
16 |
public static bool SaveID2ProjectInfo() |
|
17 |
{ |
|
18 |
Project_Info projectInfo = Project_Info.GetInstance(); |
|
19 |
try |
|
20 |
{ |
|
21 |
StreamWriter sw = new StreamWriter(Application.StartupPath + @"\ProjectInfo.info"); |
|
22 |
sw.Write(JsonConvert.SerializeObject(projectInfo)); |
|
23 |
sw.Dispose(); |
|
24 |
} |
|
25 |
catch (Exception ex) |
|
26 |
{ |
|
27 |
return false; |
|
28 |
} |
|
29 |
return true; |
|
30 |
} |
|
31 |
|
|
32 |
public static bool ReadID2ProjectInfo() |
|
33 |
{ |
|
34 |
Project_Info projectInfo = Project_Info.GetInstance(); |
|
35 |
try |
|
36 |
{ |
|
37 |
StreamReader sr = new StreamReader(Application.StartupPath + @"\ProjectInfo.info"); |
|
38 |
Project_Info jsonProjectInfo = JsonConvert.DeserializeObject<Project_Info>(sr.ReadToEnd()); |
|
39 |
sr.Dispose(); |
|
40 |
|
|
41 |
projectInfo.DefaultPath = jsonProjectInfo.DefaultPath; |
|
42 |
projectInfo.Enable = jsonProjectInfo.Enable; |
|
43 |
} |
|
44 |
catch (Exception ex) |
|
45 |
{ |
|
46 |
return false; |
|
47 |
} |
|
48 |
return true; |
|
49 |
} |
|
50 |
|
|
51 |
public static bool SaveSPPIDInfo() |
|
52 |
{ |
|
53 |
SPPID_DBInfo info = SPPID_DBInfo.GetInstance(); |
|
54 |
try |
|
55 |
{ |
|
56 |
StreamWriter sw = new StreamWriter(Application.StartupPath + @"\SPPIDInfo.info"); |
|
57 |
sw.Write(JsonConvert.SerializeObject(info)); |
|
58 |
sw.Dispose(); |
|
59 |
} |
|
60 |
catch (Exception ex) |
|
61 |
{ |
|
62 |
return false; |
|
63 |
} |
|
64 |
return true; |
|
65 |
} |
|
66 |
|
|
67 |
public static bool ReadSPPIDInfo() |
|
16 |
public static bool ConvertToSPPIDInfo(string jsonString) |
|
68 | 17 |
{ |
69 | 18 |
SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance(); |
70 | 19 |
try |
71 | 20 |
{ |
72 |
StreamReader sr = new StreamReader(Application.StartupPath + @"\SPPIDInfo.info"); |
|
73 |
SPPID_DBInfo jsonSPPIDInfo = JsonConvert.DeserializeObject<SPPID_DBInfo>(sr.ReadToEnd()); |
|
74 |
sr.Dispose(); |
|
21 |
SPPID_DBInfo jsonSPPIDInfo = JsonConvert.DeserializeObject<SPPID_DBInfo>(jsonString); |
|
75 | 22 |
|
76 | 23 |
_SPPIDInfo.DBType = jsonSPPIDInfo.DBType; |
77 | 24 |
_SPPIDInfo.Service = jsonSPPIDInfo.Service; |
... | ... | |
92 | 39 |
} |
93 | 40 |
catch (Exception ex) |
94 | 41 |
{ |
42 |
_SPPIDInfo.Enable = false; |
|
95 | 43 |
return false; |
96 | 44 |
} |
97 | 45 |
return true; |
내보내기 Unified diff