XML conversion textures folder name not using file extension

This commit is contained in:
dexy 2020-01-27 18:19:45 +11:00
parent 5f481bfd6f
commit 63ad3024fe
8 changed files with 14 additions and 53 deletions

View File

@ -106,15 +106,9 @@ namespace CodeWalker.GameFiles
StringBuilder sb = new StringBuilder();
sb.AppendLine(XmlHeader);
var ddsfolder = outputFolder;
if (!string.IsNullOrEmpty(ddsfolder))
{
ddsfolder = Path.Combine(outputFolder, ydd.Name);
}
if (ydd?.DrawableDict != null)
{
DrawableDictionary.WriteXmlNode(ydd.DrawableDict, sb, 0, ddsfolder);
DrawableDictionary.WriteXmlNode(ydd.DrawableDict, sb, 0, outputFolder);
}
return sb.ToString();

View File

@ -71,15 +71,9 @@ namespace CodeWalker.GameFiles
StringBuilder sb = new StringBuilder();
sb.AppendLine(XmlHeader);
var ddsfolder = outputFolder;
if (!string.IsNullOrEmpty(ddsfolder))
{
ddsfolder = Path.Combine(outputFolder, ydr.Name);
}
if (ydr?.Drawable != null)
{
Drawable.WriteXmlNode(ydr.Drawable, sb, 0, ddsfolder);
Drawable.WriteXmlNode(ydr.Drawable, sb, 0, outputFolder);
}
return sb.ToString();

View File

@ -75,15 +75,9 @@ namespace CodeWalker.GameFiles
StringBuilder sb = new StringBuilder();
sb.AppendLine(XmlHeader);
var ddsfolder = outputFolder;
if (!string.IsNullOrEmpty(ddsfolder))
{
ddsfolder = Path.Combine(outputFolder, yft.Name);
}
if (yft?.Fragment != null)
{
FragType.WriteXmlNode(yft.Fragment, sb, 0, ddsfolder);
FragType.WriteXmlNode(yft.Fragment, sb, 0, outputFolder);
}
return sb.ToString();

View File

@ -91,17 +91,6 @@ namespace CodeWalker.GameFiles
StringBuilder sb = new StringBuilder();
sb.AppendLine(XmlHeader);
var ddsfolder = outputFolder;
if (!string.IsNullOrEmpty(ddsfolder))
{
ddsfolder = Path.Combine(outputFolder, yld.Name);
if (!Directory.Exists(ddsfolder))
{
Directory.CreateDirectory(ddsfolder);
}
}
if (yld?.ClothDictionary != null)
{
ClothDictionary.WriteXmlNode(yld.ClothDictionary, sb, 0);

View File

@ -123,15 +123,9 @@ namespace CodeWalker.GameFiles
StringBuilder sb = new StringBuilder();
sb.AppendLine(XmlHeader);
var ddsfolder = outputFolder;
if (!string.IsNullOrEmpty(ddsfolder))
{
ddsfolder = Path.Combine(outputFolder, ypt.Name);
}
if (ypt?.PtfxList != null)
{
ParticleEffectsList.WriteXmlNode(ypt.PtfxList, sb, 0, ddsfolder);
ParticleEffectsList.WriteXmlNode(ypt.PtfxList, sb, 0, outputFolder);
}
return sb.ToString();

View File

@ -69,20 +69,9 @@ namespace CodeWalker.GameFiles
StringBuilder sb = new StringBuilder();
sb.AppendLine(XmlHeader);
var ddsfolder = outputFolder;
if (!string.IsNullOrEmpty(ddsfolder))
{
ddsfolder = Path.Combine(outputFolder, ytd.Name);
if (!Directory.Exists(ddsfolder))
{
Directory.CreateDirectory(ddsfolder);
}
}
if (ytd?.TextureDict != null)
{
TextureDictionary.WriteXmlNode(ytd.TextureDict, sb, 0, ddsfolder);
TextureDictionary.WriteXmlNode(ytd.TextureDict, sb, 0, outputFolder);
}
return sb.ToString();

View File

@ -16,6 +16,12 @@ namespace CodeWalker.GameFiles
{
var fn = e.Name;
var fnl = fn.ToLowerInvariant();
if (!string.IsNullOrEmpty(outputfolder))
{
outputfolder = Path.Combine(outputfolder, e.GetShortName());
}
if (fnl.EndsWith(".ymt"))
{
YmtFile ymt = RpfFile.GetFile<YmtFile>(e, data);

View File

@ -2451,8 +2451,8 @@ namespace CodeWalker
}
if (fnamel.EndsWith(".rbf.xml"))
{
MessageBox.Show(fname + ": RBF XML import not yet supported.", "Cannot import XML");
continue;
mformat = MetaFormat.RBF;
trimlength = 8;
}
if (fnamel.EndsWith(".rel.xml"))
{
@ -2498,6 +2498,7 @@ namespace CodeWalker
fname = fname.Substring(0, fname.Length - trimlength);
fnamel = fnamel.Substring(0, fnamel.Length - trimlength);
fpathin = fpathin.Substring(0, fpathin.Length - trimlength);
fpathin = Path.Combine(Path.GetDirectoryName(fpathin), Path.GetFileNameWithoutExtension(fpathin));
var doc = new XmlDocument();
string text = File.ReadAllText(fpath);