Trying to get escape seqs in different file

For research purposes
This commit is contained in:
Denis
2024-04-08 12:34:12 +02:00
parent 724bdf20bc
commit 770a79c869

View File

@@ -2,6 +2,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Text; using System.Text;
namespace BMGEditor namespace BMGEditor
@@ -212,22 +213,36 @@ namespace BMGEditor
string ret = ""; string ret = "";
char c; char c;
//List<string> escSeqs = new List<string>();
while ((c = m_File.Reader.ReadChar()) != '\0') while ((c = m_File.Reader.ReadChar()) != '\0')
{ {
if (c == 0x001A) if (c == 0x001A)
{ {
//string seq = "";
ret += "*" ; ret += "*" ;
//seq += "001A";
escSeqLength = m_File.Reader.ReadByte(); escSeqLength = m_File.Reader.ReadByte();
//seq += $"{String.Format("{0:X2}", escSeqLength)}";
ret += $"{String.Format("{0:X2}", escSeqLength)}"; ret += $"{String.Format("{0:X2}", escSeqLength)}";
for (int k = 3; k < escSeqLength; k++) for (int k = 3; k < escSeqLength; k++)
{ {
ret += String.Format("{0:X2}", m_File.Reader.ReadByte()); ret += String.Format("{0:X2}", m_File.Reader.ReadByte());
//seq += ret[ret.Length - 2];
//seq += ret[ret.Length - 1];
} }
ret += " "; ret += " ";
//escSeqs.Add(seq);
} }
else else
ret += c; ret += c;
} }
/*using (StreamWriter outputFile = new StreamWriter("escape_sequences.txt", true))
{
foreach (string s in escSeqs)
{
outputFile.WriteLine(s);
}
}*/
return ret; return ret;