Implemented list of all games
This commit is contained in:
64
SteamMover/Form1.Designer.cs
generated
64
SteamMover/Form1.Designer.cs
generated
@@ -28,12 +28,74 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
this.objectListView1 = new BrightIdeasSoftware.ObjectListView();
|
||||||
|
this.columnId = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
|
||||||
|
this.columnName = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
|
||||||
|
this.columnDirectory = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
|
||||||
|
this.columnLibrary = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.objectListView1)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// objectListView1
|
||||||
|
//
|
||||||
|
this.objectListView1.AllColumns.Add(this.columnId);
|
||||||
|
this.objectListView1.AllColumns.Add(this.columnName);
|
||||||
|
this.objectListView1.AllColumns.Add(this.columnDirectory);
|
||||||
|
this.objectListView1.AllColumns.Add(this.columnLibrary);
|
||||||
|
this.objectListView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||||
|
this.columnId,
|
||||||
|
this.columnName,
|
||||||
|
this.columnDirectory});
|
||||||
|
this.objectListView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.objectListView1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.objectListView1.Name = "objectListView1";
|
||||||
|
this.objectListView1.Size = new System.Drawing.Size(968, 590);
|
||||||
|
this.objectListView1.TabIndex = 0;
|
||||||
|
this.objectListView1.UseCompatibleStateImageBehavior = false;
|
||||||
|
this.objectListView1.View = System.Windows.Forms.View.Details;
|
||||||
|
//
|
||||||
|
// columnId
|
||||||
|
//
|
||||||
|
this.columnId.AspectName = "id";
|
||||||
|
this.columnId.Text = "ID";
|
||||||
|
//
|
||||||
|
// columnName
|
||||||
|
//
|
||||||
|
this.columnName.AspectName = "name";
|
||||||
|
this.columnName.Text = "Name";
|
||||||
|
//
|
||||||
|
// columnDirectory
|
||||||
|
//
|
||||||
|
this.columnDirectory.AspectName = "directory";
|
||||||
|
this.columnDirectory.Text = "Directory";
|
||||||
|
//
|
||||||
|
// columnLibrary
|
||||||
|
//
|
||||||
|
this.columnLibrary.AspectName = "library";
|
||||||
|
this.columnLibrary.DisplayIndex = 3;
|
||||||
|
this.columnLibrary.IsVisible = false;
|
||||||
|
this.columnLibrary.Text = "Library";
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(968, 590);
|
||||||
|
this.Controls.Add(this.objectListView1);
|
||||||
|
this.Name = "Form1";
|
||||||
this.Text = "Form1";
|
this.Text = "Form1";
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.objectListView1)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private BrightIdeasSoftware.ObjectListView objectListView1;
|
||||||
|
private BrightIdeasSoftware.OLVColumn columnId;
|
||||||
|
private BrightIdeasSoftware.OLVColumn columnName;
|
||||||
|
private BrightIdeasSoftware.OLVColumn columnDirectory;
|
||||||
|
private BrightIdeasSoftware.OLVColumn columnLibrary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,16 +19,34 @@ namespace SteamMover
|
|||||||
private static readonly Regex regexObjectEnd = new Regex("^(?: |\t)*\\}$");
|
private static readonly Regex regexObjectEnd = new Regex("^(?: |\t)*\\}$");
|
||||||
private static readonly Regex regexVariable = new Regex("^(?: |\t)*\"([^\"]*)\"(?: |\t)*\"([^\"]*)\"$");
|
private static readonly Regex regexVariable = new Regex("^(?: |\t)*\"([^\"]*)\"(?: |\t)*\"([^\"]*)\"$");
|
||||||
|
|
||||||
|
private const string defaultDir = @"C:\Program Files (x86)\Steam\steamapps";
|
||||||
|
|
||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
foreach (var path in Directory.GetFiles(@"C:\Program Files (x86)\Steam\steamapps\", "*.acf", SearchOption.AllDirectories))
|
var libraries = new List<string> { defaultDir };
|
||||||
ReadConfigObject(File.OpenText(path));
|
var libraryConf = (Dictionary<string, object>)ReadConfigObject(File.OpenText(Path.Combine(defaultDir, "libraryfolders.vdf")))["LibraryFolders"];
|
||||||
foreach (var path in Directory.GetFiles(@"D:\SteamLibrary\steamapps", "*.acf", SearchOption.AllDirectories))
|
for (var i = 1; libraryConf.ContainsKey(i.ToString()); i++)
|
||||||
ReadConfigObject(File.OpenText(path));
|
libraries.Add(Path.Combine((string)libraryConf[i.ToString()], "steamapps"));
|
||||||
foreach (var path in Directory.GetFiles(@"F:\SteamLibrary\steamapps", "*.acf", SearchOption.AllDirectories))
|
|
||||||
ReadConfigObject(File.OpenText(path));
|
var games = new List<Game>();
|
||||||
|
foreach(var library in libraries)
|
||||||
|
foreach(var appmanifestPath in Directory.GetFiles(library, "appmanifest_*.acf", SearchOption.TopDirectoryOnly))
|
||||||
|
{
|
||||||
|
var appmanifestConf = (Dictionary<string, object>)ReadConfigObject(File.OpenText(appmanifestPath))["AppState"];
|
||||||
|
|
||||||
|
games.Add(new Game
|
||||||
|
{
|
||||||
|
id = Convert.ToInt32((string)appmanifestConf["appid"]),
|
||||||
|
name = (string)appmanifestConf["name"],
|
||||||
|
library = library,
|
||||||
|
directory = (string)appmanifestConf["installdir"],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
objectListView1.AlwaysGroupByColumn = columnLibrary;
|
||||||
|
objectListView1.SetObjects(games);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<string, object> ReadConfigObject(StreamReader streamReader, bool nestedObject = false)
|
private Dictionary<string, object> ReadConfigObject(StreamReader streamReader, bool nestedObject = false)
|
||||||
@@ -63,7 +81,7 @@ namespace SteamMover
|
|||||||
else if ((match = regexVariable.Match(line)).Success)
|
else if ((match = regexVariable.Match(line)).Success)
|
||||||
{
|
{
|
||||||
var key = match.Groups[1].Value;
|
var key = match.Groups[1].Value;
|
||||||
var value = match.Groups[2].Value;
|
var value = match.Groups[2].Value.Replace("\\\\", "\\");
|
||||||
|
|
||||||
dictionary.Add(key, value);
|
dictionary.Add(key, value);
|
||||||
}
|
}
|
||||||
|
12
SteamMover/Game.cs
Normal file
12
SteamMover/Game.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace SteamMover
|
||||||
|
{
|
||||||
|
struct Game
|
||||||
|
{
|
||||||
|
public int id;
|
||||||
|
public string name;
|
||||||
|
public string library;
|
||||||
|
public string directory;
|
||||||
|
}
|
||||||
|
}
|
@@ -52,6 +52,7 @@
|
|||||||
<Compile Include="Form1.Designer.cs">
|
<Compile Include="Form1.Designer.cs">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Game.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
Reference in New Issue
Block a user