본문 바로가기

전체 글351

[C#] WPF Resource에서 이미지 파일(BitmapImage) 코드로 가져오기 public MainWindow() { InitializeComponent(); SetImage(); } private void SetImage() { var streamResource = Application.GetResourceStream(LoadBitmapFromResource("/Resources/chromaKey_001.jpg")); var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.StreamSource = streamResource.Stream; bitmapImage.EndInit(); img_box.Source = b.. 2021. 12. 7.
[C#] OpenCV Cam ChromaKey - 캠 크로마키 [C#] WPF - OpenCV, Cam 출력 (tistory.com) [C#] WPF - OpenCV, Cam 출력 소스 : CsharpFramework/CameraCapture at main · tjdskaqks/CsharpFramework · GitHub tjdskaqks/CsharpFramework Contribute to tjdskaqks/CsharpFramework development by creating an account on GitHub. gi.. jcoder1.tistory.com 기존 코드에서 수정된 건 별로 없다. private void _dispatcherTimer_Tick(object sender, EventArgs e) 부분 수정 // 타이머 동작 private void _d.. 2021. 12. 2.
[C# ] 요소수 중점 유통 주유소 재고현황 API 조회 데이터 상세 | 공공데이터포털 (data.go.kr) 공공데이터활용지원센터_요소수 중점 유통 주유소 재고현황_20211120 전국의 중점 유통 주유소의 요소수 재고 현황은 매일 2회 업데이트 됩니다. (12시 기준 재고현황 : 14시, 18시 기준 재고현황 : 20시) * 현재 버전 11월20일 12시 기준 업데이트 완료 www.data.go.kr 해당 페이지에서 활용신청 후 마이페이지에서 들어가면 아래처럼 일반 인증키가 나온다. Header와 Query에서 인증을 두번 해야한다. System.Net.Http.HttpClient httpClient = new(); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(.. 2021. 11. 20.
[C#] 건강보험심사평가원_병원평가정보서비스 Rest Api 사용 건강보험심사평가원_병원평가정보서비스 | 공공데이터포털 (data.go.kr) 건강보험심사평가원_병원평가정보서비스 건강보험심사평가원에서 제공하는 암호화된 요양기관 기호, 평가항목 등을 기준으로 요양기관의 평가항목별 병원평가결과를 조회하는 서비스 www.data.go.kr 활용신청 후 인증 키를 볼 수 있다. 미리보기 버튼 클릭하면 아래처럼 xml 데이터를 볼 수 있다. 1. 리스트뷰의 아이템을 클릭하면 해당 주소를 웹뷰2 구글 지도로 표시. 2. Get을 전체 리스트를 다 받아올 때까지 반복 조회. - 위에 보이는 totalCount가 numOfRows보다 작을 때까지 반복. - numOfRows가 한페이지당 결과 수인데 totalCount가 작다면 데이터가 끝. using System.Xml; using.. 2021. 11. 13.
[C#] ffmpeg 를 process 실행시 인코딩 예상 시간 구하기 using System; using System.Diagnostics; using System.Threading.Tasks; using System.Text.Json; using System.Text.Json.Serialization; using System.IO; using System.Text; using System.Runtime.InteropServices.ComTypes; using System.Collections.Generic; using System.Linq; using System.Collections.Concurrent; namespace VideoEncoding_console { class Program { static async Task Main(string[] args) { Con.. 2021. 11. 3.
[C#] mp4 Header 읽기를 통해 형식 및 duration 구하기 1. ftyp 읽기 2. mdat 건너띄기 (mdat는 영상 데이터 부분) 3. moov의 mvhd duration 구하기 참고 : https://www.adobe.com/content/dam/acom/en/devnet/flv/video_file_format_spec_v10.pdf 참고 : https://videocube.tistory.com/entry/MP4-%EB%B6%84%EC%84%9D-%ED%95%98%EA%B8%B0-MPEG4-%ED%8C%8C%ED%8A%B8-14 [MP4] 분석 하기 | MPEG-4 파트 14 | MP4Box 설치 Wiki 에 따르면 MP4 는 공식적으로 ISO/IEC 14496-14:2003 MPEG-4의 일부 규정된 멀티미디어 컨테이너 포맷이다. ㄴ 디지털 비디오, 디지.. 2021. 11. 2.
[C#-Linux] 워커 서비스 프로그램 서비스로 등록하기 1. .NET 5 Work Service 생성 2. nuget에서 Microsoft.Extensions.Hosting.Systemd 설치 program.cs - .UseSystemd() 추가 public class Program { /* [서비스 등록] sudo dotnet ./Worker_Service.dll --install sudo dotnet ./Worker_Service.dll -i [서비스 해제] sudo dotnet ./Worker_Service.dll --uninstall sudo dotnet ./Worker_Service.dll -u [서비스 시작] sudo systemctl start dotnet-worker_Service [서비스 중지-1 SIGINT] sudo systemctl st.. 2021. 10. 21.
[C#-Linux] WSL 및 리눅스 시스템에 .NET 5 설치 WSL2 사용 설치 : https://www.lesstif.com/software-architect/wsl-2-windows-subsystem-for-linux-2-89555812.html WSL 2(Windows Subsystem For Linux 2) 정식 버전 사용하기 만약 탐색기에서 \\wsl$ 로 접근시 WSL 목록이 보이지 않는다면 인스턴스가 기동되지 않아서입니다. www.lesstif.com Windows Terminal 설치 및 관리자 권한 실행 아래 실행 $ dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart $ dism.exe /online /enable-feature.. 2021. 10. 21.
[C#] Webview2 - not working Input type when it run as administrator 2022-12-14 수정. 아래로 내려보면 해결법이 있습니다. c# webview2에서 input file type 버튼을 클릭시 파일 다이얼로그 창이 뜨지 않는 현상이 있어 찾아보니 관리자 권한으로 실행시 다이얼로그 창이 뜨지 않는다고 한다. 링크 : WebView2 WPF application can't open file dialog when it run as administrator · Issue #734 · MicrosoftEdge/WebView2Feedback (github.com) WebView2 WPF application can't open file dialog when it run as administrator · Issue #734 · MicrosoftEdge/WebView2Feedba.. 2021. 10. 20.
[Windows] Bat로 reg 등록/삭제 1. 등록 regsvr32 %~dp0\xxxx1.dll regsvr32 %~dp0\xxxx2.dll 2. 삭제 regsvr32 /u %~dp0\xxxx1.dll regsvr32 /u %~dp0\xxxx2.dll 2021. 9. 2.
[C#] Webbrowser - ie 버전 up 기존 .NET Framework에서 webbrowser는 IE 7버전이기에 js 오류가 날 수 있어 레지로 버전을 11로 향상 시킬 수 있다. 1. 레지등록 방법 Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION] "프로그램이름.exe"=dword:00002ee1 xxx.reg로 만들어서 등록하면 해당 프로그램명은 ie 11로 사용 2. 프로그램 방법 (관리자 권한으로 실행 필요) using Microsoft.Win32; using System; using System.Collections.Generic; u.. 2021. 9. 2.
[C#] dll 코드로 등록 방법 (관리자 권한으로 실행해야 함) using Microsoft.Win32; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace UpdateProgram { public static class InstallHelper { public static bool RegsvrDll() { bool result = false; string screen_capture_recorder_x86 = System.IO.Path.Co.. 2021. 8. 31.
[C#] Webview2 runtime 설치 여부 및 설치 해당 코드는 .NET 6, .NET Framework로 바꿔서 사용해도 됨. if (!RuntimeSetup.CheckInstallWebview2Runtime()) //로 체크 후 await RuntimeSetup.InstallWebview2RuntimeAsync(); 설치 using Microsoft.Win32; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Update.. 2021. 8. 31.
[C#] .NET 5 설치 여부 확인 후 자동 설치 .NET 5 대상으로 한 프로그램에서 실행이 안되기 때문에 .NET Framework 4.8 대상으로 프로젝트 빌드함. 64비트 os인지 확인 using Microsoft.Win32; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace UpdateProgram { public static class InstallHelper { public static bool IsInstall.. 2021. 8. 31.
[C#] yield return 사용해야 할 때와 동기, 비동기 사용 방법 https://youtu.be/i9zw6x6zQLI?t=1741 2021. 8. 16.
[C#] WinUI3 소개 https://youtu.be/i9zw6x6zQLI?t=205 dotnetdev.kr - 디모이님 WinUI 3 소개 (slogger.today) 2021. 8. 16.
[C#] Get HttpStatusCode Message .Net Framework 4.7.2 HttpStatusCode 열거형 (System.Net) | Microsoft Docs public string GetResponseCode(HttpStatusCode httpStatusCode) { string responseMessage = string.Empty; if ((int)httpStatusCode >= 300 && (int)httpStatusCode < 400) { // 300 if (httpStatusCode.Equals(HttpStatusCode.MultipleChoices) || httpStatusCode.Equals(HttpStatusCode.Ambiguous)) { responseMessage = "HTTP 상태 300에 해당합니다. Ambig.. 2021. 8. 2.
[C#] Webview2 API POST 하기 2022-04-08 - header에 바로 추가하게 코드 수정. byte[] byteArray = Encoding.UTF8.GetBytes("보낼 데이터"); // ex) id=abc&pw=123 using (MemoryStream stream = new MemoryStream(byteArray)) { var request = webView2.CoreWebView2.Environment.CreateWebResourceRequest(url, "POST", stream, ""); request.Headers.SetHeader("Content-Type", "application/x-www-form-urlencoded"); request.Headers.SetHeader("Authorization", {인증할 t.. 2021. 7. 27.
[C#] Webview2 STATUS_INVALID_IMAGE_HASH 오류 해결 Endpoint Protector\csprnthk.dll that did not meet the Microsoft signing level requirements. 보안 프로그램으로 인해 실행이 안 되는 것을 확인할 수 있다. 위 오류를 Google에서 찾으면 https://answers.microsoft.com/en-us/microsoftedge/forum/all/microsoft-edge/8b600ac0-e077-4244-a97e-076a25fdd746 Microsoft Edge When I try and start edge I get this error: Error code: STATUS_INVALID_IMAGE_HASH When I go and look into this error via Even.. 2021. 7. 26.
[C#] IP 변경 public bool IPChangeRun(string ip, string subnet, string gateWay) { string myDesc = System.Configuration.ConfigurationManager.AppSettings["NICName"]; // NIC 정보 string address = ip; // 아이피 정보 string subnetMask = subnet; // 서브넷 정보 string gateway = gateWay; //게이트웨이 정보 using (System.Management.ManagementClass adapterConfig = new System.Management.ManagementClass("Win32_NetworkAdapterConfiguration")).. 2021. 7. 25.