프로그래밍 _공부자료.60 C# .xml 파일 실행파일 경로 가져오는법 string currentDir = ProcessExecutor.GetCurrentExePath();string xmlFile = System.IO.Path.Combine(currentDir, "SettingFile.xml");XmlDocument doc = new XmlDocument();doc.Load(xmlFile);// Application 노드 찾기XmlNode appNode = doc.SelectSingleNode("//Application");// Setting 노드에서 필요한 값 추출string programPath = appNode.SelectSingleNode("Setting").InnerText;string fullProgramPath = System.IO.Path.Combine(cu.. 2024. 7. 31. C# wpf 오류 알림 모듈화 using System;using System.Windows;namespace YourNamespace{ public static class GlobalErrorHandler { public static void Initialize() { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.Current.DispatcherUnhandledException += App_DispatcherUnhandledException; } private static void App_DispatcherUnhand.. 2024. 7. 23. C# 로그 클래스 using System;using System.IO;public class LoggerTest{ private readonly string logFilePath; public LoggerTest() { // 현재 실행 중인 애플리케이션의 경로를 기준으로 Log 폴더 경로 설정 string logDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log"); // Log 폴더가 없으면 생성 if (!Directory.Exists(logDirectory)) { Directory.CreateDirectory(logDirectory); }.. 2024. 7. 23. C# ATM 기능 만들기 public class BankAccount{ public string AccountNumber { get; set; } public string OwnerName { get; set; } public string Password { get; set; } public decimal Balance { get; set; }}public class ATM{ private List accounts; public ATM() { accounts = new List(); } public void CreateAccount(string accountNumber, string ownerName, string password) { BankAcco.. 2024. 6. 28. 이전 1 2 3 4 ··· 15 다음