2014-06-27 23:42:48 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using Microsoft.Win32;
|
|
|
|
|
|
2016-05-27 15:13:24 +00:00
|
|
|
|
namespace SCJMapper_V2.SC
|
2014-06-27 23:42:48 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Find the SC pathes and folders
|
|
|
|
|
/// </summary>
|
|
|
|
|
class SCPath
|
|
|
|
|
{
|
2014-07-05 20:46:58 +00:00
|
|
|
|
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
|
2014-07-06 00:14:57 +00:00
|
|
|
|
private static readonly AppSettings appSettings = new AppSettings( );
|
2014-06-27 23:42:48 +00:00
|
|
|
|
|
2016-05-27 15:13:24 +00:00
|
|
|
|
private static bool hasInformed = false; // prevent msgbox chains..
|
|
|
|
|
|
2014-06-27 23:42:48 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Try to locate the launcher under "App Paths"
|
|
|
|
|
/// </summary>
|
2014-08-31 13:05:56 +00:00
|
|
|
|
static private String SCLauncherFile1
|
2014-06-27 23:42:48 +00:00
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-08-31 13:05:56 +00:00
|
|
|
|
log.Debug( "SCLauncherFile1 - Entry" );
|
|
|
|
|
String scLauncher = ( String )Registry.GetValue( @"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths\StarCitizen Launcher.exe", "", null );
|
|
|
|
|
if ( scLauncher != null ) {
|
|
|
|
|
log.Info( "SCLauncherFile1 - Found HKLM - AppPath - Launcher.exe" );
|
|
|
|
|
if ( File.Exists( scLauncher ) ) {
|
|
|
|
|
return scLauncher;
|
2016-05-31 18:56:48 +00:00
|
|
|
|
} else {
|
2014-08-31 13:05:56 +00:00
|
|
|
|
log.WarnFormat( "SCLauncherFile1 - file does not exist: {0}", scLauncher );
|
|
|
|
|
return "";
|
|
|
|
|
}
|
2014-06-27 23:42:48 +00:00
|
|
|
|
}
|
2014-08-31 13:05:56 +00:00
|
|
|
|
log.Warn( "SCLauncherFile1 - did not found HKLM - AppPath - Launcher.exe" );
|
2014-06-27 23:42:48 +00:00
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Try to locate the launcher under "Uninstall"
|
|
|
|
|
/// </summary>
|
2014-08-31 13:05:56 +00:00
|
|
|
|
static private String SCLauncherFile2
|
2014-06-27 23:42:48 +00:00
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-08-31 13:05:56 +00:00
|
|
|
|
log.Debug( "SCLauncherFile2 - Entry" );
|
|
|
|
|
String scLauncher = ( String )Registry.GetValue( @"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\StarCitizen", "DisplayIcon", null );
|
|
|
|
|
if ( scLauncher != null ) {
|
|
|
|
|
log.Info( "SCLauncherFile2 - Found HKLM - Uninstall - StarCitizen" );
|
|
|
|
|
if ( File.Exists( scLauncher ) ) {
|
|
|
|
|
return scLauncher;
|
2016-05-31 18:56:48 +00:00
|
|
|
|
} else {
|
2014-08-31 13:05:56 +00:00
|
|
|
|
log.WarnFormat( "SCLauncherFile2 - file does not exist: {0}", scLauncher );
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.Warn( "SCLauncherFile2 - did not found HKLM - Uninstall - StarCitizen" );
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Try to locate the launcher under "Uninstall"
|
|
|
|
|
/// </summary>
|
|
|
|
|
static private String SCLauncherFile3
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-08-31 13:05:56 +00:00
|
|
|
|
log.Debug( "SCLauncherFile3 - Entry" );
|
|
|
|
|
String scLauncher = ( String )Registry.GetValue( @"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Cloud Imperium Games\StarCitizen Launcher.exe", "", null );
|
|
|
|
|
if ( scLauncher != null ) {
|
|
|
|
|
log.Info( "SCLauncherFile3 - Found HKLM - CIG - Launcher.exe" );
|
|
|
|
|
if ( File.Exists( scLauncher ) ) {
|
|
|
|
|
return scLauncher;
|
2016-05-31 18:56:48 +00:00
|
|
|
|
} else {
|
2014-08-31 13:05:56 +00:00
|
|
|
|
log.WarnFormat( "SCLauncherFile3 - file does not exist: {0}", scLauncher );
|
|
|
|
|
return "";
|
|
|
|
|
}
|
2014-06-27 23:42:48 +00:00
|
|
|
|
}
|
2014-08-31 13:05:56 +00:00
|
|
|
|
log.Warn( "SCLauncherFile3 - did not found HKLM - CIG - Launcher.exe" );
|
2014-06-27 23:42:48 +00:00
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-08-10 21:18:21 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Try to locate the launcher from Alpha 1.1.6 - e.g. E:\G\StarCitizen\CIGLauncher.exe
|
|
|
|
|
/// </summary>
|
|
|
|
|
static private String SCLauncherFile4
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2015-08-10 21:18:21 +00:00
|
|
|
|
log.Debug( "SCLauncherFile4 - Entry" );
|
|
|
|
|
String scLauncher = ( String )Registry.GetValue( @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\CIGLauncher.exe", "", null );
|
|
|
|
|
if ( scLauncher != null ) {
|
|
|
|
|
log.Info( "SCLauncherFile4 - Found HKCU - CIGLauncher.exe" );
|
|
|
|
|
if ( File.Exists( scLauncher ) ) {
|
|
|
|
|
return scLauncher;
|
2016-05-31 18:56:48 +00:00
|
|
|
|
} else {
|
2015-08-10 21:18:21 +00:00
|
|
|
|
log.WarnFormat( "SCLauncherFile4 - file does not exist: {0}", scLauncher );
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.Warn( "SCLauncherFile4 - did not found HKCU - CIGLauncher.exe" );
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-31 18:56:48 +00:00
|
|
|
|
// one more would be here
|
|
|
|
|
// HKEY_CURRENT_USER\Software\Cloud Imperium Games\StarCitizen UninstallString e.g. E:\G\StarCitizen\uninst.exe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-27 23:42:48 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the base SC install path from something like "E:\G\StarCitizen\Launcher\StarCitizenLauncher.exe"
|
|
|
|
|
/// </summary>
|
|
|
|
|
static private String SCBasePath
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-07-05 20:46:58 +00:00
|
|
|
|
log.Debug( "SCBasePath - Entry" );
|
2014-08-31 13:05:56 +00:00
|
|
|
|
appSettings.Reload( ); // local instance - reload as it might be changed outside
|
2014-07-06 00:14:57 +00:00
|
|
|
|
String scp = "";
|
2016-05-27 15:13:24 +00:00
|
|
|
|
|
2014-07-06 00:14:57 +00:00
|
|
|
|
if ( appSettings.UserSCPathUsed ) {
|
|
|
|
|
// User has priority
|
|
|
|
|
scp = appSettings.UserSCPath;
|
2016-01-02 00:15:58 +00:00
|
|
|
|
log.InfoFormat( "SCBasePath - user defined folder given: {0}", scp );
|
2016-05-31 18:56:48 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
//scp = ""; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
|
|
|
|
if ( Directory.Exists( scp ) ) {
|
|
|
|
|
return scp;
|
2014-08-31 13:05:56 +00:00
|
|
|
|
}
|
2016-05-31 18:56:48 +00:00
|
|
|
|
|
|
|
|
|
// not found
|
|
|
|
|
log.WarnFormat( "SCBasePath - user defined folder does not exist: {0}", scp );
|
|
|
|
|
|
|
|
|
|
string issue = string.Format( "Cannot find the user defined SC Installation Path ({0})!!\n\n" +
|
|
|
|
|
"Enter the folder where CIGLauncher.exe is located", scp);
|
|
|
|
|
|
|
|
|
|
if ( !hasInformed )
|
|
|
|
|
System.Windows.Forms.MessageBox.Show( issue, "Cannot find the user defined SC Installation Path !!",
|
|
|
|
|
System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation );
|
|
|
|
|
hasInformed = true;
|
|
|
|
|
return ""; // sorry path does not exist
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
// start the registry search - sequence 4..1 to get the newest method first
|
|
|
|
|
|
2015-08-10 21:18:21 +00:00
|
|
|
|
scp = SCLauncherFile4;
|
2016-05-31 18:56:48 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
//scp = ""; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
|
|
|
|
if ( !string.IsNullOrEmpty( scp ) ) {
|
|
|
|
|
// AC 1.1.6 path OK - this one needs no adjustments anymore but removing the filename
|
|
|
|
|
scp = Path.GetDirectoryName( scp ); // "E:\G\StarCitizen"
|
|
|
|
|
return scp;
|
|
|
|
|
}
|
2016-05-27 15:13:24 +00:00
|
|
|
|
|
2016-05-31 18:56:48 +00:00
|
|
|
|
scp = SCLauncherFile3;
|
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
//scp = ""; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
|
|
|
|
if ( !string.IsNullOrEmpty( scp ) ) {
|
|
|
|
|
// found the launcher.exe file - path adjust for the old subdir (may be remove path find 1..3 later)
|
|
|
|
|
scp = Path.GetDirectoryName( scp ); // "E:\G\StarCitizen\Launcher"
|
|
|
|
|
scp = Path.GetDirectoryName( scp ); // "E:\G\StarCitizen"
|
|
|
|
|
return scp;
|
|
|
|
|
}
|
2016-05-27 15:13:24 +00:00
|
|
|
|
|
2016-05-31 18:56:48 +00:00
|
|
|
|
scp = SCLauncherFile2;
|
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
//scp = ""; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
|
|
|
|
if ( !string.IsNullOrEmpty( scp ) ) {
|
2015-08-10 21:18:21 +00:00
|
|
|
|
// found the launcher.exe file - path adjust for the old subdir (may be remove path find 1..3 later)
|
|
|
|
|
scp = Path.GetDirectoryName( scp ); // "E:\G\StarCitizen\Launcher"
|
2016-05-31 18:56:48 +00:00
|
|
|
|
scp = Path.GetDirectoryName( scp ); // "E:\G\StarCitizen"
|
|
|
|
|
return scp;
|
2014-06-27 23:42:48 +00:00
|
|
|
|
}
|
2016-05-31 18:56:48 +00:00
|
|
|
|
|
|
|
|
|
scp = SCLauncherFile1;
|
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
//scp = ""; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
|
|
|
|
if ( !string.IsNullOrEmpty( scp ) ) {
|
|
|
|
|
// found the launcher.exe file - path adjust for the old subdir (may be remove path find 1..3 later)
|
|
|
|
|
scp = Path.GetDirectoryName( scp ); // "E:\G\StarCitizen\Launcher"
|
|
|
|
|
scp = Path.GetDirectoryName( scp ); // "E:\G\StarCitizen"
|
|
|
|
|
return scp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// nothing found
|
|
|
|
|
log.Warn( "SCBasePath - cannot find any valid SC path" );
|
|
|
|
|
// Issue a warning here to let the user know
|
|
|
|
|
string issue = string.Format( "Cannot find the SC Installation Path !!\n\n" +
|
|
|
|
|
"Use Settings to provide the path manually (don't forget to Check the Box left of the path to use it)\n\n" +
|
|
|
|
|
"Enter the folder where CIGLauncher.exe is located");
|
|
|
|
|
|
|
|
|
|
if ( !hasInformed )
|
|
|
|
|
System.Windows.Forms.MessageBox.Show( issue, "Cannot find SC Installation Path !!",
|
|
|
|
|
System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation );
|
|
|
|
|
hasInformed = true;
|
2014-06-27 23:42:48 +00:00
|
|
|
|
}
|
2016-05-31 18:56:48 +00:00
|
|
|
|
return ""; // sorry did not found a thing..
|
|
|
|
|
}// get
|
2014-08-31 13:05:56 +00:00
|
|
|
|
|
2014-06-27 23:42:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2014-08-31 13:05:56 +00:00
|
|
|
|
/// Returns the SC installation path or ""
|
2014-06-27 23:42:48 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
static public String SCInstallPath
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-07-05 20:46:58 +00:00
|
|
|
|
log.Debug( "SCInstallPath - Entry" );
|
2014-06-27 23:42:48 +00:00
|
|
|
|
return SCBasePath;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-05-31 18:56:48 +00:00
|
|
|
|
|
2014-12-22 21:37:32 +00:00
|
|
|
|
/// <summary>
|
2015-08-10 21:18:21 +00:00
|
|
|
|
/// Returns the SC Client path
|
|
|
|
|
/// AC 1.1.6: E:\G\StarCitizen\StarCitizen\Public
|
2015-12-26 22:16:25 +00:00
|
|
|
|
/// SC 2x: alternatively use PTU path E:\G\StarCitizen\StarCitizen\Test
|
2016-05-27 15:13:24 +00:00
|
|
|
|
/// SC 2.2.2: alternatively search path in E:\G\StarCitizen\StarCitizen\Live (don't know but this was mentioned in CIGs relnotes lately)
|
2014-12-22 21:37:32 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
static public String SCClientPath
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-12-22 21:37:32 +00:00
|
|
|
|
log.Debug( "SCClientPath - Entry" );
|
|
|
|
|
String scp = SCBasePath;
|
2016-05-31 18:56:48 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
// scp += "X"; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
|
|
|
|
string issue = "";
|
|
|
|
|
|
2014-12-22 21:37:32 +00:00
|
|
|
|
if ( String.IsNullOrEmpty( scp ) ) return ""; // no valid one can be found
|
2016-05-31 18:56:48 +00:00
|
|
|
|
//
|
2015-08-10 21:18:21 +00:00
|
|
|
|
scp = Path.Combine( scp, "StarCitizen" );
|
2016-05-27 15:13:24 +00:00
|
|
|
|
string scpX = "";
|
|
|
|
|
if ( appSettings.UsePTU ) {
|
|
|
|
|
scpX = Path.Combine( scp, "Test" );
|
2016-05-31 18:56:48 +00:00
|
|
|
|
if ( Directory.Exists( scpX ) ) return scpX;
|
|
|
|
|
// else not found PTU
|
|
|
|
|
// Issue a warning here to let the user know
|
|
|
|
|
issue = string.Format( "Cannot find the SC Client Path !!\n\n" +
|
|
|
|
|
"Tried to look for:\n" +
|
|
|
|
|
"{0}\\Test (PTU was enabled)\n\n" +
|
|
|
|
|
"The program cannot load or save in GameFolders\n\n" +
|
|
|
|
|
"Please submit a bug report, adding your complete SC game folder structure", scp );
|
|
|
|
|
|
2016-05-27 15:13:24 +00:00
|
|
|
|
} else {
|
2016-05-31 18:56:48 +00:00
|
|
|
|
// regular game folder
|
2016-05-27 15:13:24 +00:00
|
|
|
|
scpX = Path.Combine( scp, "Public" );
|
2016-05-31 18:56:48 +00:00
|
|
|
|
if ( Directory.Exists( scpX ) ) return scpX;
|
|
|
|
|
|
2016-05-27 15:13:24 +00:00
|
|
|
|
// SC 2.2.2+ did not found it so try Live now
|
|
|
|
|
scpX = Path.Combine( scp, "Live" );
|
2016-05-31 18:56:48 +00:00
|
|
|
|
if ( Directory.Exists( scpX ) ) return scpX;
|
2016-05-27 15:13:24 +00:00
|
|
|
|
|
2016-05-31 18:56:48 +00:00
|
|
|
|
// else not found regular one
|
|
|
|
|
// Issue a warning here to let the user know
|
|
|
|
|
issue = string.Format( "Cannot find the SC Client Path !!\n\n" +
|
2016-05-27 15:13:24 +00:00
|
|
|
|
"Tried to look for:\n" +
|
|
|
|
|
"{0}\\Public or \n" +
|
2016-05-31 18:56:48 +00:00
|
|
|
|
"{0}\\Live \n" +
|
2016-05-27 15:13:24 +00:00
|
|
|
|
"The program cannot load or save in GameFolders\n\n" +
|
2016-05-31 18:56:48 +00:00
|
|
|
|
"Please submit a bug report, adding your complete SC game folder structure", scp );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.WarnFormat( "SCClientPath - StarCitizen\\Public, StarCitizen\\Live or for PTU \\Test subfolder does not exist: {0}", scp );
|
2015-12-26 22:16:25 +00:00
|
|
|
|
|
2016-05-31 18:56:48 +00:00
|
|
|
|
// Issue a warning here to let the user know
|
|
|
|
|
if ( !hasInformed ) System.Windows.Forms.MessageBox.Show( issue, "Cannot find SC Client Path !!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation );
|
2016-05-27 15:13:24 +00:00
|
|
|
|
hasInformed = true;
|
2014-12-22 21:37:32 +00:00
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-06-27 23:42:48 +00:00
|
|
|
|
/// <summary>
|
2015-08-10 21:18:21 +00:00
|
|
|
|
/// Returns the SC ClientData path
|
|
|
|
|
/// AC 1.1.6: E:\G\StarCitizen\StarCitizen\Public\Data
|
2014-06-27 23:42:48 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
static public String SCClientDataPath
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-07-05 20:46:58 +00:00
|
|
|
|
log.Debug( "SCClientDataPath - Entry" );
|
2014-12-22 21:37:32 +00:00
|
|
|
|
String scp = SCClientPath;
|
2014-08-31 13:05:56 +00:00
|
|
|
|
if ( String.IsNullOrEmpty( scp ) ) return ""; // no valid one can be found
|
2016-05-31 18:56:48 +00:00
|
|
|
|
|
2014-06-27 23:42:48 +00:00
|
|
|
|
scp = Path.Combine( scp, "Data" );
|
2016-05-31 18:56:48 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
// scp += "X"; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
2014-08-31 13:05:56 +00:00
|
|
|
|
if ( Directory.Exists( scp ) ) return scp;
|
|
|
|
|
|
2015-08-10 21:18:21 +00:00
|
|
|
|
log.WarnFormat( "SCClientDataPath - StarCitizen\\Public\\Data subfolder does not exist: {0}", scp );
|
2014-08-31 13:05:56 +00:00
|
|
|
|
return "";
|
2014-06-27 23:42:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2015-08-10 21:18:21 +00:00
|
|
|
|
/// Returns the SC ClientData path
|
|
|
|
|
/// AC 1.1.6: E:\G\StarCitizen\StarCitizen\Public\USER
|
2014-06-27 23:42:48 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
static public String SCClientUSERPath
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-07-05 20:46:58 +00:00
|
|
|
|
log.Debug( "SCClientUSERPath - Entry" );
|
2014-12-22 21:37:32 +00:00
|
|
|
|
String scp = SCClientPath;
|
2014-06-27 23:42:48 +00:00
|
|
|
|
if ( String.IsNullOrEmpty( scp ) ) return "";
|
|
|
|
|
//
|
|
|
|
|
scp = Path.Combine( scp, "USER" );
|
2016-05-31 18:56:48 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
// scp += "X"; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
2014-08-31 13:05:56 +00:00
|
|
|
|
if ( Directory.Exists( scp ) ) return scp;
|
|
|
|
|
|
2015-08-10 21:18:21 +00:00
|
|
|
|
log.WarnFormat( "SCClientUSERPath - StarCitizen\\Public\\USER subfolder does not exist: {0}", scp );
|
2014-08-31 13:05:56 +00:00
|
|
|
|
return "";
|
2014-06-27 23:42:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-12-22 21:37:32 +00:00
|
|
|
|
/// <summary>
|
2015-08-10 21:18:21 +00:00
|
|
|
|
/// Returns the SC ClientData path
|
|
|
|
|
/// AC 1.1.6: E:\G\StarCitizen\StarCitizen\Public
|
2014-12-22 21:37:32 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
static public String SCClientLogsPath
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-12-22 21:37:32 +00:00
|
|
|
|
log.Debug( "SCClientLogsPath - Entry" );
|
|
|
|
|
String scp = SCClientPath;
|
|
|
|
|
if ( String.IsNullOrEmpty( scp ) ) return "";
|
2016-05-31 18:56:48 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
// scp += "X"; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
2014-12-22 21:37:32 +00:00
|
|
|
|
if ( Directory.Exists( scp ) ) return scp;
|
|
|
|
|
|
2015-08-10 21:18:21 +00:00
|
|
|
|
log.WarnFormat( "SCClientLogsPath - StarCitizen\\Public subfolder does not exist: {0}", scp );
|
2014-12-22 21:37:32 +00:00
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-06-28 21:50:07 +00:00
|
|
|
|
/// <summary>
|
2015-08-10 21:18:21 +00:00
|
|
|
|
/// Returns the SC ClientData path
|
|
|
|
|
/// AC 1.1.6: E:\G\StarCitizen\StarCitizen\Public\USER\Controls\Mappings
|
2014-06-28 21:50:07 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
static public String SCClientMappingPath
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-07-05 20:46:58 +00:00
|
|
|
|
log.Debug( "SCClientMappingPath - Entry" );
|
2015-02-28 22:43:52 +00:00
|
|
|
|
String scp = SCClientUSERPath; // AC1.03 new here
|
2014-06-28 21:50:07 +00:00
|
|
|
|
if ( String.IsNullOrEmpty( scp ) ) return "";
|
|
|
|
|
//
|
|
|
|
|
scp = Path.Combine( scp, "Controls" );
|
|
|
|
|
scp = Path.Combine( scp, "Mappings" );
|
2016-05-31 18:56:48 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
// scp += "X"; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
2014-08-31 13:05:56 +00:00
|
|
|
|
if ( Directory.Exists( scp ) ) return scp;
|
|
|
|
|
|
2015-08-10 21:18:21 +00:00
|
|
|
|
log.WarnFormat( "SCClientMappingPath - StarCitizen\\Public\\USER\\Controls\\Mappings subfolder does not exist: {0}", scp );
|
2014-08-31 13:05:56 +00:00
|
|
|
|
return "";
|
2014-06-28 21:50:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-06-27 23:42:48 +00:00
|
|
|
|
/// <summary>
|
2015-08-10 21:18:21 +00:00
|
|
|
|
/// Returns the SC GameData.pak file path
|
|
|
|
|
/// AC 1.1.6: E:\G\StarCitizen\StarCitizen\Public\Data\GameData.pak
|
2014-06-27 23:42:48 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
static public String SCGameData_pak
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-07-05 20:46:58 +00:00
|
|
|
|
log.Debug( "SCGameData_pak - Entry" );
|
2014-06-27 23:42:48 +00:00
|
|
|
|
String scp = SCClientDataPath;
|
|
|
|
|
if ( String.IsNullOrEmpty( scp ) ) return "";
|
|
|
|
|
//
|
|
|
|
|
scp = Path.Combine( scp, "GameData.pak" );
|
2016-05-31 18:56:48 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
// scp += "X"; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
2014-08-31 13:05:56 +00:00
|
|
|
|
if ( File.Exists( scp ) ) return scp;
|
|
|
|
|
|
2015-08-10 21:18:21 +00:00
|
|
|
|
log.WarnFormat( "SCGameData_pak - StarCitizen\\Public\\Data\\GameData.pak file does not exist: {0}", scp );
|
2014-08-31 13:05:56 +00:00
|
|
|
|
return "";
|
2014-06-27 23:42:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-03-06 16:22:16 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the SC DataXML.pak file path
|
|
|
|
|
/// SC Alpha 2.2: E:\G\StarCitizen\StarCitizen\Public\Data\DataXML.pak (contains the binary XML now)
|
|
|
|
|
/// </summary>
|
|
|
|
|
static public String SCDataXML_pak
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2016-03-06 16:22:16 +00:00
|
|
|
|
log.Debug( "SCDataXML_pak - Entry" );
|
|
|
|
|
String scp = SCClientDataPath;
|
|
|
|
|
if ( String.IsNullOrEmpty( scp ) ) return "";
|
|
|
|
|
//
|
|
|
|
|
scp = Path.Combine( scp, "DataXML.pak" );
|
2016-05-31 18:56:48 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
//***************************************
|
|
|
|
|
// scp += "X"; // TEST not found (COMMENT OUT FOR PRODUCTIVE BUILD)
|
|
|
|
|
//***************************************
|
|
|
|
|
#endif
|
2016-03-06 16:22:16 +00:00
|
|
|
|
if ( File.Exists( scp ) ) return scp;
|
|
|
|
|
|
|
|
|
|
log.WarnFormat( "SCDataXML_pak - StarCitizen\\Public\\Data\\DataXML.pak file does not exist: {0}", scp );
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-12-22 21:37:32 +00:00
|
|
|
|
/// <summary>
|
2015-08-10 21:18:21 +00:00
|
|
|
|
/// Returns the SC log file path to the latest logfile
|
|
|
|
|
/// AC 1.1.6: E:\G\StarCitizen\StarCitizen\Public\Game.log NOTE: 1.1.6 does not longer contain the needed entries .-((
|
2014-12-22 21:37:32 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
static public String SCLastLog
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-12-22 21:37:32 +00:00
|
|
|
|
log.Debug( "SCLastLog - Entry" );
|
|
|
|
|
String scp = SCClientLogsPath;
|
|
|
|
|
if ( String.IsNullOrEmpty( scp ) ) return "";
|
|
|
|
|
//
|
|
|
|
|
try {
|
|
|
|
|
var files = Directory.EnumerateFiles( scp, "*.log", SearchOption.TopDirectoryOnly );
|
|
|
|
|
DateTime newestT = DateTime.FromFileTime( 1 ); // very old...
|
|
|
|
|
String newestF = "";
|
|
|
|
|
foreach ( String f in files ) {
|
|
|
|
|
try {
|
|
|
|
|
FileInfo finfo = new FileInfo( f );
|
|
|
|
|
if ( finfo.LastWriteTime > newestT ) {
|
|
|
|
|
newestF = f; newestT = finfo.LastWriteTime;
|
|
|
|
|
}
|
2016-05-31 18:56:48 +00:00
|
|
|
|
} catch {
|
2014-12-22 21:37:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return newestF;
|
2016-05-31 18:56:48 +00:00
|
|
|
|
} catch {
|
2014-12-22 21:37:32 +00:00
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-06-27 23:42:48 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the relative path of DefaultProfile.xml
|
2016-03-06 16:22:16 +00:00
|
|
|
|
/// SC Alpha 2.2: still true .. but contains the binary XML now
|
2014-06-27 23:42:48 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
static public String DefaultProfilePath_rel
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-07-05 20:46:58 +00:00
|
|
|
|
log.Debug( "DefaultProfilePath_rel - Entry" );
|
2014-06-27 23:42:48 +00:00
|
|
|
|
return @"Libs\Config";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2014-06-28 20:31:31 +00:00
|
|
|
|
/// Returns the name part of the DefaultProfile w/o extension...
|
2016-03-06 16:22:16 +00:00
|
|
|
|
/// SC Alpha 2.2: still true .. but contains the binary XML now
|
2014-06-27 23:42:48 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
static public String DefaultProfileName
|
|
|
|
|
{
|
2016-05-31 18:56:48 +00:00
|
|
|
|
get {
|
2014-07-05 20:46:58 +00:00
|
|
|
|
log.Debug( "DefaultProfileName - Entry" );
|
2014-06-28 20:31:31 +00:00
|
|
|
|
return @"defaultProfile";
|
2014-06-27 23:42:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|