본문 바로가기

C# Winform26

C# 초간단 Rest API Server 만들기 (Simple-HTTP) C# Rest API Server 만들기 Simple-HTTP 이용하기 GitHub - dajuric/simple-http: Simple, portable HTTP server for .NET based on HttpListener. Simple, portable HTTP server for .NET based on HttpListener. - GitHub - dajuric/simple-http: Simple, portable HTTP server for .NET based on HttpListener. github.com Simple-HTTP 설치 Nuget에서 검색후 설치 2. Route 설정 및 관리 프로젝트에 Service폴더 추가 및 HttpRoute.cs 추가 using SimpleHttp; .. 2023. 6. 30.
C# Telegram message 보내기 HttpClient 선언 using System.Net.Http; private static HttpClient httpclient = new HttpClient(); Telegram Token, Chat_id 확인하기 Telegram 봇 만들기 및 채팅 ID 얻기 1. 텔레그램에 BotFarther 추가 BotFather를 검색후 추가해준다. 2. 명령어 사용 /start를 채팅창에 치면 그림과 같이 명령어와 기능을 설명해준다. 기존에 봇이 있다면 /mybots로 관리할수 있다. 신규로 봇 program-day.tistory.com Telegram message 보내기 public void SendTelegramMsg(string msg, string chat_id, string token) { str.. 2023. 6. 29.
C# HttpClient 권장 WebRequest, WebClient, ServicePoint는 사용되지 않음 호환성이 손상되는 변경: WebRequest, WebClient, ServicePoint는 더 이상 사용되지 않음 - .NET WebRequest, WebClient 및 ServicePoint가 더 이상 사용되지 않고 대신 HttpClient가 사용되는 .NET 6의 호환성이 손상되는 변경에 대해 알아봅니다. learn.microsoft.com WebClient MSDN WebClient 클래스 (System.Net) URI로 식별되는 리소스와 데이터를 주고 받기 위한 일반적인 메서드를 제공합니다. learn.microsoft.com HttpWebRequest MSDN HttpWebRequest 클래스 (System.Net).. 2023. 6. 29.
textbox vertical alignment 이벤트 추가 (TextChanged) 이전글 참고해 주세요. using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; public class VerticalTextBox : Control { public VerticalTextBox() { //OnPaint의 e.Graphics.DrawRectangle 잔상 제거 -> ControlStyles.ResizeRedraw 필수 base.SetStyle(ControlStyles.OptimizedDoubleBuff.. 2023. 6. 27.
HttpClient 사용해서 UPBIT 마켓 조회하기 HttpClient 사용해서 UPBIT 마켓 조회하기 1. HttpClient 선언해줍니다. using System.Net.Http; private static HttpClient client = new HttpClient(); 2. Button을 추가하고 GetAsync를 실행한다. private void btnGetMarket_Click(object sender, EventArgs e) { HttpResponseMessage response = client.GetAsync("https://api.upbit.com/v1/market/all").GetAwaiter().GetResult(); string json = response.Content.ReadAsStringAsync().GetAwaiter()... 2023. 6. 26.
C# Winform | String to Byte Array | Byte Array to String C# Winform | String to Byte Array | Byte Array to String String to Byte Array private byte[] StringToByte(string str) { byte[] bytes = Encoding.Default.GetBytes(str); return bytes; } Colored by Color Scripter cs Byte Array to String private string ByteToString(byte[] bytes) { string str = Encoding.Default.GetString(bytes); return str; } Colored by Color Scripter cs Test Code private void btnTest.. 2020. 12. 8.