WeddingThankYou 1.0.0.0
결혼식 이후 감사 인사와 사진, 계좌 안내, 연락처를 모바일 페이지로 전달하는 감사장 서비스입니다.
로딩중...
검색중...
일치하는것 없음
WeddingThankYou.Program 클래스 참조

정적 Public 멤버 함수

static void Main ()

정적 Private 멤버 함수

static void Run ()
static bool IsTcpPortAvailable (int port, bool listenAnyIp)
static int GetFreeLoopbackPort ()
static void WriteStartupFailureLog (Exception ex)
static int GetInt (IConfiguration cfg, string key, int fallback)
static bool GetBool (IConfiguration cfg, string key, bool fallback)
static string ResolvePath (string? configuredPath, string fallback)

상세한 설명

Program.cs 파일의 26 번째 라인에서 정의되었습니다.

멤버 함수 문서화

◆ GetBool()

bool WeddingThankYou.Program.GetBool ( IConfiguration cfg,
string key,
bool fallback )
inlinestaticprivate

Bool 값을 가져옵니다.

매개변수
cfgcfg에 사용할 IConfiguration 값입니다.
keykey에 사용할 string 값입니다.
fallbackfallback에 사용할 bool 값입니다.
반환값
Get Bool 조건이 충족되면 true이고, 그렇지 않으면 false입니다.

Program.cs 파일의 357 번째 라인에서 정의되었습니다.

357 =>
358 bool.TryParse(cfg[key], out bool v) ? v : fallback;

다음에 의해서 참조됨 : Run().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetFreeLoopbackPort()

int WeddingThankYou.Program.GetFreeLoopbackPort ( )
inlinestaticprivate

Free Loopback Port 값을 가져옵니다.

반환값
Get Free Loopback Port 작업에서 생성한 int 결과입니다.

Program.cs 파일의 226 번째 라인에서 정의되었습니다.

227 {
228 var listener = new TcpListener(IPAddress.Loopback, 0);
229 listener.Start();
230 try
231 {
232 return ((IPEndPoint)listener.LocalEndpoint).Port;
233 }
234 finally
235 {
236 listener.Stop();
237 }
238 }

다음에 의해서 참조됨 : Run().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetInt()

int WeddingThankYou.Program.GetInt ( IConfiguration cfg,
string key,
int fallback )
inlinestaticprivate

Int 값을 가져옵니다.

매개변수
cfgcfg에 사용할 IConfiguration 값입니다.
keykey에 사용할 string 값입니다.
fallbackfallback에 사용할 int 값입니다.
반환값
Get Int 작업에서 생성한 int 결과입니다.

Program.cs 파일의 314 번째 라인에서 정의되었습니다.

314 =>
315 int.TryParse(cfg[key], out int v) ? v : fallback;

다음에 의해서 참조됨 : Run().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ IsTcpPortAvailable()

bool WeddingThankYou.Program.IsTcpPortAvailable ( int port,
bool listenAnyIp )
inlinestaticprivate

Is Tcp Port Available 조건을 확인합니다.

매개변수
portport에 사용할 int 값입니다.
listenAnyIplisten Any Ip에 사용할 bool 값입니다.
반환값
Is Tcp Port Available 조건이 충족되면 true이고, 그렇지 않으면 false입니다.

Program.cs 파일의 189 번째 라인에서 정의되었습니다.

190 {
191 if (port <= 0) return false;
192
193 TcpListener? listener = null;
194 try
195 {
196 listener = new TcpListener(listenAnyIp ? IPAddress.Any : IPAddress.Loopback, port);
197 listener.Start();
198 return true;
199 }
200 catch (SocketException)
201 {
202 return false;
203 }
204 finally
205 {
206 listener?.Stop();
207 }
208 }

다음에 의해서 참조됨 : Run().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ Main()

void WeddingThankYou.Program.Main ( )
inlinestatic

Main 작업을 수행합니다.

Program.cs 파일의 37 번째 라인에서 정의되었습니다.

38 {
39 try
40 {
41 Run();
42 }
43 catch (Exception ex)
44 {
45 WriteStartupFailureLog(ex);
46 System.Windows.MessageBox.Show(
47 $"Wedding ThankYou 실행 중 오류가 발생했습니다.\n\n{ex.Message}\n\n자세한 내용은 로그를 확인하세요.",
48 "Wedding ThankYou",
49 System.Windows.MessageBoxButton.OK,
50 System.Windows.MessageBoxImage.Error);
51 }
52 }

다음을 참조함 : Run(), WriteStartupFailureLog().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ ResolvePath()

string WeddingThankYou.Program.ResolvePath ( string? configuredPath,
string fallback )
inlinestaticprivate

Resolve Path 작업을 수행합니다.

매개변수
configuredPathconfigured Path에 사용할 string? 값입니다.
fallbackfallback에 사용할 string 값입니다.
반환값
Resolve Path 작업에서 생성한 string 결과입니다.

Program.cs 파일의 392 번째 라인에서 정의되었습니다.

393 {
394 if (string.IsNullOrWhiteSpace(configuredPath))
395 {
396 return fallback;
397 }
398
399 return Path.IsPathRooted(configuredPath)
400 ? configuredPath
401 : Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, configuredPath));
402 }

다음에 의해서 참조됨 : Run().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ Run()

void WeddingThankYou.Program.Run ( )
inlinestaticprivate

Run 작업을 수행합니다.

Program.cs 파일의 62 번째 라인에서 정의되었습니다.

63 {
64 HostApplicationBuilder builder = Host.CreateApplicationBuilder();
65 builder.Configuration.AddUserSecrets("codemaru-oauth-2ba4e1b2");
66
67 int serverPort = GetInt(builder.Configuration, "WeddingServer:Port", 4088);
68 bool listenAnyIp = GetBool(builder.Configuration, "WeddingServer:ListenAnyIp", true);
69 bool useEmbeddedWebView = GetBool(builder.Configuration, "WeddingShell:UseEmbeddedWebView", true);
70 if (!IsTcpPortAvailable(serverPort, listenAnyIp))
71 {
72 serverPort = GetFreeLoopbackPort();
73 listenAnyIp = false;
74 }
75
76 AuthOptions authOptions =
77 builder.Configuration.GetSection(AuthOptions.SectionName).Get<AuthOptions>() ?? new AuthOptions();
78 string usersDbPath = ResolvePath(
79 builder.Configuration[$"{AuthOptions.SectionName}:UsersDbPath"],
80 Path.Combine(AppContext.BaseDirectory, "App_Data", "codemaru.db"));
81
82 builder.Services.AddDreamineHybridWpf();
83 builder.Services.AddDreamineIdentityWpfHost();
84
85 // ── Wedding 서비스 ─────────────────────────────────────────
86 var weddingOpts = WeddingOptions.From(builder.Configuration);
87 builder.Services.AddSingleton(weddingOpts);
88 builder.Services.AddSingleton<ITenantStore, JsonTenantStore>();
89 builder.Services.AddSingleton<IGuestbookStorage, CsvGuestbookStorage>();
90 builder.Services.AddSingleton<IGlobalSettingsStore, JsonGlobalSettingsStore>();
91 builder.Services.AddSingleton<IMediaQuotaPolicyResolver, MediaQuotaPolicyResolver>();
92 builder.Services.AddSingleton<IImageOptimizationService, SystemDrawingImageOptimizationService>();
93 builder.Services.AddSingleton<IMediaMigrationService, JsonMediaMigrationService>();
94 builder.Services.AddSingleton<IMediaUsageQueryService, FileSystemMediaUsageQueryService>();
95 builder.Services.AddSingleton<ISuperAdminSessionTokenService, SuperAdminSessionTokenService>();
96 builder.Services.AddSingleton<IPhotoService, LocalPhotoService>();
97
98 builder.Services.AddSingleton<Views.MainWindow>();
99
100 builder.Services.AddDreamineBlazorServer<AppShell>(options =>
101 {
102 options.Port = serverPort;
103 options.ListenAnyIp = listenAnyIp;
104 options.UseEmbeddedWebView = useEmbeddedWebView;
105 // Wedding 서비스 Blazor 호스트에 공유 (ViewModel은 AutoRegisterViewModels로 자동 등록)
106 options.SharedServiceTypes.Add(typeof(WeddingOptions));
107 options.SharedServiceTypes.Add(typeof(ITenantStore));
108 options.SharedServiceTypes.Add(typeof(IGuestbookStorage));
109 options.SharedServiceTypes.Add(typeof(IGlobalSettingsStore));
110 options.SharedServiceTypes.Add(typeof(IMediaQuotaPolicyResolver));
111 options.SharedServiceTypes.Add(typeof(IImageOptimizationService));
112 options.SharedServiceTypes.Add(typeof(IMediaMigrationService));
113 options.SharedServiceTypes.Add(typeof(IMediaUsageQueryService));
114 options.SharedServiceTypes.Add(typeof(ISuperAdminSessionTokenService));
115 options.SharedServiceTypes.Add(typeof(IPhotoService));
116 // 업로드된 사진/미디어를 /wedding-data/ URL로 제공
117 options.AddPhysicalStaticFiles(weddingOpts.ResolvedDataPath, "/wedding-data");
118
119 // InputFile(동영상 등 대용량 업로드)은 SignalR 회선을 통해 청크 단위로 전송되는데,
120 // 기본 SignalR 메시지 크기 제한(32KB)과 짧은 타임아웃 때문에 큰 파일은 매우 느리거나
121 // 응답 없이 멈춘 것처럼 보입니다. 업로드 용량 검증은 LocalPhotoService에서 별도로
122 // 하고 있으므로 전송 한도 자체는 풀어줍니다.
123 options.ConfigureServices = services =>
124 {
125 services.AddServerSideBlazor()
126 .AddHubOptions(o =>
127 {
128 o.MaximumReceiveMessageSize = null; // 무제한 (용량 검증은 LocalPhotoService에서 수행)
129 o.ClientTimeoutInterval = TimeSpan.FromMinutes(10);
130 o.HandshakeTimeout = TimeSpan.FromMinutes(2);
131 o.KeepAliveInterval = TimeSpan.FromSeconds(10);
132 });
133
134 services.AddAntiforgery(o =>
135 {
136 o.Cookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Lax;
137 o.Cookie.SecurePolicy = Microsoft.AspNetCore.Http.CookieSecurePolicy.SameAsRequest;
138 });
139
140 services.Configure<CircuitOptions>(o =>
141 {
142 o.DisconnectedCircuitMaxRetained = 100;
143 o.DisconnectedCircuitRetentionPeriod = TimeSpan.FromMinutes(3);
144 o.JSInteropDefaultCallTimeout = TimeSpan.FromMinutes(1);
145 o.MaxBufferedUnacknowledgedRenderBatches = 10;
146 });
147
148 services.AddScoped<ThankYouUserContext>();
149 };
150
151 options.AddDreamineIdentity(authOptions, usersDbPath);
152 });
153
154 builder.Build().RunDreamineWpfApp<App>();
155 }

다음을 참조함 : WeddingThankYou.Services.WeddingOptions.From(), GetBool(), GetFreeLoopbackPort(), GetInt(), IsTcpPortAvailable(), ResolvePath().

다음에 의해서 참조됨 : Main().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ WriteStartupFailureLog()

void WeddingThankYou.Program.WriteStartupFailureLog ( Exception ex)
inlinestaticprivate

Startup Failure Log 데이터를 씁니다.

매개변수
exex에 사용할 Exception 값입니다.

Program.cs 파일의 256 번째 라인에서 정의되었습니다.

257 {
258 try
259 {
260 var dir = Path.Combine(
261 Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
262 "WeddingThankYou",
263 "Logs");
264 Directory.CreateDirectory(dir);
265 var path = Path.Combine(dir, "startup-error.log");
266 File.AppendAllText(path, $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] {ex}\r\n\r\n");
267 }
268 catch
269 {
270 // 마지막 안전망: 오류 로그 작성 실패가 앱 종료 원인이 되지 않게 둡니다.
271 }
272 }

다음에 의해서 참조됨 : Main().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: