Permalink
Browse files

* Can now detect Steam games that have been installed on ther drives …

…through Steam's new feature that lets you do what I just said.

* Updated version numbers to 1.0.4
  • Loading branch information...
sanmadjack committed Jan 1, 2013
1 parent c37695a commit 8394982a05227fe9a65348163a0e5bf8f8a795da
@@ -49,3 +49,6 @@
[submodule "Libs/Updater"]
path = Libs/Updater
url = https://github.com/sanmadjack/Updater.CSharp.git
[submodule "Libs/VDF"]
path = Libs/VDF
url = ../../sanmadjack/VDF.git
@@ -1,3 +1,6 @@
=1.0.4=
* Can now detect Steam games that have been installed on ther drives through Steam's new feature that lets you do what I just said.
=1.0.2=
* Implemented custom List view to overcome the limitations of the stock one
* Added interface text to explain the restore process
@@ -1,5 +1,5 @@
#define MyAppName "MASGAU"
#define MyAppVersion "1.0.2"
#define MyAppVersion "1.0.4"
#define MyAppPublisher "Matthew Barbour"
#define MyAppURL "http://masgau.org/"
#define Mode "Release"
@@ -17,7 +17,7 @@ DefaultGroupName={#MyAppName}
Compression=lzma/Ultra64
SolidCompression=true
OutputBaseFilename={#MyAppName}-{#MyAppVersion}-{#Stability}-Setup
AppCopyright=2012
AppCopyright=2013
ChangesAssociations=true
WizardImageFile=installer_logo.bmp
WizardSmallImageFile=installer_logo_small.bmp
Submodule VDF added at 3f4e6a
@@ -21,6 +21,17 @@ public abstract class ALocationHandler : Model<StringID, UserData> {
this.type = type;
}
protected void addUserEv(string user, EnvironmentVariable ev, string name, string folder) {
UserData user_data;
if (Contains(user))
user_data = getUser(user);
else {
user_data = new UserData(user);
this.AddWithSort(user_data);
}
user_data.addEvFolder(ev, name, folder);
}
protected void setUserEv(string user, EnvironmentVariable ev, string folder) {
UserData user_data;
if (Contains(user))
@@ -1,11 +1,13 @@
using VDF;
namespace MASGAU.Location {
public abstract class ASteamLocationHandler : ALocationHandler {
// The paths
public string path { get; protected set; }
public string userdata_path { get; protected set; }
public string steam_apps_path { get; protected set; }
protected SteamConfigFile config_file;
public ASteamLocationHandler()
: base(HandlerType.Steam) {
resetSteamPath();
@@ -4,41 +4,17 @@
using MASGAU.Location.Holders;
namespace MASGAU.Location {
public class EvFolder : Dictionary<string, string> {
public bool Matches(string path) {
foreach (string folder in this.Values) {
string[] split = path.Split(Path.DirectorySeparatorChar);
for (int i = 0; i < split.Length; i++) {
string new_path = split[0] + Path.DirectorySeparatorChar;
for (int j = 1; j <= i; j++) {
new_path = Path.Combine(new_path, split[j]);
}
if (new_path.ToLower().Equals(folder.ToLower()))
return true;
}
}
return false;
}
public IEnumerable<string> Folders {
get {
return this.Values;
}
}
protected IEnumerable<string> SubFolders {
protected IEnumerable<string> FolderNames {
get {
return this.Keys;
}
}
public string BaseFolder { get; protected set; }
public EvFolder(string folder) {
this.Add("", folder);
BaseFolder = folder;
}
public bool HasDirs {
get {
return this.Count > 0;
@@ -51,6 +27,43 @@ public class EvFolder : Dictionary<string, string> {
return this.Count > 1;
}
}
public string BaseFolder { get; protected set; }
public EvFolder(string folder): this("",folder) { }
public EvFolder(string name, string folder) {
this.Add(name, folder);
BaseFolder = folder;
}
public EvFolder(DirectoryInfo parent, bool create_from_subfolders) {
if (create_from_subfolders) {
BaseFolder = parent.FullName;
DirectoryInfo[] subs = parent.GetDirectories();
foreach (DirectoryInfo dir in subs) {
this.Add(dir.Name, dir.FullName);
}
} else {
this.Add("", parent.FullName);
BaseFolder = parent.FullName;
}
}
public bool Matches(string path) {
foreach (string folder in this.Values) {
string[] split = path.Split(Path.DirectorySeparatorChar);
for (int i = 0; i < split.Length; i++) {
string new_path = split[0] + Path.DirectorySeparatorChar;
for (int j = 1; j <= i; j++) {
new_path = Path.Combine(new_path, split[j]);
}
if (new_path.ToLower().Equals(folder.ToLower()))
return true;
}
}
return false;
}
public IEnumerable<DetectedLocationPathHolder> createDetectedLocations(LocationPath loc, string owner) {
List<DetectedLocationPathHolder> return_me = new List<DetectedLocationPathHolder>();
@@ -61,14 +74,11 @@ public class EvFolder : Dictionary<string, string> {
return return_me;
}
public EvFolder(DirectoryInfo parent) {
BaseFolder = parent.FullName;
DirectoryInfo[] subs = parent.GetDirectories();
foreach (DirectoryInfo dir in subs) {
this.Add(dir.Name, dir.FullName);
}
public void AddFolder(string name, string path) {
this.Add(name, path);
}
}
}
@@ -23,22 +23,38 @@ public UserData(string name)
} else
return null;
}
public void setEvFolder(EnvironmentVariable ev, string folder) {
this.setEvFolder(ev, new EvFolder(folder));
}
public void setEvFolder(EnvironmentVariable ev, DirectoryInfo folder) {
if (!folder.Exists || folder.GetDirectories().Length == 0)
return;
this.setEvFolder(ev, new EvFolder(folder));
public void setEvFolder(EnvironmentVariable ev, string name, string folder) {
this.setEvFolder(ev, new EvFolder(name, folder));
}
public void setEvFolder(EnvironmentVariable ev, DirectoryInfo folder, bool user_sub_folders) {
if (user_sub_folders) {
if (!folder.Exists || folder.GetDirectories().Length == 0)
return;
this.setEvFolder(ev, new EvFolder(folder, user_sub_folders));
} else {
this.setEvFolder(ev, folder.FullName);
}
}
public void setEvFolder(EnvironmentVariable ev, EvFolder folder) {
if (folders.ContainsKey(ev))
folders[ev] = folder;
else
folders.Add(ev, folder);
}
public void addEvFolder(EnvironmentVariable ev, string name, string folder) {
if (folders.ContainsKey(ev)) {
EvFolder evf = folders[ev];
evf.AddFolder(name, folder);
} else {
setEvFolder(ev, name, folder);
}
}
public bool hasFolderFor(EnvironmentVariable ev) {
return folders.ContainsKey(ev);
}
@@ -149,9 +149,13 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
<EmbeddedResource Include="data\a.xml" />
<EmbeddedResource Include="data\a.xml">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="data\b.xml" />
<EmbeddedResource Include="data\c.xml" />
<EmbeddedResource Include="data\c.xml">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="data\d.xml" />
<EmbeddedResource Include="data\e.xml" />
<EmbeddedResource Include="data\f.xml">
@@ -169,7 +173,9 @@
<EmbeddedResource Include="data\o.xml" />
<EmbeddedResource Include="data\p.xml" />
<EmbeddedResource Include="data\q.xml" />
<EmbeddedResource Include="data\r.xml" />
<EmbeddedResource Include="data\r.xml">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="data\s.xml" />
<EmbeddedResource Include="data\t.xml">
<SubType>Designer</SubType>
@@ -243,6 +249,10 @@
<Project>{292010F1-B671-4E46-BB96-3F8574E3C7B2}</Project>
<Name>Updater</Name>
</ProjectReference>
<ProjectReference Include="..\Libs\VDF\VDF.csproj">
<Project>{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}</Project>
<Name>VDF</Name>
</ProjectReference>
<ProjectReference Include="..\Libs\XmlData\XmlData.csproj">
<Project>{427B2AD4-31CC-4308-A9AB-5264D4A51A3B}</Project>
<Name>XmlData</Name>
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.*")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyVersion("1.0.4.*")]
[assembly: AssemblyFileVersion("1.0.4.0")]
@@ -37,6 +37,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameSave.Info", "Libs\GameS
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Libs\Updater\Updater.csproj", "{292010F1-B671-4E46-BB96-3F8574E3C7B2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VDF", "Libs\VDF\VDF.csproj", "{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -227,6 +229,16 @@ Global
{292010F1-B671-4E46-BB96-3F8574E3C7B2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{292010F1-B671-4E46-BB96-3F8574E3C7B2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{292010F1-B671-4E46-BB96-3F8574E3C7B2}.Release|x86.ActiveCfg = Release|Any CPU
{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}.Debug|x86.ActiveCfg = Debug|Any CPU
{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}.Release|Any CPU.Build.0 = Release|Any CPU
{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8392B97A-0EA5-489B-92A3-BBE9CFCCB5A5}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
BIN +18.5 KB (100%) MASGAU.NET.suo
Binary file not shown.
@@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.*")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyVersion("1.0.4.*")]
[assembly: AssemblyFileVersion("1.0.4.0")]
@@ -1,6 +1,7 @@
using System.IO;
using GameSaveInfo;
using MASGAU.Registry;
using VDF;
namespace MASGAU.Location {
public class SteamLocationHandler : ASteamLocationHandler {
// Custom Methods
@@ -17,6 +18,28 @@ public SteamLocationHandler()
return null;
}
protected void loadSteamPaths(DirectoryInfo read_me) {
DirectoryInfo[] read_us;
if (read_me.Exists) {
read_us = read_me.GetDirectories();
foreach (DirectoryInfo subDir in read_us) {
if (subDir.Name.ToLower() != "common" && subDir.Name.ToLower() != "sourcemods" && subDir.Name.ToLower() != "media") {
addUserEv(subDir.Name, EnvironmentVariable.SteamUser, subDir.FullName, subDir.FullName);
}
}
steam_apps_path = read_me.FullName;
DirectoryInfo common_folder = new DirectoryInfo(Path.Combine(steam_apps_path, "common"));
if (common_folder.Exists)
global.addEvFolder(EnvironmentVariable.SteamCommon, common_folder.FullName, common_folder.FullName);
DirectoryInfo source_mods = new DirectoryInfo(Path.Combine(steam_apps_path, "sourcemods"));
if (source_mods.Exists)
global.addEvFolder(EnvironmentVariable.SteamSourceMods, common_folder.FullName, source_mods.FullName);
}
}
protected override void resetSteamPath() {
string reg_path = null, set_path = null;
RegistryHandler steam = new RegistryHandler("local_machine", "SOFTWARE\\Valve\\Steam", false);
@@ -32,26 +55,24 @@ public SteamLocationHandler()
if (path != null) {
DirectoryInfo read_me = new DirectoryInfo(Path.Combine(path, "steamapps"));
DirectoryInfo[] read_us;
if (read_me.Exists) {
read_us = read_me.GetDirectories();
foreach (DirectoryInfo subDir in read_us) {
if (subDir.Name.ToLower() != "common" && subDir.Name.ToLower() != "sourcemods" && subDir.Name.ToLower() != "media") {
setUserEv(subDir.Name, EnvironmentVariable.SteamUser, subDir.FullName);
}
}
steam_apps_path = read_me.FullName;
DirectoryInfo common_folder = new DirectoryInfo(Path.Combine(steam_apps_path, "common"));
if (common_folder.Exists)
global.setEvFolder(EnvironmentVariable.SteamCommon, common_folder.FullName);
// Loads the steam isntall path folders
loadSteamPaths(read_me);
DirectoryInfo source_mods = new DirectoryInfo(Path.Combine(steam_apps_path, "sourcemods"));
if (source_mods.Exists)
global.setEvFolder(EnvironmentVariable.SteamSourceMods, source_mods.FullName);
// Loads the alt steam library folders
if (File.Exists(Path.Combine(path, "config", "config.vdf"))) {
config_file = new SteamConfigFile(Path.Combine(path, "config", "config.vdf"));
foreach (string folder in config_file.BaseInstallFolders) {
read_me = new DirectoryInfo(Path.Combine(folder, "SteamApps"));
loadSteamPaths(read_me);
}
}
// Loads the steam cloud folders
read_me = new DirectoryInfo(Path.Combine(path, "userdata"));
if (read_me.Exists) {
DirectoryInfo[] read_us;
read_us = read_me.GetDirectories();
foreach (DirectoryInfo subDir in read_us) {
setUserEv(subDir.Name, EnvironmentVariable.SteamUserData, subDir.FullName);
@@ -153,7 +153,7 @@ public SystemLocationHandler()
if (ubisoft_save != null && ubisoft_save.Exists) {
global.setEvFolder(EnvironmentVariable.UbisoftSaveStorage, ubisoft_save);
global.setEvFolder(EnvironmentVariable.UbisoftSaveStorage, ubisoft_save, true);
}
@@ -261,7 +261,7 @@ public SystemLocationHandler()
DirectoryInfo flash_share = new DirectoryInfo(Path.Combine(add_me.getFolder(EnvironmentVariable.AppData).BaseFolder, @"Macromedia\Flash Player\#SharedObjects"));
if (flash_share.Exists) {
add_me.setEvFolder(EnvironmentVariable.FlashShared, flash_share);
add_me.setEvFolder(EnvironmentVariable.FlashShared, flash_share, true);
}
Oops, something went wrong.

0 comments on commit 8394982

Please sign in to comment.