public Form1() { InitializeComponent(); m_menuStrip = new MenuStrip(); var fileMenu = new ToolStripMenuItem("File"); var fileOpenItem = new ToolStripMenuItem("Open Aion client directory..."); fileOpenItem.Click += FileOpenItem_Click; fileMenu.DropDownItems.Add(fileOpenItem); m_menuStrip.Items.Add(fileMenu); Controls.Add(m_menuStrip); m_treeView = new TreeView(); m_treeView.Location = new Point(0, m_menuStrip.Bottom); m_treeView.Size = new Size(300, 800); m_treeView.ImageList = new ImageList(); m_treeView.ImageList.Images.Add(Properties.Resources.DefaultImage); //0 m_treeView.ImageList.Images.Add(Properties.Resources.DirImage); //1 m_treeView.ImageList.Images.Add(Properties.Resources.PakImage); //2 m_treeView.ImageList.Images.Add(Properties.Resources.TextImage); //3 m_treeView.ImageList.Images.Add(Properties.Resources.ImageImage); //4 m_treeView.ImageList.Images.Add(Properties.Resources.LevelImage); //5 m_treeView.HideSelection = false; m_treeView.AfterSelect += M_treeView_AfterSelect; m_treeView.BeforeExpand += M_treeView_BeforeExpand; m_treeView.NodeMouseDoubleClick += M_treeView_NodeMouseDoubleClick; m_treeView.KeyPress += M_treeView_KeyPress; m_treeView.ItemDrag += M_treeView_ItemDrag; Controls.Add(m_treeView); m_imageViewer = new ImageViewerControl(); m_imageViewer.Hide(); Controls.Add(m_imageViewer); m_textViewer = new TextBox(); m_textViewer.Font = new Font(FontFamily.GenericMonospace, 10); m_textViewer.Multiline = true; m_textViewer.ScrollBars = ScrollBars.Both; m_textViewer.Hide(); Controls.Add(m_textViewer); DoResize(); AllowDrop = true; var dir = ClientViewerSettings.GetClientDir(); if (dir == null) { dir = GetClientDirFromOpenDialog(); } LoadClientDir(dir); }
private void LoadClientDir(string dir) { if (dir == null) { return; } m_treeView.Nodes.Clear(); try { LoadDirectoryStructure(dir); LoadLevels(); m_treeView.SelectedNode = m_treeView.Nodes[0]; try { ClientViewerSettings.SetClientDir(dir); } catch { } } catch (Exception e) { MessageBox.Show("Error loading dir: " + e.Message); } }