[국원고 프로젝트] Utils Class(4)

Benedictus Park·2022년 12월 15일
0
post-thumbnail
using System.IO;
using System.Net;
using System.Text.Json;
using System.Net.NetworkInformation;

namespace Utils
{
    public struct KeySet
    {
        public byte[] Key;
        public byte[] IV;
    }

    public static class ArrayAppender
    {
        public static void Append<T>(ref T[] a, T[] b)
        {
            T[] result = new T[a.Length + b.Length];

            for(int i = 0; i < a.Length; i++)
            {
                result[i] = a[i];
            }
            for(int i = a.Length; i < a.Length + b.Length; i++)
            {
                result[i] = b[i - a.Length];
            }

            a = result;
        }

        public static void Append<T>(ref T[] a, T b)
        {
            T[] result = new T[a.Length + 1];

            for(int i = 0; i < a.Length; i++)
            {
                result[i] = a[i];
            }

            result[a.Length] = b;
            a = result;
        }
    }

    public static class CONSTANTS
    {
        public static int FAIL = 0x00;
        public static int SUCCESS = 0x01;
        public static int SEND_KEY = 0x02;
        public static int DECRYPT_REQ = 0x03;
    }
}
  • 통신을 위한 상수의 선언을 추가하였다.

0개의 댓글