public void ImportDDS(string fileName, string mipMapSaveLocation, bool importTexArray) { var dds = new DdsFile(File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)); var srvRes = new ErpGfxSRVResource(); srvRes.FromResource(Resource); var foundMipMapSaveLocation = false; if (srvRes.SurfaceRes.HasMips) { if (string.IsNullOrEmpty(mipMapSaveLocation)) { var sdialog = new SaveFileDialog { Filter = "Mipmaps files|*.mipmaps|All files|*.*", Title = "Select the mipmaps save location and file name", FileName = Path.GetFileName(srvRes.SurfaceRes.Frag2.MipMapFileName) }; var mipFullPath = Path.GetDirectoryName(Path.Combine(Properties.Settings.Default.F12016Dir, srvRes.SurfaceRes.Frag2.MipMapFileName)); if (Directory.Exists(mipFullPath)) { sdialog.InitialDirectory = mipFullPath; } foundMipMapSaveLocation = sdialog.ShowDialog() == true; mipMapSaveLocation = sdialog.FileName; } else if (Directory.Exists(Path.GetDirectoryName(mipMapSaveLocation))) { foundMipMapSaveLocation = true; } if (!foundMipMapSaveLocation) { return; } } Stream mipMapStream = foundMipMapSaveLocation ? File.Open(mipMapSaveLocation, FileMode.Create, FileAccess.Write, FileShare.Read) : null; using (mipMapStream) { dds.ToErpGfxSRVResource(srvRes, mipMapStream, importTexArray, _texArrayIndex); } srvRes.ToResource(Resource); }