265 lines
11 KiB
C#
265 lines
11 KiB
C#
using Aurora.Api;
|
|
using PropertyTools.DataAnnotations;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices.ComTypes;
|
|
using System.Security.Permissions;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace WeldingCommon.Settings
|
|
{
|
|
public class DataLogPathSetting : ISettingItem
|
|
{
|
|
// 설정된 DATA_PATH 기준 (현재 D:\ILSOSConfig\), 필요시 변경 해 주도록 하자
|
|
[DirectoryPath]
|
|
public string DATA_LOG_ROOT_DIR { get; set; } // D:\ILSOSConfig\
|
|
[DirectoryPath]
|
|
public string DATA_LOG_DIR { get; set; } // 현재는 _vision 임. D:\ILSOSConfig\Data\ 로 설정 하면 좋을 듯.
|
|
|
|
[Category("Vision Image Path")]
|
|
[DirectoryPath]
|
|
public string IMAGE_DIR_RCC_AUTORUN { get; set; } // D:\ILSOSConfig\_vision\ + RCC\AutoRun\Image\ + \날짜\ + 시간_CenterGrab.png
|
|
// D:\ILSOSConfig\_vision\ + RCC\AutoRun\Image\ + \날짜\ + 시간_FlyingScout.png
|
|
[DirectoryPath]
|
|
public string IMAGE_DIR_RCC_MANUAL { get; set; } // D:\ILSOSConfig\_vision\ + RCC\Manual\Image\ + \날짜\ + 시간_FlyingScout.png
|
|
|
|
[DirectoryPath]
|
|
public string IMAGE_DIR_SCOUT_NORMAL { get; set; } // D:\ILSOSConfig\_vision\ + Scout\Normal\Image\ + \날짜\ + 시간_NormalScout.png
|
|
[DirectoryPath]
|
|
public string IMAGE_DIR_SCOUT_FLYING { get; set; } // D:\ILSOSConfig\_vision\ + Scout\Flying\Image\ + \날짜\ + 시간_FlyingVisionScout.png
|
|
|
|
[Category("Vision Data Path")]
|
|
[DirectoryPath]
|
|
public string DATA_DIR_RCC_AUTORUN { get; set; } // D:\ILSOSConfig\_vision\ + RCC\AutoRun\Data\ + \날짜\ + 시간_CenterOffset.csv
|
|
// D:\ILSOSConfig\_vision\ + RCC\AutoRun\Data\ + \날짜\ + 시간_GenObject.csv
|
|
[DirectoryPath]
|
|
public string DATA_DIR_RCC_MANUAL { get; set; } // D:\ILSOSConfig\_vision\ + RCC\Manual\Data\ + \날짜\ + 시간_EdgeContour.csv
|
|
// D:\ILSOSConfig\_vision\ + RCC\Manual\Data\ + \날짜\ + 시간_CenterOffset.csv
|
|
// D:\ILSOSConfig\_vision\ + RCC\Manual\Data\ + \날짜\ + 시간_EdgeShrinkOffset.csv
|
|
|
|
[Category("DrawObject Data Path")]
|
|
[DirectoryPath]
|
|
public string DATA_DIR_SCANNER_RECORD { get; set; } // D:\ILSOSConfig\_device\_scanner\Record
|
|
[DirectoryPath]
|
|
public string DATA_DIR_SCANNER_RECORD_COORDINATE { get; set; } // D:\ILSOSConfig\_device\_scanner\Record\Coordinate
|
|
[DirectoryPath]
|
|
public string DATA_DIR_SCANNER_RECORD_METADATA { get; set; } // D:\ILSOSConfig\_device\_scanner\Record\MetaData
|
|
[DirectoryPath]
|
|
public string DATA_DIR_SCANNER_RECORD_LDD_FILE_FORMAT { get; set; } // D:\ILSOSConfig\_device\_scanner\Record\LDDFileFormat
|
|
|
|
|
|
// 진종우S (삭제, 필요 시 경로 추가하겠음(현재 사용하지않는 함수에 루트가 되어있음)
|
|
[Category("Need Remove")]
|
|
[DirectoryPath]
|
|
public string VISION_IMAGE_DIR_OBJECT_GENERATOR_TEST { get; set; } // D:\ILSOSConfig\_vision\Test
|
|
|
|
public DataLogPathSetting()
|
|
{
|
|
DATA_LOG_ROOT_DIR = ConfigurationManager.AppSettings.Get("DATA_PATH");
|
|
|
|
DATA_LOG_DIR = Path.Combine(DATA_LOG_ROOT_DIR, "_vision");
|
|
|
|
IMAGE_DIR_RCC_AUTORUN = Path.Combine(DATA_LOG_DIR, "RCC", "AutoRun", "Image");
|
|
IMAGE_DIR_RCC_MANUAL = Path.Combine(DATA_LOG_DIR, "RCC", "Manual", "Image");
|
|
IMAGE_DIR_SCOUT_NORMAL = Path.Combine(DATA_LOG_DIR, "Scout", "Normal", "Image");
|
|
IMAGE_DIR_SCOUT_FLYING = Path.Combine(DATA_LOG_DIR, "Scout", "Flying", "Image");
|
|
|
|
DATA_DIR_RCC_AUTORUN = Path.Combine(DATA_LOG_DIR, "RCC", "AutoRun", "Data");
|
|
DATA_DIR_RCC_MANUAL = Path.Combine(DATA_LOG_DIR, "RCC", "Manual", "Data");
|
|
|
|
DATA_DIR_SCANNER_RECORD = Path.Combine(DATA_LOG_ROOT_DIR, "_device", "_scanner", "Record");
|
|
DATA_DIR_SCANNER_RECORD_COORDINATE = Path.Combine(DATA_DIR_SCANNER_RECORD, "Coordinate");
|
|
DATA_DIR_SCANNER_RECORD_METADATA = Path.Combine(DATA_DIR_SCANNER_RECORD, "Metadata");
|
|
DATA_DIR_SCANNER_RECORD_LDD_FILE_FORMAT = Path.Combine(DATA_DIR_SCANNER_RECORD, "LDDFileFormat");
|
|
|
|
VISION_IMAGE_DIR_OBJECT_GENERATOR_TEST = Path.Combine(DATA_LOG_DIR, "Test");
|
|
}
|
|
|
|
private void CreateDirectoryIfNotExist(string path)
|
|
{
|
|
if (!Directory.Exists(path)) {
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
}
|
|
|
|
private string MakeFilePath(string prefixDir, string postfixFileName, string extension, bool isNeedMillisecond = false)
|
|
{
|
|
string dateString = DateTime.Now.ToString("yyyyMMdd");
|
|
string dirPath = Path.Combine(prefixDir, dateString);
|
|
CreateDirectoryIfNotExist(dirPath);
|
|
|
|
string fileName = string.Empty;
|
|
if (isNeedMillisecond) {
|
|
fileName = string.Format($"{DateTime.Now.ToString("yyyyMMdd_HHmmss_fff")}_{postfixFileName}.{extension}");
|
|
} else {
|
|
fileName = string.Format($"{DateTime.Now.ToString("yyyyMMdd_HHmmss")}_{postfixFileName}.{extension}");
|
|
}
|
|
return Path.Combine(dirPath, fileName);
|
|
}
|
|
|
|
// Image Path
|
|
public string GetDirPath_RCC_AutoRun_Image()
|
|
{
|
|
CreateDirectoryIfNotExist(IMAGE_DIR_RCC_AUTORUN);
|
|
return IMAGE_DIR_RCC_AUTORUN;
|
|
}
|
|
|
|
public string GetDirPath_RCC_Manual_Image()
|
|
{
|
|
CreateDirectoryIfNotExist(IMAGE_DIR_RCC_MANUAL);
|
|
return IMAGE_DIR_RCC_MANUAL;
|
|
}
|
|
|
|
public string GetDirPath_Scout_Normal_Image()
|
|
{
|
|
CreateDirectoryIfNotExist(IMAGE_DIR_SCOUT_NORMAL);
|
|
return IMAGE_DIR_SCOUT_NORMAL;
|
|
}
|
|
|
|
public string GetDirPath_Scout_Flying_Image()
|
|
{
|
|
CreateDirectoryIfNotExist(IMAGE_DIR_SCOUT_FLYING);
|
|
return IMAGE_DIR_SCOUT_FLYING;
|
|
}
|
|
|
|
public string GetDirPath_RCC_AutoRun_Data()
|
|
{
|
|
CreateDirectoryIfNotExist(DATA_DIR_RCC_AUTORUN);
|
|
return DATA_DIR_RCC_AUTORUN;
|
|
}
|
|
|
|
public string GetDirPath_RCC_Manual_Data()
|
|
{
|
|
CreateDirectoryIfNotExist(DATA_DIR_RCC_MANUAL);
|
|
return DATA_DIR_RCC_MANUAL;
|
|
}
|
|
|
|
|
|
// File Path
|
|
// RCC\AutoRun\Image - CenterGrab.png, FlyingScout.png
|
|
public string GetFilePath_RCC_AutoRun_Image(string postfixFileName)
|
|
{
|
|
string prefixDir = GetDirPath_RCC_AutoRun_Image();
|
|
string filePath = MakeFilePath(prefixDir, postfixFileName, "png");
|
|
return filePath;
|
|
}
|
|
|
|
// RCC\Manual\Image - FlyingScout.png
|
|
public string GetFilePath_RCC_Manual_Image_FlyingScout(string postfixFileName)
|
|
{
|
|
string prefixDir = GetDirPath_RCC_Manual_Image();
|
|
string filePath = MakeFilePath(prefixDir, postfixFileName, "png");
|
|
return filePath;
|
|
}
|
|
|
|
// Scout\Normal\Image - NormalScout.png
|
|
public string GetFilePath_Scout_Normal_Image(string postfixFileName)
|
|
{
|
|
string prefixDir = GetDirPath_Scout_Normal_Image();
|
|
string filePath = MakeFilePath(prefixDir, postfixFileName, "png");
|
|
return filePath;
|
|
}
|
|
|
|
// Scout\Flying\Image - FlyingVisionScout.png
|
|
public string GetFilePath_Scout_Flying_Image(string postfixFileName)
|
|
{
|
|
string prefixDir = GetDirPath_Scout_Normal_Image();
|
|
string filePath = MakeFilePath(prefixDir, postfixFileName, "png");
|
|
return filePath;
|
|
}
|
|
|
|
// RCC\AutoRun\Data - CenterOffset.csv, GenObject.csv
|
|
public string GetFilePath_RCC_AutoRun_Data(string postfixFileName)
|
|
{
|
|
string prefixDir = GetDirPath_RCC_AutoRun_Data();
|
|
string filePath = MakeFilePath(prefixDir, postfixFileName, "csv");
|
|
return filePath;
|
|
}
|
|
|
|
// RCC\Manual\Data - EdgeContour.csv, CenterOffset.csv, EdgeShrinkOffset.csv
|
|
public string GetFilePath_RCC_Manual_Data(string postfixFileName)
|
|
{
|
|
string prefixDir = GetDirPath_RCC_Manual_Data();
|
|
string filePath = MakeFilePath(prefixDir, postfixFileName, "csv");
|
|
return filePath;
|
|
}
|
|
|
|
#region Scanner Record Data
|
|
private string MakeFilePathNoDateDir(string prefixDir, string postfixFileName, string extension, bool isNeedMillisecond = false)
|
|
{
|
|
string fileName = string.Empty;
|
|
if (isNeedMillisecond) {
|
|
fileName = string.Format($"{DateTime.Now.ToString("yyyyMMdd_HHmmss_fff")}_{postfixFileName}.{extension}");
|
|
} else {
|
|
fileName = string.Format($"{DateTime.Now.ToString("yyyyMMdd_HHmmss")}_{postfixFileName}.{extension}");
|
|
}
|
|
return Path.Combine(prefixDir, fileName);
|
|
}
|
|
|
|
// Scanner Record Data - _scanner\Record
|
|
public string GetDirPath_ScannerRecordLog()
|
|
{
|
|
CreateDirectoryIfNotExist(DATA_DIR_SCANNER_RECORD);
|
|
return DATA_DIR_SCANNER_RECORD;
|
|
}
|
|
|
|
public string GetFilePath_ScannerRecordLog(string postfixFileName, bool isNeedMillisecond)
|
|
{
|
|
string prefixDir = GetDirPath_ScannerRecordLog();
|
|
string filePath = MakeFilePathNoDateDir(prefixDir, postfixFileName, "csv", isNeedMillisecond);
|
|
return filePath;
|
|
}
|
|
|
|
public string GetDirPath_ScannerRecordLog_Coordinate()
|
|
{
|
|
CreateDirectoryIfNotExist(DATA_DIR_SCANNER_RECORD_COORDINATE);
|
|
return DATA_DIR_SCANNER_RECORD_COORDINATE;
|
|
}
|
|
|
|
public string GetFilePath_ScannerRecordLog_Coordinate(string postfixFileName, bool isNeedMillisecond)
|
|
{
|
|
string prefixDir = GetDirPath_ScannerRecordLog_Coordinate();
|
|
string filePath = MakeFilePathNoDateDir(prefixDir, postfixFileName, "csv", isNeedMillisecond);
|
|
return filePath;
|
|
}
|
|
|
|
public string GetDirPath_ScannerRecordLog_MetaData()
|
|
{
|
|
CreateDirectoryIfNotExist(DATA_DIR_SCANNER_RECORD_METADATA);
|
|
return DATA_DIR_SCANNER_RECORD_METADATA;
|
|
}
|
|
|
|
public string GetFilePath_ScannerRecordLog_MetaData(string postfixFileName, bool isNeedMillisecond)
|
|
{
|
|
string prefixDir = GetDirPath_ScannerRecordLog_MetaData();
|
|
string filePath = MakeFilePathNoDateDir(prefixDir, postfixFileName, "csv", true);
|
|
return filePath;
|
|
}
|
|
|
|
public string GetDirPath_ScannerRecordLog_LddFileFormat()
|
|
{
|
|
CreateDirectoryIfNotExist(DATA_DIR_SCANNER_RECORD_LDD_FILE_FORMAT);
|
|
return DATA_DIR_SCANNER_RECORD_LDD_FILE_FORMAT;
|
|
}
|
|
|
|
public string GetFilePath_ScannerRecordLog_LddFileFormat(string postfixFileName, bool isNeedMillisecond)
|
|
{
|
|
string prefixDir = GetDirPath_ScannerRecordLog_LddFileFormat();
|
|
string filePath = MakeFilePathNoDateDir(prefixDir, postfixFileName, "zip", true);
|
|
return filePath;
|
|
}
|
|
#endregion
|
|
|
|
public string GetDirPath_ObjectGeneratorTestImage()
|
|
{
|
|
CreateDirectoryIfNotExist(VISION_IMAGE_DIR_OBJECT_GENERATOR_TEST);
|
|
return VISION_IMAGE_DIR_OBJECT_GENERATOR_TEST;
|
|
}
|
|
|
|
}
|
|
}
|