mirror of
https://github.com/whoswhip/RhythiaReplayExporter.git
synced 2026-12-04 07:08:42 +00:00
fix: use local app data on linux; try "Rhythia" as well
This commit is contained in:
+21
-7
@@ -1,12 +1,18 @@
|
||||
using Microsoft.Data.Sqlite;
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Data.Sqlite;
|
||||
|
||||
namespace RhythiaReplayExporter;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
string appData;
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
else
|
||||
appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
if (string.IsNullOrWhiteSpace(appData))
|
||||
{
|
||||
Console.WriteLine("Failed to find app data folder.");
|
||||
@@ -17,9 +23,13 @@ class Program
|
||||
string rhythia = Path.Combine(appData, "CapoRhythia");
|
||||
if (!Directory.Exists(rhythia))
|
||||
{
|
||||
Console.WriteLine("CapoRhythia directory doesn't exist in app data.");
|
||||
Environment.Exit(1);
|
||||
return;
|
||||
rhythia = Path.Combine(appData, "Rhythia");
|
||||
if (!Directory.Exists(rhythia))
|
||||
{
|
||||
Console.WriteLine("Neither CapoRhythia or Rhythia exists in app data.");
|
||||
Environment.Exit(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
string database = Path.Combine(rhythia, "rhythia.db");
|
||||
@@ -47,7 +57,11 @@ class Program
|
||||
int count = 0;
|
||||
while (reader.Read())
|
||||
{
|
||||
DateTime createdAt = DateTime.ParseExact(reader.GetString(0), "yyyy-MM-dd HH:mm:ss.FFFFFFF", CultureInfo.InvariantCulture);
|
||||
DateTime createdAt = DateTime.ParseExact(
|
||||
reader.GetString(0),
|
||||
"yyyy-MM-dd HH:mm:ss.FFFFFFF",
|
||||
CultureInfo.InvariantCulture
|
||||
);
|
||||
string legacyMapId = reader.GetString(1);
|
||||
byte[] replay = reader.GetFieldValue<byte[]>(2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user