본문 바로가기

C#83

[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.
[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.
[C#] Everything SDK 사용 SDK 다운 : SDK - voidtools SDK - voidtools www.voidtools.com ## Everything이 background에 실행 중이어야 한다. 실행 중이 아니라면 ipc 에러가 나온다. using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace DunamuCommon.EveryThing { public class EverythingAPI { const string EVERYTHING_DLL_NAME = "Everything64.dll"; co.. 2021. 7. 25.
[C#] Slack Message 보내기 1. Slack 채널 만든 후 https://api.slack.com/apps 에서 앱 만들기 2. 퍼미션 설정 3. WebHook Url 만들기 4. WebhookUrl = 위에서 copy한 url public async static Task SendMessageAsync(string message, string slackUrl = WebhookUrl) { string paramJson = System.Text.Json.JsonSerializer.Serialize(new { text = message }); // Payload var content = new System.Net.Http.FormUrlEncodedContent(new Dictionary { { "payload", paramJson } }.. 2021. 6. 1.
[C#] Mail 보내기 using MailMessage msg = new MailMessage("xxxx@naver.com", "xxxx@naver.com", "제목", "내용"); //msg.IsBodyHtml = true; //본문이 HTML 인 경우 // SmtpClient using (var smtp = new SmtpClient()) { // 셋업(SMTP 서버, 포트) smtp.Host = "smtp.naver.com"; smtp.Port = 587; smtp.EnableSsl = true; // SSL 사용 smtp.SendCompleted += (s, e1) => { if (string.IsNullOrEmpty($"{e1.Error}")) MessageBox.Show($"메일 발송 성공", "성공", Messag.. 2021. 5. 4.
[C#] .NET Framework 버전 확인 설치된 .NET Framework 버전 확인 | Microsoft Docs 설치된 .NET Framework 버전 확인 코드, regedit.exe 또는 PowerShell을 사용하여 Windows 레지스트리를 쿼리하는 방법으로 컴퓨터에 설치된 .NET Framework 버전을 검색합니다. docs.microsoft.com Environment.Version -> 5.0.5 RuntimeInformation.FrameworkDescription -> .NET 5.0.5 using Microsoft.Win32; using System; namespace CsharpTest { class Program { static void Main(string[] args) { Console.WriteLine("Hell.. 2021. 4. 27.
[C#] WPF - OpenCV, Cam 출력 소스 : CsharpFramework/CameraCapture at main · tjdskaqks/CsharpFramework · GitHub tjdskaqks/CsharpFramework Contribute to tjdskaqks/CsharpFramework development by creating an account on GitHub. github.com 1. .NET Framework 4.8 2. Visual Studio 16.9.4 - 카메라 디바이스 리스트 가져오기 (LINQ) using DirectShowLib; // 카메라 리스트 가져오기 private void GetCameraList() => cameraDevices.AddRange(from DsDevice dsDevice in DsDe.. 2021. 4. 16.
[C#] 윈도우 마이크 컨트롤 2 (AudioSwitcher, NAudio) [C#] 윈도우 마이크 컨트롤 (AudioSwitcher, NAudio) (tistory.com) [C#] 윈도우 마이크 컨트롤 (AudioSwitcher, NAudio) 1. 최소 사양을 맞추기 위해 .NET Framework 4.5.2 버전을 사용 2. Winform, UserControl 사용 가능 3. 비주얼 스튜디오 16.9.3 1. 음소거 버튼 - 패널로 사용 (PictureBox로 대체가능) 2. ContextMenuStrip에.. jcoder1.tistory.com WPF Usercontrol를 Winform Usercontrol에 붙여 MFC에서 호출 CsharpFramework/AudioControl at main · tjdskaqks/CsharpFramework (github.com).. 2021. 4. 13.