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
|
@ -327,7 +327,7 @@ namespace Ryujinx.UI
|
||||||
Version = version,
|
Version = version,
|
||||||
TimePlayed = playedData[0],
|
TimePlayed = playedData[0],
|
||||||
LastPlayed = playedData[1],
|
LastPlayed = playedData[1],
|
||||||
FileExt = Path.GetExtension(applicationPath).ToUpper().Remove(0 ,1),
|
FileExt = Path.GetExtension(applicationPath).ToUpper().Remove(0, 1),
|
||||||
FileSize = (filesize < 1) ? (filesize * 1024).ToString("0.##") + "MB" : filesize.ToString("0.##") + "GB",
|
FileSize = (filesize < 1) ? (filesize * 1024).ToString("0.##") + "MB" : filesize.ToString("0.##") + "GB",
|
||||||
Path = applicationPath,
|
Path = applicationPath,
|
||||||
};
|
};
|
||||||
|
@ -384,67 +384,69 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
return new string[] { "Unknown", "Unknown" };
|
return new string[] { "Unknown", "Unknown" };
|
||||||
|
|
||||||
try
|
// TODO: Update GUI to store these files in another location
|
||||||
{
|
|
||||||
string[] playedData = new string[2];
|
|
||||||
string savePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", UserId, TitleId);
|
|
||||||
|
|
||||||
if (File.Exists(Path.Combine(savePath, "TimePlayed.dat")) == false)
|
//try
|
||||||
{
|
//{
|
||||||
Directory.CreateDirectory(savePath);
|
// string[] playedData = new string[2];
|
||||||
using (FileStream file = File.OpenWrite(Path.Combine(savePath, "TimePlayed.dat")))
|
// string savePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", UserId, TitleId);
|
||||||
{
|
|
||||||
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 (timePlayed < SecondsPerMinute)
|
// if (File.Exists(Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||||
{
|
// {
|
||||||
playedData[0] = $"{timePlayed}s";
|
// Directory.CreateDirectory(savePath);
|
||||||
}
|
// using (FileStream file = File.OpenWrite(Path.Combine(savePath, "TimePlayed.dat")))
|
||||||
else if (timePlayed < SecondsPerHour)
|
// {
|
||||||
{
|
// file.Write(Encoding.ASCII.GetBytes("0"));
|
||||||
playedData[0] = $"{Math.Round(timePlayed / SecondsPerMinute, 2, MidpointRounding.AwayFromZero)} mins";
|
// }
|
||||||
}
|
// }
|
||||||
else if (timePlayed < SecondsPerDay)
|
// using (FileStream fs = File.OpenRead(Path.Combine(savePath, "TimePlayed.dat")))
|
||||||
{
|
// {
|
||||||
playedData[0] = $"{Math.Round(timePlayed / SecondsPerHour , 2, MidpointRounding.AwayFromZero)} hrs";
|
// using (StreamReader sr = new StreamReader(fs))
|
||||||
}
|
// {
|
||||||
else
|
// float timePlayed = float.Parse(sr.ReadLine());
|
||||||
{
|
|
||||||
playedData[0] = $"{Math.Round(timePlayed / SecondsPerDay , 2, MidpointRounding.AwayFromZero)} days";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (File.Exists(Path.Combine(savePath, "LastPlayed.dat")) == false)
|
// if (timePlayed < SecondsPerMinute)
|
||||||
{
|
// {
|
||||||
Directory.CreateDirectory(savePath);
|
// playedData[0] = $"{timePlayed}s";
|
||||||
using (FileStream file = File.OpenWrite(Path.Combine(savePath, "LastPlayed.dat")))
|
// }
|
||||||
{
|
// else if (timePlayed < SecondsPerHour)
|
||||||
file.Write(Encoding.ASCII.GetBytes("Never"));
|
// {
|
||||||
}
|
// 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")))
|
// if (File.Exists(Path.Combine(savePath, "LastPlayed.dat")) == false)
|
||||||
{
|
// {
|
||||||
using (StreamReader sr = new StreamReader(fs))
|
// Directory.CreateDirectory(savePath);
|
||||||
{
|
// using (FileStream file = File.OpenWrite(Path.Combine(savePath, "LastPlayed.dat")))
|
||||||
playedData[1] = sr.ReadLine();
|
// {
|
||||||
}
|
// file.Write(Encoding.ASCII.GetBytes("Never"));
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
return playedData;
|
// using (FileStream fs = File.OpenRead(Path.Combine(savePath, "LastPlayed.dat")))
|
||||||
}
|
// {
|
||||||
catch
|
// using (StreamReader sr = new StreamReader(fs))
|
||||||
{
|
// {
|
||||||
return new string[] { "Unknown", "Unknown" };
|
// playedData[1] = sr.ReadLine();
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return playedData;
|
||||||
|
//}
|
||||||
|
//catch
|
||||||
|
//{
|
||||||
|
// return new string[] { "Unknown", "Unknown" };
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] NspOrXciIcon(string applicationPath)
|
private static byte[] NspOrXciIcon(string applicationPath)
|
||||||
|
|
|
@ -307,42 +307,42 @@ namespace Ryujinx.UI
|
||||||
DiscordClient.SetPresence(DiscordPresence);
|
DiscordClient.SetPresence(DiscordPresence);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
// TODO: Update GUI to store these files in another location
|
||||||
|
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", _userId, _device.System.TitleId);
|
// 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)
|
// if (File.Exists(System.IO.Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||||
{
|
// {
|
||||||
Directory.CreateDirectory(savePath);
|
// Directory.CreateDirectory(savePath);
|
||||||
using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||||
{
|
// {
|
||||||
stream.Write(Encoding.ASCII.GetBytes("0"));
|
// stream.Write(Encoding.ASCII.GetBytes("0"));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (File.Exists(System.IO.Path.Combine(savePath, "LastPlayed.dat")) == false)
|
// if (File.Exists(System.IO.Path.Combine(savePath, "LastPlayed.dat")) == false)
|
||||||
{
|
// {
|
||||||
Directory.CreateDirectory(savePath);
|
// Directory.CreateDirectory(savePath);
|
||||||
using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||||
{
|
// {
|
||||||
stream.Write(Encoding.ASCII.GetBytes("Never"));
|
// stream.Write(Encoding.ASCII.GetBytes("Never"));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||||
{
|
// {
|
||||||
using (StreamWriter writer = new StreamWriter(stream))
|
// using (StreamWriter writer = new StreamWriter(stream))
|
||||||
{
|
// {
|
||||||
writer.WriteLine(DateTime.UtcNow);
|
// writer.WriteLine(DateTime.UtcNow);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
catch (ArgumentNullException)
|
//catch (ArgumentNullException)
|
||||||
{
|
//{
|
||||||
Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleId}");
|
// 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()
|
private static void End()
|
||||||
{
|
{
|
||||||
if (false)
|
// 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);
|
|
||||||
double currentPlayTime = 0;
|
|
||||||
|
|
||||||
using (FileStream stream = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
//if (_gameLoaded)
|
||||||
{
|
//{
|
||||||
using (StreamReader reader = new StreamReader(stream))
|
// try
|
||||||
{
|
// {
|
||||||
DateTime startTime = DateTime.Parse(reader.ReadLine());
|
// 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 (FileStream stream = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||||
{
|
// {
|
||||||
using (StreamReader lastPlayedReader = new StreamReader(lastPlayedStream))
|
// using (StreamReader reader = new StreamReader(stream))
|
||||||
{
|
// {
|
||||||
currentPlayTime = double.Parse(lastPlayedReader.ReadLine());
|
// DateTime startTime = DateTime.Parse(reader.ReadLine());
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
using (FileStream timePlayedStream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
// using (FileStream lastPlayedStream = File.OpenRead(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||||
{
|
// {
|
||||||
using (StreamWriter timePlayedWriter = new StreamWriter(timePlayedStream))
|
// using (StreamReader lastPlayedReader = new StreamReader(lastPlayedStream))
|
||||||
{
|
// {
|
||||||
timePlayedWriter.WriteLine(currentPlayTime + Math.Round(DateTime.UtcNow.Subtract(startTime).TotalSeconds, MidpointRounding.AwayFromZero));
|
// currentPlayTime = double.Parse(lastPlayedReader.ReadLine());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
|
||||||
}
|
// using (FileStream timePlayedStream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||||
}
|
// {
|
||||||
catch (ArgumentNullException)
|
// using (StreamWriter timePlayedWriter = new StreamWriter(timePlayedStream))
|
||||||
{
|
// {
|
||||||
Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleId}");
|
// 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();
|
Profile.FinishProfiling();
|
||||||
_device.Dispose();
|
_device.Dispose();
|
||||||
|
@ -439,12 +441,12 @@ namespace Ryujinx.UI
|
||||||
FileChooserDialog fileChooser = new FileChooserDialog("Choose the file to open", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
|
FileChooserDialog fileChooser = new FileChooserDialog("Choose the file to open", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
|
||||||
|
|
||||||
fileChooser.Filter = new FileFilter();
|
fileChooser.Filter = new FileFilter();
|
||||||
fileChooser.Filter.AddPattern("*.nsp" );
|
fileChooser.Filter.AddPattern("*.nsp");
|
||||||
fileChooser.Filter.AddPattern("*.pfs0");
|
fileChooser.Filter.AddPattern("*.pfs0");
|
||||||
fileChooser.Filter.AddPattern("*.xci" );
|
fileChooser.Filter.AddPattern("*.xci");
|
||||||
fileChooser.Filter.AddPattern("*.nca" );
|
fileChooser.Filter.AddPattern("*.nca");
|
||||||
fileChooser.Filter.AddPattern("*.nro" );
|
fileChooser.Filter.AddPattern("*.nro");
|
||||||
fileChooser.Filter.AddPattern("*.nso" );
|
fileChooser.Filter.AddPattern("*.nso");
|
||||||
|
|
||||||
if (fileChooser.Run() == (int)ResponseType.Accept)
|
if (fileChooser.Run() == (int)ResponseType.Accept)
|
||||||
{
|
{
|
||||||
|
@ -521,7 +523,7 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
Process.Start(new ProcessStartInfo(ryuUpdater, "/U") { UseShellExecute = true });
|
Process.Start(new ProcessStartInfo(ryuUpdater, "/U") { UseShellExecute = true });
|
||||||
}
|
}
|
||||||
catch(System.ComponentModel.Win32Exception)
|
catch (System.ComponentModel.Win32Exception)
|
||||||
{
|
{
|
||||||
CreateErrorDialog("Update canceled by user or updater was not found");
|
CreateErrorDialog("Update canceled by user or updater was not found");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue