Skip to content

Commit

Permalink
increase delay before sending commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
kianzarrin committed Oct 29, 2021
1 parent 32e5f7a commit a7fd417
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
6 changes: 4 additions & 2 deletions LoadOrder/UI/LoadOrderWindowMenuStrip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public class LoadOrderWindowMenuStrip : MenuStrip {
// tsmiReDownload
//
tsmiReDownload.Name = "tsmiReDownload";
tsmiReDownload.Text = "&Redownload broken downloads";
tsmiReDownload.Text = "&Redownload broken downloads [Experimental]";
//
// tsmiSync
//
Expand Down Expand Up @@ -301,7 +301,9 @@ public class LoadOrderWindowMenuStrip : MenuStrip {
.ToArray();
SteamUtil.ReDownload(ids);

var res = MessageBox.Show("You can monitor download progress in steam client. Wait for steam to finish downloading. Then press ok to refresh everyhing.", "Wait for download");
var res = MessageBox.Show(
"You can monitor download progress in steam client. Wait for steam to finish downloading. Then press ok to refresh everyhing.\n" +
"should this not work the first time please try again", "Wait for download");
ConfigWrapper.instance.CSCache.MissingDir = new ulong[0];
LoadOrderWindow.Instance.DownloadWarningLabel.Visible = false;
await LoadOrderWindow.Instance.ReloadAll(); // reload to fix included/excluded, paths, ...
Expand Down
4 changes: 2 additions & 2 deletions LoadOrder/Util/SteamUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ namespace LoadOrderTool.Util {
public static class SteamUtil {
public static void ExecuteSteam(string args) {
ContentUtil.Execute(DataLocation.SteamPath, DataLocation.SteamExe, args).WaitForExit();
Thread.Sleep(10);
Thread.Sleep(30);
}

public static void ReDownload(IEnumerable<ulong> ids) {
try {
Log.Called(ids);
ExecuteSteam("steam://open/console");// so that user can see what is happening.
Thread.Sleep(100); // wait for steam to be ready.
Thread.Sleep(200); // wait for steam to be ready.
foreach (var id in ids)
ExecuteSteam($"+workshop_download_item 255710 {id}");
ExecuteSteam("steam://open/downloads");
Expand Down
4 changes: 3 additions & 1 deletion LoadOrderMod/Settings/Tabs/SubscriptionsTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ static class SubscriptionsTab {
var path = tfSteamPath_.text;
if (CheckSteamPath(path)) {
CheckSubsUtil.ReDownload(path);
Prompt.Warning("Exit", "Please exit to desktop, wait for steam download to finish, and then start Cities skylines again.");
Prompt.Warning("Exit",
"Please exit to desktop, wait for steam download to finish, and then start Cities skylines again.\n" +
"Should this not work the first time, please try again.");
}
} catch (Exception ex) {
ex.Log();
Expand Down
5 changes: 2 additions & 3 deletions LoadOrderMod/Util/CheckSubsUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,12 @@ public class CheckSubsUtil : MonoBehaviour {
string steamExe = steam.Name;
void ExecuteSteam(string args) {
Execute(steamDir, steamExe, args).WaitForExit();
Thread.Sleep(10);
Thread.Sleep(30);
}

ExecuteSteam("steam://open/console"); // so that user can see what is happening.
Thread.Sleep(50); // wait until steam is ready.
Thread.Sleep(100); // wait until steam is ready.

// work-around: the first command is sometimes missed.
ExecuteSteam($"+workshop_download_item 255710 {ids.FirstOrDefault()}");
Thread.Sleep(100);

Expand Down
2 changes: 1 addition & 1 deletion Version.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<AssemblyVersion>1.1.7.*</AssemblyVersion>
<AssemblyVersion>1.1.8.*</AssemblyVersion>
</PropertyGroup>
</Project>

0 comments on commit a7fd417

Please sign in to comment.