private void load_file() { FileStream fs = null; try { fs = new FileStream(filepath, FileMode.Open); BinaryReader r = new BinaryReader(fs); // read offsets for (int i = 0; i < 250; i++) { offsets[i] = r.ReadUInt32(); } // read strings (TODO, a bit bodged) for (UInt32 i = 0; i < 250; i++) { TexString sec = new TexString(); UInt32 end; string text = ""; if (i == 249) { end = 30000; // TODO } else { end = ((offsets[i + 1] - offsets[i]) * 2); } r.BaseStream.Seek((0x3e8 + offsets[i] * 2), SeekOrigin.Begin); for (UInt32 rp = 0; rp < end; rp += 2) { byte[] b = r.ReadBytes(2); if (b[0] == 0 && b[1] == 0) { if (text.Length > 1) { sec.Text = text; sec.Index = i; sections.Add(sec); } text = ""; sec = new TexString(); } else { text += System.Text.Encoding.Unicode.GetString(b); } } } } catch (IOException) { return; } finally { fs.Close(); } }
private void sectionCell_edit(object o, Gtk.EditedArgs args) { Gtk.TreeIter iter; store.GetIter(out iter, new Gtk.TreePath(args.Path)); TexString sec = (TexString)store.GetValue(iter, 0); sec.Text = args.NewText; }
private void RenderSection(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { TexString sec = (TexString)model.GetValue(iter, 0); (cell as Gtk.CellRendererText).Text = sec.Text; }