Add additional sarc extension for botw font

This commit is contained in:
KillzXGaming 2019-07-18 20:02:37 -04:00
parent 64639c4886
commit 643ccb24d0
3 changed files with 18 additions and 9 deletions

View file

@ -17,7 +17,7 @@ namespace FirstPlugin
public bool CanSave { get; set; }
public string[] Description { get; set; } = new string[] { "Sorted ARChive" };
public string[] Extension { get; set; } = new string[] { "*.pack", "*.sarc", "*.bgenv", "*.sblarc", "*.sbactorpack", ".arc" };
public string[] Extension { get; set; } = new string[] { "*.pack", "*.sarc", "*.bgenv", "*.sbfarc", "*.sblarc", "*.sbactorpack", ".arc" };
public string FileName { get; set; }
public string FilePath { get; set; }
public IFileInfo IFileInfo { get; set; }

View file

@ -139,7 +139,6 @@ namespace Toolbox.Library
{
string FullPath = Path.Combine(parentNode.FullPath, FileName);
FullPath = FullPath.Substring(FullPath.IndexOf("/", 1) + 1);
// FullPath.Substring(Path.GetPathRoot(FullPath).Length);
Console.WriteLine($"FullPath {FullPath}");
File.ArchiveFileInfo.FileName = FullPath;
}
@ -150,7 +149,14 @@ namespace Toolbox.Library
bool HasAddedFile = archiveFile.AddFile(File.ArchiveFileInfo);
if (HasAddedFile)
{
if (parentNode is ArchiveRootNodeWrapper)
((ArchiveRootNodeWrapper)parentNode).FileNodes.Add(File);
if (parentNode is ArchiveFolderNodeWrapper)
((ArchiveRootNodeWrapper)parentNode).FileNodes.Add(File);
parentNode.Nodes.Add(File);
}
}
}

View file

@ -218,7 +218,7 @@ namespace Toolbox.Library
private void AddFolderAction(object sender, EventArgs args)
{
Nodes.Add(new ArchiveFolderNodeWrapper("NewFolder", ArchiveFile));
Nodes.Add(new ArchiveFolderNodeWrapper("NewFolder", ArchiveFile, this));
}
private void AddFileAction(object sender, EventArgs args)
@ -239,10 +239,10 @@ namespace Toolbox.Library
return;
for (int i = 0; i < FileNodes.Count; i++)
FileNodes[i].ArchiveFileInfo.FileName = SetFullath(FileNodes[i], this);
FileNodes[i].ArchiveFileInfo.FileName = SetFullPath(FileNodes[i], this);
}
private static string SetFullath(TreeNode node, TreeNode root)
private static string SetFullPath(TreeNode node, TreeNode root)
{
string nodePath = node.FullPath;
int startIndex = nodePath.IndexOf(root.Text);
@ -397,7 +397,7 @@ namespace Toolbox.Library
{
if (node is IDirectoryContainer)
{
var folder = new ArchiveFolderNodeWrapper(node.Name, archiveFile);
var folder = new ArchiveFolderNodeWrapper(node.Name, archiveFile, this);
parent.Nodes.Add(folder);
if (((IDirectoryContainer)node).Nodes != null)
@ -455,7 +455,7 @@ namespace Toolbox.Library
{
// Node was not found, add it
var folder = new ArchiveFolderNodeWrapper(parentName, archiveFile);
var folder = new ArchiveFolderNodeWrapper(parentName, archiveFile, this);
if (rootIndex == roots.Length - 1)
{
@ -486,6 +486,8 @@ namespace Toolbox.Library
//Wrapper for folders
public class ArchiveFolderNodeWrapper : ArchiveBase, IContextMenuNode
{
public ArchiveRootNodeWrapper RootNode;
public virtual object PropertyDisplay { get; set; }
public bool CanReplace
@ -510,8 +512,9 @@ namespace Toolbox.Library
}
}
public ArchiveFolderNodeWrapper(string text, IArchiveFile archiveFile ) : base(archiveFile)
public ArchiveFolderNodeWrapper(string text, IArchiveFile archiveFile, ArchiveRootNodeWrapper root ) : base(archiveFile)
{
RootNode = root;
Text = text;
PropertyDisplay = new GenericFolderProperties();
((GenericFolderProperties)PropertyDisplay).Name = Text;
@ -535,7 +538,7 @@ namespace Toolbox.Library
private void AddFolderAction(object sender, EventArgs args)
{
Nodes.Add(new ArchiveFolderNodeWrapper("NewFolder", ArchiveFile));
Nodes.Add(new ArchiveFolderNodeWrapper("NewFolder", ArchiveFile, RootNode));
}
private void AddFileAction(object sender, EventArgs args)