Exemplo n.º 1
0
        private void tv1_DoubleClick(object sender, EventArgs e)
        {
            if (tv1.SelectedNode == null)
            {
                return;
            }
            byte[] data = BF2FileSystem.GetFileFromNode(tv1.SelectedNode);
            if (data == null)
            {
                return;
            }
            string ending = Path.GetExtension(BF2FileSystem.GetPathFromNode(tv1.SelectedNode)).ToLower();

            switch (ending)
            {
            case ".inc":
            case ".xml":
            case ".txt":
            case ".con":
            case ".tweak":
                TextEditor te = new TextEditor();
                te.rtb1.Text = Encoding.ASCII.GetString(data);
                te.ShowDialog();
                if (te._exitOk)
                {
                    BF2FileSystem.SetFileFromNode(tv1.SelectedNode, Encoding.ASCII.GetBytes(te.rtb1.Text));
                }
                break;
            }
        }
Exemplo n.º 2
0
        private void importToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string         name = Path.GetFileName(BF2FileSystem.GetPathFromNode(tv1.SelectedNode));
            string         ext  = Path.GetExtension(name);
            OpenFileDialog dlg  = new OpenFileDialog();

            dlg.FileName = name;
            dlg.Filter   = "*" + ext + "|*" + ext;
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                BF2FileSystem.SetFileFromNode(tv1.SelectedNode, File.ReadAllBytes(dlg.FileName));
                Log.WriteLine(dlg.FileName + " imported.");
            }
        }