Skip to content

Commit

Permalink
Loads and saves resource index
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtleMan64 authored Jul 22, 2018
1 parent 00d777d commit 9a02f99
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion JoystickDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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 {}
}
}
}

0 comments on commit 9a02f99

Please sign in to comment.