Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Save location changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
barisyild committed Sep 13, 2018
1 parent a4a4a71 commit c6ab0fc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions OnPSApp/Models/GameStatisticModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class GameStatisticModel

public GameStatisticModel(String onlineId, String platform, String npTitleId, String titleName, String npTitleIconUrl)
{
string folderPath = Application.StartupPath + "/profiles/"+ onlineId + "/"+platform+"/";
string folderPath = Program.SavePath + "/profiles/"+ onlineId + "/"+platform+"/";

bool exists = System.IO.Directory.Exists(folderPath);

Expand Down Expand Up @@ -117,7 +117,7 @@ public void SaveData()

public static ArrayList GetAvailablePlatforms(String onlineId)
{
String Path = Application.StartupPath + @"\profiles\" + onlineId;
String Path = Program.SavePath + @"\profiles\" + onlineId;
if (!Directory.Exists(Path))
{
Directory.CreateDirectory(Path);
Expand All @@ -136,7 +136,7 @@ public static ArrayList GetAvailablePlatforms(String onlineId)

public static ArrayList GetFiles(String onlineId, String platform)
{
String Path = Application.StartupPath + @"\profiles\" + onlineId + @"\" + platform + @"\";
String Path = Program.SavePath + @"\profiles\" + onlineId + @"\" + platform + @"\";
if (!Directory.Exists(Path))
{
Directory.CreateDirectory(Path);
Expand Down
12 changes: 6 additions & 6 deletions OnPSApp/Other/IniFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace OnPS.Other
class IniFile // revision 11
{
string Path;
string EXE = Assembly.GetExecutingAssembly().GetName().Name;
string ApplicationName = "OnPS";

[DllImport("kernel32", CharSet = CharSet.Unicode)]
static extern long WritePrivateProfileString(string Section, string Key, string Value, string FilePath);
Expand All @@ -19,29 +19,29 @@ class IniFile // revision 11

public IniFile(string IniPath = null)
{
Path = new FileInfo(IniPath + EXE + ".ini").FullName.ToString();
Path = new FileInfo(IniPath + ApplicationName + ".ini").FullName.ToString();
}

public string Read(string Key, string Section = null)
{
var RetVal = new StringBuilder(255);
GetPrivateProfileString(Section ?? EXE, Key, "", RetVal, 255, Path);
GetPrivateProfileString(Section ?? ApplicationName, Key, "", RetVal, 255, Path);
return RetVal.ToString();
}

public void Write(string Key, string Value, string Section = null)
{
WritePrivateProfileString(Section ?? EXE, Key, Value, Path);
WritePrivateProfileString(Section ?? ApplicationName, Key, Value, Path);
}

public void DeleteKey(string Key, string Section = null)
{
Write(Key, null, Section ?? EXE);
Write(Key, null, Section ?? ApplicationName);
}

public void DeleteSection(string Section = null)
{
Write(null, null, Section ?? EXE);
Write(null, null, Section ?? ApplicationName);
}

public bool KeyExists(string Key, string Section = null)
Expand Down
7 changes: 6 additions & 1 deletion OnPSApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace OnPS
{
static class Program
{
public static String SavePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/OnPS/";
public const String VERSION = "1.0.0.0";
public static NotifyIcon notifyIcon;
public static bool steamAvailable = false;
Expand Down Expand Up @@ -59,14 +60,18 @@ static void Main(string[] args)
AllocConsole();
}
}
bool exists = System.IO.Directory.Exists(SavePath);

if (!exists)
System.IO.Directory.CreateDirectory(SavePath);
using (mutex = new Mutex(false, appGuid))
{
if (!mutex.WaitOne(0, false))
{
MessageBox.Show("OnPS already running.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
iniFile = new IniFile(Application.StartupPath+@"\");
iniFile = new IniFile(SavePath + @"\");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate (object senderr, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) {
Expand Down

0 comments on commit c6ab0fc

Please sign in to comment.