04-15-2015, 02:45 PM
(04-15-2015, 12:49 PM)Someone else Wrote: @YinYin: You could try to implement the following in order to not rely on lf2.exe being called lf2.exe (or that it even exists):I'd very much like it to be that way, but my implementation is awfully slow whenever the folder structure is a bit deeper or the directory could not be found:
CSHARP-Code:
private void open(string args) { // //opening stuff and bmp_begin parsing // lf2root = Path.GetDirectoryName(args) + "\\"; bool DirectoryFound = false; do { DirectoryFound = true; for (int i = 0; i < global.objectfile.bmp_begin.bmps.Count; i++) { if (!File.Exists(lf2root + global.objectfile.bmp_begin.bmps[i].path)) { DirectoryFound = false; break; } } } while (!DirectoryFound && UpOneDirectory(ref lf2root)); if (!DirectoryFound) lf2root = "\\\\"; //indication of unfound root directory from previous implementation /*/get lf2.exe path - previous implementation lf2root = Path.GetDirectoryName(args) + "\\lf2.exe"; while (!File.Exists(lf2root) && lf2root.Length > 10) lf2root = lf2root.Substring(0, lf2root.Length - new DirectoryInfo(Path.GetDirectoryName(lf2root)).Name.Length - Path.GetFileName(lf2root).Length - 2) + "\\lf2.exe"; lf2root = Path.GetDirectoryName(lf2root) + "\\";*/ } private bool UpOneDirectory(ref string lf2root) { if (lf2root.Length > 4) { lf2root = lf2root.Substring(0, lf2root.Length - new DirectoryInfo(Path.GetDirectoryName(lf2root + "\\")).Name.Length); return true; } return false; } |
favorite dcing techniques: wpoint | double key inputs | holding back | alternate basic moves