Permalink
Browse files

Save location changed.

  • Loading branch information...
barisyild committed Sep 13, 2018
1 parent a4a4a71 commit c6ab0fc06fb822a010f085a96b0c421628e068b1
Showing with 15 additions and 10 deletions.
  1. +3 −3 OnPSApp/Models/GameStatisticModel.cs
  2. +6 −6 OnPSApp/Other/IniFile.cs
  3. +6 −1 OnPSApp/Program.cs
@@ -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);

@@ -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);
@@ -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);
@@ -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);
@@ -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)
@@ -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;
@@ -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) {

0 comments on commit c6ab0fc

Please sign in to comment.