You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
3.7 KiB
81 lines
3.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
|
|
namespace leak_test_project
|
|
{
|
|
/// <summary>
|
|
/// App.xaml에 대한 상호 작용 논리
|
|
/// </summary>
|
|
public partial class App : Application
|
|
{
|
|
public static Housing.Login.StartupLoginWindowResult LoginResult { get; set; }
|
|
|
|
protected override void OnStartup(StartupEventArgs e)
|
|
{
|
|
base.OnStartup(e);
|
|
|
|
// Database.ini 파일이 없는 경우 기본 템플릿 생성
|
|
try
|
|
{
|
|
string dbIniPath = Housing.Services.DatabaseSettings.GetDefaultFilePath();
|
|
if (!System.IO.File.Exists(dbIniPath))
|
|
{
|
|
string defaultContent =
|
|
"; =====================================================================\r\n" +
|
|
"; Mobi Leak Test System - 데이터베이스 및 로그인 설정 파일 (Database.ini)\r\n" +
|
|
"; =====================================================================\r\n" +
|
|
"\r\n" +
|
|
"; [데이터베이스 접속 상세 설정]\r\n" +
|
|
"; Db_Server : 중앙 MSSQL 데이터베이스 서버의 IP 주소 또는 호스트명\r\n" +
|
|
"; Db_Name : 검사 데이터를 저장할 대상 데이터베이스 이름\r\n" +
|
|
"; Db_User : 데이터베이스 접속 계정 ID (예: sa)\r\n" +
|
|
"; Db_Password: 데이터베이스 접속 계정의 비밀번호\r\n" +
|
|
"Db_Server=192.168.10.10, 1433\r\n" +
|
|
"Db_Name=NE1aW_PT_Sensor\r\n" +
|
|
"Db_User=su\r\n" +
|
|
"Db_Password=amotech821\r\n" +
|
|
"\r\n" +
|
|
"[Login]\r\n" +
|
|
"; Procedure: 로그인 검증에 사용할 DB 저장 프로시저명입니다. (공란일 경우 기본 테이블 조회 쿼리 작동)\r\n" +
|
|
"Procedure=dbo.CheckOperator\r\n" +
|
|
"\r\n" +
|
|
"; ProcessName: 로그인 검증 시 전달할 공정 이름입니다.\r\n" +
|
|
"ProcessName=EOL\r\n" +
|
|
"\r\n" +
|
|
"; OfflinePreview: 오프라인 모드 활성화 여부 (true = DB 연결 없이 로그인 통과, false = 실제 DB 인증)\r\n" +
|
|
"OfflinePreview=false\r\n";
|
|
System.IO.File.WriteAllText(dbIniPath, defaultContent, System.Text.Encoding.UTF8);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
System.Diagnostics.Debug.WriteLine($"[App Database.ini Create Error] {ex.Message}");
|
|
}
|
|
|
|
// Logs 폴더 사전 생성 보장 (실행 폴더 기준)
|
|
try
|
|
{
|
|
// 실행 폴더(C:\LeakTest\) 기준 Logs 폴더 생성
|
|
string logFolderLocal = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs");
|
|
if (!System.IO.Directory.Exists(logFolderLocal))
|
|
{
|
|
System.IO.Directory.CreateDirectory(logFolderLocal);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
System.Diagnostics.Debug.WriteLine($"[App Logs Directory Create Error] {ex.Message}");
|
|
}
|
|
|
|
// 메인 윈도우 생성 및 즉시 표시
|
|
var mainWindow = new MainWindow();
|
|
this.MainWindow = mainWindow;
|
|
mainWindow.Show();
|
|
}
|
|
}
|
|
}
|
|
|