개정판 d4b1ab29
issue #000: psn Keyword 수정중
Change-Id: I16f70d04ab35137c90823cfd319f0d96cd6161f3
DTI_PID/ID2PSN/Program.cs | ||
---|---|---|
42 | 42 | |
43 | 43 |
using (NetworkStream networkStream = tcpClient.GetStream()) |
44 | 44 |
{ |
45 |
networkStream.Write(message, 0, message.Length); |
|
45 |
try |
|
46 |
{ |
|
47 |
networkStream.Write(message, 0, message.Length); |
|
46 | 48 | |
47 |
byte[] outbuf = new byte[1024]; |
|
48 |
int nbytes = networkStream.Read(outbuf, 0, outbuf.Length); |
|
49 |
string output = Encoding.UTF8.GetString(outbuf, 4, nbytes - 5); |
|
50 |
var result = JsonConvert.DeserializeObject<Dictionary<string, string>>(output); |
|
49 |
byte[] outbuf = new byte[1024];
|
|
50 |
int nbytes = networkStream.Read(outbuf, 0, outbuf.Length);
|
|
51 |
string output = Encoding.UTF8.GetString(outbuf, 4, nbytes - 5);
|
|
52 |
var result = JsonConvert.DeserializeObject<Dictionary<string, string>>(output);
|
|
51 | 53 | |
52 |
|
|
54 |
if (result["db_type"] == "SQLite") |
|
55 |
{ |
|
56 |
info.ID2DBType = ID2DB_Type.SQLite; |
|
57 |
var parent = Directory.GetParent(Path.GetDirectoryName(result["db_name"])); |
|
58 |
info.DefaultPath = parent.ToString(); |
|
59 |
///DataRow dr = projectTable.Select(string.Format("DBTypes_UID = 2 AND Name = '{0}'", result["db_name"])).FirstOrDefault(); |
|
60 |
///info.DefaultPath = dr.Field<string>("Path"); |
|
61 |
} |
|
62 |
else if (result["db_type"] == "MSSQL") |
|
63 |
{ |
|
64 |
info.ID2DBType = ID2DB_Type.MSSQL; |
|
65 |
info.ServerIP = result["host"]; |
|
66 |
//info.Port = "3389"; |
|
67 |
info.DBUser = result["user"]; |
|
68 |
info.DBPassword = result["password"]; |
|
69 |
info.Database = result["db_name"]; |
|
70 |
info.DefaultPath = result["path"]; |
|
71 |
///DataRow dr = projectTable.Select(string.Format("DBTypes_UID = 2 AND Name = '{0}'", result["db_name"])).FirstOrDefault(); |
|
72 |
///info.DefaultPath = dr.Field<string>("Path"); |
|
73 |
/// |
|
53 | 74 | |
54 |
if (result["db_type"] == "SQLite") |
|
55 |
{ |
|
56 |
info.ID2DBType = ID2DB_Type.SQLite; |
|
57 |
var parent = Directory.GetParent(Path.GetDirectoryName(result["db_name"])); |
|
58 |
info.DefaultPath = parent.ToString(); |
|
59 |
///DataRow dr = projectTable.Select(string.Format("DBTypes_UID = 2 AND Name = '{0}'", result["db_name"])).FirstOrDefault(); |
|
60 |
///info.DefaultPath = dr.Field<string>("Path"); |
|
75 |
} |
|
76 | ||
77 |
MessageBox.Show(info.ID2DBType + "\n" + info.ServerIP + "\n" + info.DBUser + "\n" + info.DBPassword + "\n" + info.Database + "\n" + info.DefaultPath, "ID2PSN", MessageBoxButtons.OK, MessageBoxIcon.Error); |
|
61 | 78 |
} |
62 |
else if (result["db_type"] == "MSSQL")
|
|
79 |
catch(Exception ex)
|
|
63 | 80 |
{ |
64 |
info.ID2DBType = ID2DB_Type.MSSQL; |
|
65 |
info.ServerIP = result["host"]; |
|
66 |
//info.Port = "3389"; |
|
67 |
info.DBUser = result["user"]; |
|
68 |
info.DBPassword = result["password"]; |
|
69 |
info.Database = result["db_name"]; |
|
70 |
info.DefaultPath = result["path"]; |
|
71 |
///DataRow dr = projectTable.Select(string.Format("DBTypes_UID = 2 AND Name = '{0}'", result["db_name"])).FirstOrDefault(); |
|
72 |
///info.DefaultPath = dr.Field<string>("Path"); |
|
73 |
/// |
|
74 |
|
|
81 |
MessageBox.Show(ex.StackTrace, "ID2PSN", MessageBoxButtons.OK, MessageBoxIcon.Error); |
|
75 | 82 |
} |
76 | ||
77 |
MessageBox.Show(info.ID2DBType + "\n" + info.ServerIP + "\n" + info.DBUser + "\n" + info.DBPassword + "\n" + info.Database + "\n" + info.DefaultPath, "ID2PSN", MessageBoxButtons.OK, MessageBoxIcon.Error); |
|
78 | 83 |
} |
79 | 84 |
tcpClient.Close(); |
80 | 85 |
} |
... | ... | |
90 | 95 |
} |
91 | 96 |
catch (Exception ex) |
92 | 97 |
{ |
93 |
MessageBox.Show("Failed to open ID2 drawing.", "ID2PSN", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
98 |
MessageBox.Show(ex.StackTrace, "ID2PSN", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
94 | 99 |
} |
95 | 100 |
} |
96 | 101 |
} |
내보내기 Unified diff