/// <summary> /// Encrypts all png graphics /// </summary> private static void DoGraphicConversions() { //if (IO.IO.FileExists("GFX\\Arrows.png")) { // System.IO.File.WriteAllBytes(IO.IO.GetGfxPath("Arrows.pmugfx"), Graphics.SurfaceManager.EncryptSurface(IO.IO.GetGfxPath("Arrows.png"))); // System.IO.File.Delete(IO.IO.GetGfxPath("Arrows.png")); //} //if (IO.IO.FileExists("GFX\\BigSpells.png")) { // System.IO.File.WriteAllBytes(IO.IO.GetGfxPath("BigSpells.pmugfx"), Graphics.SurfaceManager.EncryptSurface(IO.IO.GetGfxPath("BigSpells.png"))); // System.IO.File.Delete(IO.IO.GetGfxPath("BigSpells.png")); //} //if (IO.IO.FileExists("GFX\\BigSprites.png")) { // System.IO.File.WriteAllBytes(IO.IO.GetGfxPath("BigSprites0.pmugfx"), Graphics.SurfaceManager.EncryptSurface(IO.IO.GetGfxPath("BigSprites.png"))); // System.IO.File.Delete(IO.IO.GetGfxPath("BigSprites.png")); //} //if (IO.IO.FileExists("GFX\\Spells.png")) { // System.IO.File.WriteAllBytes(IO.IO.GetGfxPath("Spells.pmugfx"), Graphics.SurfaceManager.EncryptSurface(IO.IO.GetGfxPath("Spells.png"))); // System.IO.File.Delete(IO.IO.GetGfxPath("Spells.png")); //} //for (int i = 0; i < Graphics.GraphicsManager.MAX_TILES; i++) { // if (IO.IO.FileExists(IO.Paths.GfxPath + "Tiles" + i.ToString() + ".png")) { // System.IO.File.WriteAllBytes(IO.Paths.GfxPath + "Tiles" + i.ToString() + ".pmugfx", Graphics.SurfaceManager.EncryptSurface(IO.Paths.GfxPath + "Tiles" + i.ToString() + ".png")); // System.IO.File.Delete(IO.Paths.GfxPath + "Tiles" + i.ToString() + ".png"); // } //} string[] files = System.IO.Directory.GetFiles(IO.Paths.GfxPath + "Sprites/", "*", SearchOption.TopDirectoryOnly); for (int i = 0; i < files.Length; i++) { if (files[i].EndsWith(".png")) { System.IO.File.WriteAllBytes(System.IO.Path.ChangeExtension(files[i], ".pmugfx"), Graphics.SurfaceManager.EncryptSurface(files[i])); System.IO.File.Delete(files[i]); } } files = System.IO.Directory.GetFiles(IO.Paths.GfxPath + "Spells/", "*", SearchOption.TopDirectoryOnly); for (int i = 0; i < files.Length; i++) { if (files[i].EndsWith(".png")) { System.IO.File.WriteAllBytes(System.IO.Path.ChangeExtension(files[i], ".pmugfx"), Graphics.SurfaceManager.EncryptSurface(files[i])); System.IO.File.Delete(files[i]); } } files = System.IO.Directory.GetFiles(IO.Paths.GfxPath + "Mugshots/", "*", SearchOption.TopDirectoryOnly); for (int i = 0; i < files.Length; i++) { if (files[i].EndsWith(".png")) { string path = System.IO.Path.GetDirectoryName(files[i]) + "/" + System.IO.Path.GetFileNameWithoutExtension(files[i]) + ".pmugfx"; SdlDotNet.Graphics.Surface mugshotSurface = new SdlDotNet.Graphics.Surface(files[i]); mugshotSurface.ReplaceColor(Color.FromArgb(255, 254, 254, 254), Color.FromArgb(254, 254, 254, 254)); mugshotSurface.ReplaceColor(Color.FromArgb(255, 255, 255, 255), Color.FromArgb(254, 255, 255, 255)); SurfaceManager.SaveSurface(mugshotSurface, files[i]); System.IO.File.WriteAllBytes(path, Graphics.SurfaceManager.EncryptSurface(files[i])); System.IO.File.Delete(files[i]); } } }