Exemplo n.º 1
0
        private void listView_ItemDrag(object sender, ItemDragEventArgs e)
        {
            string selectedFile = fileSelector.SelectedFile;

            if (string.IsNullOrEmpty(selectedFile))
            {
                return;
            }

            string[] fileNames;

            try
            {
                var excludeExtensions = new List <string>();

                if (checkBoxExcludeBpfFile.Checked)
                {
                    excludeExtensions.Add(".bpf");
                }

                if (checkBoxExcludeResFile.Checked)
                {
                    excludeExtensions.Add(".res");
                }

                fileNames = MainEngine.GetProjectFiles(selectedFile, fileListElementName, fileNameElementName, excludeExtensions.ToArray()).ToArray();
            }
            catch (Exception exception)
            {
                showErrorMessage(selectedFile + "\r\n" + exception.Message);
                return;
            }

            DragDropEffects effect = listView.DoDragDrop(new DataObject(DataFormats.FileDrop, fileNames), DragDropEffects.All);
        }
Exemplo n.º 2
0
        private void fileSelector_SelectedFileChanged(object sender, EventArgs e)
        {
            string fileName;

            try
            {
                var fileInfo = new FileInfo(fileSelector.SelectedFile);

                if (!(fileInfo.Exists))
                {
                    return;
                }

                fileName = fileInfo.FullName;
            }
            catch (ArgumentException)
            {
                return;
            }

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            tryAndCatch <Exception>(delegate()
            {
                textBoxIncludePath.Text = MainEngine.GetFormattedPaths(fileName, macrosElementName, includePathElementName);
            });

            tryAndCatch <Exception>(delegate()
            {
                textBoxLibPath.Text = MainEngine.GetFormattedPaths(fileName, macrosElementName, libPathElementName);
            });

            tryAndCatch <Exception>(delegate()
            {
                textBoxUserDefines.Text = MainEngine.GetElementValue(fileName, macrosElementName, userDefinesElementName);
            });
        }