daily update on 20241129 by nitload youmu, frameworkDialogue added

This commit is contained in:
Nitload
2024-11-29 05:47:53 +08:00
parent 6e2f93b053
commit 7c8d462ca5
2190 changed files with 49578 additions and 72052 deletions
@@ -0,0 +1,62 @@
using StgSharp.Data;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace StgSharpData
{
public class EncodeStream
{
List<byte> data;
byte[] buffer;
byte count;
BitArray bufferArray;
public int Length
{
get { return data.Count; }
}
public List<byte> EncodeData
{
get=> data;
}
public EncodeStream()
{
count = 0;
buffer = new byte[1];
data = new List<byte>();
bufferArray = new BitArray(8,true);
}
public void WriteBits<T>(HuffmanKey<T> key) where T : struct
{
BitArray bit = key.GetBitArray();
for (int i = 0; i < bit.Count; i++)
{
if (count == 8)
{
bufferArray.CopyTo(buffer, 0);
data.Add(buffer[0]);
count = 0;
}
bufferArray[count] = bit[i];
count++;
}
}
public string Output
{
get
{
return Encoding.UTF8.GetString(data.ToArray());
}
}
}
}