コード例 #1
0
        public void BrowseApplicationExecuted()
        {
            var startPath = GameApplicationPath;

            if (string.IsNullOrEmpty(startPath))
            {
                startPath = ToolboxUpdater.GetSteamFilePath();
                if (!string.IsNullOrEmpty(startPath))
                {
                    startPath = Path.Combine(startPath, @"SteamApps\common");
                }
            }

            IsValidApplication = false;
            IsWrongApplication = false;

            var openFileDialog = _openFileDialogFactory();

            openFileDialog.CheckFileExists  = true;
            openFileDialog.CheckPathExists  = true;
            openFileDialog.DefaultExt       = "exe";
            openFileDialog.FileName         = "SpaceEngineers";
            openFileDialog.Filter           = Res.DialogLocateApplicationFilter;
            openFileDialog.InitialDirectory = startPath;
            openFileDialog.Multiselect      = false;
            openFileDialog.Title            = Res.DialogLocateApplicationTitle;

            // Open the dialog
            if (_dialogService.ShowOpenFileDialog(this, openFileDialog) == DialogResult.OK)
            {
                GameApplicationPath = openFileDialog.FileName;
            }
        }
コード例 #2
0
        public void BrowseAppPathExecuted()
        {
            var startPath = SEBinPath;

            if (string.IsNullOrEmpty(startPath))
            {
                startPath = ToolboxUpdater.GetSteamFilePath();
                if (!string.IsNullOrEmpty(startPath))
                {
                    startPath = Path.Combine(startPath, @"SteamApps\common");
                }
            }

            var openFileDialog = _openFileDialogFactory();

            openFileDialog.CheckFileExists  = true;
            openFileDialog.CheckPathExists  = true;
            openFileDialog.DefaultExt       = "exe";
            openFileDialog.FileName         = "SpaceEngineers";
            openFileDialog.Filter           = Res.DialogLocateApplicationFilter;
            openFileDialog.InitialDirectory = startPath;
            openFileDialog.Multiselect      = false;
            openFileDialog.Title            = Res.DialogLocateApplicationTitle;

            // Open the dialog
            if (_dialogService.ShowOpenFileDialog(this, openFileDialog) == DialogResult.OK)
            {
                var gameBinPath = openFileDialog.FileName;

                if (!string.IsNullOrEmpty(gameBinPath))
                {
                    try
                    {
                        var fullPath = Path.GetFullPath(gameBinPath);
                        if (File.Exists(fullPath))
                        {
                            gameBinPath = Path.GetDirectoryName(fullPath);
                        }
                    }
                    catch { }
                }

                SEBinPath = gameBinPath;
            }
        }