private WaveTexture InnerLoadTexture(string filename) { WaveTexture texture = null; try { using (var stream = this.OpenFile(filename)) { if (stream != null) { texture = Texture2D.FromFile(WaveServices.GraphicsDevice, stream); } else { texture = StaticResources.DefaultTexture; } } } catch (Exception e) { System.Diagnostics.Debug.WriteLine($"Exception loading {filename} texture: {e.ToString()}"); } return(texture); }
/// <summary> /// Register a texture with a given identifier /// </summary> /// <param name="identifier">The texture identifier</param> /// <param name="texture">The texture</param> /// <returns>False if the texture was already registered, true otherwise</returns> internal bool RegisterTexture(string identifier, WaveTexture texture) { return(this.textures.TryAdd(identifier, new Lazy <WaveTexture>(() => texture))); }