From 5402dadbd97441021f58c4c45e23c4f071249fe0 Mon Sep 17 00:00:00 2001 From: trainwrck <88688443+trainwrck@users.noreply.github.com> Date: Mon, 9 Aug 2021 23:43:30 +0200 Subject: [PATCH] Main table: modified date Added modfiied date to main table --- Sideloader/RCLONE.cs | 50 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/Sideloader/RCLONE.cs b/Sideloader/RCLONE.cs index a03d7d35..98e5f335 100644 --- a/Sideloader/RCLONE.cs +++ b/Sideloader/RCLONE.cs @@ -7,6 +7,15 @@ namespace AndroidSideloader { + class rcloneFolder + { + public string Path { get; set; } + public string Name { get; set; } + public string Size { get; set; } + public string ModTime { get; set; } + + } + class SideloaderRCLONE { public static List RemotesList = new List(); @@ -38,12 +47,12 @@ class SideloaderRCLONE public static void UpdateNouns(string remote) { - RCLONE.runRcloneCommand($"sync \"{remote}:{RcloneGamesFolder}/.meta/nouns\" \"{Nouns}\""); - } - + RCLONE.runRcloneCommand($"sync \"{remote}:{RcloneGamesFolder}/.meta/nouns\" \"{Nouns}\""); + } + public static void UpdateGamePhotos(string remote) { - RCLONE.runRcloneCommand($"sync \"{remote}:{RcloneGamesFolder}/.meta/thumbnails\" \"{ThumbnailsFolder}\""); + RCLONE.runRcloneCommand($"sync \"{remote}:{RcloneGamesFolder}/.meta/thumbnails\" \"{ThumbnailsFolder}\""); } public static void UpdateGameNotes(string remote) @@ -76,7 +85,7 @@ public static void initGames(string remote) { gameProperties.Clear(); games.Clear(); - string tempGameList = RCLONE.runRcloneCommand($"cat \"{remote}:{RcloneGamesFolder}/GameList.txt\"").Output; + string tempGameList = RCLONE.runRcloneCommand($"cat \"{remote}:{RcloneGamesFolder}/GameList.txt\"").Output; if (MainForm.debugMode) File.WriteAllText("GamesList.txt", tempGameList); string gamePropertiesLine = Utilities.StringUtilities.RemoveEverythingAfterFirst(tempGameList, "\n"); @@ -85,13 +94,28 @@ public static void initGames(string remote) { gameProperties.Add(gameProperty); } + gameProperties.Add("Modified Date"); + tempGameList = Utilities.StringUtilities.RemoveEverythingBeforeFirst(tempGameList, "\n"); + List gameFolders = JsonConvert.DeserializeObject>(RCLONE.runRcloneCommand($"lsjson \"{remote}:{RcloneGamesFolder}\"").Output); + + foreach (string game in tempGameList.Split('\n')) { if (game.Length > 1) - games.Add(game.Split(';')); + { + string[] splitGame = game.Split(';'); + + //gameFolder.find(); + + var gameFolder = gameFolders.Find((predicate) => predicate.Path == splitGame[1]); + //splitGame[6] = gameFolder.ModTime; + Array.Resize(ref splitGame, splitGame.Length + 1); + splitGame[splitGame.Length - 1] = gameFolder.ModTime; + games.Add(splitGame); + } } //Output @@ -100,12 +124,20 @@ public static void initGames(string remote) //{ // Console.WriteLine($"gameProperty: {s}"); //} + + + foreach (string[] s in games) { - string output = ""; - for (int i = 0; i < gameProperties.Count; i++) - output += s[i] + " "; + //string output = ""; + //for (int i = 0; i < gameProperties.Count; i++) + // output += s[i] + " "; + } + + + + } #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously