|
|
@@ -4,6 +4,7 @@ using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.Data;
|
|
|
+using System.Diagnostics;
|
|
|
using System.Drawing;
|
|
|
using System.IO;
|
|
|
using System.Net;
|
|
|
@@ -977,10 +978,34 @@ namespace UAS_MES.PublicMethod
|
|
|
/// <param name="lbl"></param>
|
|
|
public static void WriteLbl(ApplicationClass lbl)
|
|
|
{
|
|
|
- String str = SystemInf.ProcessesID + "|" + lbl.PID;
|
|
|
+ Process[] processes = System.Diagnostics.Process.GetProcessesByName("lppa");
|
|
|
+ List<int> PidList = new List<int>();
|
|
|
+ List<DateTime> Pstarttime = new List<DateTime>();
|
|
|
+ int PID = 0;
|
|
|
+ for (int i = 0; i < processes.Length; i++)
|
|
|
+ {
|
|
|
+ PidList.Add(processes[i].Id);
|
|
|
+ Pstarttime.Add(processes[i].StartTime);
|
|
|
+ }
|
|
|
+ DateTime Temp = Pstarttime[0];
|
|
|
+ if (Pstarttime.ToArray().Length > 0)
|
|
|
+ {
|
|
|
+ PID = PidList[0];
|
|
|
+ }
|
|
|
+ for (int i = 0; i < PidList.ToArray().Length; i++)
|
|
|
+ {
|
|
|
+ if (Temp < Pstarttime[i])
|
|
|
+ {
|
|
|
+ PID = PidList[i];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Temp = Pstarttime[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String str = SystemInf.ProcessesID + "|" + PID;
|
|
|
string sysdisc = Environment.GetEnvironmentVariable("windir").Substring(0, 1);
|
|
|
FileStream fs = new FileStream(Directory.GetCurrentDirectory() + @"\" + "lblprocess" + ".txt", FileMode.Append, FileAccess.Write);
|
|
|
- Console.WriteLine(Directory.GetCurrentDirectory() + @"\" + "lblprocess" + ".txt");
|
|
|
StreamWriter sw = new StreamWriter(fs);
|
|
|
sw.WriteLine(str, Encoding.UTF8);
|
|
|
sw.Close();
|