http://localhost:8888/baseinfo 시간 없는 경우 현재 시간 적용
This commit is contained in:
@@ -35,6 +35,19 @@ namespace XRServer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string PlaybackFolderPath { get; set; } = string.Empty;
|
public string PlaybackFolderPath { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
private string currentMMSS = "00:00";
|
||||||
|
public string CurrentMMSS
|
||||||
|
{
|
||||||
|
get => currentMMSS;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
// MM:SS 형식이 맞는지 확인합니다.
|
||||||
|
if (TimeFormatRegex.IsMatch(value))
|
||||||
|
{
|
||||||
|
currentMMSS = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// BaseInfoHandler의 생성자입니다.
|
/// BaseInfoHandler의 생성자입니다.
|
||||||
@@ -65,15 +78,17 @@ namespace XRServer
|
|||||||
|
|
||||||
// 1. URL에서 'mm:ss' 형식의 시간 부분이 있는지 정규식으로 확인합니다.
|
// 1. URL에서 'mm:ss' 형식의 시간 부분이 있는지 정규식으로 확인합니다.
|
||||||
Match match = TimeFormatRegex.Match(url);
|
Match match = TimeFormatRegex.Match(url);
|
||||||
if (!match.Success)
|
// 만약 'mm:ss' 형식이 URL에 없다면, 기본값으로 현재 설정된 MM:SS 값을 사용합니다.
|
||||||
{
|
string timePart = CurrentMMSS;
|
||||||
// 시간 형식이 올바르지 않으면, 클라이언트에게 '400 Bad Request' 오류를 보냅니다.
|
//if (!match.Success)
|
||||||
context.Response = new HttpResponse(HttpResponseCode.BadRequest, "잘못된 시간 형식입니다. URL 끝에 'mm:ss' 형식을 포함하세요.", false);
|
//{
|
||||||
return; // 처리 종료
|
// // 시간 형식이 올바르지 않으면, 클라이언트에게 '400 Bad Request' 오류를 보냅니다.
|
||||||
}
|
// context.Response = new HttpResponse(HttpResponseCode.BadRequest, "잘못된 시간 형식입니다. URL 끝에 'mm:ss' 형식을 포함하세요.", false);
|
||||||
|
// return; // 처리 종료
|
||||||
|
//}
|
||||||
|
|
||||||
// 2. URL에서 시간 부분과 요청 타입(예: "baseinfo" 또는 "Position")을 추출합니다.
|
// 2. URL에서 시간 부분과 요청 타입(예: "baseinfo" 또는 "Position")을 추출합니다.
|
||||||
string timePart = match.Value; // "01:23"
|
if (match.Success) timePart = match.Value; // "01:23"
|
||||||
string requestType = GetRequestType(url, match.Index); // "baseinfo"
|
string requestType = GetRequestType(url, match.Index); // "baseinfo"
|
||||||
|
|
||||||
// 3. SQLiteService를 사용해 데이터베이스에서 해당 시간의 데이터를 비동기적으로 조회합니다.
|
// 3. SQLiteService를 사용해 데이터베이스에서 해당 시간의 데이터를 비동기적으로 조회합니다.
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ namespace XRServer
|
|||||||
|
|
||||||
// 현재 재생 시간으로 mm:ss 형식 문자열 생성
|
// 현재 재생 시간으로 mm:ss 형식 문자열 생성
|
||||||
string currentPlaybackTime = _currentPlaybackTime.ToString(@"mm\:ss");
|
string currentPlaybackTime = _currentPlaybackTime.ToString(@"mm\:ss");
|
||||||
Logger.Debug($"현재 재생 시간: {currentPlaybackTime}");
|
//Logger.Debug($"현재 재생 시간: {currentPlaybackTime}");
|
||||||
// 메인 스레드에서 타임틱 이벤트 호출
|
// 메인 스레드에서 타임틱 이벤트 호출
|
||||||
// [수정됨] Dispatcher가 종료되었는지 확인하여 예외 방지
|
// [수정됨] Dispatcher가 종료되었는지 확인하여 예외 방지
|
||||||
var dispatcher = Application.Current?.Dispatcher;
|
var dispatcher = Application.Current?.Dispatcher;
|
||||||
|
|||||||
@@ -337,9 +337,10 @@ namespace XRServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MqttService_OnTimeTick(string mmdd)
|
private void MqttService_OnTimeTick(string mmss)
|
||||||
{
|
{
|
||||||
nowTimeTxt.Content = "NOW " + mmdd;
|
nowTimeTxt.Content = "NOW " + mmss;
|
||||||
|
httpHandler.CurrentMMSS = mmss;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startTimeBtn_Click(object sender, RoutedEventArgs e)
|
private void startTimeBtn_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user