示例#1
0
        private void DumpBlock(DataReader reader, Po po, bool fullWidth = false)
        {
            for (int i = 0; i < SizeBlock; i++)
            {
                if (!(JapaneseStrings.Contains(Count) || BadPointers.Contains(Count)))
                {
                    PoEntry entry = new PoEntry(); //Generate the entry on the po file

                    //Get position
                    int position = reader.ReadInt32() - 0x401600;
                    reader.Stream.PushToPosition(position);

                    //Get the text
                    DumpText(reader);

                    //Normalize the text
                    NormalizeText(fullWidth);

                    //Return to the original position
                    reader.Stream.PopPosition();

                    //entry.Original = ReplaceText(TextNormalized, true);  //Add the string block
                    entry.Original = TextNormalized.Replace("\0", "");
                    entry.Context  = Count.ToString(); //Context
                    po.Add(entry);

                    //Clear the text
                    TextNormalized = "";
                }
                else
                {
                    reader.Stream.Position += 4;
                }

                Count++;
            }
        }
示例#2
0
 private void NormalizeText(bool full)
 {
     for (int i = 0; i < Text.Count; i++)
     {
         byte[] arraysjis = BitConverter.GetBytes(Text[i]);
         string temp      = TALKDAT.Binary2Po.SJIS.GetString(arraysjis);
         if (!full && !japaneseChars.Contains(temp))
         {
             TextNormalized += temp.Normalize(NormalizationForm.FormKC);
         }
         else
         {
             TextNormalized += temp;
         }
     }
     //Delete the /0/0
     TextNormalized = TextNormalized.Remove(TextNormalized.Length - 2);
     //Add text to the empty string
     if (string.IsNullOrEmpty(TextNormalized))
     {
         TextNormalized = "<!empty>";
     }
     Text.Clear();
 }