Example #1
0
 private void lstStrings_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.lstStrings.SelectedItems.Count > 0)
     {
         LangStock SelectLang = this.languelist[(int)this.lstStrings.SelectedItems[0].Tag];
         this.txtString.Text = SelectLang.Langue.Replace("\n", "\r\n");
     }
 }
Example #2
0
        private void openFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog
            {
                Title  = "Open Language Files",
                Filter = "Pangya Languages (english.dat, thailand.dat)|*.dat"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                this.languelist = new List <LangStock>();

                using (BinaryReader reader = new BinaryReader(File.Open(dialog.FileName, FileMode.Open, FileAccess.Read), IffFile.GetFileEncodingByRegion(RegionSelected)))
                {
                    int           num     = 0;
                    StringBuilder builder = new StringBuilder();
                    while (reader.BaseStream.Position < reader.BaseStream.Length)
                    {
                        if (reader.PeekChar() != 0)
                        {
                            builder.Append(reader.ReadChar());
                        }
                        else
                        {
                            LangStock item = new LangStock
                            {
                                Langue = builder.ToString(),
                                Index  = num
                            };
                            this.languelist.Add(item);
                            builder = new StringBuilder();
                            reader.BaseStream.Seek(1L, SeekOrigin.Current);
                            num++;
                        }
                    }
                    UpdateStringList();
                }
            }
        }