mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 23:12:59 +08:00
Improved error message for missing .dds files on XML import
This commit is contained in:
parent
fc0d84d9dd
commit
d6b4d0b3a5
@ -553,26 +553,37 @@ namespace CodeWalker.GameFiles
|
|||||||
Format = Xml.GetChildEnumInnerText<TextureFormat>(node, "Format");
|
Format = Xml.GetChildEnumInnerText<TextureFormat>(node, "Format");
|
||||||
var filename = Xml.GetChildInnerText(node, "FileName");
|
var filename = Xml.GetChildInnerText(node, "FileName");
|
||||||
|
|
||||||
try
|
|
||||||
|
if ((!string.IsNullOrEmpty(filename)) && (!string.IsNullOrEmpty(ddsfolder)))
|
||||||
{
|
{
|
||||||
var filepath = Path.Combine(ddsfolder, filename);
|
var filepath = Path.Combine(ddsfolder, filename);
|
||||||
if (File.Exists(filepath))
|
if (File.Exists(filepath))
|
||||||
{
|
{
|
||||||
var dds = File.ReadAllBytes(filepath);
|
try
|
||||||
var tex = DDSIO.GetTexture(dds);
|
|
||||||
if (tex != null)
|
|
||||||
{
|
{
|
||||||
Data = tex.Data;
|
var dds = File.ReadAllBytes(filepath);
|
||||||
Width = tex.Width;
|
var tex = DDSIO.GetTexture(dds);
|
||||||
Height = tex.Height;
|
if (tex != null)
|
||||||
Depth = tex.Depth;
|
{
|
||||||
Levels = tex.Levels;
|
Data = tex.Data;
|
||||||
Format = tex.Format;
|
Width = tex.Width;
|
||||||
Stride = tex.Stride;
|
Height = tex.Height;
|
||||||
|
Depth = tex.Depth;
|
||||||
|
Levels = tex.Levels;
|
||||||
|
Format = tex.Format;
|
||||||
|
Stride = tex.Stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw new Exception("Texture file format not supported:\n" + filepath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Texture file not found:\n" + filepath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user