//11.txt
//{"param":{"loginid":"admin","pwd":"admin123"},"proto":"r","sender":"/cli/admin/10.1.181.79/25216","id":"login_client.0000919860.001","ts":"1713428639","method":"login_client"}
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
class Program
{
public static void Main(string[] args)
{
if (args.Length == 1)
{
CHKNM nmm = new CHKNM();
nmm.RUN(args[0]);
}
else
{
CHKNM nmm = new CHKNM();
nmm.RUN();
}
}
}
class CHKNM
{
public void RUN(string fileText)
{
string lines = File.ReadAllText(fileText);
Console.WriteLine(lines);
byte[] bytes = Encoding.UTF8.GetBytes(lines);
PrintByteArray(bytes);
}
public void RUN()
{
byte[] buffer = new byte[] { 123, 34, 112, 97, 114, 97, 109, 34, 58, 123, 34, 108, 111, 103, 105, 110, 105, 100, 34, 58, 34, 97, 100, 109, 105, 110, 34, 44, 34, 112, 119, 100, 34, 58, 34, 97, 100, 109, 105, 110, 49, 50, 51, 34, 125, 44, 34, 112, 114, 111, 116, 111, 34, 58, 34, 114, 34, 44, 34, 115, 101, 110, 100, 101, 114, 34, 58, 34, 47, 99, 108, 105, 47, 97, 100, 109, 105, 110, 47, 49, 48, 46, 49, 46, 49, 56, 49, 46, 55, 57, 47, 50, 53, 50, 49, 54, 34, 44, 34, 105, 100, 34, 58, 34, 108, 111, 103, 105, 110, 95, 99, 108, 105, 101, 110, 116, 46, 48, 48, 48, 48, 57, 49, 57, 56, 54, 48, 46, 48, 48, 49, 34, 44, 34, 116, 115, 34, 58, 34, 49, 55, 49, 51, 52, 50, 56, 54, 51, 57, 34, 44, 34, 109, 101, 116, 104, 111, 100, 34, 58, 34, 108, 111, 103, 105, 110, 95, 99, 108, 105, 101, 110, 116, 34, 125, 13, 10, };
string strText = Encoding.Default.GetString(buffer);
Console.WriteLine(strText);
}
public void PrintByteArray(byte[] bytes)
{
var sb = new StringBuilder("new byte[] { ");
foreach (var b in bytes)
{
sb.Append(b + ", ");
}
sb.Append("}");
Console.WriteLine(sb.ToString());
}
}
'c# 언어 > 중급과정' 카테고리의 다른 글
c# > windows.pre.foundation > 원리금균등상환.금리비교시.대출상환포함 (0) | 2024.06.12 |
---|---|
원리금균등상환계산기(Windows.Presentation.Foundation) (0) | 2024.05.31 |
(ComponentOne) 라이선스 에러 발생시 대처 방법 안내 - 마이그레이션 방법(추가 질문사항) (0) | 2024.03.06 |
(클로버-X에 질문)GC(Garbage Collection)의 문제점 (0) | 2024.02.14 |
Sample.File.Explorer/Source (0) | 2024.02.13 |