Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/riperiperi/Simitone into …
Browse files Browse the repository at this point in the history
…simitone-cheats
  • Loading branch information
JDrocks450 committed Nov 24, 2019
2 parents 28507e4 + 85b3db5 commit ec2418e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 25 deletions.
13 changes: 9 additions & 4 deletions Client/Simitone/Simitone.Windows/GameLocator/LinuxLocator.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Simitone.Windows.GameLocator
{
public class LinuxLocator : ILocator
{
public string FindTheSimsOnline()
{
return "game/TSOClient/";
return "";
//string localDir = @"../The Sims Online/TSOClient/";
//if (File.Exists(Path.Combine(localDir, "tuning.dat"))) return localDir;

//return "game/TSOClient/";
}

public string FindTheSims1()
{
string localDir = @"../The Sims/";
if (File.Exists(Path.Combine(localDir, "GameData", "Behavior.iff"))) return localDir;

return "game1/";
}
}
Expand Down
10 changes: 9 additions & 1 deletion Client/Simitone/Simitone.Windows/GameLocator/MacOSLocator.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
using System;
using System.IO;

namespace Simitone.Windows.GameLocator
{
public class MacOSLocator : ILocator
{
public string FindTheSimsOnline()
{
return string.Format("{0}/Documents/The Sims Online/TSOClient/", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
return "";
//string localDir = @"../The Sims Online/TSOClient/";
//if (File.Exists(Path.Combine(localDir, "tuning.dat"))) return localDir;

//return string.Format("{0}/Documents/The Sims Online/TSOClient/", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
}

public string FindTheSims1()
{
string localDir = @"../The Sims/";
if (File.Exists(Path.Combine(localDir, "GameData", "Behavior.iff"))) return localDir;

return "game1/";
}
}
Expand Down
44 changes: 24 additions & 20 deletions Client/Simitone/Simitone.Windows/GameLocator/WindowsLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
Expand All @@ -13,35 +14,37 @@ public class WindowsLocator : ILocator
public string FindTheSimsOnline()
{
return "";
string Software = "";
//string Software = "";

using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))
{
//Find the path to TSO on the user's system.
RegistryKey softwareKey = hklm.OpenSubKey("SOFTWARE");
//using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))
//{
// //Find the path to TSO on the user's system.
// RegistryKey softwareKey = hklm.OpenSubKey("SOFTWARE");

if (Array.Exists(softwareKey.GetSubKeyNames(), delegate (string s) { return s.Equals("Maxis", StringComparison.InvariantCultureIgnoreCase); }))
{
RegistryKey maxisKey = softwareKey.OpenSubKey("Maxis");
if (Array.Exists(maxisKey.GetSubKeyNames(), delegate (string s) { return s.Equals("The Sims Online", StringComparison.InvariantCultureIgnoreCase); }))
{
RegistryKey tsoKey = maxisKey.OpenSubKey("The Sims Online");
string installDir = (string)tsoKey.GetValue("InstallDir");
installDir += "\\TSOClient\\";
return installDir.Replace('\\', '/');
}
}
}
return @"C:\Program Files\Maxis\The Sims Online\TSOClient\".Replace('\\', '/');
// if (Array.Exists(softwareKey.GetSubKeyNames(), delegate (string s) { return s.Equals("Maxis", StringComparison.InvariantCultureIgnoreCase); }))
// {
// RegistryKey maxisKey = softwareKey.OpenSubKey("Maxis");
// if (Array.Exists(maxisKey.GetSubKeyNames(), delegate (string s) { return s.Equals("The Sims Online", StringComparison.InvariantCultureIgnoreCase); }))
// {
// RegistryKey tsoKey = maxisKey.OpenSubKey("The Sims Online");
// string installDir = (string)tsoKey.GetValue("InstallDir");
// installDir += "\\TSOClient\\";
// return installDir.Replace('\\', '/');
// }
// }
//}
//return @"C:\Program Files\Maxis\The Sims Online\TSOClient\".Replace('\\', '/');
}

public string FindTheSims1()
{
string Software = "";
// Search relative directory similar to how macOS and Linux works; allows portability
string localDir = @"../The Sims/";
if (File.Exists(Path.Combine(localDir, "GameData", "Behavior.iff"))) return localDir;

using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))
{
//Find the path to TSO on the user's system.
//Find the path to TS1 on the user's system.
RegistryKey softwareKey = hklm.OpenSubKey("SOFTWARE");

if (Array.Exists(softwareKey.GetSubKeyNames(), delegate (string s) { return s.Equals("Maxis", StringComparison.InvariantCultureIgnoreCase); }))
Expand All @@ -56,6 +59,7 @@ public string FindTheSims1()
}
}
}
// Fall back to the default install location if the other two checks fail
return @"C:\Program Files (x86)\Maxis\The Sims\".Replace('\\', '/');
}

Expand Down

0 comments on commit ec2418e

Please sign in to comment.