/* * static IEnumerable<string> AllFiles(string path, * string pattern=null, * bool recursive=false) * { * foreach (string file in Directory.GetFiles( * * foreach (string subpath in Directory.GetDirectories(path)) * foreach (string subret in AllFiles(subpath,pattern,recursive)) * yield return subret; * } */ static void RLE_stuff() { if (File.Exists("ex.txt")) { File.Delete("ex.txt"); } if (Directory.Exists("./img")) { Directory.Delete("./img", true); } Directory.CreateDirectory("./img"); foreach (string fn in Directory.GetFiles("/mnt/rmclient/RLEs/Chr", "*.rle", SearchOption.AllDirectories)) { Console.WriteLine(fn); //Console.ReadKey(); var rle = new RM.v38.RLE(); try { rle.Load(new ByteReader(File.ReadAllBytes(fn)), fn); } catch (Exception ex) { Console.WriteLine("EX IN " + fn); throw ex; } var f = fn.Replace("/mnt/rmclient/RLEs/", "") .Replace("/", "_") .Replace(".rle", ""); for (int i = 0; i < rle.Resources.Count; i++) { if (rle.Resources[i] != null && rle.Resources[i].Image != null) { rle.Resources[i].Image.Save("./img/" + f + "_" + i + ".bmp"); } } Console.WriteLine(f); } }
/* static IEnumerable<string> AllFiles(string path, string pattern=null, bool recursive=false) { foreach (string file in Directory.GetFiles( foreach (string subpath in Directory.GetDirectories(path)) foreach (string subret in AllFiles(subpath,pattern,recursive)) yield return subret; } */ static void RLE_stuff() { if (File.Exists("ex.txt")) File.Delete("ex.txt"); if (Directory.Exists("./img")) Directory.Delete("./img", true); Directory.CreateDirectory("./img"); foreach (string fn in Directory.GetFiles("/mnt/rmclient/RLEs/Chr", "*.rle", SearchOption.AllDirectories)) { Console.WriteLine(fn); //Console.ReadKey(); var rle = new RM.v38.RLE(); try { rle.Load(new ByteReader(File.ReadAllBytes(fn)), fn); } catch (Exception ex) { Console.WriteLine("EX IN " + fn); throw ex; } var f = fn.Replace("/mnt/rmclient/RLEs/", "") .Replace("/", "_") .Replace(".rle", ""); for (int i = 0; i < rle.Resources.Count; i++) if (rle.Resources[i] != null && rle.Resources[i].Image != null) rle.Resources[i].Image.Save("./img/" + f + "_" + i + ".bmp"); Console.WriteLine(f); } }