mirror of
https://github.com/psforever/GameLauncher.git
synced 2026-01-19 18:24:45 +00:00
Move items around, exit code, tweaks
This commit is contained in:
parent
c280f72de1
commit
71665d8718
45
PS2ModLauncher/LauncherForm.Designer.cs
generated
45
PS2ModLauncher/LauncherForm.Designer.cs
generated
|
|
@ -41,6 +41,10 @@
|
|||
this.launchMessage = new System.Windows.Forms.Label();
|
||||
this.spinner = new System.Windows.Forms.PictureBox();
|
||||
this.ps_consoleOutput = new System.Windows.Forms.TextBox();
|
||||
this.outputRightClick = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.selectAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.copy = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveToFile = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
|
|
@ -52,6 +56,7 @@
|
|||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.spinner)).BeginInit();
|
||||
this.outputRightClick.SuspendLayout();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.toolStripContainer1.ContentPanel.SuspendLayout();
|
||||
|
|
@ -186,6 +191,7 @@
|
|||
// ps_consoleOutput
|
||||
//
|
||||
this.ps_consoleOutput.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.ps_consoleOutput.ContextMenuStrip = this.outputRightClick;
|
||||
this.ps_consoleOutput.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ps_consoleOutput.Location = new System.Drawing.Point(0, 0);
|
||||
this.ps_consoleOutput.Multiline = true;
|
||||
|
|
@ -196,6 +202,39 @@
|
|||
this.ps_consoleOutput.TabIndex = 1;
|
||||
this.ps_consoleOutput.WordWrap = false;
|
||||
//
|
||||
// outputRightClick
|
||||
//
|
||||
this.outputRightClick.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.selectAll,
|
||||
this.copy,
|
||||
this.saveToFile});
|
||||
this.outputRightClick.Name = "outputRightClick";
|
||||
this.outputRightClick.Size = new System.Drawing.Size(165, 70);
|
||||
//
|
||||
// selectAll
|
||||
//
|
||||
this.selectAll.Name = "selectAll";
|
||||
this.selectAll.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
|
||||
this.selectAll.Size = new System.Drawing.Size(164, 22);
|
||||
this.selectAll.Text = "Select All";
|
||||
this.selectAll.Click += new System.EventHandler(this.selectAll_Click);
|
||||
//
|
||||
// copy
|
||||
//
|
||||
this.copy.Name = "copy";
|
||||
this.copy.ShortcutKeyDisplayString = "";
|
||||
this.copy.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
|
||||
this.copy.Size = new System.Drawing.Size(164, 22);
|
||||
this.copy.Text = "Copy";
|
||||
this.copy.Click += new System.EventHandler(this.copy_Click);
|
||||
//
|
||||
// saveToFile
|
||||
//
|
||||
this.saveToFile.Name = "saveToFile";
|
||||
this.saveToFile.Size = new System.Drawing.Size(164, 22);
|
||||
this.saveToFile.Text = "Save to file ...";
|
||||
this.saveToFile.Click += new System.EventHandler(this.saveToFile_Click);
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
|
|
@ -267,7 +306,6 @@
|
|||
this.Name = "LauncherForm";
|
||||
this.Text = "PS1 GameLauncher";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LauncherForm_FormClosing);
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.ResizeBegin += new System.EventHandler(this.LauncherForm_ResizeBegin);
|
||||
this.ResizeEnd += new System.EventHandler(this.LauncherForm_ResizeEnd);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
|
|
@ -277,6 +315,7 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.spinner)).EndInit();
|
||||
this.outputRightClick.ResumeLayout(false);
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
|
|
@ -307,6 +346,10 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
|
||||
private System.Windows.Forms.Button hideShowOutput;
|
||||
private System.Windows.Forms.PictureBox spinner;
|
||||
private System.Windows.Forms.ContextMenuStrip outputRightClick;
|
||||
private System.Windows.Forms.ToolStripMenuItem selectAll;
|
||||
private System.Windows.Forms.ToolStripMenuItem copy;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveToFile;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,13 +53,13 @@ namespace PSLauncher
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Debugger.IsAttached)
|
||||
Settings.Default.Reset();
|
||||
//if (Debugger.IsAttached)
|
||||
// Settings.Default.Reset();
|
||||
|
||||
string psDefault = getDefaultDirectory();
|
||||
string psDefault = Util.getDefaultPlanetSideDirectory();
|
||||
|
||||
// first run with no settings or invalid starting path
|
||||
if (Settings.Default.PSPath == "" || !checkDirForPlanetSide(Settings.Default.PSPath))
|
||||
if (Settings.Default.PSPath == "" || !Util.checkDirForPlanetSide(Settings.Default.PSPath))
|
||||
{
|
||||
Settings.Default.PSPath = psDefault;
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ namespace PSLauncher
|
|||
return;
|
||||
}
|
||||
|
||||
if (!checkDirForPlanetSide(path))
|
||||
if (!Util.checkDirForPlanetSide(path))
|
||||
{
|
||||
setErrorMessage("Invalid planetside exe");
|
||||
return;
|
||||
|
|
@ -565,12 +565,9 @@ namespace PSLauncher
|
|||
|
||||
void ps_Exited(object sender, EventArgs e)
|
||||
{
|
||||
gameStopped();
|
||||
}
|
||||
addLine(String.Format("ProcessEnd: exit code 0x{0}", psProcess.ExitCode.ToString("X8")));
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
gameStopped();
|
||||
}
|
||||
|
||||
private void progressShown(bool shown)
|
||||
|
|
@ -636,6 +633,7 @@ namespace PSLauncher
|
|||
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
this.MaximizeBox = false;
|
||||
this.FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -644,11 +642,12 @@ namespace PSLauncher
|
|||
this.MaximumSize = new System.Drawing.Size(0, 0);
|
||||
|
||||
if (oldSize.IsEmpty)
|
||||
this.Size = new System.Drawing.Size(400, 500); // default size to expand to
|
||||
this.Size = new System.Drawing.Size(600, 500); // default size to expand to
|
||||
else
|
||||
this.Size = oldSize;
|
||||
|
||||
this.MaximizeBox = true;
|
||||
this.FormBorderStyle = FormBorderStyle.Sizable;
|
||||
}
|
||||
|
||||
splitContainer1.Panel2Collapsed = !open;
|
||||
|
|
@ -688,91 +687,40 @@ namespace PSLauncher
|
|||
a.ShowDialog(this);
|
||||
}
|
||||
|
||||
private static string getDefaultDirectory()
|
||||
private void selectAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
RegistryKey key = null;
|
||||
string psFolder = "";
|
||||
this.ps_consoleOutput.Focus();
|
||||
this.ps_consoleOutput.SelectAll();
|
||||
}
|
||||
|
||||
// non-steam install
|
||||
key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\App Paths\LaunchPad.exe");
|
||||
private void copy_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.ps_consoleOutput.Copy();
|
||||
}
|
||||
|
||||
if (key != null && key.GetValue("") != null)
|
||||
private void saveToFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog saveFile = new SaveFileDialog();
|
||||
|
||||
saveFile.FileName = "";
|
||||
saveFile.Filter = "Output file (*.txt) | *.txt";
|
||||
saveFile.AddExtension = true;
|
||||
saveFile.DefaultExt = ".txt";
|
||||
|
||||
DialogResult result = saveFile.ShowDialog();
|
||||
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
String defaultDirectory;
|
||||
defaultDirectory = key.GetValue("").ToString();
|
||||
defaultDirectory = Path.GetDirectoryName(defaultDirectory);
|
||||
FileStream f = File.OpenWrite(saveFile.FileName);
|
||||
|
||||
// verify that we aren't mistakingly returning a PlanetSide 2 directory...
|
||||
if (Directory.Exists(defaultDirectory) && checkDirForPlanetSide(defaultDirectory))
|
||||
return defaultDirectory;
|
||||
var encoder = new ASCIIEncoding();
|
||||
var header = encoder.GetBytes(String.Format("{0} log output {1}" + Environment.NewLine, this.Text, DateTime.Now.ToString()));
|
||||
var data = new ASCIIEncoding().GetBytes(this.ps_consoleOutput.Text);
|
||||
|
||||
// try to go up a directory and find the PlanetSide folder
|
||||
string upOne = Directory.GetParent(defaultDirectory).FullName;
|
||||
psFolder = Path.Combine(upOne, "Planetside");
|
||||
|
||||
if (Directory.Exists(psFolder) && checkDirForPlanetSide(psFolder))
|
||||
return psFolder;
|
||||
f.Write(header, 0, header.Length);
|
||||
f.Write(data, 0, data.Length);
|
||||
f.Close();
|
||||
}
|
||||
|
||||
// worth a shot!
|
||||
psFolder = Path.Combine(ProgramFilesx86(), "Sony\\PlanetSide");
|
||||
|
||||
if (Directory.Exists(psFolder) && checkDirForPlanetSide(psFolder))
|
||||
return psFolder;
|
||||
|
||||
// HACK: our last attempt. Should work on Win7 and above with and updated launcher
|
||||
psFolder = "C:\\Users\\Public\\Sony Online Entertainment\\Installed Games\\Planetside";
|
||||
|
||||
if (Directory.Exists(psFolder) && checkDirForPlanetSide(psFolder))
|
||||
return psFolder;
|
||||
|
||||
// give up
|
||||
return "";
|
||||
}
|
||||
|
||||
private static bool checkDirForPlanetSide(string dir)
|
||||
{
|
||||
return File.Exists(Path.Combine(dir, SettingsForm.PS_EXE_NAME));
|
||||
}
|
||||
|
||||
private static string ProgramFilesx86()
|
||||
{
|
||||
if (8 == IntPtr.Size
|
||||
|| (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("ProgramFiles(x86)");
|
||||
}
|
||||
|
||||
return Environment.GetEnvironmentVariable("ProgramFiles");
|
||||
}
|
||||
}
|
||||
|
||||
public static class QueryExtensions
|
||||
{
|
||||
public static string ToQueryString(this NameValueCollection nvc)
|
||||
{
|
||||
IEnumerable<string> segments = from key in nvc.AllKeys
|
||||
from value in nvc.GetValues(key)
|
||||
select string.Format("{0}={1}", key, value);
|
||||
return string.Join("&", segments);
|
||||
}
|
||||
}
|
||||
public static class Win32
|
||||
{
|
||||
|
||||
public const int WM_SETREDRAW = 0x0b;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
public static void SuspendPainting(IntPtr hWnd)
|
||||
{
|
||||
SendMessage(hWnd, WM_SETREDRAW, (IntPtr)0, IntPtr.Zero);
|
||||
}
|
||||
|
||||
public static void ResumePainting(IntPtr hWnd)
|
||||
{
|
||||
SendMessage(hWnd, WM_SETREDRAW, (IntPtr)1, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,6 +165,9 @@
|
|||
nQAGArBTt8R8mLuyPyEAOwAAAAAAAAAAAA==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="outputRightClick.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>511, 9</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>224, 17</value>
|
||||
</metadata>
|
||||
|
|
|
|||
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// 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.0.4")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.4")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
|
|
|
|||
22
PS2ModLauncher/SettingsForm.Designer.cs
generated
22
PS2ModLauncher/SettingsForm.Designer.cs
generated
|
|
@ -30,7 +30,7 @@
|
|||
{
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.selectDirectory = new System.Windows.Forms.Button();
|
||||
this.planetside2PathTextField = new System.Windows.Forms.TextBox();
|
||||
this.planetsidePathTextField = new System.Windows.Forms.TextBox();
|
||||
this.launchArgs = new System.Windows.Forms.TextBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.planetsideVersion = new System.Windows.Forms.Label();
|
||||
|
|
@ -60,12 +60,12 @@
|
|||
//
|
||||
// planetside2PathTextField
|
||||
//
|
||||
this.planetside2PathTextField.Location = new System.Drawing.Point(12, 33);
|
||||
this.planetside2PathTextField.Name = "planetside2PathTextField";
|
||||
this.planetside2PathTextField.ReadOnly = true;
|
||||
this.planetside2PathTextField.Size = new System.Drawing.Size(222, 20);
|
||||
this.planetside2PathTextField.TabIndex = 8;
|
||||
this.planetside2PathTextField.Text = "Path to PlanetSide folder";
|
||||
this.planetsidePathTextField.Location = new System.Drawing.Point(12, 33);
|
||||
this.planetsidePathTextField.Name = "planetside2PathTextField";
|
||||
this.planetsidePathTextField.ReadOnly = true;
|
||||
this.planetsidePathTextField.Size = new System.Drawing.Size(222, 20);
|
||||
this.planetsidePathTextField.TabIndex = 8;
|
||||
this.planetsidePathTextField.Text = "Path to PlanetSide folder";
|
||||
//
|
||||
// launchArgs
|
||||
//
|
||||
|
|
@ -90,6 +90,8 @@
|
|||
this.planetsideVersion.Name = "planetsideVersion";
|
||||
this.planetsideVersion.Size = new System.Drawing.Size(132, 21);
|
||||
this.planetsideVersion.TabIndex = 25;
|
||||
this.planetsideVersion.Text = "Version";
|
||||
this.planetsideVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// clearOnLaunch
|
||||
//
|
||||
|
|
@ -118,14 +120,14 @@
|
|||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(244, 211);
|
||||
this.Controls.Add(this.planetsideVersion);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.clearOnLaunch);
|
||||
this.Controls.Add(this.planetsideVersion);
|
||||
this.Controls.Add(this.launchArgs);
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.selectDirectory);
|
||||
this.Controls.Add(this.planetside2PathTextField);
|
||||
this.Controls.Add(this.planetsidePathTextField);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(260, 250);
|
||||
|
|
@ -142,7 +144,7 @@
|
|||
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button selectDirectory;
|
||||
private System.Windows.Forms.TextBox planetside2PathTextField;
|
||||
private System.Windows.Forms.TextBox planetsidePathTextField;
|
||||
private System.Windows.Forms.TextBox launchArgs;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label planetsideVersion;
|
||||
|
|
|
|||
|
|
@ -20,25 +20,27 @@ namespace PSLauncher
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
planetside2PathTextField.Text = Settings.Default.PSPath;
|
||||
planetsidePathTextField.Text = Settings.Default.PSPath;
|
||||
launchArgs.Text = Settings.Default.ExtraArgs;
|
||||
clearOnLaunch.Checked = Settings.Default.ClearOutputOnLaunch;
|
||||
|
||||
checkPath(Path.Combine(planetsidePathTextField.Text, PS_EXE_NAME), false);
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
// set the starting path for the dialog
|
||||
if (planetside2PathTextField.Text != "")
|
||||
findPTRDirDialogue.SelectedPath = planetside2PathTextField.Text;
|
||||
|
||||
DialogResult r = findPTRDirDialogue.ShowDialog();
|
||||
if (planetsidePathTextField.Text != "")
|
||||
findPTRDirDialogue.SelectedPath = planetsidePathTextField.Text;
|
||||
|
||||
DialogResult r = findPTRDirDialogue.ShowDialog(this);
|
||||
|
||||
if (r == DialogResult.OK)
|
||||
{
|
||||
// combine the folder name with the standard PS.exe name
|
||||
string psPath = Path.Combine(findPTRDirDialogue.SelectedPath, PS_EXE_NAME);
|
||||
|
||||
planetside2PathTextField.Text = findPTRDirDialogue.SelectedPath;
|
||||
planetsidePathTextField.Text = findPTRDirDialogue.SelectedPath;
|
||||
|
||||
if (checkPath(psPath))
|
||||
Settings.Default.PSPath = findPTRDirDialogue.SelectedPath;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace PSLauncher
|
||||
|
|
@ -20,4 +23,94 @@ namespace PSLauncher
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class QueryExtensions
|
||||
{
|
||||
public static string ToQueryString(this NameValueCollection nvc)
|
||||
{
|
||||
IEnumerable<string> segments = from key in nvc.AllKeys
|
||||
from value in nvc.GetValues(key)
|
||||
select string.Format("{0}={1}", key, value);
|
||||
return string.Join("&", segments);
|
||||
}
|
||||
}
|
||||
public static class Win32
|
||||
{
|
||||
|
||||
public const int WM_SETREDRAW = 0x0b;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
public static void SuspendPainting(IntPtr hWnd)
|
||||
{
|
||||
SendMessage(hWnd, WM_SETREDRAW, (IntPtr)0, IntPtr.Zero);
|
||||
}
|
||||
|
||||
public static void ResumePainting(IntPtr hWnd)
|
||||
{
|
||||
SendMessage(hWnd, WM_SETREDRAW, (IntPtr)1, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Util
|
||||
{
|
||||
public static string getDefaultPlanetSideDirectory()
|
||||
{
|
||||
Microsoft.Win32.RegistryKey key = null;
|
||||
string psFolder = "";
|
||||
|
||||
// non-steam install
|
||||
key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\App Paths\LaunchPad.exe");
|
||||
|
||||
if (key != null && key.GetValue("") != null)
|
||||
{
|
||||
String defaultDirectory;
|
||||
defaultDirectory = key.GetValue("").ToString();
|
||||
defaultDirectory = Path.GetDirectoryName(defaultDirectory);
|
||||
|
||||
// verify that we aren't mistakingly returning a PlanetSide 2 directory...
|
||||
if (Directory.Exists(defaultDirectory) && checkDirForPlanetSide(defaultDirectory))
|
||||
return defaultDirectory;
|
||||
|
||||
// try to go up a directory and find the PlanetSide folder
|
||||
string upOne = Directory.GetParent(defaultDirectory).FullName;
|
||||
psFolder = Path.Combine(upOne, "Planetside");
|
||||
|
||||
if (Directory.Exists(psFolder) && checkDirForPlanetSide(psFolder))
|
||||
return psFolder;
|
||||
}
|
||||
|
||||
// worth a shot!
|
||||
psFolder = Path.Combine(ProgramFilesx86(), "Sony\\PlanetSide");
|
||||
|
||||
if (Directory.Exists(psFolder) && checkDirForPlanetSide(psFolder))
|
||||
return psFolder;
|
||||
|
||||
// HACK: our last attempt. Should work on Win7 and above with and updated launcher
|
||||
psFolder = "C:\\Users\\Public\\Sony Online Entertainment\\Installed Games\\Planetside";
|
||||
|
||||
if (Directory.Exists(psFolder) && checkDirForPlanetSide(psFolder))
|
||||
return psFolder;
|
||||
|
||||
// give up
|
||||
return "";
|
||||
}
|
||||
|
||||
public static bool checkDirForPlanetSide(string dir)
|
||||
{
|
||||
return File.Exists(Path.Combine(dir, SettingsForm.PS_EXE_NAME));
|
||||
}
|
||||
|
||||
public static string ProgramFilesx86()
|
||||
{
|
||||
if (8 == IntPtr.Size
|
||||
|| (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("ProgramFiles(x86)");
|
||||
}
|
||||
|
||||
return Environment.GetEnvironmentVariable("ProgramFiles");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue