mirror of
https://github.com/EpicMorg/UniversalValveToolbox.git
synced 2025-01-12 22:58:08 +03:00
1.0.0.3
Pre-release
This commit is contained in:
parent
9f02064ee2
commit
416a6fa3c4
17
README.md
17
README.md
@ -1,7 +1,18 @@
|
||||
# UniversalValveToolbox
|
||||
# Universal Valve Toolbox
|
||||
|
||||
# [![AppVeyor](https://img.shields.io/appveyor/ci/stamepicmorg/universalvalvetoolbox?style=flat-square)](https://ci.appveyor.com/project/stamepicmorg/universalvalvetoolbox) [![Translation status](https://translate.epicm.org/widgets/universalvalvetoolbox/-/svg-badge.svg)](https://translate.epicm.org/engage/universalvalvetoolbox/?utm_source=widget) [![Size](https://img.shields.io/github/repo-size/EpicMorg/UniversalValveToolbox?label=size&style=flat-square)](https://github.com/EpicMorg/UniversalValveToolbox/archive/master.zip) [![Release](https://img.shields.io/github/v/release/EpicMorg/UniversalValveToolbox?style=flat-square)](https://github.com/EpicMorg/UniversalValveToolbox/releases) [![GitHub license](https://img.shields.io/github/license/EpicMorg/UniversalValveToolbox.svg?style=popout-square)](LICENSE.md) [![Changelog](https://img.shields.io/badge/Changelog-yellow.svg?style=popout-square)](CHANGELOG.md) [![Activity](https://img.shields.io/github/commit-activity/w/EpicMorg/UniversalValveToolbox?&style=flat-square)](https://github.com/EpicMorg/UniversalValveToolbox/commits) [![GitHub issues](https://img.shields.io/github/issues/EpicMorg/UniversalValveToolbox.svg?style=popout-square)](https://github.com/EpicMorg/UniversalValveToolbox/issues) [![GitHub forks](https://img.shields.io/github/forks/EpicMorg/UniversalValveToolbox.svg?style=popout-square)](https://github.com/EpicMorg/UniversalValveToolbox/network) [![GitHub stars](https://img.shields.io/github/stars/EpicMorg/UniversalValveToolbox.svg?style=popout-square)](https://github.com/EpicMorg/UniversalValveToolbox/stargazers) [![GitHub uses](https://img.shields.io/sourcegraph/rrc/github.com/EpicMorg/UniversalValveToolbox?style=flat-square)](https://github.com/EpicMorg/UniversalValveToolbox/pulse) [![CodeScene Code Health](https://codescene.io/projects/6852/status-badges/code-health)](https://codescene.io/projects/6852) [![CodeScene System Mastery](https://codescene.io/projects/6852/status-badges/system-mastery)](https://codescene.io/projects/6852)
|
||||
|
||||
[![](https://codescene.io/projects/6852/status.svg)](https://codescene.io/projects/6852/jobs/latest-successful/results)
|
||||
|
||||
# Description
|
||||
Toolbox for easy launching some officials Valve's SDK such as Source SDK 2013 SP or MP.
|
||||
|
||||
# Settings
|
||||
Mod could be changed at `settings.json` with `ToolboxMod` section. Supported mods: `retail`, `bundle`, `dev`.
|
||||
## Retail
|
||||
This is default mode. Shows all avalible users games at account. Tool launched with default steam app id `480` for requesting steam api and getting info.
|
||||
|
||||
## Bundle mode
|
||||
If you want to distribute this tollbox with your game - edit `settings.json` and switch `ToolboxMod` to `bundle` value. And change `ToolsAppId` and `BundleAppID` for your's `SteamApp` of you game and sdk tools.
|
||||
## Dev mode
|
||||
Dev mode is the same mode as `bundle` but local path of root of your game folder and angine name will be get from `DevEnginePath` and `DevEngineName` values. Also You should set `ToolsAppId` and `BundleAppID` for your's `SteamApp` of you game and sdk tools.
|
||||
|
||||
[![](https://codescene.io/projects/6852/status.svg)](https://codescene.io/projects/6852/jobs/latest-successful/results)
|
||||
|
@ -1,10 +1,18 @@
|
||||
using UniversalValveToolbox.Base;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using UniversalValveToolbox.Base;
|
||||
|
||||
namespace UniversalValveToolbox.Model.Dto {
|
||||
public class SettingsDtoModel : DtoModel {
|
||||
private string lastSelectedProject;
|
||||
private string[] availableLanguages;
|
||||
private string language;
|
||||
private string devenginepath = "C://";
|
||||
private string devenginename = "My Future Game (engine)";
|
||||
private ToolboxMod toolboxmod = ToolboxMod.retail;
|
||||
private uint toolsappid = 480;
|
||||
private uint bundleappsid = 480;
|
||||
|
||||
|
||||
public string LastSelectedProject {
|
||||
get => lastSelectedProject;
|
||||
@ -20,5 +28,35 @@ namespace UniversalValveToolbox.Model.Dto {
|
||||
get => language;
|
||||
set => UpdateField(value, ref language);
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ToolboxMod ToolboxMod
|
||||
{
|
||||
get => toolboxmod;
|
||||
set => UpdateField(value, ref toolboxmod);
|
||||
}
|
||||
public uint ToolsAppId
|
||||
{
|
||||
get => toolsappid;
|
||||
set => UpdateField(value, ref toolsappid);
|
||||
}
|
||||
public uint BundleAppID
|
||||
{
|
||||
get => bundleappsid;
|
||||
set => UpdateField(value, ref bundleappsid);
|
||||
}
|
||||
public string DevEnginePath
|
||||
{
|
||||
get => devenginepath;
|
||||
set => UpdateField(value, ref devenginepath);
|
||||
}
|
||||
public string DevEngineName
|
||||
{
|
||||
get => devenginename;
|
||||
set => UpdateField(value, ref devenginename);
|
||||
}
|
||||
}
|
||||
public enum ToolboxMod {
|
||||
retail, bundle, dev
|
||||
}
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ namespace UniversalValveToolbox {
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main() {
|
||||
SteamClient.Init(480);
|
||||
|
||||
var dataProvide = new DataProvider();
|
||||
var currSettings = dataProvide.Settings;
|
||||
|
||||
LanguageManager.UpdateLanguage(currSettings.Language);
|
||||
|
||||
SteamClient.Init(currSettings.ToolsAppId);
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FormMain());
|
||||
|
@ -12,8 +12,10 @@ using UniversalValveToolbox.Model.Provider;
|
||||
using UniversalValveToolbox.Model.ViewModel;
|
||||
using UniversalValveToolbox.Utils;
|
||||
|
||||
namespace UniversalValveToolbox {
|
||||
public partial class FormMain : Form {
|
||||
namespace UniversalValveToolbox
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
private readonly string RUN_PROJECT_ID = "RUN_PROJECT_ID";
|
||||
|
||||
private EngineDtoModel[] Engines;
|
||||
@ -25,21 +27,25 @@ namespace UniversalValveToolbox {
|
||||
private ListViewGroup listViewGroupAddons;
|
||||
private ListViewGroup listViewGroupTools;
|
||||
|
||||
private EngineDtoModel SelectedEngine {
|
||||
get {
|
||||
private EngineDtoModel SelectedEngine
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Engines.Length == 0)
|
||||
return null;
|
||||
|
||||
return Engines[comboBoxEngine.SelectedIndex];
|
||||
}
|
||||
}
|
||||
private ProjectDtoModel SelectedProject {
|
||||
private ProjectDtoModel SelectedProject
|
||||
{
|
||||
get => (ProjectDtoModel)((comboBoxProjects.Enabled)
|
||||
? Projects.First(project => project.Name.Equals(comboBoxProjects.SelectedItem))
|
||||
: null);
|
||||
}
|
||||
|
||||
public FormMain() {
|
||||
public FormMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
FillBaseMenuItems();
|
||||
|
||||
@ -47,21 +53,25 @@ namespace UniversalValveToolbox {
|
||||
|
||||
Text = VersionHelper.AssemblyTitle + VersionHelper.AssemblyVersion;
|
||||
|
||||
comboBoxEngine.SelectedIndexChanged += (s, e) => {
|
||||
comboBoxEngine.SelectedIndexChanged += (s, e) =>
|
||||
{
|
||||
UpdateProjectList();
|
||||
UpdateToolsList();
|
||||
UpdateAddonsList();
|
||||
};
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e) {
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void UpdateLastSelectedProject() {
|
||||
private void UpdateLastSelectedProject()
|
||||
{
|
||||
var lastSelectedProject = dataProvider.Projects.FirstOrDefault(project => project.Name.Equals(dataProvider.Settings.LastSelectedProject));
|
||||
|
||||
if (lastSelectedProject != null && Engines.Length != 0) {
|
||||
if (lastSelectedProject != null && Engines.Length != 0)
|
||||
{
|
||||
var indexEngine = comboBoxEngine.Items.IndexOf(Engines.First(engine => engine.Appid.Equals(lastSelectedProject.Engine)).Name);
|
||||
comboBoxEngine.SelectedIndex = indexEngine;
|
||||
|
||||
@ -75,14 +85,16 @@ namespace UniversalValveToolbox {
|
||||
EnvUtils.PrepareSFMData($"{SelectedProject?.Path ?? string.Empty}");
|
||||
}
|
||||
}
|
||||
private void SaveLastSelectedProject() {
|
||||
private void SaveLastSelectedProject()
|
||||
{
|
||||
var settings = dataProvider.Settings;
|
||||
settings.LastSelectedProject = SelectedProject?.Name;
|
||||
dataProvider.Settings = settings;
|
||||
}
|
||||
|
||||
|
||||
private void UpdateFormData() {
|
||||
private void UpdateFormData()
|
||||
{
|
||||
UpdateEngineList();
|
||||
UpdateProjectList();
|
||||
UpdateToolsList();
|
||||
@ -92,16 +104,19 @@ namespace UniversalValveToolbox {
|
||||
UpdateLastSelectedProject();
|
||||
}
|
||||
|
||||
private void UpdateNavigationBar() {
|
||||
private void UpdateNavigationBar()
|
||||
{
|
||||
UpdateLogInStatus();
|
||||
UpdateInfoNavigationBar();
|
||||
}
|
||||
|
||||
private void toolStripStatusLabelRefresh_Click(object sender, EventArgs e) {
|
||||
private void toolStripStatusLabelRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateFormData();
|
||||
}
|
||||
|
||||
public void FillBaseMenuItems() {
|
||||
public void FillBaseMenuItems()
|
||||
{
|
||||
#region static content, do not edit
|
||||
//creating groups (categores)
|
||||
listViewGroupAddons = new ListViewGroup(Properties.translations.MenuCategories.catAddons);
|
||||
@ -164,14 +179,15 @@ namespace UniversalValveToolbox {
|
||||
});
|
||||
}
|
||||
|
||||
private void UpdateEngineList() {
|
||||
var dataProvider = new DataProvider();
|
||||
Engines = dataProvider.Engines.Where(engine => {
|
||||
var isInstall = SteamApps.IsAppInstalled(engine.Appid);
|
||||
return isInstall;
|
||||
}).ToArray();
|
||||
private void UpdateEngineList()
|
||||
{
|
||||
|
||||
if (Engines != null && Engines.Length != 0) {
|
||||
|
||||
|
||||
GetAvailableEngines();
|
||||
|
||||
if (Engines != null && Engines.Length != 0)
|
||||
{
|
||||
comboBoxEngine.Enabled = true;
|
||||
comboBoxEngine.Items.Clear();
|
||||
comboBoxEngine.Items.AddRange(Engines.Select(engine => engine.Name).ToArray());
|
||||
@ -180,8 +196,35 @@ namespace UniversalValveToolbox {
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateProjectList() {
|
||||
if (Engines.Length == 0) {
|
||||
private void GetAvailableEngines()
|
||||
{
|
||||
var dataProvider = new DataProvider();
|
||||
if (dataProvider.Settings.ToolboxMod == ToolboxMod.dev)
|
||||
{
|
||||
EngineDtoModel engineValues = dataProvider.Engines.Single(engine => engine.Appid == dataProvider.Settings.BundleAppID);
|
||||
Engines = new[] {
|
||||
new EngineDtoModel {
|
||||
Appid = (int)dataProvider.Settings.BundleAppID,
|
||||
Name = dataProvider.Settings.DevEngineName,
|
||||
Bin = engineValues.Bin,
|
||||
Tools = engineValues.Tools
|
||||
}
|
||||
};
|
||||
}
|
||||
else {
|
||||
Engines = dataProvider.Engines.Where(engine => dataProvider.Settings.ToolboxMod switch
|
||||
{
|
||||
ToolboxMod.retail => SteamApps.IsAppInstalled(engine.Appid),
|
||||
ToolboxMod.bundle => engine.Appid == dataProvider.Settings.BundleAppID,
|
||||
_ => throw new Exception($"Unrecognised toolbox mode: {dataProvider.Settings.ToolboxMod}")
|
||||
}).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateProjectList()
|
||||
{
|
||||
if (Engines.Length == 0)
|
||||
{
|
||||
comboBoxProjects.Enabled = false;
|
||||
|
||||
comboBoxProjects.Items.Clear();
|
||||
@ -194,7 +237,8 @@ namespace UniversalValveToolbox {
|
||||
var selectEngine = Engines[comboBoxEngine.SelectedIndex];
|
||||
AvailableProjects = Projects.Where(project => project.Engine == selectEngine.Appid).ToArray();
|
||||
|
||||
if (AvailableProjects != null && AvailableProjects.Length != 0) {
|
||||
if (AvailableProjects != null && AvailableProjects.Length != 0)
|
||||
{
|
||||
comboBoxProjects.Enabled = true;
|
||||
|
||||
comboBoxProjects.Items.Clear();
|
||||
@ -202,17 +246,20 @@ namespace UniversalValveToolbox {
|
||||
|
||||
comboBoxProjects.SelectedIndex = 0;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
comboBoxProjects.Enabled = false;
|
||||
|
||||
comboBoxProjects.Items.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateToolsList() {
|
||||
private void UpdateToolsList()
|
||||
{
|
||||
var removeItem = new List<ListViewItem>();
|
||||
|
||||
foreach (ListViewItem item in listViewGroupTools.Items) {
|
||||
foreach (ListViewItem item in listViewGroupTools.Items)
|
||||
{
|
||||
removeItem.Add(item);
|
||||
}
|
||||
|
||||
@ -221,19 +268,30 @@ namespace UniversalValveToolbox {
|
||||
if (SelectedEngine == null)
|
||||
return;
|
||||
|
||||
var pathSelectedEngine = SteamApps.AppInstallDir(SelectedEngine.Appid);
|
||||
var dataProvider = new DataProvider();
|
||||
|
||||
if (pathSelectedEngine != null) {
|
||||
var pathSelectedEngine = dataProvider.Settings.ToolboxMod switch
|
||||
{
|
||||
ToolboxMod.retail => SteamApps.AppInstallDir(SelectedEngine.Appid),
|
||||
ToolboxMod.bundle => SteamApps.AppInstallDir(dataProvider.Settings.BundleAppID),
|
||||
ToolboxMod.dev => dataProvider.Settings.DevEnginePath,
|
||||
_ => throw new Exception($"Unrecognised engine type: {dataProvider.Settings.ToolboxMod}")
|
||||
};
|
||||
|
||||
if (pathSelectedEngine != null)
|
||||
{
|
||||
var pairPathIconTools = SelectedEngine.Tools
|
||||
.Where(tool => File.Exists(Path.Combine(pathSelectedEngine, tool.Bin)))
|
||||
.Select(tool => {
|
||||
.Select(tool =>
|
||||
{
|
||||
var keyByPath = Path.Combine(pathSelectedEngine, tool.Bin);
|
||||
var icon = Icon.ExtractAssociatedIcon(Path.Combine(pathSelectedEngine, tool.Bin));
|
||||
|
||||
return new Pair(keyByPath, icon);
|
||||
});
|
||||
|
||||
foreach (var pair in pairPathIconTools) {
|
||||
foreach (var pair in pairPathIconTools)
|
||||
{
|
||||
listView.SmallImageList.Images.Add((string)pair.First, (Icon)pair.Second);
|
||||
listView.LargeImageList.Images.Add((string)pair.First, (Icon)pair.Second);
|
||||
}
|
||||
@ -242,16 +300,19 @@ namespace UniversalValveToolbox {
|
||||
var itemsTools = SelectedEngine.Tools
|
||||
.Where(tool => File.Exists(Path.Combine(pathSelectedEngine, tool.Bin)))
|
||||
|
||||
.Select(tool => {
|
||||
.Select(tool =>
|
||||
{
|
||||
string keyByPath = null;
|
||||
|
||||
if (pathSelectedEngine != null)
|
||||
keyByPath = Path.Combine(pathSelectedEngine, tool.Bin);
|
||||
|
||||
if (keyByPath == null) {
|
||||
if (keyByPath == null)
|
||||
{
|
||||
return new ListViewItem(tool.Name, listViewGroupTools);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return new ListViewItem(tool.Name, keyByPath, listViewGroupTools);
|
||||
}
|
||||
|
||||
@ -259,10 +320,18 @@ namespace UniversalValveToolbox {
|
||||
listView.Items.AddRange(itemsTools);
|
||||
|
||||
|
||||
var enginePath = SteamApps.AppInstallDir(SelectedEngine.Appid);
|
||||
var enginePath = dataProvider.Settings.ToolboxMod switch
|
||||
{
|
||||
ToolboxMod.retail => SteamApps.AppInstallDir(SelectedEngine.Appid),
|
||||
ToolboxMod.bundle => SteamApps.AppInstallDir(dataProvider.Settings.BundleAppID),
|
||||
ToolboxMod.dev => dataProvider.Settings.DevEnginePath,
|
||||
_ => throw new Exception($"Unrecognised engine type: {dataProvider.Settings.ToolboxMod}")
|
||||
};
|
||||
|
||||
var isAvailableProjectBySelectEngine = Projects.Any(project => project.Engine == SelectedEngine.Appid);
|
||||
|
||||
if (enginePath != null && isAvailableProjectBySelectEngine) {
|
||||
if (enginePath != null && isAvailableProjectBySelectEngine)
|
||||
{
|
||||
var iconPathEngine = Path.Combine(enginePath, SelectedEngine.Bin);
|
||||
|
||||
var runProjectListViewItem = new ListViewItem(Properties.translations.MenuItems.itmRunProject, iconPathEngine, listViewGroupTools);
|
||||
@ -272,10 +341,12 @@ namespace UniversalValveToolbox {
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAddonsList() {
|
||||
private void UpdateAddonsList()
|
||||
{
|
||||
var removeItem = new List<ListViewItem>();
|
||||
|
||||
foreach (ListViewItem item in listViewGroupAddons.Items) {
|
||||
foreach (ListViewItem item in listViewGroupAddons.Items)
|
||||
{
|
||||
removeItem.Add(item);
|
||||
}
|
||||
|
||||
@ -289,34 +360,40 @@ namespace UniversalValveToolbox {
|
||||
|
||||
|
||||
var pairPathIconTools = addonsSelectedEngine
|
||||
.Where(addon => {
|
||||
.Where(addon =>
|
||||
{
|
||||
var path = addon.Bin;
|
||||
|
||||
return File.Exists(path);
|
||||
|
||||
})
|
||||
.Select(addons => {
|
||||
.Select(addons =>
|
||||
{
|
||||
var keyByPath = addons.Bin;
|
||||
var icon = Icon.ExtractAssociatedIcon(keyByPath);
|
||||
|
||||
return new Pair(keyByPath, icon);
|
||||
});
|
||||
|
||||
foreach (var pair in pairPathIconTools) {
|
||||
foreach (var pair in pairPathIconTools)
|
||||
{
|
||||
listView.SmallImageList.Images.Add((string)pair.First, (Icon)pair.Second);
|
||||
listView.LargeImageList.Images.Add((string)pair.First, (Icon)pair.Second);
|
||||
}
|
||||
|
||||
var itemsAddons = addonsSelectedEngine.Select(addons => {
|
||||
var itemsAddons = addonsSelectedEngine.Select(addons =>
|
||||
{
|
||||
string keyByPath = null;
|
||||
|
||||
if (pathSelectedEngine != null)
|
||||
keyByPath = Path.Combine(pathSelectedEngine, addons.Bin);
|
||||
|
||||
if (keyByPath == null) {
|
||||
if (keyByPath == null)
|
||||
{
|
||||
return new ListViewItem(addons.Name, listViewGroupAddons);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return new ListViewItem(addons.Name, keyByPath, listViewGroupAddons);
|
||||
}
|
||||
|
||||
@ -325,7 +402,8 @@ namespace UniversalValveToolbox {
|
||||
listView.Items.AddRange(itemsAddons);
|
||||
}
|
||||
|
||||
private void UpdateInfoNavigationBar() {
|
||||
private void UpdateInfoNavigationBar()
|
||||
{
|
||||
var countAvailableEngines = Engines.Length;
|
||||
var countAvailableProjects = dataProvider.Projects.Length;
|
||||
var countAvailableAddons = dataProvider.Addons.Length;
|
||||
@ -334,41 +412,50 @@ namespace UniversalValveToolbox {
|
||||
toolStripStatusLabelAddons.Text = Properties.translations.MenuNavbar.menuStrAddons + $"{countAvailableAddons}";
|
||||
}
|
||||
|
||||
private void UpdateLogInStatus() {
|
||||
private void UpdateLogInStatus()
|
||||
{
|
||||
var steamData = SteamManager.SteamData;
|
||||
|
||||
if (steamData.SteamPid != 0) {
|
||||
if (steamData.SteamPid != 0)
|
||||
{
|
||||
toolStripStatusLabelSteam.Image = Properties.Resources.checked_16;
|
||||
toolStripStatusLabelSteam.Text = Properties.translations.MenuNavbar.menuStrSteam + Properties.translations.MenuNavbar.menuStrOnline;
|
||||
toolStripStatusLabelSteam.ToolTipText = Properties.translations.MenuNavbar.menuStrSteam + $"PID: {steamData.SteamPid.ToString()}";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
toolStripStatusLabelSteam.Image = Properties.Resources.cancel_16;
|
||||
toolStripStatusLabelSteam.ToolTipText = string.Empty;
|
||||
toolStripStatusLabelSteam.Text = Properties.translations.MenuNavbar.menuStrSteam + Properties.translations.MenuNavbar.menuStrOffline;
|
||||
}
|
||||
|
||||
if (steamData.UserNameSteam != null) {
|
||||
if (steamData.UserNameSteam != null)
|
||||
{
|
||||
toolStripStatusLabelLogin.Text = Properties.translations.MenuNavbar.menuStrLogin + $"{steamData.UserNameSteam}";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
toolStripStatusLabelLogin.Text = Properties.translations.MenuNavbar.menuStrLogin + Properties.translations.MenuNavbar.menuStrNone;
|
||||
}
|
||||
}
|
||||
|
||||
private void button_Launch_Click(object sender, EventArgs e) {
|
||||
private void button_Launch_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.OpenSettings();
|
||||
}
|
||||
|
||||
private void listView_MouseDoubleClick(object sender, MouseEventArgs e) {
|
||||
private void listView_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
var selectItem = listView.SelectedItems[0];
|
||||
|
||||
var selectItemText = selectItem.Text;
|
||||
EnvUtils.PrepareVProject($"{SelectedProject?.Path ?? string.Empty}");
|
||||
EnvUtils.PrepareSFMData($"{SelectedProject?.Path ?? string.Empty}");
|
||||
|
||||
if (selectItem.Group == listViewGroupTools) {
|
||||
if (RUN_PROJECT_ID.Equals(selectItem.Tag) && SelectedProject != null) {
|
||||
if (selectItem.Group == listViewGroupTools)
|
||||
{
|
||||
if (RUN_PROJECT_ID.Equals(selectItem.Tag) && SelectedProject != null)
|
||||
{
|
||||
var pathEngineBin = Path.Combine(SteamApps.AppInstallDir(SelectedEngine.Appid), SelectedEngine.Bin);
|
||||
|
||||
|
||||
@ -376,47 +463,57 @@ namespace UniversalValveToolbox {
|
||||
}
|
||||
|
||||
var selectedTool = SelectedEngine.Tools.FirstOrDefault(tool => tool.Name == selectItemText);
|
||||
if (selectedTool != null) {
|
||||
var selectedEnginePath = SteamApps.AppInstallDir(SelectedEngine.Appid);
|
||||
if (selectedTool != null)
|
||||
{
|
||||
// var selectedEnginePath = SteamApps.AppInstallDir(SelectedEngine.Appid);
|
||||
|
||||
if (selectedEnginePath != null) {
|
||||
var selectedEnginePath = dataProvider.Settings.ToolboxMod switch
|
||||
{
|
||||
ToolboxMod.retail => SteamApps.AppInstallDir(SelectedEngine.Appid),
|
||||
ToolboxMod.bundle => SteamApps.AppInstallDir(dataProvider.Settings.BundleAppID),
|
||||
ToolboxMod.dev => dataProvider.Settings.DevEnginePath,
|
||||
_ => throw new Exception($"Unrecognised engine type: {dataProvider.Settings.ToolboxMod}")
|
||||
};
|
||||
|
||||
|
||||
if (selectedEnginePath != null)
|
||||
{
|
||||
var toolPath = Path.Combine(selectedEnginePath, selectedTool.Bin);
|
||||
|
||||
if (File.Exists(toolPath)) {
|
||||
if (File.Exists(toolPath))
|
||||
{
|
||||
string finalArg = $"-steam {selectedTool.Args}";
|
||||
|
||||
if (!finalArg.Contains("-game")) {
|
||||
if (!finalArg.Contains("-game"))
|
||||
{
|
||||
finalArg += $" -game \"{SelectedProject?.Path ?? string.Empty}\" ";
|
||||
}
|
||||
Process.Start(toolPath, finalArg);
|
||||
// SteamClient.Shutdown();
|
||||
// SteamClient.Init(Convert.ToUInt32(SelectedEngine.Appid));
|
||||
// var process = Process.Start(toolPath, finalArg);
|
||||
// process.EnableRaisingEvents = true;
|
||||
// process.Exited += (a, b) => {
|
||||
// SteamClient.Shutdown();
|
||||
// SteamClient.Init(480);
|
||||
// };
|
||||
|
||||
}
|
||||
else
|
||||
MessageBox.Show($"\"{selectedTool.Name}\" {Properties.translations.MessageBoxes.msgTextNotFound}\n{toolPath}", Properties.translations.MessageBoxes.msgWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show($"\"{SelectedEngine.Name}\" {Properties.translations.MessageBoxes.msgTextWithAppID} \"{SelectedEngine.Appid}\" {Properties.translations.MessageBoxes.msgTextNotInstalledInstall}", Properties.translations.MessageBoxes.msgWarning, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes) {
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Process.Start($"steam://install/{SelectedEngine.Appid}");
|
||||
}
|
||||
else if (dialogResult == DialogResult.No) {
|
||||
else if (dialogResult == DialogResult.No)
|
||||
{
|
||||
MessageBox.Show($"{Properties.translations.MessageBoxes.msgTextInstallationOf} \"{SelectedEngine.Name}\" {Properties.translations.MessageBoxes.msgTextWithAppID} \"{SelectedEngine.Appid}\" {Properties.translations.MessageBoxes.msgTextCancelled}", Properties.translations.MessageBoxes.msgInfo, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (selectItem.Group == listViewGroupAddons) {
|
||||
else if (selectItem.Group == listViewGroupAddons)
|
||||
{
|
||||
var selectedAddons = dataProvider.Addons.FirstOrDefault(addon => addon.Name == selectItemText);
|
||||
if (selectedAddons != null) {
|
||||
if (selectedAddons != null)
|
||||
{
|
||||
var addonPath = Path.Combine(selectedAddons.Bin);
|
||||
|
||||
if (File.Exists(addonPath))
|
||||
@ -427,34 +524,43 @@ namespace UniversalValveToolbox {
|
||||
}
|
||||
}
|
||||
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmOpenSettings) {
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmOpenSettings)
|
||||
{
|
||||
this.OpenSettings();
|
||||
}
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmEditConfigurations) {
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmEditConfigurations)
|
||||
{
|
||||
var frmProfiles = new FormProjects();
|
||||
if (frmProfiles.ShowDialog() == DialogResult.OK) {
|
||||
if (frmProfiles.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
UpdateFormData();
|
||||
}
|
||||
}
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmEditPlugins) {
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmEditPlugins)
|
||||
{
|
||||
var frmPlugins = new FormAddons();
|
||||
if (frmPlugins.ShowDialog() == DialogResult.OK) {
|
||||
if (frmPlugins.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
UpdateFormData();
|
||||
}
|
||||
}
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmAbout) {
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmAbout)
|
||||
{
|
||||
var frmAbout = new FormAbout();
|
||||
frmAbout.ShowDialog();
|
||||
}
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmGitHubLink) {
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmGitHubLink)
|
||||
{
|
||||
Process.Start("https://github.com/EpicMorg/UniversalValveToolbox");
|
||||
}
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmGitHubReport) {
|
||||
else if (selectItemText == Properties.translations.MenuItems.itmGitHubReport)
|
||||
{
|
||||
Process.Start("https://github.com/EpicMorg/UniversalValveToolbox/issues/new/choose");
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenSettings() {
|
||||
private void OpenSettings()
|
||||
{
|
||||
var dataManager = new DataProvider();
|
||||
var settingsDto = dataManager.Settings;
|
||||
var languageProvider = new LanguageProvider();
|
||||
@ -463,14 +569,17 @@ namespace UniversalValveToolbox {
|
||||
|
||||
var frmSettings = new FormSettings(settingsModel);
|
||||
|
||||
if (frmSettings.ShowDialog() == DialogResult.OK) {
|
||||
if (frmSettings.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
dataManager.Settings = settingsDto;
|
||||
Application.Restart();
|
||||
}
|
||||
}
|
||||
|
||||
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) {
|
||||
private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
SaveLastSelectedProject();
|
||||
SteamClient.Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,9 @@
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -369,9 +372,6 @@
|
||||
<None Include="json\engines\243730_ssdk2013sp.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="json\projects\bst.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="json\projects\test project.json" />
|
||||
<None Include="json\settings.json" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"appid": 1950750,
|
||||
"appid": 1966980,
|
||||
"name": "Bestiarium Project",
|
||||
"bin": "bst.exe",
|
||||
"tools": [
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"Engine": 243730,
|
||||
"Path": "W:\\Steam\\steamapps\\sourcemods\\bst",
|
||||
"Name": "bst",
|
||||
"Args": ""
|
||||
}
|
@ -2,5 +2,10 @@
|
||||
"LastSelectedProject": null,
|
||||
"Language": "en-US",
|
||||
"AvailableLanguages": [ "en-US", "ru-RU" ],
|
||||
"Theme": null
|
||||
"Theme": null,
|
||||
"ToolboxMod": "bundle", //retail, bundle, dev
|
||||
"ToolsAppId": 1966980, //set your game real steam sdk id for init SteamApi or use 480 stub
|
||||
"BundleAppID": 1950750, //set your gane steam id for get fs path
|
||||
"DevEnginePath": "C://", //set you game root folder if you run dev-mod
|
||||
"DevEngineName": "My Future Game (engine)" //set you game root folder if you run dev-mod
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user