초기 커밋.
This commit is contained in:
148
DDUtilityApp/LOGPARSER/DATA/CompressInformation.cs
Normal file
148
DDUtilityApp/LOGPARSER/DATA/CompressInformation.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using JWH;
|
||||
using JWH.DATA;
|
||||
|
||||
namespace DDUtilityApp.LOGPARSER.DATA
|
||||
{
|
||||
|
||||
public class CompressInformation : DataTableBase
|
||||
{
|
||||
|
||||
public string ExtractPath { get; protected set; }
|
||||
|
||||
public string FileName { get; protected set; }
|
||||
|
||||
public List<FileInfo> Files { get; set; } = new List<FileInfo>();
|
||||
|
||||
public CompressInformation()
|
||||
{
|
||||
}
|
||||
|
||||
public CompressInformation(string filename)
|
||||
{
|
||||
this.FileName = filename;
|
||||
this.Files.AddRange(this.Decompress(filename).ToArray());
|
||||
}
|
||||
|
||||
private List<FileInfo> Decompress(string srcFile)
|
||||
{
|
||||
List<FileInfo> lstFile = new List<FileInfo>();
|
||||
try
|
||||
{
|
||||
|
||||
string extension = System.IO.Path.GetExtension(srcFile);
|
||||
if (!Directory.Exists(GlobalVariable.Instance.WorkflowPath)) Directory.CreateDirectory(GlobalVariable.Instance.WorkflowPath);
|
||||
|
||||
string destFile = $@"{GlobalVariable.Instance.WorkflowPath}{System.IO.Path.GetFileNameWithoutExtension(srcFile)}";
|
||||
if (this.Decompress(srcFile, destFile) == false) return lstFile;
|
||||
|
||||
string directoryName = $@"{GlobalVariable.Instance.WorkflowPath}{System.IO.Path.GetFileNameWithoutExtension(srcFile)}_{DateTime.Now.ToString("MMddHHmmss")}";
|
||||
if (!Directory.Exists(directoryName)) Directory.CreateDirectory(directoryName);
|
||||
this.ExtractPath = directoryName;
|
||||
|
||||
FileInfo destFileInfo = new FileInfo(destFile);
|
||||
using (FileStream readStream = destFileInfo.OpenRead())
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
// Get Length of FileName
|
||||
byte[] byteLength = new byte[4];
|
||||
int nRead = readStream.Read(byteLength, 0, 4);
|
||||
if (nRead <= 0) break;
|
||||
int lenFilename = BitConverter.ToInt32(byteLength, 0);
|
||||
lenFilename *= 2;
|
||||
|
||||
// Get FileName
|
||||
byte[] byteFilename = new byte[lenFilename];
|
||||
nRead = readStream.Read(byteFilename, 0, lenFilename);
|
||||
if (nRead <= 0) break;
|
||||
string filename = Encoding.Unicode.GetString(byteFilename);
|
||||
|
||||
// Get Length of File Body
|
||||
nRead = readStream.Read(byteLength, 0, 4);
|
||||
if (nRead <= 0) break;
|
||||
int lenFile = BitConverter.ToInt32(byteLength, 0);
|
||||
|
||||
if (lenFile == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get File Body
|
||||
byte[] byteFileBody = new byte[lenFile];
|
||||
nRead = readStream.Read(byteFileBody, 0, lenFile);
|
||||
if (nRead <= 0) break;
|
||||
|
||||
// Write File
|
||||
using (FileStream writeStream = File.Create($"{directoryName}\\{filename}"))
|
||||
writeStream.Write(byteFileBody, 0, lenFile);
|
||||
|
||||
lstFile.Add(new FileInfo($"{directoryName}\\{filename}"));
|
||||
}
|
||||
}
|
||||
destFileInfo.Delete();
|
||||
|
||||
return lstFile;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
XLogger.Instance.Fatal(ex);
|
||||
return lstFile;
|
||||
}
|
||||
}
|
||||
|
||||
private void Compress(DirectoryInfo directorySelected)
|
||||
{
|
||||
foreach (FileInfo fileToCompress in directorySelected.GetFiles())
|
||||
{
|
||||
using (FileStream originalFileStream = fileToCompress.OpenRead())
|
||||
{
|
||||
if ((File.GetAttributes(fileToCompress.FullName) &
|
||||
FileAttributes.Hidden) != FileAttributes.Hidden & fileToCompress.Extension != ".gz")
|
||||
{
|
||||
using (FileStream compressedFileStream = File.Create(fileToCompress.FullName + ".gz"))
|
||||
{
|
||||
using (GZipStream compressionStream = new GZipStream(compressedFileStream, CompressionMode.Compress))
|
||||
{
|
||||
originalFileStream.CopyTo(compressionStream);
|
||||
}
|
||||
}
|
||||
FileInfo info = new FileInfo(GlobalVariable.Instance.WorkflowPath + Path.DirectorySeparatorChar + fileToCompress.Name + ".gz");
|
||||
Console.WriteLine($"Compressed {fileToCompress.Name} from {fileToCompress.Length.ToString()} to {info.Length.ToString()} bytes.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool Decompress(string srcFile, string destFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
FileInfo srcFileInfo = new FileInfo(srcFile);
|
||||
using (FileStream srcStream = srcFileInfo.OpenRead())
|
||||
{
|
||||
using (FileStream destStream = File.Create(destFile))
|
||||
{
|
||||
using (GZipStream zipStream = new GZipStream(srcStream, CompressionMode.Decompress))
|
||||
{
|
||||
zipStream.CopyTo(destStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
XLogger.Instance.Fatal(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
182
DDUtilityApp/LOGPARSER/DATA/EisEquipment.cs
Normal file
182
DDUtilityApp/LOGPARSER/DATA/EisEquipment.cs
Normal file
@@ -0,0 +1,182 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using DDUtilityApp.DATA;
|
||||
using JWH;
|
||||
using JWH.DATA;
|
||||
|
||||
namespace DDUtilityApp.LOGPARSER.DATA
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// EIS 설비 정보
|
||||
/// </summary>
|
||||
public class EisEquipment : DataTableBase
|
||||
{
|
||||
|
||||
/// <summary>LogServer Information</summary>
|
||||
public LogServer Server { get; set; }
|
||||
|
||||
/// <summary>MES.FacilityName</summary>
|
||||
public string Facility { get; set; }
|
||||
|
||||
/// <summary>EIS.Line</summary>
|
||||
public string Line { get; set; }
|
||||
|
||||
/// <summary>MES.ProcessSegmentID</summary>
|
||||
public string ProcessSegmentID { get; set; }
|
||||
|
||||
/// <summary>MES.ProcessSegmentName</summary>
|
||||
public string ProcessSegmentName { get; set; }
|
||||
|
||||
/// <summary>EIS.ModelID</summary>
|
||||
public string ModelID { get; set; }
|
||||
|
||||
/// <summary>MES.Maker</summary>
|
||||
public string Maker { get; set; }
|
||||
|
||||
/// <summary>EIS.ModelVersion (From EIS.EquipmentModelDetails)</summary>
|
||||
public string ModelVersion { get; set; }
|
||||
|
||||
/// <summary>EIS.Version</summary>
|
||||
public string Version { get; set; }
|
||||
|
||||
/// <summary>EIS.RunningVersion</summary>
|
||||
public string RunningVersion { get; set; }
|
||||
|
||||
/// <summary>Empty</summary>
|
||||
public string CusLibVersion { get; set; }
|
||||
|
||||
/// <summary>EIS.EquipmentID</summary>
|
||||
public string EquipmentID { get; set; }
|
||||
|
||||
/// <summary>Name is Select(MES, EIS)</summary>
|
||||
[ReadOnly(true)]
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = string.Empty;
|
||||
foreach(string name in this.DisplayNameOrder.Split(';'))
|
||||
{
|
||||
value = this.PropertyGet(name);
|
||||
if (!string.IsNullOrEmpty(value)) break;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>EIS.Description</summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>EIS.GemSettingID (From DriverParameter)</summary>
|
||||
public string GemSettingID { get; set; }
|
||||
|
||||
/// <summary>EIS.DriverFileName (From DriverParameter)</summary>
|
||||
public string DriverFileName { get; set; }
|
||||
|
||||
/// <summary>EIS.EquipmentIP (From DriverParameter)</summary>
|
||||
public string EquipmentIP { get; set; }
|
||||
|
||||
/// <summary>EIS.Port (From DriverParameter)</summary>
|
||||
public int Port { get; set; }
|
||||
|
||||
/// <summary>Empty</summary>
|
||||
public string ServerName { get; set; }
|
||||
|
||||
/// <summary>EIS.ServerIP</summary>
|
||||
public string ServerIP { get; set; }
|
||||
|
||||
/// <summary>EIS.OriginServerIP</summary>
|
||||
public string OriginServerIP { get; set; }
|
||||
|
||||
/// <summary>LogServerIP</summary>
|
||||
public string LogServerIP { get; set; }
|
||||
|
||||
private string m_LogPath = string.Empty;
|
||||
|
||||
/// <summary>EIS.LogPath</summary>
|
||||
public string LogPath
|
||||
{
|
||||
get { return this.m_LogPath; }
|
||||
set { this.m_LogPath = this.SetLogPath(value); }
|
||||
}
|
||||
|
||||
/// <summary>MES.Description</summary>
|
||||
public string MesName { get; set; }
|
||||
|
||||
/// <summary>MES.OperationMode</summary>
|
||||
public string OperationMode { get; set; }
|
||||
|
||||
private string m_ControlMode = string.Empty;
|
||||
|
||||
/// <summary>MES.ControlMode</summary>
|
||||
public string ControlMode
|
||||
{
|
||||
get { return this.m_ControlMode; }
|
||||
set { this.m_ControlMode = value.ToTitleCase(); }
|
||||
}
|
||||
|
||||
private string m_EquipmentState = string.Empty;
|
||||
|
||||
/// <summary>MES.EqpState</summary>
|
||||
public string State
|
||||
{
|
||||
get { return this.m_EquipmentState; }
|
||||
set { this.m_EquipmentState = value.ToTitleCase(); }
|
||||
}
|
||||
|
||||
/// <summary>MES.LastTrackInLotID</summary>
|
||||
public string LastTrackInLotID { get; set; }
|
||||
|
||||
/// <summary>MES.LastTrackOutLotID</summary>
|
||||
public string LastTrackOutLotID { get; set; }
|
||||
|
||||
/// <summary>DisplayName OrderBy</summary>
|
||||
public string DisplayNameOrder { get; set; } = "MesName;Description;";
|
||||
|
||||
/// <summary>MES 기준등록 존재여부</summary>
|
||||
public bool MesRegistration { get; set; } = true;
|
||||
|
||||
/// <summary>MES Daemon</summary>
|
||||
public string MesDaemon { get; set; }
|
||||
|
||||
/// <summary>MES Service</summary>
|
||||
public string MesService { get; set; }
|
||||
|
||||
/// <summary>MES Subject</summary>
|
||||
public string MesSubject { get; set; }
|
||||
|
||||
/// <summary>PLC_TYPE</summary>
|
||||
public string PlcType { get; set; }
|
||||
|
||||
/// <summary>PM Date</summary>
|
||||
public DateTime PMDate { get; set; }
|
||||
|
||||
private string SetLogPath(string value)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (value.StartsWith(@"\"))
|
||||
{
|
||||
string[] values = value.Split(new string[] { @"\" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
this.LogServerIP = values[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value.StartsWith("X:"))
|
||||
this.LogServerIP = "192.168.7.150";
|
||||
else
|
||||
this.LogServerIP = this.ServerIP;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
41
DDUtilityApp/LOGPARSER/DATA/EisEquipmentModelDetails.cs
Normal file
41
DDUtilityApp/LOGPARSER/DATA/EisEquipmentModelDetails.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using JWH.DATA;
|
||||
|
||||
namespace DDUtilityApp.LOGPARSER.DATA
|
||||
{
|
||||
|
||||
public class EisModelDetails : DataTableBase
|
||||
{
|
||||
|
||||
public string ModelID { get; set; }
|
||||
|
||||
public string Version { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public DateTime DateTime { get; set; }
|
||||
|
||||
public string Modifier { get; set; }
|
||||
|
||||
public string LockState { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class EisModelInfo : DataTableBase
|
||||
{
|
||||
|
||||
public string ModelID { get; set; }
|
||||
|
||||
public string Maker { get; set; }
|
||||
|
||||
public string Model { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public DateTime DateTime { get; set; }
|
||||
|
||||
public string Modifier { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
40
DDUtilityApp/LOGPARSER/DATA/LogFile.cs
Normal file
40
DDUtilityApp/LOGPARSER/DATA/LogFile.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using JWH.DATA;
|
||||
|
||||
namespace DDUtilityApp.LOGPARSER.DATA
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 로그 파일 정보
|
||||
/// </summary>
|
||||
public class LogFile : DataTableBase
|
||||
{
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public long Length { get; set; }
|
||||
|
||||
public string Extension { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime LastAccessTime { get; set; }
|
||||
|
||||
public DateTime LastWriteTime { get; set; }
|
||||
|
||||
public LogFile()
|
||||
{
|
||||
}
|
||||
|
||||
public LogFile(string fullName)
|
||||
{
|
||||
this.Name = System.IO.Path.GetFileNameWithoutExtension(fullName);
|
||||
this.FullName = fullName;
|
||||
this.Extension = System.IO.Path.GetExtension(fullName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
98
DDUtilityApp/LOGPARSER/DATA/StandardData.cs
Normal file
98
DDUtilityApp/LOGPARSER/DATA/StandardData.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using DDUtilityApp.SECS;
|
||||
using JWH.DATA;
|
||||
|
||||
namespace DDUtilityApp.LOGPARSER.DATA
|
||||
{
|
||||
|
||||
public class StandardCollection : List<StandardData>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class StandardData : DataTableBase
|
||||
{
|
||||
|
||||
public delegate void onBodyParser(StandardData sender);
|
||||
|
||||
[Browsable(false)]
|
||||
public int LineNumber { get; set; }
|
||||
|
||||
public DateTime DateTime { get; set; }
|
||||
|
||||
public string Level { get; set; }
|
||||
|
||||
public string Server { get; set; }
|
||||
|
||||
public string Service { get; set; }
|
||||
|
||||
public string Type { get; set; }
|
||||
|
||||
public string MessageName { get; set; }
|
||||
|
||||
public string Return { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
public string EquipmentID { get; set; }
|
||||
|
||||
public string PortID { get; set; }
|
||||
|
||||
public string CarrierID { get; set; }
|
||||
|
||||
public string LotID { get; set; }
|
||||
|
||||
public string ModuleID { get; set; }
|
||||
|
||||
public string HostPanelID { get; set; }
|
||||
|
||||
public string PanelID { get; set; }
|
||||
|
||||
public string PanelQty { get; set; }
|
||||
|
||||
public string TID { get; set; }
|
||||
|
||||
public string SystemByte { get; set; }
|
||||
|
||||
public string Column1 { get; set; }
|
||||
|
||||
public string Column2 { get; set; }
|
||||
|
||||
public string Column3 { get; set; }
|
||||
|
||||
public string Column4 { get; set; }
|
||||
|
||||
public string Column5 { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public StringBuilder Body { get; set; } = new StringBuilder();
|
||||
|
||||
[Browsable(false)]
|
||||
public SECSItem SECSItem { get; set; } = null;
|
||||
|
||||
[Browsable(false)]
|
||||
public onBodyParser BodyParser { get; set; }
|
||||
|
||||
public void BodyParsing()
|
||||
{
|
||||
if (this.BodyParser == null) return;
|
||||
|
||||
this.BodyParser.DynamicInvoke(this);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append($"{this.Server} {this.MessageName}");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user