Fixed Steam3 content always downloading depots for all platforms.

pull/8/head
Nicholas Hastings 12 years ago
parent c0e55988ea
commit d073b9ef34

@ -326,13 +326,30 @@ namespace DepotDownloader
if (depots != null)
{
foreach (var child in depots.Children)
foreach (var depotSection in depots.Children)
{
int id = -1;
if (int.TryParse(child.Name, out id) && child.Children.Count > 0 && (depotId == -1 || id == depotId))
if (depotSection.Children.Count == 0)
continue;
if (!int.TryParse(depotSection.Name, out id))
continue;
if (depotId > -1 && id != depotId)
continue;
if (!Config.DownloadAllPlatforms)
{
depotIDs.Add(id);
var depotConfig = depotSection["config"];
if (depotConfig != KeyValue.Invalid && depotConfig["oslist"] != KeyValue.Invalid)
{
var oslist = depotSection["oslist"].Value.Split(',');
if (Array.IndexOf(oslist, Util.GetSteamOS()) == -1)
continue;
}
}
depotIDs.Add(id);
}
}

@ -18,7 +18,7 @@ namespace DepotDownloader
// Environment.OSVersion.Platform returns PlatformID.Unix under Mono on OS X
// Code adapted from Mono: mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
public static bool IsMacOSX()
private static bool IsMacOSX()
{
if ( _isMacOSX != -1 )
return _isMacOSX == 1;
@ -54,6 +54,22 @@ namespace DepotDownloader
return false;
}
public static string GetSteamOS()
{
switch (Environment.OSVersion.Platform)
{
case PlatformID.Win32NT:
case PlatformID.Win32Windows:
return "windows";
case PlatformID.MacOSX:
return "macos";
case PlatformID.Unix:
return IsMacOSX() ? "macos" : "linux";
}
return "unknown";
}
public static string ReadPassword()
{
ConsoleKeyInfo keyInfo;

Loading…
Cancel
Save