C# (48) 썸네일형 리스트형 C# http post header body C# http post header body var cl = new HttpClient(); cl.BaseAddress = new Uri(""); int _TimeoutSec = 90; cl.Timeout = new TimeSpan(0, 0, _TimeoutSec); string _ContentType = "application/x-www-form-urlencoded"; cl.DefaultRequestHeaders.Add(key, value); cl.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(_ContentType)); cl.DefaultRequestHeaders.Add("key", "value"); c.. C# HttpClient RestAPI Post C# HttpClient RestAPI Post 비동기 HttpClient public static string BaseUrl = ""; public static async Task Login(bool isReturnResponseMessage = false) { ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; // 인증 string result = string.Empty; try { string id = ""; string pw = ""; var bytevalue = Encoding.UTF8.GetBytes(id + ":" + pw); var base64value = Convert.ToBase64St.. C# HttpClient RestAPI Patch C# HttpClient RestAPI Patch public static async Task WDDCAsync(string bearer, string id, string val, bool isReturnResponseMessage = false) { //ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; // 인증 try { var cl = new HttpClient(); cl.BaseAddress = new Uri(BaseUrl); cl.Timeout = TimeSpan.FromSeconds(3); cl.DefaultRequestHeaders.Add("authorization", "Bearer " + .. C# HttpClient RestAPI Get C# HttpClient RestAPI Get 비동기 HttpClient public static async Task AlarmAsync(string bearer, string id, bool isReturnResponseMessage = false) { //ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; // 인증 string result = string.Empty; try { var cl = new HttpClient(); cl.BaseAddress = new Uri(BaseUrl); cl.Timeout = TimeSpan.FromSeconds(3); cl.DefaultRequestHeaders.A.. C# QR/Barcode 생성 C# QR/Barcode 생성 1. zen barcode QR코드 생성 NuGet -> 검색 ( zen barcode ) -> Zen.Barcode.Rendering.Framework 설치 public static class CQRGenerator { public static void Make(string uri, string savePath, int height = 50) { Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr; // 바코드 : Code128WithChecksum, QR : CodeQr var qrImage = qrcode.Draw(uri, height); qrImage.Save(savePath); }.. C# Byte To ImageSource C# Byte To ImageSource public static ImageSource ByteToImage(byte[] imageData) { BitmapImage biImg = new BitmapImage(); MemoryStream ms = new MemoryStream(imageData); biImg.BeginInit(); biImg.StreamSource = ms; biImg.EndInit(); ImageSource imgSrc = biImg as ImageSource; return imgSrc; } C# byte 압축 / 해제 C# byte 압축 / 해제 // byte 압축하기 byte[] originByte; byte[] compressedByte; using (MemoryStream ms = new MemoryStream()) { using (DeflateStream ds = new DeflateStream(ms, CompressionMode.Compress)) { ds.Write(originByte, 0, originByte.Length); } compressedByte = ms.ToArray(); } // byte 압축풀기 byte[] originByte; byte[] deCompressedByte; using (MemoryStream ms = new MemoryStream(compressedByte)) { using .. C# Byte Array에 Byte Array 합치기 C# Byte Array에 Byte Array 합치기 Byte array / Add / Combine / Sum private static byte[] Combine(byte[] first, byte[] second) { byte[] ret = new byte[first.Length + second.Length]; Buffer.BlockCopy(first, 0, ret, 0, first.Length); Buffer.BlockCopy(second, 0, ret, first.Length, second.Length); return ret; } 이전 1 2 3 4 5 6 다음 목록 더보기