Skip to content

Commit 9a02f99

Browse files
authored
Loads and saves resource index
1 parent 00d777d commit 9a02f99

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

JoystickDisplay.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,17 @@ public Display()
4343
R = 1;
4444
S = 1;
4545

46+
try
47+
{
48+
string[] lines = System.IO.File.ReadAllLines("Index.ini");
49+
int savedIndex = Int32.Parse(lines[0]);
50+
folderIndex = savedIndex;
51+
}
52+
catch {}
53+
4654
string path = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
4755
string[] folders = System.IO.Directory.GetDirectories(path,"*", System.IO.SearchOption.AllDirectories);
48-
string folder = folders[0];
56+
string folder = folders[folderIndex];
4957

5058
imgBase = new Bitmap(folder+"/base.png");
5159
imgStick = new Bitmap(folder+"/stick.png");
@@ -298,5 +306,15 @@ public void keyPress(object sender, PreviewKeyDownEventArgs e)
298306
imgStickSmall = new Bitmap(folder+"/stickSmall.png");
299307
}
300308
}
309+
310+
public void saveIndex()
311+
{
312+
try
313+
{
314+
string text = ""+folderIndex;
315+
System.IO.File.WriteAllText("Index.ini", text);
316+
}
317+
catch {}
318+
}
301319
}
302320
}

0 commit comments

Comments
 (0)