Completely comment out GUI play stats code
This commit is contained in:
parent
92efd41197
commit
50b07f3b92
2 changed files with 217 additions and 213 deletions
|
@ -384,67 +384,69 @@ namespace Ryujinx.UI
|
|||
{
|
||||
return new string[] { "Unknown", "Unknown" };
|
||||
|
||||
try
|
||||
{
|
||||
string[] playedData = new string[2];
|
||||
string savePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", UserId, TitleId);
|
||||
// TODO: Update GUI to store these files in another location
|
||||
|
||||
if (File.Exists(Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||
{
|
||||
Directory.CreateDirectory(savePath);
|
||||
using (FileStream file = File.OpenWrite(Path.Combine(savePath, "TimePlayed.dat")))
|
||||
{
|
||||
file.Write(Encoding.ASCII.GetBytes("0"));
|
||||
}
|
||||
}
|
||||
using (FileStream fs = File.OpenRead(Path.Combine(savePath, "TimePlayed.dat")))
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(fs))
|
||||
{
|
||||
float timePlayed = float.Parse(sr.ReadLine());
|
||||
//try
|
||||
//{
|
||||
// string[] playedData = new string[2];
|
||||
// string savePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", UserId, TitleId);
|
||||
|
||||
if (timePlayed < SecondsPerMinute)
|
||||
{
|
||||
playedData[0] = $"{timePlayed}s";
|
||||
}
|
||||
else if (timePlayed < SecondsPerHour)
|
||||
{
|
||||
playedData[0] = $"{Math.Round(timePlayed / SecondsPerMinute, 2, MidpointRounding.AwayFromZero)} mins";
|
||||
}
|
||||
else if (timePlayed < SecondsPerDay)
|
||||
{
|
||||
playedData[0] = $"{Math.Round(timePlayed / SecondsPerHour , 2, MidpointRounding.AwayFromZero)} hrs";
|
||||
}
|
||||
else
|
||||
{
|
||||
playedData[0] = $"{Math.Round(timePlayed / SecondsPerDay , 2, MidpointRounding.AwayFromZero)} days";
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (File.Exists(Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||
// {
|
||||
// Directory.CreateDirectory(savePath);
|
||||
// using (FileStream file = File.OpenWrite(Path.Combine(savePath, "TimePlayed.dat")))
|
||||
// {
|
||||
// file.Write(Encoding.ASCII.GetBytes("0"));
|
||||
// }
|
||||
// }
|
||||
// using (FileStream fs = File.OpenRead(Path.Combine(savePath, "TimePlayed.dat")))
|
||||
// {
|
||||
// using (StreamReader sr = new StreamReader(fs))
|
||||
// {
|
||||
// float timePlayed = float.Parse(sr.ReadLine());
|
||||
|
||||
if (File.Exists(Path.Combine(savePath, "LastPlayed.dat")) == false)
|
||||
{
|
||||
Directory.CreateDirectory(savePath);
|
||||
using (FileStream file = File.OpenWrite(Path.Combine(savePath, "LastPlayed.dat")))
|
||||
{
|
||||
file.Write(Encoding.ASCII.GetBytes("Never"));
|
||||
}
|
||||
}
|
||||
// if (timePlayed < SecondsPerMinute)
|
||||
// {
|
||||
// playedData[0] = $"{timePlayed}s";
|
||||
// }
|
||||
// else if (timePlayed < SecondsPerHour)
|
||||
// {
|
||||
// playedData[0] = $"{Math.Round(timePlayed / SecondsPerMinute, 2, MidpointRounding.AwayFromZero)} mins";
|
||||
// }
|
||||
// else if (timePlayed < SecondsPerDay)
|
||||
// {
|
||||
// playedData[0] = $"{Math.Round(timePlayed / SecondsPerHour , 2, MidpointRounding.AwayFromZero)} hrs";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// playedData[0] = $"{Math.Round(timePlayed / SecondsPerDay , 2, MidpointRounding.AwayFromZero)} days";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
using (FileStream fs = File.OpenRead(Path.Combine(savePath, "LastPlayed.dat")))
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(fs))
|
||||
{
|
||||
playedData[1] = sr.ReadLine();
|
||||
}
|
||||
}
|
||||
// if (File.Exists(Path.Combine(savePath, "LastPlayed.dat")) == false)
|
||||
// {
|
||||
// Directory.CreateDirectory(savePath);
|
||||
// using (FileStream file = File.OpenWrite(Path.Combine(savePath, "LastPlayed.dat")))
|
||||
// {
|
||||
// file.Write(Encoding.ASCII.GetBytes("Never"));
|
||||
// }
|
||||
// }
|
||||
|
||||
return playedData;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new string[] { "Unknown", "Unknown" };
|
||||
}
|
||||
// using (FileStream fs = File.OpenRead(Path.Combine(savePath, "LastPlayed.dat")))
|
||||
// {
|
||||
// using (StreamReader sr = new StreamReader(fs))
|
||||
// {
|
||||
// playedData[1] = sr.ReadLine();
|
||||
// }
|
||||
// }
|
||||
|
||||
// return playedData;
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
// return new string[] { "Unknown", "Unknown" };
|
||||
//}
|
||||
}
|
||||
|
||||
private static byte[] NspOrXciIcon(string applicationPath)
|
||||
|
|
|
@ -307,42 +307,42 @@ namespace Ryujinx.UI
|
|||
DiscordClient.SetPresence(DiscordPresence);
|
||||
}
|
||||
|
||||
return;
|
||||
// TODO: Update GUI to store these files in another location
|
||||
|
||||
try
|
||||
{
|
||||
string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", _userId, _device.System.TitleId);
|
||||
//try
|
||||
//{
|
||||
// string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", _userId, _device.System.TitleId);
|
||||
|
||||
if (File.Exists(System.IO.Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||
{
|
||||
Directory.CreateDirectory(savePath);
|
||||
using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
{
|
||||
stream.Write(Encoding.ASCII.GetBytes("0"));
|
||||
}
|
||||
}
|
||||
// if (File.Exists(System.IO.Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||
// {
|
||||
// Directory.CreateDirectory(savePath);
|
||||
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
// {
|
||||
// stream.Write(Encoding.ASCII.GetBytes("0"));
|
||||
// }
|
||||
// }
|
||||
|
||||
if (File.Exists(System.IO.Path.Combine(savePath, "LastPlayed.dat")) == false)
|
||||
{
|
||||
Directory.CreateDirectory(savePath);
|
||||
using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
{
|
||||
stream.Write(Encoding.ASCII.GetBytes("Never"));
|
||||
}
|
||||
}
|
||||
// if (File.Exists(System.IO.Path.Combine(savePath, "LastPlayed.dat")) == false)
|
||||
// {
|
||||
// Directory.CreateDirectory(savePath);
|
||||
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
// {
|
||||
// stream.Write(Encoding.ASCII.GetBytes("Never"));
|
||||
// }
|
||||
// }
|
||||
|
||||
using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
{
|
||||
using (StreamWriter writer = new StreamWriter(stream))
|
||||
{
|
||||
writer.WriteLine(DateTime.UtcNow);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ArgumentNullException)
|
||||
{
|
||||
Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleId}");
|
||||
}
|
||||
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
// {
|
||||
// using (StreamWriter writer = new StreamWriter(stream))
|
||||
// {
|
||||
// writer.WriteLine(DateTime.UtcNow);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//catch (ArgumentNullException)
|
||||
//{
|
||||
// Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleId}");
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,42 +360,44 @@ namespace Ryujinx.UI
|
|||
|
||||
private static void End()
|
||||
{
|
||||
if (false)
|
||||
{
|
||||
try
|
||||
{
|
||||
string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", _userId, _device.System.TitleId);
|
||||
double currentPlayTime = 0;
|
||||
// TODO: Update GUI to store these files in another location
|
||||
|
||||
using (FileStream stream = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
DateTime startTime = DateTime.Parse(reader.ReadLine());
|
||||
//if (_gameLoaded)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", _userId, _device.System.TitleId);
|
||||
// double currentPlayTime = 0;
|
||||
|
||||
using (FileStream lastPlayedStream = File.OpenRead(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
{
|
||||
using (StreamReader lastPlayedReader = new StreamReader(lastPlayedStream))
|
||||
{
|
||||
currentPlayTime = double.Parse(lastPlayedReader.ReadLine());
|
||||
}
|
||||
}
|
||||
// using (FileStream stream = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
// {
|
||||
// using (StreamReader reader = new StreamReader(stream))
|
||||
// {
|
||||
// DateTime startTime = DateTime.Parse(reader.ReadLine());
|
||||
|
||||
using (FileStream timePlayedStream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
{
|
||||
using (StreamWriter timePlayedWriter = new StreamWriter(timePlayedStream))
|
||||
{
|
||||
timePlayedWriter.WriteLine(currentPlayTime + Math.Round(DateTime.UtcNow.Subtract(startTime).TotalSeconds, MidpointRounding.AwayFromZero));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ArgumentNullException)
|
||||
{
|
||||
Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleId}");
|
||||
}
|
||||
}
|
||||
// using (FileStream lastPlayedStream = File.OpenRead(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
// {
|
||||
// using (StreamReader lastPlayedReader = new StreamReader(lastPlayedStream))
|
||||
// {
|
||||
// currentPlayTime = double.Parse(lastPlayedReader.ReadLine());
|
||||
// }
|
||||
// }
|
||||
|
||||
// using (FileStream timePlayedStream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
// {
|
||||
// using (StreamWriter timePlayedWriter = new StreamWriter(timePlayedStream))
|
||||
// {
|
||||
// timePlayedWriter.WriteLine(currentPlayTime + Math.Round(DateTime.UtcNow.Subtract(startTime).TotalSeconds, MidpointRounding.AwayFromZero));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (ArgumentNullException)
|
||||
// {
|
||||
// Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleId}");
|
||||
// }
|
||||
//}
|
||||
|
||||
Profile.FinishProfiling();
|
||||
_device.Dispose();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue