예제 #1
0
		void ChooseMapPath(object sender, RoutedEventArgs e) {
			var ofd = new VistaOpenFileDialog();
			ofd.Filter = "Symbol maps (*.map)|*.map|All Files (*.*)|*.*";
			if (ofd.ShowDialog() ?? false) {
				PathBox.Text = ofd.FileName;
			}
		}
예제 #2
0
		void ChooseSNKey(object sender, RoutedEventArgs e) {
			var ofd = new VistaOpenFileDialog();
			ofd.Filter = "Supported Key Files (*.snk, *.pfx)|*.snk;*.pfx|All Files (*.*)|*.*";
			if (ofd.ShowDialog() ?? false) {
				module.SNKeyPath = ofd.FileName;
			}
		}
예제 #3
0
        public string[] GetFileOpenPath(string title, string filter)
        {
            if (VistaOpenFileDialog.IsVistaFileDialogSupported)
            {
                VistaOpenFileDialog openFileDialog = new VistaOpenFileDialog();
                openFileDialog.Title = title;
                openFileDialog.CheckFileExists = true;
                openFileDialog.RestoreDirectory = true;
                openFileDialog.Multiselect = true;
                openFileDialog.Filter = filter;

                if (openFileDialog.ShowDialog() == true)
                    return openFileDialog.FileNames;
            }
            else
            {
                Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog();
                ofd.Title = title;
                ofd.CheckFileExists = true;
                ofd.RestoreDirectory = true;
                ofd.Multiselect = true;
                ofd.Filter = filter;

                if (ofd.ShowDialog() == true)
                    return ofd.FileNames;
            }

            return null;
        }
		private void OnAddReferenceButtonClick(object sender, RoutedEventArgs e)
		{
			var dialog = new VistaOpenFileDialog
			{
				CheckFileExists = true,
				Multiselect = false,
				Filter = LocalizedStrings.Str1422
			};

			if (dialog.ShowDialog(this.GetWindow()) != true)
				return;

			var assembly = Assembly.ReflectionOnlyLoadFrom(dialog.FileName);
			if (assembly != null)
			{
				_references.Add(new CodeReference
				{
					Name = assembly.GetName().Name,
					Location = assembly.Location
				});
			}
			else
			{
				new MessageBoxBuilder()
					.Text(LocalizedStrings.Str1423)
					.Warning()
					.Owner(this)
					.Show();
			}
		}
예제 #5
0
 private void UnitPrefabBrowseButton_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new VistaOpenFileDialog { Filter = @"All files (*.*)|*.*" };
     var showDialog = dialog.ShowDialog(Application.Current.MainWindow);
     if (showDialog != null && (bool)showDialog) {
         var splitPath = dialog.FileName.Split("\\"[0]);
         UnitPrefabPath.Text = splitPath[splitPath.Length - 1];
     }
 }
        private void BrowseButton_Click(object sender, RoutedEventArgs e)
        {
            var fileBrowser = new VistaOpenFileDialog
            {
                CheckFileExists = true,
                CheckPathExists = true,
                Filter = Properties.Resources.SupportedAudioFilesFilter
            };

            if (fileBrowser.ShowDialog() != true) return;

            FilePath = fileBrowser.FileName;
        }
예제 #7
0
        private void BrowseButton_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new VistaOpenFileDialog
            {
                Filter = "Executables (*.exe)|*.exe",
                Multiselect = false
            };

            if (dialog.ShowDialog() == true)
            {
                ExePathTextBox.Text = dialog.FileName;
                ExePath = dialog.FileName;
            }
        }
예제 #8
0
파일: MainWindow.xaml.cs 프로젝트: rr-/ALAS
        private void ChooseTargetProgramClick(object sender, RoutedEventArgs eventArgs)
        {
            var dialog = new VistaOpenFileDialog
            {
                DefaultExt = ".exe",
                Filter = "Executable files (.exe)|*.exe"
            };

            bool? result = dialog.ShowDialog();
            if (result == true)
            {
                MainWindowData.ProgramPath = dialog.FileName;
            }
        }
        private void Browse_Files(object sender, RoutedEventArgs e)
        {
            Ookii.Dialogs.Wpf.VistaOpenFileDialog filedlg = new Ookii.Dialogs.Wpf.VistaOpenFileDialog();

            if (filedlg.ShowDialog(this).GetValueOrDefault())
            {
                pdfname = filedlg.FileName;
            }

            if (!string.IsNullOrEmpty(pdfname))
            {
                Debug.AppendText("Selected file is " + Get_File_Name(pdfname) + "\n");
            }
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            AddPlugin.Command = new RelayCommand(() => {
                var ofd = new VistaOpenFileDialog();
                ofd.Filter = ".NET assemblies (*.exe, *.dll)|*.exe;*.dll|All Files (*.*)|*.*";
                ofd.Multiselect = true;
                if (ofd.ShowDialog() ?? false) {
                    foreach (string plugin in ofd.FileNames) {
                        try {
                            ComponentDiscovery.LoadComponents(project.Protections, project.Packers, plugin);
                            project.Plugins.Add(new StringItem(plugin));
                        }
                        catch {
                            MessageBox.Show("Failed to load plugin '" + plugin + "'.");
                        }
                    }
                }
            });

            RemovePlugin.Command = new RelayCommand(() => {
                int selIndex = PluginPaths.SelectedIndex;
                Debug.Assert(selIndex != -1);

                string plugin = project.Plugins[selIndex].Item;
                ComponentDiscovery.RemoveComponents(project.Protections, project.Packers, plugin);
                project.Plugins.RemoveAt(selIndex);

                PluginPaths.SelectedIndex = selIndex >= project.Plugins.Count ? project.Plugins.Count - 1 : selIndex;
            }, () => PluginPaths.SelectedIndex != -1);

            AddProbe.Command = new RelayCommand(() => {
                var fbd = new VistaFolderBrowserDialog();
                if (fbd.ShowDialog() ?? false)
                    project.ProbePaths.Add(new StringItem(fbd.SelectedPath));
            });

            RemoveProbe.Command = new RelayCommand(() => {
                int selIndex = ProbePaths.SelectedIndex;
                Debug.Assert(selIndex != -1);
                project.ProbePaths.RemoveAt(selIndex);
                ProbePaths.SelectedIndex = selIndex >= project.ProbePaths.Count ? project.ProbePaths.Count - 1 : selIndex;
            }, () => ProbePaths.SelectedIndex != -1);
        }
예제 #11
0
 public static bool TryFilePath(string dialogTitle, string filter, out string fileName)
 {
     var fileSelector = new VistaOpenFileDialog()
     {
         Title = dialogTitle,
         Filter = filter,
         Multiselect = false,
         CheckFileExists = true,
         DefaultExt = filter.Split('|').ElementAt(1).Replace("*", "") // It SHOULD be an extension method, so todo
     };
     if (fileSelector.ShowDialog() == true)
     {
         fileName = fileSelector.FileName;
         return true;
     }
     else
     {
         fileName = string.Empty;
         return false;
     }
 }
예제 #12
0
		private void Browse_Click(object sender, RoutedEventArgs e)
		{
			var dlg = new VistaOpenFileDialog
			{
				Filter = "Assembly Files (*.dll)|*.dll",
				Multiselect = true,
			};

			if (dlg.ShowDialog(this) != true)
				return;

			Toc.Items.Clear();

			var navigation = new Navigation
			{
				UrlPrefix = "http://stocksharp.com/doc/ref/",
				EmptyImage = "http://stocksharp.com/images/blank.gif"
			};
			GenerateHtml.CssUrl = @"file:///C:/VisualStudio/Web/trunk/Site/css/style.css";
			GenerateHtml.Navigation = navigation; //ToDo: переделать
			GenerateHtml.IsHtmlAsDiv = false;
			GenerateHtml.IsRussian = true;

			var asmFiles = dlg.FileNames;
			var docFiles = asmFiles
				.Select(f => Path.Combine(Path.GetDirectoryName(f), Path.GetFileNameWithoutExtension(f) + ".xml"))
				.Where(File.Exists)
				.ToArray();

			var slnDom = SolutionDom.Build("StockSharp. Описание типов", asmFiles, docFiles, Path.GetFullPath(@"..\..\..\..\..\StockSharp\trunk\Documentation\DocSandCastle\Comments\project.xml"), null, new FindOptions
			{
				InternalClasses = false,
				UndocumentedClasses = true,
				PrivateMembers = false,
				UndocumentedMembers = true
			});

			_root = BuildPages.BuildSolution(slnDom);
			BuildTree(_root, Toc.Items);
		}
예제 #13
0
        /// <summary>
        /// Import a CSV file
        /// </summary>
        public void Import()
        {
            var dialog = new VistaOpenFileDialog { Filter = "CSV files (*.csv)|*.csv", CheckFileExists = true };
            dialog.ShowDialog();
            string filename = dialog.FileName;

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

            IDictionary<int, string> chapterMap = new Dictionary<int, string>();
            try
            {
                var sr = new StreamReader(filename);
                string csv = sr.ReadLine();
                while (csv != null)
                {
                    if (csv.Trim() != string.Empty)
                    {
                        csv = csv.Replace("\\,", "<!comma!>");
                        string[] contents = csv.Split(',');
                        int chapter;
                        int.TryParse(contents[0], out chapter);
                        chapterMap.Add(chapter, contents[1].Replace("<!comma!>", ","));
                    }
                    csv = sr.ReadLine();
                }
            }
            catch (Exception)
            {
                // Do Nothing
            }

            // Now iterate over each chatper we have, and set it's name
            foreach (ChapterMarker item in this.Chapters)
            {
                string chapterName;
                chapterMap.TryGetValue(item.ChapterNumber, out chapterName);
                item.ChapterName = chapterName;

                // TODO force a fresh of this property
            }
        }
예제 #14
0
 /// <summary>
 /// Browse VLC Path
 /// </summary>
 public void BrowseVlcPath()
 {
     VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.exe)|*.exe" };
     dialog.ShowDialog();
     this.VLCPath = dialog.FileName;
 }
예제 #15
0
 /// <summary>
 /// Browse - Send File To
 /// </summary>
 public void BrowseSendFileTo()
 {
     VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*" };
     dialog.ShowDialog();
     this.SendFileTo = Path.GetFileNameWithoutExtension(dialog.FileName);
     this.sendFileToPath = dialog.FileName;
 }
        /// <summary>
        /// Import an SRT File.
        /// </summary>
        public void Import()
        {
            VistaOpenFileDialog dialog = new VistaOpenFileDialog
                {
                    Filter = "SRT files (*.srt)|*.srt",
                    CheckFileExists = true,
                    Multiselect = true
                };

            dialog.ShowDialog();

            foreach (var srtFile in dialog.FileNames)
            {
                SubtitleTrack track = new SubtitleTrack
                    {
                        SrtFileName = Path.GetFileNameWithoutExtension(srtFile),
                        SrtOffset = 0,
                        SrtCharCode = "UTF-8",
                        SrtLang = "English",
                        SubtitleType = SubtitleType.SRT,
                        SrtPath = srtFile
                    };
                this.Task.SubtitleTracks.Add(track);
            }
        }
예제 #17
0
        /// <summary>
        /// The debug scan log.
        /// </summary>
        public void DebugScanLog()
        {
            VistaOpenFileDialog dialog = new VistaOpenFileDialog();

            dialog.ShowDialog();

            if (File.Exists(dialog.FileName))
            {
                this.scanService.DebugScanLog(dialog.FileName);
            }
        }
예제 #18
0
		void OpenProj() {
			if (!PromptSave())
				return;

			var ofd = new VistaOpenFileDialog();
			ofd.Filter = "ConfuserEx Projects (*.crproj)|*.crproj|All Files (*.*)|*.*";
			if ((ofd.ShowDialog(Application.Current.MainWindow) ?? false) && ofd.FileName != null) {
				string fileName = ofd.FileName;
				try {
					var xmlDoc = new XmlDocument();
					xmlDoc.Load(fileName);
					var proj = new ConfuserProject();
					proj.Load(xmlDoc);
					Project = new ProjectVM(proj, fileName);
					FileName = fileName;
				}
				catch {
					MessageBox.Show("Invalid project!", "ConfuserEx", MessageBoxButton.OK, MessageBoxImage.Error);
				}
			}
		}
예제 #19
0
        /// <summary>
        /// Import a CSV file
        /// </summary>
        public void Import()
        {
            var dialog = new VistaOpenFileDialog { Filter = "CSV files (*.csv)|*.csv", CheckFileExists = true };
            dialog.ShowDialog();
            string filename = dialog.FileName;

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

            IDictionary<int, string> chapterMap = new Dictionary<int, string>();
            try
            {
                using (CsvReader csv = new CsvReader(new StreamReader(filename), false))
                {
                    while (csv.ReadNextRecord())
                    {
                        if (csv.FieldCount == 2)
                        {
                            int chapter;
                            int.TryParse(csv[0], out chapter);
                            chapterMap[chapter] = csv[1];
                        }
                    }
                }
            }
            catch (Exception)
            {
                // Do Nothing
            }

            // Now iterate over each chatper we have, and set it's name
            foreach (ChapterMarker item in this.Task.ChapterNames)
            {
                string chapterName;
                chapterMap.TryGetValue(item.ChapterNumber, out chapterName);
                item.ChapterName = chapterName;
            }
        }
예제 #20
0
        /// <summary>
        /// Import a saved queue
        /// </summary>
        public void Import()
        {
            VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "HandBrake Queue Files (*.hbq)|*.hbq", CheckFileExists = true  };
            dialog.ShowDialog();

            this.queueProcessor.QueueManager.RestoreQueue(dialog.FileName);
        }
예제 #21
0
 /// <summary>
 /// File Scan
 /// </summary>
 public void FileScan()
 {
     VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*" };
     dialog.ShowDialog();
     this.StartScan(dialog.FileName, 0);
 }
예제 #22
0
        private void OpenAFXFolderMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var ofd = new VistaOpenFileDialog
            {
                Filter = "ReShade.fx|Reshade.fx"
            };

            if (ofd.ShowDialog() == true)
            {
                string fxpath = ofd.FileName;
                Items = ItemProvider.GetItems(Path.GetDirectoryName(fxpath));

                // Reset the datacontext
                DataContext = null;
                DataContext = Items;
            }
        }
예제 #23
0
 /// <summary>
 /// Browse - Send File To
 /// </summary>
 public void BrowseSendFileTo()
 {
     VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*", FileName = this.sendFileToPath };
     bool? dialogResult = dialog.ShowDialog();
     if (dialogResult.HasValue && dialogResult.Value)
     {
         this.SendFileTo = Path.GetFileNameWithoutExtension(dialog.FileName);
         this.sendFileToPath = dialog.FileName;
     }
 }
예제 #24
0
		private void ExecutedOpenStrategy(object sender, ExecutedRoutedEventArgs e)
		{
			var dlg = new VistaOpenFileDialog
			{
				Filter = "{0} (.xml)|*.xml".Put(LocalizedStrings.Str1355),
				CheckFileExists = true,
				RestoreDirectory = true
			};

			if (dlg.ShowDialog(this) != true)
				return;

			UnloadStrategy();
			
			if (!LoadStrategy(dlg.FileName))
				return;

			_settings.SetValue("StrategyFile", dlg.FileName);

		}
예제 #25
0
        /// <summary>
        /// Import a Preset
        /// </summary>
        public void PresetImport()
        {
            VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "Plist (*.plist)|*.plist", CheckFileExists = true };
            dialog.ShowDialog();
            string filename = dialog.FileName;

            if (!string.IsNullOrEmpty(filename))
            {
                EncodeTask parsed = PlistPresetHandler.Import(filename);
                if (this.presetService.CheckIfPresetExists(parsed.PresetName))
                {
                    if (!presetService.CanUpdatePreset(parsed.PresetName))
                    {
                        MessageBox.Show(
                            "You can not import a preset with the same name as a built-in preset.",
                            "Error",
                            MessageBoxButton.OK,
                            MessageBoxImage.Error);
                        return;
                    }

                    MessageBoxResult result =
                        MessageBox.Show(
                            "This preset appears to already exist. Would you like to overwrite it?",
                            "Overwrite preset?",
                            MessageBoxButton.YesNo,
                            MessageBoxImage.Warning);
                    if (result == MessageBoxResult.Yes)
                    {
                        Preset preset = new Preset { Name = parsed.PresetName, CropSettings = parsed.UsesPictureSettings, Task = parsed };

                        presetService.Update(preset);
                    }
                }
                else
                {
                    Preset preset = new Preset { Name = parsed.PresetName, Task = parsed, CropSettings = parsed.UsesPictureSettings, };
                    presetService.Add(preset);
                }

                this.NotifyOfPropertyChange("Presets");
            }
        }
예제 #26
0
 /// <summary>
 /// Browse VLC Path
 /// </summary>
 public void BrowseVlcPath()
 {
     VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.exe)|*.exe", FileName = this.VLCPath };
     bool? dialogResult = dialog.ShowDialog();
     if (dialogResult.HasValue && dialogResult.Value)
     {
         this.VLCPath = dialog.FileName;
     }
 }
예제 #27
0
 private void SelectFiles()
 {
     var dialog = new VistaOpenFileDialog
     {
         Multiselect = true,
         Filter = @"JPEG files (*.jpg)|*.jpg|All files (*.*)|*.*"
     };
     if (dialog.ShowDialog() == true)
     {
         AllFiles = new ObservableCollection<FileWrapper>(dialog.FileNames.Select(s => new FileWrapper { FullName = s }));
     }
 }
예제 #28
0
        /// <summary>
        /// Import a Preset
        /// </summary>
        public void PresetImport()
        {
            VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "Plist (*.plist)|*.plist", CheckFileExists = true };
            dialog.ShowDialog();
            string filename = dialog.FileName;

            if (!string.IsNullOrEmpty(filename))
            {
                Preset preset = PlistUtility.Import(filename);
                if (this.presetService.CheckIfPresetExists(preset.Name))
                {
                    if (!presetService.CanUpdatePreset(preset.Name))
                    {
                        MessageBox.Show(
                            "You can not import a preset with the same name as a built-in preset.",
                            "Error",
                            MessageBoxButton.OK,
                            MessageBoxImage.Error);
                        return;
                    }

                    MessageBoxResult result =
                        MessageBox.Show(
                            "This preset appears to already exist. Would you like to overwrite it?",
                            "Overwrite preset?",
                            MessageBoxButton.YesNo,
                            MessageBoxImage.Warning);
                    if (result == MessageBoxResult.Yes)
                    {
                        presetService.Update(preset);
                    }
                }
                else
                {
                    presetService.Add(preset);
                }

                this.NotifyOfPropertyChange(() => this.Presets);
            }
        }
예제 #29
0
		private void CertificateButtonClick(object sender, RoutedEventArgs e)
		{
			var dialog = new VistaOpenFileDialog
			{
				Filter = @"Certificates files (*.pk12)|*.pk12|All files (*.*)|*.*",
				CheckFileExists = true,
				Multiselect = false,
			};

			if (dialog.ShowDialog(this) != true)
				return;

			Properties.Settings.Default.CertFile = dialog.FileName;
		}
예제 #30
0
        /// <summary>
        /// File Scan
        /// </summary>
        public void FileScanTitleSpecific()
        {
            VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*" };
            dialog.ShowDialog();

            if (string.IsNullOrEmpty(dialog.FileName))
            {
                return;
            }

            ITitleSpecificViewModel titleSpecificView = IoC.Get<ITitleSpecificViewModel>();
            this.WindowManager.ShowDialog(titleSpecificView);

            if (titleSpecificView.SelectedTitle.HasValue)
            {
                this.StartScan(dialog.FileName, titleSpecificView.SelectedTitle.Value);
            }
        }
예제 #31
0
        /// <summary>
        /// Open file dialog so user can locate episode in file directory.
        /// </summary>
        /// <param name="showActionModifer">Whether to display action modifier after path is selected</param>
        /// <param name="copyAction">Whether to copy file, move otherwise</param>
        /// <param name="items">Organization items to add move/copy action to once located</param>
        /// <returns>true if locate was sucessful</returns>
        public bool UserLocate(bool showActionModifer, bool copyAction, out List<OrgItem> items)
        {
            // Initialize org items
            items = new List<OrgItem>();

            // Open file dialog
            VistaOpenFileDialog ofd = new VistaOpenFileDialog();
            ofd.Filter = "All Files|*.*";
            if (!(bool)ofd.ShowDialog())
                return false;

            // Try to get episode information from file
            int fileEpSeason, fileEpNumber1, fileEpNumber2;
            bool fileInfoFound = FileHelper.GetEpisodeInfo(ofd.FileName, this.Show.DatabaseName, out fileEpSeason, out fileEpNumber1, out fileEpNumber2);

            // Assign episodes
            TvEpisode ep1 = this;
            TvEpisode ep2 = null;

            // Locate could be for double episode file, only taken if one of the episode from file matches selected
            if (fileInfoFound && fileEpSeason == this.Season)
            {
                if (fileEpNumber1 == this.DisplayNumber)
                {
                    if (fileEpNumber2 > 0)
                        show.FindEpisode(ep1.Season, fileEpNumber2, false, out ep2);
                    else
                        ep2 = null;
                }
                else if (fileEpNumber2 == this.DisplayNumber)
                {
                    if (fileEpNumber1 > 0 && show.FindEpisode(this.Season, fileEpNumber1, false, out ep1))
                        ep2 = this;
                    else
                        ep1 = this;
                }
            }

            // Build org item
            OrgAction action = copyAction ? OrgAction.Copy : OrgAction.Move;
            string destination = show.BuildFilePath(ep1, ep2, Path.GetExtension(ofd.FileName));
            OrgItem item = new OrgItem(OrgStatus.Found, action, ofd.FileName, destination, ep1, ep2, FileCategory.TvVideo, null);

            // Display modifier
            if (showActionModifer)
            {
                OrgItemEditorWindow editor = new OrgItemEditorWindow(item);
                editor.ShowDialog();

                // Add results if valid
                if (editor.Results == null)
                    return false;

                items.Add(editor.Results);
                return true;
            }

            items.Add(item);
            return true;
        }