Jul 25, 2019 07:58 AM
(This post was last modified: Jul 25, 2019 10:22 AM by Bunnyslippers69.)
Not sure if anyone will find this useful, but i thought i'd at least give back to the community somewhat. It lists all steam games installed inside the default download location. If you have multiple game drives, this isn't going to list all of them.
I'd appreciate some constructive criticism\feedback, but just being negative isn't going to benefit anyone. Thanks.
EDIT: I've remade this in a Windows Form. Pretty much the same idea, but using lists. i.imgur.com/sKSXb9g.png
I'd appreciate some constructive criticism\feedback, but just being negative isn't going to benefit anyone. Thanks.
Code
using System;
using System.IO;
using Microsoft.Win32;
namespace Steam_Game_List
{
class Program
{
static void Main(string[] args)
{
var path = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam", "InstallPath", null);
if (File.Exists(Convert.ToString(path + @"\steam.exe")))
{
var dirs = Directory.GetDirectories(Path.Combine(path + @"\steamapps\common\"));
foreach (var dir in dirs)
{
double dirSizeB = DirSize(new DirectoryInfo(dir));
double dirSizeKB = ScaleUp(dirSizeB);
double dirSizeMB = ScaleUp(dirSizeKB);
double dirSizeGB = ScaleUp(dirSizeMB);
string fileName = dir.Replace(Path.Combine(path + @"\steamapps\common\"), "");
ColoredConsoleWrite(ConsoleColor.White, fileName);
ColoredConsoleWrite(ConsoleColor.Yellow, "\n\tSizes{" + dirSizeMB + "MB\t");
ColoredConsoleWrite(ConsoleColor.Yellow, dirSizeGB + "GB}\n\n");
}
}
else{Console.WriteLine("Couldn't find steam folder");}
Console.Read();
}
public static long DirSize(DirectoryInfo d)
{
long size = 0;
// Add file sizes.
FileInfo[] fis = d.GetFiles();
foreach (FileInfo fi in fis)
{
size += fi.Length;
}
// Add subdirectory sizes.
DirectoryInfo[] dis = d.GetDirectories();
foreach (DirectoryInfo di in dis)
{
size += DirSize(di);
}
return size;
}
public static void ColoredConsoleWrite(ConsoleColor color, string text)
{
ConsoleColor originalColor = Console.ForegroundColor;
Console.ForegroundColor = color;
Console.Write(text);
Console.ForegroundColor = originalColor;
}
public static double ScaleUp(double defSize)
{
return Math.Round(defSize / 1024, 2);
}
}
}EDIT: I've remade this in a Windows Form. Pretty much the same idea, but using lists. i.imgur.com/sKSXb9g.png



![[Image: vp6iypF.gif]](https://i.imgur.com/vp6iypF.gif)