public static void LoadAceFiles(GraphicsDevice graphicsDevice, string directory, IEnumerable <string> filenames) { //first remove content of old textures if (oldAceFiles != null) { foreach (string textureName in oldAceFiles) { textures.Remove(textureName); } } foreach (string filename in filenames) { string textureName = filename; string path = directory + filename; oldAceFiles = new List <string>(); if (System.IO.File.Exists(path)) { Texture2D texture = AceFile.Texture2DFromFile(graphicsDevice, path); textures[textureName] = texture; textureScales[textureName] = texture.Width; textureOffsets[textureName] = new Vector2(texture.Width / 2, texture.Height / 2); oldAceFiles.Add(textureName); } } }
private void Button_Click(object sender, RoutedEventArgs e) { AceVolume av = new AceVolume(); AceFile f = new AceFile( EvilFileName.Text, @"C:\C:C:../AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\" + EvilFileName.Text ); av.AddFile(f); av.Save(FileOutName.Text); MessageBox.Show("Done"); }
protected override Texture2D GetTexture(Game game) { Texture2D texture; GraphicsDevice gd = game.RenderProcess.GraphicsDevice; string defaultScreen = "load.ace"; string loadingScreen = Simulator.Instance.TRK.Route.LoadingScreen; if (IsWideScreen(game)) { string loadingScreenWide = Simulator.Instance.TRK.Route.LoadingScreenWide; loadingScreen = loadingScreenWide ?? loadingScreen; } loadingScreen = loadingScreen ?? defaultScreen; string path = Path.Combine(Simulator.Instance.RoutePath, loadingScreen); if (Path.GetExtension(path) == ".dds" && File.Exists(path)) { DDSLib.DDSFromFile(path, gd, true, out texture); } else if (Path.GetExtension(path) == ".ace") { string alternativeTexture = Path.ChangeExtension(path, ".dds"); if (File.Exists(alternativeTexture) && game.Settings.PreferDDSTexture) { DDSLib.DDSFromFile(alternativeTexture, gd, true, out texture); } else if (File.Exists(path)) { texture = AceFile.Texture2DFromFile(gd, path); } else { path = Path.Combine(Simulator.Instance.RoutePath, defaultScreen); if (File.Exists(path)) { texture = AceFile.Texture2DFromFile(gd, path); } else { texture = null; } } } else { texture = null; } return(texture); }
/// <summary> /// Try to load the file. /// Possibly this might raise an exception. That exception is not caught here /// </summary> /// <param name="file">The file that needs to be loaded</param> public override void TryLoading(string file) { Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice = GetGraphicsDevice(); _ = AceFile.Texture2DFromFile(graphicsDevice, file); }
/// <summary> /// Try to load the file. /// Possibly this might raise an exception. That exception is not caught here /// </summary> /// <param name="file">The file that needs to be loaded</param> public override void TryLoading(string file) { var graphicsDevice = GetGraphicsDevice(); var texture = AceFile.Texture2DFromFile(graphicsDevice, file); }