Skip to content

Commit

Permalink
Поддержка ру языка
Browse files Browse the repository at this point in the history
  • Loading branch information
VaIeroK committed Jun 28, 2022
1 parent 504795c commit 3e599df
Showing 1 changed file with 16 additions and 28 deletions.
44 changes: 16 additions & 28 deletions OGF tool/OGF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,21 @@ public void close_chunk(BinaryWriter w)

public string read_stringZ()
{
List<char> str = new List<char>();
string str = "";

while (reader.BaseStream.Position < reader.BaseStream.Length)
{
byte one = reader.ReadByte();
if (one != 0)
byte[] one = { reader.ReadByte() };
if (one[0] != 0)
{
str.Add((char)one);
str += Encoding.Default.GetString(one);
}
else
{
break;
}
}

return new string(str.ToArray());
return str;
}

public void write_stringZ(BinaryWriter w, string str)
Expand Down Expand Up @@ -272,7 +271,7 @@ public byte[] data()

foreach (var str in refs0)
{
temp.AddRange(Encoding.ASCII.GetBytes(str));
temp.AddRange(Encoding.Default.GetBytes(str));
temp.Add(0);
}

Expand All @@ -299,7 +298,7 @@ public byte[] data_all()
{
List<byte> temp = new List<byte>();

temp.AddRange(Encoding.ASCII.GetBytes(data));
temp.AddRange(Encoding.Default.GetBytes(data));
temp.Add(0);

return temp.ToArray();
Expand Down Expand Up @@ -344,9 +343,9 @@ public byte[] data()

for (int i = 0; i < bones.Count; i++)
{
temp.AddRange(Encoding.ASCII.GetBytes(bones[i])); // bone name
temp.AddRange(Encoding.Default.GetBytes(bones[i])); // bone name
temp.Add(0);
temp.AddRange(Encoding.ASCII.GetBytes(parent_bones[i]));// parent bone name
temp.AddRange(Encoding.Default.GetBytes(parent_bones[i]));// parent bone name
temp.Add(0);
temp.AddRange(fobb[i]); // obb
}
Expand Down Expand Up @@ -411,7 +410,7 @@ public byte[] data()
for (int i = 0; i < materials.Count; i++)
{
temp.AddRange(BitConverter.GetBytes(version[i]));
temp.AddRange(Encoding.ASCII.GetBytes(materials[i]));
temp.AddRange(Encoding.Default.GetBytes(materials[i]));
temp.Add(0);
for (int j = 0; j < bytes_1[i].Count; j++)
temp.AddRange(bytes_1[i][j]);
Expand Down Expand Up @@ -458,21 +457,21 @@ public byte[] data(bool four_byte)
{
List<byte> temp = new List<byte>();

temp.AddRange(Encoding.ASCII.GetBytes(m_source));
temp.AddRange(Encoding.Default.GetBytes(m_source));
temp.Add(0);
temp.AddRange(Encoding.ASCII.GetBytes(m_export_tool));
temp.AddRange(Encoding.Default.GetBytes(m_export_tool));
temp.Add(0);
if (!four_byte)
temp.AddRange(BitConverter.GetBytes(m_export_time));
else
temp.AddRange(BitConverter.GetBytes((uint)m_export_time));
temp.AddRange(Encoding.ASCII.GetBytes(m_owner_name));
temp.AddRange(Encoding.Default.GetBytes(m_owner_name));
temp.Add(0);
if (!four_byte)
temp.AddRange(BitConverter.GetBytes(m_creation_time));
else
temp.AddRange(BitConverter.GetBytes((uint)m_creation_time));
temp.AddRange(Encoding.ASCII.GetBytes(m_export_modif_name_tool));
temp.AddRange(Encoding.Default.GetBytes(m_export_modif_name_tool));
temp.Add(0);
if (!four_byte)
temp.AddRange(BitConverter.GetBytes(m_modified_time));
Expand Down Expand Up @@ -532,20 +531,9 @@ public byte[] data()
temp.AddRange(BitConverter.GetBytes(2));
temp.AddRange(BitConverter.GetBytes(m_texture.Length + m_shader.Length + 2));

foreach (char c in m_texture)
{
byte b = (byte)c;
temp.Add(b);
}

temp.AddRange(Encoding.Default.GetBytes(m_texture));
temp.Add(0);

foreach (char c in m_shader)
{
byte b = (byte)c;
temp.Add(b);
}

temp.AddRange(Encoding.Default.GetBytes(m_shader));
temp.Add(0);

return temp.ToArray();
Expand Down

0 comments on commit 3e599df

Please sign in to comment.