output changes, VValue error fix
This commit is contained in:
parent
62cd170a17
commit
8a0bdbfb7e
6 changed files with 50 additions and 19 deletions
|
@ -9,7 +9,7 @@
|
|||
<Version>2.0.0.0</Version>
|
||||
<PackageIcon>ini.ico</PackageIcon>
|
||||
<PackageIconUrl />
|
||||
<Description>Automatically generates and installs CreamAPI files for programs/games.</Description>
|
||||
<Description>Automatically installs and generates CreamAPI files for programs/games on the user's computer.</Description>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
|
||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<PackageTags>steam, dlc</PackageTags>
|
||||
<AssemblyName>CreamInstaller</AssemblyName>
|
||||
<Company>CreamInstaller</Company>
|
||||
<Product>CreamAPI Generator & Installer</Product>
|
||||
<Product>CreamAPI Installer & Generator</Product>
|
||||
<Authors>pointfeev</Authors>
|
||||
<PackageId>pointfeev.creaminstaller</PackageId>
|
||||
<StartupObject>CreamInstaller.Program</StartupObject>
|
||||
|
|
|
@ -78,10 +78,11 @@ namespace CreamInstaller
|
|||
Resources.WriteResourceToFile("steam_api64.dll", api64);
|
||||
UpdateUser($"Wrote resource to file: {api64}", LogColor.Resource);
|
||||
}
|
||||
UpdateUser("Generating CreamAPI for " + selection.Name + $" in directory \"{directory}\" . . . ", LogColor.Operation);
|
||||
string cApi = directory + @"\cream_api.ini";
|
||||
File.Create(cApi).Close();
|
||||
StreamWriter writer = File.AppendText(cApi);
|
||||
writer.WriteLine("; CreamInstaller");
|
||||
writer.WriteLine("; " + Application.CompanyName + " v" + Application.ProductVersion);
|
||||
if (selection.SteamAppId > 0)
|
||||
{
|
||||
writer.WriteLine();
|
||||
|
@ -165,11 +166,11 @@ namespace CreamInstaller
|
|||
try
|
||||
{
|
||||
await Operate();
|
||||
UpdateUser("CreamAPI successfully installed for " + ProgramCount + " program(s).", LogColor.Success);
|
||||
UpdateUser("CreamAPI successfully installed and generated for " + ProgramCount + " program(s).", LogColor.Success);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
UpdateUser("CreamAPI installation failed: " + exception.ToString(), LogColor.Error);
|
||||
UpdateUser("CreamAPI installation and/or generation failed: " + exception.ToString(), LogColor.Error);
|
||||
retryButton.Enabled = true;
|
||||
}
|
||||
userProgressBar.Value = userProgressBar.Maximum;
|
||||
|
|
|
@ -63,5 +63,20 @@ namespace CreamInstaller
|
|||
public static List<ProgramSelection> AllSafeEnabled => AllSafe.FindAll(s => s.Enabled);
|
||||
|
||||
public static ProgramSelection FromName(string displayName) => AllSafe.Find(s => s.Name == displayName);
|
||||
|
||||
public static Tuple<int, string> GetDlc(string displayName)
|
||||
{
|
||||
foreach (ProgramSelection selection in AllSafe)
|
||||
{
|
||||
foreach (Tuple<int, string> app in selection.AllSteamDlc)
|
||||
{
|
||||
if (app.Item2 == displayName)
|
||||
{
|
||||
return app;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
3
CreamInstaller/SelectForm.Designer.cs
generated
3
CreamInstaller/SelectForm.Designer.cs
generated
|
@ -111,6 +111,9 @@ namespace CreamInstaller
|
|||
this.treeView1.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.treeView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.treeView1.CheckBoxes = true;
|
||||
this.treeView1.Enabled = false;
|
||||
this.treeView1.FullRowSelect = true;
|
||||
this.treeView1.HotTracking = true;
|
||||
this.treeView1.Location = new System.Drawing.Point(6, 22);
|
||||
this.treeView1.Name = "treeView1";
|
||||
this.treeView1.Size = new System.Drawing.Size(448, 208);
|
||||
|
|
|
@ -3,6 +3,7 @@ using Gameloop.Vdf.Linq;
|
|||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -162,10 +163,7 @@ namespace CreamInstaller
|
|||
if (Program.Canceled) return;
|
||||
string dlcName = null;
|
||||
VProperty dlcAppInfo = null;
|
||||
if (SteamCMD.GetAppInfo(id, 0, out dlcAppInfo)
|
||||
&& !(dlcAppInfo?.Value is VValue)
|
||||
&& !(dlcAppInfo?.Value?["common"] is VValue))
|
||||
dlcName = dlcAppInfo?.Value?["common"]?["name"]?.ToString();
|
||||
if (SteamCMD.GetAppInfo(id, 0, out dlcAppInfo)) dlcName = dlcAppInfo?.Value?["common"]?["name"]?.ToString();
|
||||
if (Program.Canceled) return;
|
||||
if (string.IsNullOrWhiteSpace(dlcName)) dlcName = $"Unnamed DLC ({id})";
|
||||
dlc[id] = dlcName;
|
||||
|
@ -201,6 +199,7 @@ namespace CreamInstaller
|
|||
if (Program.Canceled) return;
|
||||
TreeNode programNode = treeNodes.Find(s => s.Text == name) ?? new();
|
||||
programNode.Text = name;
|
||||
programNode.Checked = true;
|
||||
programNode.Remove();
|
||||
treeView1.Nodes.Add(programNode);
|
||||
treeNodes.Remove(programNode);
|
||||
|
@ -210,6 +209,7 @@ namespace CreamInstaller
|
|||
if (Program.Canceled || programNode is null) return;
|
||||
TreeNode dlcNode = treeNodes.Find(s => s.Text == dlcApp.Value) ?? new();
|
||||
dlcNode.Text = dlcApp.Value;
|
||||
dlcNode.Checked = true;
|
||||
dlcNode.Remove();
|
||||
programNode.Nodes.Add(dlcNode);
|
||||
treeNodes.Remove(dlcNode);
|
||||
|
@ -242,7 +242,7 @@ namespace CreamInstaller
|
|||
noneFoundLabel.Visible = false;
|
||||
allCheckBox.Enabled = false;
|
||||
acceptButton.Enabled = false;
|
||||
treeView1.CheckBoxes = false;
|
||||
treeView1.Enabled = false;
|
||||
|
||||
label2.Visible = true;
|
||||
progressBar1.Visible = true;
|
||||
|
@ -259,8 +259,8 @@ namespace CreamInstaller
|
|||
if (_progress < 0) maxProgress = -_progress;
|
||||
else curProgress = _progress;
|
||||
int p = Math.Max(Math.Min((int)((float)(curProgress / (float)maxProgress) * 100), 100), 0);
|
||||
if (setup) label2.Text = "Setting up SteamCMD . . . " + p + "%";
|
||||
else label2.Text = "Gathering your CreamAPI-applicable games and their DLCs . . . " + p + "%";
|
||||
if (setup) label2.Text = $"Setting up SteamCMD . . . {p}% ({curProgress}/{maxProgress})";
|
||||
else label2.Text = $"Gathering and caching your applicable games and their DLCs . . . {p}% ({curProgress}/{maxProgress})";
|
||||
progressBar1.Value = p;
|
||||
};
|
||||
|
||||
|
@ -278,7 +278,7 @@ namespace CreamInstaller
|
|||
watcher.Dispose();
|
||||
|
||||
setup = false;
|
||||
label2.Text = "Gathering your CreamAPI-applicable games and their DLCs . . . ";
|
||||
label2.Text = "Gathering and caching your applicable games and their DLCs . . . ";
|
||||
await Task.Run(() => GetCreamApiApplicablePrograms(iProgress));
|
||||
|
||||
ProgramSelection.All.ForEach(selection => selection.SteamApiDllDirectories.RemoveAll(directory => !Directory.Exists(directory)));
|
||||
|
@ -295,7 +295,7 @@ namespace CreamInstaller
|
|||
if (ProgramSelection.All.Any())
|
||||
{
|
||||
allCheckBox.Enabled = true;
|
||||
treeView1.CheckBoxes = true;
|
||||
treeView1.Enabled = true;
|
||||
treeNodes.ForEach(node => node.Checked = true);
|
||||
if (ProgramSelection.AllSafeEnabled.Any())
|
||||
{
|
||||
|
@ -338,6 +338,20 @@ namespace CreamInstaller
|
|||
private void OnLoad(object sender, EventArgs e)
|
||||
{
|
||||
treeView1.AfterCheck += OnTreeViewNodeCheckedChanged;
|
||||
treeView1.NodeMouseClick += (sender, e) =>
|
||||
{
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
ProgramSelection selection = ProgramSelection.FromName(e.Node.Text);
|
||||
Tuple<int, string> dlc = ProgramSelection.GetDlc(e.Node.Text);
|
||||
int appId = selection?.SteamAppId ?? dlc?.Item1 ?? 0;
|
||||
if (appId > 0) Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "https://steamdb.info/app/" + appId,
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
};
|
||||
OnLoad();
|
||||
}
|
||||
|
||||
|
|
|
@ -77,13 +77,11 @@ namespace CreamInstaller
|
|||
}
|
||||
if (Program.Canceled || output is null) return false;
|
||||
appInfo = VdfConvert.Deserialize(output);
|
||||
if (appInfo?.Value?.Children()?.ToList()?.Count == 0) return true;
|
||||
VToken type = null;
|
||||
try { type = appInfo?.Value?["common"]?["type"]; } catch { }
|
||||
if (!(appInfo.Value is VValue) && appInfo.Value.Children().ToList().Count == 0) return true;
|
||||
VToken type = appInfo.Value is VValue ? null : appInfo.Value?["common"]?["type"];
|
||||
if (type is null || type.ToString() == "Game")
|
||||
{
|
||||
string buildid = null;
|
||||
try { buildid = appInfo.Value["depots"]["public"]["buildid"].ToString(); } catch { }
|
||||
string buildid = appInfo.Value is VValue ? null : appInfo.Value["depots"]?["public"]?["buildid"]?.ToString();
|
||||
if (buildid is null && !(type is null)) return true;
|
||||
if (type is null || int.Parse(buildid) < buildId)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue