Added error if file not found for model import

This commit is contained in:
Michael Smith 2016-05-02 23:14:39 -07:00
parent 6de63fa3c6
commit 8741b7df2a

View File

@ -29,6 +29,7 @@ namespace OSCADSharp.Solids
public ImportedModel(string filePath) public ImportedModel(string filePath)
{ {
this.filePath = filePath; this.filePath = filePath;
this.errorIfFileNotFound();
//TODO: Attempt to compute bounds //TODO: Attempt to compute bounds
} }
@ -40,8 +41,18 @@ namespace OSCADSharp.Solids
public ImportedModel(string filePath, Bounds bounds) public ImportedModel(string filePath, Bounds bounds)
{ {
this.filePath = filePath; this.filePath = filePath;
this.errorIfFileNotFound();
this.objectBounds = bounds; this.objectBounds = bounds;
} }
private void errorIfFileNotFound()
{
if (!File.Exists(this.filePath))
{
throw new FileNotFoundException("No model file was found at location: " + this.filePath);
}
}
#endregion #endregion
#region OSCADObject Overrides #region OSCADObject Overrides