## 신규 기능 - ACS(중앙제어시스템) 시뮬레이터 프로젝트 생성 - 8가지 AGV 제어 명령어 지원: * SetCurrent: 현재 위치 설정 * Goto: RFID 이동 * GotoAlias: 별칭 이동 (v1.1.0) * Stop: 정지 * Reset: 에러 리셋 * Manual: 수동 제어 * MarkStop: 마크센서 정지 * LiftControl: 리프트 제어 ## AGV 상태 실시간 표시 (v1.3.0) - AGV 상태 그룹박스 추가 (8가지 상태 정보) - Status 메시지(cmd=3) 자동 수신 및 UI 업데이트 - 상태별 색상 표시로 직관적 모니터링 ## 설정 관리 - 실행 폴더에 JSON 형식 설정 파일 저장 (v1.4.0) - COM 포트, 보레이트, RFID, 별칭, AGV 선택 자동 저장 - 설정 파일 직접 편집 가능 ## 기술 스택 - .NET Framework 4.8 - ENIGProtocol 프로젝트 참조 - RS232/Xbee 통신 - Newtonsoft.Json 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
68 lines
2.0 KiB
C#
68 lines
2.0 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Windows.Forms;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace Test_ACS
|
|
{
|
|
/// <summary>
|
|
/// 애플리케이션 설정을 관리하는 클래스
|
|
/// </summary>
|
|
public class AppSettings
|
|
{
|
|
public string LastPort { get; set; } = "COM1";
|
|
public string LastBaudRate { get; set; } = "9600";
|
|
public string LastRFID { get; set; } = "0001";
|
|
public string LastAlias { get; set; } = "CHARGER1";
|
|
public int LastAGV { get; set; } = 11;
|
|
|
|
private static string GetConfigFilePath()
|
|
{
|
|
// 실행 파일과 같은 폴더에 같은 이름으로 .config 파일 생성
|
|
string exePath = Application.ExecutablePath;
|
|
string exeName = Path.GetFileNameWithoutExtension(exePath);
|
|
string configPath = Path.Combine(Path.GetDirectoryName(exePath), exeName + ".config");
|
|
return configPath;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 설정 파일을 로드합니다
|
|
/// </summary>
|
|
public static AppSettings Load()
|
|
{
|
|
try
|
|
{
|
|
string configPath = GetConfigFilePath();
|
|
if (File.Exists(configPath))
|
|
{
|
|
string json = File.ReadAllText(configPath);
|
|
return JsonConvert.DeserializeObject<AppSettings>(json);
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
// 로드 실패 시 기본값 반환
|
|
}
|
|
|
|
return new AppSettings();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 설정을 파일에 저장합니다
|
|
/// </summary>
|
|
public void Save()
|
|
{
|
|
try
|
|
{
|
|
string configPath = GetConfigFilePath();
|
|
string json = JsonConvert.SerializeObject(this, Formatting.Indented);
|
|
File.WriteAllText(configPath, json);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
// 저장 실패 시 무시
|
|
}
|
|
}
|
|
}
|
|
}
|