From 9a02f99646da81ed32788508287edf9eb87d59d4 Mon Sep 17 00:00:00 2001 From: TurtleMan64 Date: Sat, 21 Jul 2018 17:27:32 -0700 Subject: [PATCH] Loads and saves resource index --- JoystickDisplay.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/JoystickDisplay.cs b/JoystickDisplay.cs index d556255..b098289 100644 --- a/JoystickDisplay.cs +++ b/JoystickDisplay.cs @@ -43,9 +43,17 @@ public Display() R = 1; S = 1; + try + { + string[] lines = System.IO.File.ReadAllLines("Index.ini"); + int savedIndex = Int32.Parse(lines[0]); + folderIndex = savedIndex; + } + catch {} + string path = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName); string[] folders = System.IO.Directory.GetDirectories(path,"*", System.IO.SearchOption.AllDirectories); - string folder = folders[0]; + string folder = folders[folderIndex]; imgBase = new Bitmap(folder+"/base.png"); imgStick = new Bitmap(folder+"/stick.png"); @@ -298,5 +306,15 @@ public void keyPress(object sender, PreviewKeyDownEventArgs e) imgStickSmall = new Bitmap(folder+"/stickSmall.png"); } } + + public void saveIndex() + { + try + { + string text = ""+folderIndex; + System.IO.File.WriteAllText("Index.ini", text); + } + catch {} + } } }