private void loadHeightMap(string heightMapFileName)
 {
     if (heightMapFileName.EndsWith("hfz") || heightMapFileName.EndsWith("hf2.gz") || heightMapFileName.EndsWith("hf2"))
     {
         this.heightMap = (HeightMap)new Hf2HeightMap(heightMapFileName);
     }
     else if (heightMapFileName.EndsWith("hff"))
     {
         this.heightMap = (HeightMap)new HffHeightMap(heightMapFileName);
     }
 }
        private void handleBrowseHeightmapImgFile()
        {
            Stream inf;
            string selectedFileName = this.heightMapOpenFileDialog.FileName;

            if ((FileStream)(inf = (Stream)File.Open(selectedFileName, FileMode.Open)) == null)
            {
                throw new FileNotFoundException(selectedFileName);
            }

            this.heightMap = (HeightMap)new BmpHeightMap(inf);
            this.upperLeftX.Maximum = this.lowerRightX.Maximum = this.lowerRightX.Value = (Decimal)this.heightMap.Width;
            this.upperLeftY.Maximum = this.lowerRightY.Maximum = this.lowerRightY.Value = (Decimal)this.heightMap.Height;
            inf.Close();
        }