Пример #1
0
        private void replaceFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FileNode Node = (FileNode)treeView1.SelectedNode;

            OpenFileDialog o = new OpenFileDialog()
            {
                Filter   = Node.GetFileFilter(),
                FileName = Node.Entry.Name
            };

            if (o.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            byte[] Data = File.ReadAllBytes(o.FileName);

            using (FileStream GCMStream = OpenGCMStream())
            {
                if (GCM.ReplaceFile(Node.Entry, GCMStream, Data))
                {
                    MessageBox.Show("File was successfully replaced.", "GCM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("No space was found for the file. This shouldn't really happen unless a very large file was selected.", "GCM", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            RefreshPropertyGrid();
        }