--- KHSCALE_TP/Program.cs
+++ KHSCALE_TP/Program.cs
... | ... | @@ -18,10 +18,14 @@ |
| 18 | 18 |
{
|
| 19 | 19 |
U3Config config = new U3Config(); |
| 20 | 20 |
|
| 21 |
+ U3Util.ErrorLog("프로그램 시작");
|
|
| 22 |
+ |
|
| 21 | 23 |
Application.EnableVisualStyles(); |
| 22 | 24 |
Application.SetCompatibleTextRenderingDefault(false); |
| 23 | 25 |
Application.Run(new FormScale()); |
| 24 | 26 |
m_ThreadRun = false; |
| 27 |
+ |
|
| 28 |
+ U3Util.ErrorLog("프로그램 종료");
|
|
| 25 | 29 |
} |
| 26 | 30 |
} |
| 27 | 31 |
} |
--- ModbusTest/FormModbus.cs
+++ ModbusTest/FormModbus.cs
... | ... | @@ -316,9 +316,18 @@ |
| 316 | 316 |
public int RunState = 0; |
| 317 | 317 |
List<string[,]> lst = new List<string[,]>(); |
| 318 | 318 |
string[,] array; |
| 319 |
+ |
|
| 320 |
+ |
|
| 319 | 321 |
private void timer_AutoInput_Tick(object sender, EventArgs e) |
| 320 | 322 |
{
|
| 321 |
- switch(RunState) |
|
| 323 |
+ DateTime dt = DateTime.Now; |
|
| 324 |
+ if (dt.Hour == 2 && dt.Minute == 2 && dt.Second == 2) |
|
| 325 |
+ {
|
|
| 326 |
+ this.Close(); |
|
| 327 |
+ return; |
|
| 328 |
+ } |
|
| 329 |
+ |
|
| 330 |
+ switch (RunState) |
|
| 322 | 331 |
{
|
| 323 | 332 |
case 0: |
| 324 | 333 |
//U3Util.ErrorLog(textBox_State.Text); |
... | ... | @@ -983,6 +992,8 @@ |
| 983 | 992 |
|
| 984 | 993 |
if (input_Mach_CD == "" || input_RealData == "") return; |
| 985 | 994 |
|
| 995 |
+ U3Util.ErrorLog("void DB_Input(string[,]Data) --> HTSaveRealDataAll");
|
|
| 996 |
+ |
|
| 986 | 997 |
if (DBConnectionSingleton.Instance().SetCommand("HTSaveRealDataAll",
|
| 987 | 998 |
DBConnectionSingleton.Instance().getParams("COMP_CD", "0001"),
|
| 988 | 999 |
DBConnectionSingleton.Instance().getParams("MACH_CD", input_Mach_CD),
|
... | ... | @@ -1067,6 +1078,8 @@ |
| 1067 | 1078 |
|
| 1068 | 1079 |
if (input_Mach_CD == "" || input_RealData == "") return; |
| 1069 | 1080 |
|
| 1081 |
+ U3Util.ErrorLog("All_Data_Insert --> HTSaveRealDataAll");
|
|
| 1082 |
+ |
|
| 1070 | 1083 |
if (DBConnectionSingleton.Instance().SetCommand("HTSaveRealDataAll",
|
| 1071 | 1084 |
DBConnectionSingleton.Instance().getParams("COMP_CD", "0001"),
|
| 1072 | 1085 |
DBConnectionSingleton.Instance().getParams("MACH_CD", input_Mach_CD),
|
... | ... | @@ -1075,6 +1088,14 @@ |
| 1075 | 1088 |
textBox_State.Text += "DBInsert Complete : " + input_Mach_CD + "\r\n"; |
| 1076 | 1089 |
textBox_State.Text += "DBInsert Complete : " + input_RealData + "\r\n"; |
| 1077 | 1090 |
} |
| 1091 |
+ |
|
| 1092 |
+ if (CheckTemp() == false) |
|
| 1093 |
+ {
|
|
| 1094 |
+ this.Close(); |
|
| 1095 |
+ return; |
|
| 1096 |
+ } |
|
| 1097 |
+ |
|
| 1098 |
+ U3Util.ErrorLog("온도 체크 완료. All_Data_Insert");
|
|
| 1078 | 1099 |
|
| 1079 | 1100 |
UpdateHbtOnOff(); |
| 1080 | 1101 |
UpdateBaseoilSwitch(); |
... | ... | @@ -1247,6 +1268,7 @@ |
| 1247 | 1268 |
string strBaseoil = U3Util.toStr(drCurPV["REMARK04"]); |
| 1248 | 1269 |
string strMachCD = U3Util.toStr(drCurPV["MACH_CD"]); |
| 1249 | 1270 |
string strMachNM = U3Util.toStr(drCurPV["MACH_NM"]); |
| 1271 |
+ string strRealData = U3Util.toStr(drCurPV["REAL_DATA"]); |
|
| 1250 | 1272 |
float fPV = U3Util.toFloat(drCurPV["PV_VAL"]); |
| 1251 | 1273 |
|
| 1252 | 1274 |
if (m_dicPV.ContainsKey(strMachCD) == false) |
... | ... | @@ -1261,11 +1283,12 @@ |
| 1261 | 1283 |
U3Util.ErrorLog("### " + strBaseoil + " = 이전: " + fPrev.ToString() + " / 현재: " + fPV.ToString());
|
| 1262 | 1284 |
|
| 1263 | 1285 |
string sql3 = ""; |
| 1264 |
- sql3 += " insert into T_HT_HIST_BASEOIL (COMP_CD,BASEOIL_CD,HBT_CD,ONOFF_YN,PV_VAL,MACH_NM,REG_DT) values (";
|
|
| 1286 |
+ sql3 += " insert into T_HT_HIST_BASEOIL (COMP_CD,BASEOIL_CD,HBT_CD,ONOFF_YN,REAL_DATA,PV_VAL,MACH_NM,REG_DT) values (";
|
|
| 1265 | 1287 |
sql3 += " '0001', "; |
| 1266 | 1288 |
sql3 += " '" + strBaseoil + "', "; |
| 1267 | 1289 |
sql3 += " '', "; |
| 1268 | 1290 |
sql3 += " 'X', "; |
| 1291 |
+ sql3 += " " + strRealData + ", "; |
|
| 1269 | 1292 |
sql3 += " " + fPrev.ToString() + ", "; |
| 1270 | 1293 |
sql3 += " '" + strMachNM + "', "; |
| 1271 | 1294 |
sql3 += " getdate() "; |
... | ... | @@ -1290,9 +1313,10 @@ |
| 1290 | 1313 |
} |
| 1291 | 1314 |
|
| 1292 | 1315 |
Dictionary<string, float> pvDic = new Dictionary<string, float>(); |
| 1316 |
+ Dictionary<string, float> realDataDic = new Dictionary<string, float>(); |
|
| 1293 | 1317 |
Dictionary<string, string> machNmDic = new Dictionary<string, string>(); |
| 1294 | 1318 |
strSQL = ""; |
| 1295 |
- strSQL += " SELECT a.MACH_CD, (REAL_DATA * VALUE_RATIO) as PV_VAL, MACH_NM, REMARK04"; |
|
| 1319 |
+ strSQL += " SELECT a.MACH_CD, a.REAL_DATA, (REAL_DATA * VALUE_RATIO) as PV_VAL, MACH_NM, REMARK04"; |
|
| 1296 | 1320 |
strSQL += " FROM T_HT_REAL_DATA a"; |
| 1297 | 1321 |
strSQL += " left join T_STD_MACH b on a.MACH_CD = b.MACH_CD"; |
| 1298 | 1322 |
strSQL += " where b.REMARK04 is not null"; |
... | ... | @@ -1301,9 +1325,13 @@ |
| 1301 | 1325 |
{
|
| 1302 | 1326 |
string strKey = U3Util.toStr(drPv["REMARK04"]); |
| 1303 | 1327 |
float fVal = U3Util.toFloat(drPv["PV_VAL"]); |
| 1328 |
+ float fRealData = U3Util.toFloat(drPv["REAL_DATA"]); |
|
| 1304 | 1329 |
string strMachNm = U3Util.toStr(drPv["MACH_NM"]); |
| 1330 |
+ |
|
| 1305 | 1331 |
if (pvDic.ContainsKey(strKey) == false) |
| 1306 | 1332 |
pvDic.Add(strKey, fVal); |
| 1333 |
+ if (realDataDic.ContainsKey(strKey) == false) |
|
| 1334 |
+ realDataDic.Add(strKey, fRealData); |
|
| 1307 | 1335 |
if (machNmDic.ContainsKey(strKey) == false) |
| 1308 | 1336 |
machNmDic.Add(strKey, strMachNm); |
| 1309 | 1337 |
} |
... | ... | @@ -1350,6 +1378,12 @@ |
| 1350 | 1378 |
pvVal = pvDic[item.Key]; |
| 1351 | 1379 |
} |
| 1352 | 1380 |
|
| 1381 |
+ float realDataVal = 0; |
|
| 1382 |
+ if (realDataDic.ContainsKey(item.Key)) |
|
| 1383 |
+ {
|
|
| 1384 |
+ realDataVal = realDataDic[item.Key]; |
|
| 1385 |
+ } |
|
| 1386 |
+ |
|
| 1353 | 1387 |
string mach_nm = ""; |
| 1354 | 1388 |
if (machNmDic.ContainsKey(item.Key)) |
| 1355 | 1389 |
{
|
... | ... | @@ -1360,11 +1394,13 @@ |
| 1360 | 1394 |
if (item.Value != oldValue) |
| 1361 | 1395 |
{
|
| 1362 | 1396 |
float pvVal2 = 0; |
| 1397 |
+ float realDataVal2 = 0; |
|
| 1398 |
+ |
|
| 1363 | 1399 |
if (item.Value.Length == 0) |
| 1364 | 1400 |
{
|
| 1365 | 1401 |
// N인 경우 PV_VAL2 에 차이값을 저장한다 |
| 1366 | 1402 |
string sql4 = ""; |
| 1367 |
- sql4 += " select* from T_HT_HIST_BASEOiL"; |
|
| 1403 |
+ sql4 += " select * from T_HT_HIST_BASEOiL"; |
|
| 1368 | 1404 |
sql4 += " where BASEOIL_CD = '" + item.Key + "' and HBT_CD = '" + oldValue + "'"; |
| 1369 | 1405 |
sql4 += " order by idx desc"; |
| 1370 | 1406 |
|
... | ... | @@ -1373,15 +1409,20 @@ |
| 1373 | 1409 |
{
|
| 1374 | 1410 |
float fPrev = U3Util.toFloat(dt4.Rows[0]["PV_VAL"]); |
| 1375 | 1411 |
pvVal2 = fPrev - pvVal; |
| 1412 |
+ |
|
| 1413 |
+ float rPrev = U3Util.toFloat(dt4.Rows[0]["REAL_DATA"]); |
|
| 1414 |
+ realDataVal2 = rPrev - realDataVal; |
|
| 1376 | 1415 |
} |
| 1377 | 1416 |
} |
| 1378 | 1417 |
|
| 1379 | 1418 |
string sql3 = ""; |
| 1380 |
- sql3 += " insert into T_HT_HIST_BASEOIL (COMP_CD,BASEOIL_CD,HBT_CD,ONOFF_YN,PV_VAL,PV_VAL2,MACH_NM,REG_DT) values (";
|
|
| 1419 |
+ sql3 += " insert into T_HT_HIST_BASEOIL (COMP_CD,BASEOIL_CD,HBT_CD,ONOFF_YN,REAL_DATA,REAL_DATA2, PV_VAL,PV_VAL2,MACH_NM,REG_DT) values (";
|
|
| 1381 | 1420 |
sql3 += " '0001', "; |
| 1382 | 1421 |
sql3 += " '" + item.Key + "', "; |
| 1383 | 1422 |
sql3 += " '" + ((item.Value.Length > 0) ? item.Value : oldValue) + "', "; |
| 1384 | 1423 |
sql3 += " '" + ((item.Value.Length > 0) ? "Y" : "N") + "', "; |
| 1424 |
+ sql3 += " " + realDataVal.ToString() + ", "; |
|
| 1425 |
+ sql3 += " " + realDataVal2.ToString() + ", "; |
|
| 1385 | 1426 |
sql3 += " " + pvVal.ToString() + ", "; |
| 1386 | 1427 |
sql3 += " " + pvVal2.ToString() + ", "; |
| 1387 | 1428 |
sql3 += " '" + mach_nm + "', "; |
... | ... | @@ -1464,9 +1505,55 @@ |
| 1464 | 1505 |
} |
| 1465 | 1506 |
} |
| 1466 | 1507 |
|
| 1508 |
+ // 온도값이 500이 넘는 오류가 발생하면 프로그램을 종료한다 |
|
| 1509 |
+ private bool CheckTemp() |
|
| 1510 |
+ {
|
|
| 1511 |
+ U3Database db = new U3Database(); |
|
| 1512 |
+ string strSQL = ""; |
|
| 1513 |
+ |
|
| 1514 |
+ strSQL = ""; |
|
| 1515 |
+ strSQL += " select r.MACH_CD,(r.REAL_DATA * m.VALUE_RATIO) REAL_DATA, m.MACH_NM, m.MACH_NO, c.WORK_ROUT_CD"; |
|
| 1516 |
+ strSQL += " FROM T_HT_REAL_DATA r"; |
|
| 1517 |
+ strSQL += " left join T_STD_MACH m on r.MACH_CD = m.MACH_CD and r.COMP_CD = m.COMP_CD"; |
|
| 1518 |
+ strSQL += " left join T_STD_CODE c on c.NO_RMK = m.MACH_NO order by r.MACH_CD asc"; |
|
| 1519 |
+ DataTable dtTemp = db.OpenSQL(strSQL); |
|
| 1520 |
+ |
|
| 1521 |
+ if (dtTemp == null || dtTemp.Rows.Count == 0) |
|
| 1522 |
+ return true; |
|
| 1523 |
+ |
|
| 1524 |
+ bool bResult = true; |
|
| 1525 |
+ int nZeroCount = 0; |
|
| 1526 |
+ |
|
| 1527 |
+ foreach (DataRow dr in dtTemp.Rows) |
|
| 1528 |
+ {
|
|
| 1529 |
+ string sName = U3Util.toStr(dr["MACH_NM"]); |
|
| 1530 |
+ float fVal = U3Util.toFloat(dr["REAL_DATA"]); |
|
| 1531 |
+ |
|
| 1532 |
+ if (sName.IndexOf("온도") > 0)
|
|
| 1533 |
+ {
|
|
| 1534 |
+ if (fVal >= 500) |
|
| 1535 |
+ {
|
|
| 1536 |
+ bResult = false; |
|
| 1537 |
+ U3Util.ErrorLog("온도이상 발생 " + sName + " = " + fVal.ToString());
|
|
| 1538 |
+ } |
|
| 1539 |
+ if (fVal == 0) |
|
| 1540 |
+ {
|
|
| 1541 |
+ nZeroCount++; |
|
| 1542 |
+ if (nZeroCount > 5) |
|
| 1543 |
+ {
|
|
| 1544 |
+ bResult = false; |
|
| 1545 |
+ U3Util.ErrorLog("온도이상 발생 " + sName + " = " + fVal.ToString());
|
|
| 1546 |
+ } |
|
| 1547 |
+ } |
|
| 1548 |
+ } |
|
| 1549 |
+ } |
|
| 1550 |
+ return bResult; |
|
| 1551 |
+ } |
|
| 1467 | 1552 |
|
| 1468 | 1553 |
private void timer_Log_Tick(object sender, EventArgs e) |
| 1469 | 1554 |
{
|
| 1555 |
+ U3Util.ErrorLog("timer_Log_Tick --> HTInsertRealToLog");
|
|
| 1556 |
+ |
|
| 1470 | 1557 |
if (DBConnectionSingleton.Instance().SetCommand("HTInsertRealToLog"))
|
| 1471 | 1558 |
{
|
| 1472 | 1559 |
//textBox_State.Text += "DBInsert Complete : Log Insert\r\n"; |
--- ModbusTest/Program.cs
+++ ModbusTest/Program.cs
... | ... | @@ -16,6 +16,8 @@ |
| 16 | 16 |
{
|
| 17 | 17 |
U3Config config = new U3Config(); |
| 18 | 18 |
|
| 19 |
+ U3Util.ErrorLog("프로그램 시작");
|
|
| 20 |
+ |
|
| 19 | 21 |
Application.EnableVisualStyles(); |
| 20 | 22 |
Application.SetCompatibleTextRenderingDefault(false); |
| 21 | 23 |
|
... | ... | @@ -24,6 +26,8 @@ |
| 24 | 26 |
//test(); |
| 25 | 27 |
|
| 26 | 28 |
Application.Run(new FormModbus()); |
| 29 |
+ |
|
| 30 |
+ U3Util.ErrorLog("프로그램 종료");
|
|
| 27 | 31 |
} |
| 28 | 32 |
|
| 29 | 33 |
static void test() |
--- SignusKH/Form1.cs
+++ SignusKH/Form1.cs
... | ... | @@ -54,6 +54,14 @@ |
| 54 | 54 |
else if (System.IO.File.Exists(strChrome3)) |
| 55 | 55 |
this.m_lstExe.Add(strChrome3); |
| 56 | 56 |
|
| 57 |
+ |
|
| 58 |
+ // 크롬은 한번만 실행하고 재실행 안함 |
|
| 59 |
+ UpdateProgram(0); |
|
| 60 |
+ this.m_lstExe.Clear(); |
|
| 61 |
+ |
|
| 62 |
+ |
|
| 63 |
+ this.m_lstExe.Add(AppPath + string.Format("\\KHSCALE-1.exe"));
|
|
| 64 |
+ this.m_lstExe.Add(AppPath + string.Format("\\KHSCALE-2.exe"));
|
|
| 57 | 65 |
this.m_lstExe.Add(AppPath + string.Format("\\KHSCALE.exe"));
|
| 58 | 66 |
//this.m_lstExe.Add(AppPath + string.Format("\\YdtechInTemp.exe"));
|
| 59 | 67 |
//this.m_lstExe.Add(AppPath + string.Format("\\YdtechOutTemp.exe"));
|
... | ... | @@ -81,12 +89,19 @@ |
| 81 | 89 |
|
| 82 | 90 |
public void UpdateProgram(int index) |
| 83 | 91 |
{
|
| 92 |
+ U3Util.ErrorLog(index.ToString() + " Update"); |
|
| 93 |
+ |
|
| 84 | 94 |
if (index < 0) return; |
| 85 | 95 |
if (index >= this.m_lstExe.Count()) return; |
| 86 | 96 |
|
| 87 | 97 |
string AppExe = this.m_lstExe[index]; |
| 98 |
+ U3Util.ErrorLog(AppExe); |
|
| 99 |
+ |
|
| 88 | 100 |
if (System.IO.File.Exists(AppExe) == false) |
| 101 |
+ {
|
|
| 102 |
+ U3Util.ErrorLog(AppExe + " 찾을 수 없음"); |
|
| 89 | 103 |
return; |
| 104 |
+ } |
|
| 90 | 105 |
|
| 91 | 106 |
string AppPath = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\"));
|
| 92 | 107 |
|
... | ... | @@ -124,6 +139,8 @@ |
| 124 | 139 |
return; |
| 125 | 140 |
} |
| 126 | 141 |
|
| 142 |
+ U3Util.ErrorLog(AppExe + " 실행"); |
|
| 143 |
+ |
|
| 127 | 144 |
m_ps[index].StartInfo.FileName = AppExe; |
| 128 | 145 |
m_ps[index].StartInfo.WorkingDirectory = AppPath; |
| 129 | 146 |
m_ps[index].StartInfo.Arguments = ""; |
--- SignusKH/Program.cs
+++ SignusKH/Program.cs
... | ... | @@ -33,11 +33,15 @@ |
| 33 | 33 |
return; |
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 |
+ U3Util.ErrorLog("프로그램 시작");
|
|
| 37 |
+ |
|
| 36 | 38 |
messageQuit = RegisterWindowMessage("MSG_SIGNUS_QUIT");
|
| 37 | 39 |
|
| 38 | 40 |
Application.EnableVisualStyles(); |
| 39 | 41 |
Application.SetCompatibleTextRenderingDefault(false); |
| 40 | 42 |
Application.Run(new Form1()); |
| 43 |
+ |
|
| 44 |
+ U3Util.ErrorLog("프로그램 종료");
|
|
| 41 | 45 |
} |
| 42 | 46 |
|
| 43 | 47 |
static public void DeleteOldFiles(string dirName, int nSec) |
--- SignusKH/SignusKH.csproj
+++ SignusKH/SignusKH.csproj
... | ... | @@ -56,6 +56,7 @@ |
| 56 | 56 |
</Compile> |
| 57 | 57 |
<Compile Include="Program.cs" /> |
| 58 | 58 |
<Compile Include="Properties\AssemblyInfo.cs" /> |
| 59 |
+ <Compile Include="U3Util.cs" /> |
|
| 59 | 60 |
<EmbeddedResource Include="Form1.resx"> |
| 60 | 61 |
<DependentUpon>Form1.cs</DependentUpon> |
| 61 | 62 |
</EmbeddedResource> |
+++ SignusKH/U3Util.cs
... | ... | @@ -0,0 +1,194 @@ |
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Linq; | |
| 4 | +using System.Text; | |
| 5 | +using System.Threading.Tasks; | |
| 6 | +using System.Windows.Forms; | |
| 7 | +using System.IO; | |
| 8 | +using System.Drawing; | |
| 9 | +using System.Drawing.Imaging; | |
| 10 | +using System.Drawing.Drawing2D; | |
| 11 | + | |
| 12 | +namespace SignusKH | |
| 13 | +{ | |
| 14 | + public class U3Util | |
| 15 | + { | |
| 16 | + static public Random rnd = new Random(new System.DateTime().Millisecond); | |
| 17 | + | |
| 18 | + static public string GetErrorLogFile(bool bFullPath) | |
| 19 | + { | |
| 20 | + string AppPath = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")); | |
| 21 | + string AppName = Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf("\\") + 1); | |
| 22 | + string AppTitle = AppName.Substring(0, AppName.LastIndexOf(".")); | |
| 23 | + | |
| 24 | + if (bFullPath) | |
| 25 | + return AppPath + "\\" + AppTitle + "Error.txt"; | |
| 26 | + else | |
| 27 | + return AppTitle + "Error.txt"; | |
| 28 | + } | |
| 29 | + | |
| 30 | + static public string GetEventLogFile(bool bFullPath) | |
| 31 | + { | |
| 32 | + string AppPath = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")); | |
| 33 | + string AppName = Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf("\\") + 1); | |
| 34 | + string AppTitle = AppName.Substring(0, AppName.LastIndexOf(".")); | |
| 35 | + | |
| 36 | + if (bFullPath) | |
| 37 | + return AppPath + "\\" + AppTitle + "Event.txt"; | |
| 38 | + else | |
| 39 | + return AppTitle + "Event.txt"; | |
| 40 | + } | |
| 41 | + | |
| 42 | + static public string GetImagePath() | |
| 43 | + { | |
| 44 | + string AppPath = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")); | |
| 45 | + return AppPath + "\\" + "Images"; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public static Bitmap ResizeImage(Image image, int width, int height) | |
| 49 | + { | |
| 50 | + var destRect = new Rectangle(0, 0, width, height); | |
| 51 | + var destImage = new Bitmap(width, height); | |
| 52 | + | |
| 53 | + destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution); | |
| 54 | + | |
| 55 | + using (var graphics = Graphics.FromImage(destImage)) | |
| 56 | + { | |
| 57 | + graphics.CompositingMode = CompositingMode.SourceCopy; | |
| 58 | + graphics.CompositingQuality = CompositingQuality.HighQuality; | |
| 59 | + graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; | |
| 60 | + graphics.SmoothingMode = SmoothingMode.HighQuality; | |
| 61 | + graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; | |
| 62 | + | |
| 63 | + using (var wrapMode = new ImageAttributes()) | |
| 64 | + { | |
| 65 | + wrapMode.SetWrapMode(WrapMode.TileFlipXY); | |
| 66 | + graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + return destImage; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public static void ErrorLog(string strLog) | |
| 73 | + { | |
| 74 | + try | |
| 75 | + { | |
| 76 | + FileLog(strLog, GetErrorLogFile(false)); | |
| 77 | + } | |
| 78 | + catch | |
| 79 | + { | |
| 80 | + } | |
| 81 | + } | |
| 82 | + | |
| 83 | + public static void EventLog(string strLog) | |
| 84 | + { | |
| 85 | + try | |
| 86 | + { | |
| 87 | + FileLog(strLog, GetEventLogFile(false)); | |
| 88 | + } | |
| 89 | + catch | |
| 90 | + { | |
| 91 | + } | |
| 92 | + } | |
| 93 | + | |
| 94 | + public static void FileLog(string strLog, string strFileName) | |
| 95 | + { | |
| 96 | + string str = ""; | |
| 97 | + | |
| 98 | + DateTime t = DateTime.Now; | |
| 99 | + str = t.ToString("(yyyy-MM-dd HH:mm:ss.fff) "); | |
| 100 | + str += strLog; | |
| 101 | + | |
| 102 | + try | |
| 103 | + { | |
| 104 | + string AppPath = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")); | |
| 105 | + string strLogFile = AppPath + "\\" + strFileName; | |
| 106 | + FileBackup(strLogFile); | |
| 107 | + FileWrite(strLogFile, str); | |
| 108 | + } | |
| 109 | + catch (Exception ex) | |
| 110 | + { | |
| 111 | + throw new Exception("FileLog->:" + ex.Message); | |
| 112 | + } | |
| 113 | + } | |
| 114 | + | |
| 115 | + public static void FileBackup(string strLogFile) | |
| 116 | + { | |
| 117 | + if (File.Exists(strLogFile)) | |
| 118 | + { | |
| 119 | + try | |
| 120 | + { | |
| 121 | + FileInfo f = new FileInfo(strLogFile); | |
| 122 | + if (f.Length >= (2 * 1024 * 1024)) | |
| 123 | + { | |
| 124 | + System.IO.File.Delete(strLogFile + ".bak"); | |
| 125 | + f.MoveTo(strLogFile + ".bak"); | |
| 126 | + } | |
| 127 | + } | |
| 128 | + catch (Exception ex) | |
| 129 | + { | |
| 130 | + throw new Exception("FileBackup->:" + ex.Message); | |
| 131 | + } | |
| 132 | + } | |
| 133 | + } | |
| 134 | + | |
| 135 | + public static void FileWrite(string strLogFile, string str) | |
| 136 | + { | |
| 137 | + try | |
| 138 | + { | |
| 139 | + FileStream fs = new FileStream(strLogFile, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None); | |
| 140 | + fs.Seek(0, SeekOrigin.End); | |
| 141 | + StreamWriter swFromFile = new StreamWriter(fs); | |
| 142 | + swFromFile.WriteLine(str); | |
| 143 | + swFromFile.Close(); | |
| 144 | + fs.Close(); | |
| 145 | + } | |
| 146 | + catch (Exception ex) | |
| 147 | + { | |
| 148 | + ErrorLog("FileWrite->:" + ex.Message); | |
| 149 | + } | |
| 150 | + } | |
| 151 | + | |
| 152 | + public static string FileRead(string strFileName) | |
| 153 | + { | |
| 154 | + if (System.IO.File.Exists(strFileName) == false) return ""; | |
| 155 | + | |
| 156 | + string result = ""; | |
| 157 | + try | |
| 158 | + { | |
| 159 | + FileStream fs = new FileStream(strFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); | |
| 160 | + fs.Seek(0, SeekOrigin.Begin); | |
| 161 | + StreamReader srFile = new StreamReader(fs, Encoding.Default, true); | |
| 162 | + result = srFile.ReadToEnd(); | |
| 163 | + srFile.Close(); | |
| 164 | + fs.Close(); | |
| 165 | + } | |
| 166 | + catch (Exception ex) | |
| 167 | + { | |
| 168 | + ErrorLog("FileRead->:" + ex.Message); | |
| 169 | + } | |
| 170 | + return result; | |
| 171 | + } | |
| 172 | + | |
| 173 | + public static bool GetBit(byte b, int bitNumber) | |
| 174 | + { | |
| 175 | + return (b & (1 << bitNumber)) != 0; | |
| 176 | + } | |
| 177 | + | |
| 178 | + public static bool GetBit(short s, int bitNumber) | |
| 179 | + { | |
| 180 | + return (s & (1 << bitNumber)) != 0; | |
| 181 | + } | |
| 182 | + | |
| 183 | + static public DateTime FromUnixTime(long unixTime) | |
| 184 | + { | |
| 185 | + var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); | |
| 186 | + return epoch.AddSeconds(unixTime); | |
| 187 | + } | |
| 188 | + | |
| 189 | + static public Int32 ToUnixTime(DateTime dt) | |
| 190 | + { | |
| 191 | + return (Int32)(dt.Subtract(new DateTime(1970, 1, 1, 0, 0, 0))).TotalSeconds; | |
| 192 | + } | |
| 193 | + } | |
| 194 | +} |
--- SignusKHSVR/Form1.cs
+++ SignusKHSVR/Form1.cs
... | ... | @@ -54,7 +54,8 @@ |
| 54 | 54 |
//else if (System.IO.File.Exists(strChrome3)) |
| 55 | 55 |
// this.m_lstExe.Add(strChrome3); |
| 56 | 56 |
|
| 57 |
- //this.m_lstExe.Add(AppPath + string.Format("\\KHSCALE.exe"));
|
|
| 57 |
+ this.m_lstExe.Add(AppPath + string.Format("\\SignusServer.exe"));
|
|
| 58 |
+ this.m_lstExe.Add(AppPath + string.Format("\\KHPANEL.exe"));
|
|
| 58 | 59 |
|
| 59 | 60 |
timer1.Enabled = true; |
| 60 | 61 |
timer1.Interval = 500; |
... | ... | @@ -225,7 +226,8 @@ |
| 225 | 226 |
m_ps[index].StartInfo.FileName = AppExe; |
| 226 | 227 |
m_ps[index].StartInfo.WorkingDirectory = AppPath; |
| 227 | 228 |
m_ps[index].StartInfo.Arguments = ""; |
| 228 |
- m_ps[index].StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized; |
|
| 229 |
+ //m_ps[index].StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized; |
|
| 230 |
+ m_ps[index].StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal; |
|
| 229 | 231 |
m_ps[index].Start(); |
| 230 | 232 |
} |
| 231 | 233 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?