OpenBve.Host.QueryTextureDimensions C# (CSharp) Method

QueryTextureDimensions() public method

Queries the dimensions of a texture.
public QueryTextureDimensions ( string path, int &width, int &height ) : bool
path string The path to the file or folder that contains the texture.
width int Receives the width of the texture.
height int Receives the height of the texture.
return bool
		public override bool QueryTextureDimensions(string path, out int width, out int height) {
			if (System.IO.File.Exists(path) || System.IO.Directory.Exists(path)) {
				for (int i = 0; i < Plugins.LoadedPlugins.Length; i++) {
					if (Plugins.LoadedPlugins[i].Texture != null) {
						try {
							if (Plugins.LoadedPlugins[i].Texture.CanLoadTexture(path)) {
								try {
									if (Plugins.LoadedPlugins[i].Texture.QueryTextureDimensions(path, out width, out height)) {
										return true;
									}
									Interface.AddMessage(Interface.MessageType.Error, false,
									                     "Plugin " + Plugins.LoadedPlugins[i].Title + " returned unsuccessfully at QueryTextureDimensions"
									                    );
								} catch (Exception ex) {
									Interface.AddMessage(Interface.MessageType.Error, false,
									                     "Plugin " + Plugins.LoadedPlugins[i].Title + " raised the following exception at QueryTextureDimensions:" + ex.Message
									                    );
								}
							}
						} catch (Exception ex) {
							Interface.AddMessage(Interface.MessageType.Error, false,
							                     "Plugin " + Plugins.LoadedPlugins[i].Title + " raised the following exception at CanLoadTexture:" + ex.Message
							                    );
						}
					}
				}
				Interface.AddMessage(Interface.MessageType.Error, false,
				                     "No plugin found that is capable of loading texture " + path
				                    );
			} else {
				ReportProblem(OpenBveApi.Hosts.ProblemType.PathNotFound, path.ToString());
			}
			width = 0;
			height = 0;
			return false;
		}