00001 using System;
00002 using System.Collections;
00003 using System.Collections.Generic;
00004 using System.Linq;
00005 using System.Text;
00006
00007 namespace NicoLiveTools {
00011 public class RecieveBuffer {
00012
00013
00014 private byte[] m_buffer;
00015
00016 private List<string> m_lineString;
00017
00018
00019 public byte[] Buffer {
00020 get {
00021 return m_buffer;
00022 }
00023 set {
00024 m_buffer = value;
00025 }
00026 }
00027
00028 public int Bytes {
00029 get;
00030 set;
00031 }
00032
00033 public List<string> LineString {
00034 get {
00035 return m_lineString;
00036 }
00037 }
00038
00039
00040 public RecieveBuffer() : this(1024){
00041 }
00042
00043 public RecieveBuffer(int bufferSize) {
00044 m_buffer = new byte[bufferSize];
00045 }
00046
00047 public void Analyze() {
00048 int start = 0;
00049 m_lineString = new List<string>();
00050 for (int i = 0; i < Bytes; i++) {
00051 if (Buffer[i] == 0 || i == Bytes - 1) {
00052 m_lineString.Add(Encoding.UTF8.GetString(Buffer, start, i - start));
00053 start = i + 1;
00054 continue;
00055 }
00056 }
00057 }
00058 }
00059 }