Fix actor renaming for odyssey

This commit is contained in:
KillzXGaming 2019-11-10 16:37:21 -05:00
parent 7d4ad62dd0
commit ed4ef23eb7
2 changed files with 13 additions and 12 deletions

View file

@ -182,18 +182,9 @@ namespace FirstPlugin
string NewActorName = dialog.textBox1.Text;
FileName = NewActorName + ".szs";
foreach (var file in files)
{
string NodeName = Path.GetFileNameWithoutExtension(file.FileName);
string ext = Utils.GetExtension(file.FileName);
if (NodeName == ActorName)
{
file.FileName = $"{NewActorName}{ext}";
}
else if (file.FileName.Contains("Attribute.byml"))
{
file.FileName = $"{NewActorName}Attribute.byml";
}
foreach (var file in files) {
file.FileName = file.FileName.Replace(ActorName, NewActorName);
file.UpdateWrapper();
}
}
}

View file

@ -75,6 +75,15 @@ namespace Toolbox.Library
[Browsable(false)]
public virtual bool CanLoadFile { get; set; } = true;
[Browsable(false)]
public ArchiveFileWrapper FileWrapper;
public void UpdateWrapper()
{
if (FileWrapper == null) return;
FileWrapper.Text = Path.GetFileName(FileName);
}
[Browsable(false)]
public virtual IFileFormat OpenFile()
@ -276,6 +285,7 @@ namespace Toolbox.Library
public void AddFileNode(ArchiveFileWrapper fileWrapper)
{
FileNodes.Add(Tuple.Create(fileWrapper.ArchiveFileInfo, (TreeNode)fileWrapper));
fileWrapper.ArchiveFileInfo.FileWrapper = fileWrapper;
string FullName = SetFullPath(fileWrapper, this);
if (FullName != string.Empty)