mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 15:14:55 +00:00
RARC : Support renaming.
This commit is contained in:
parent
6837bc30d1
commit
2fd88ce7eb
2 changed files with 20 additions and 2 deletions
|
@ -22,7 +22,7 @@ namespace FirstPlugin
|
||||||
public IFileInfo IFileInfo { get; set; }
|
public IFileInfo IFileInfo { get; set; }
|
||||||
|
|
||||||
public bool CanAddFiles { get; set; }
|
public bool CanAddFiles { get; set; }
|
||||||
public bool CanRenameFiles { get; set; }
|
public bool CanRenameFiles { get; set; } = true;
|
||||||
public bool CanReplaceFiles { get; set; }
|
public bool CanReplaceFiles { get; set; }
|
||||||
public bool CanDeleteFiles { get; set; }
|
public bool CanDeleteFiles { get; set; }
|
||||||
|
|
||||||
|
@ -456,9 +456,15 @@ namespace FirstPlugin
|
||||||
for (int i = 0; i < parentDir.Children.Count; i++)
|
for (int i = 0; i < parentDir.Children.Count; i++)
|
||||||
{
|
{
|
||||||
if (parentDir.Children[i] is FileEntry)
|
if (parentDir.Children[i] is FileEntry)
|
||||||
|
{
|
||||||
((FileEntry)parentDir.Children[i]).NameOffset = (ushort)stringPos;
|
((FileEntry)parentDir.Children[i]).NameOffset = (ushort)stringPos;
|
||||||
|
((FileEntry)parentDir.Children[i]).UpdateHash();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
((DirectoryEntry)parentDir.Children[i]).NameOffset = (ushort)stringPos;
|
((DirectoryEntry)parentDir.Children[i]).NameOffset = (ushort)stringPos;
|
||||||
|
((DirectoryEntry)parentDir.Children[i]).UpdateHash();
|
||||||
|
}
|
||||||
|
|
||||||
Console.WriteLine($"{parentDir.Children[i].Name} {stringPos}");
|
Console.WriteLine($"{parentDir.Children[i].Name} {stringPos}");
|
||||||
|
|
||||||
|
@ -628,6 +634,10 @@ namespace FirstPlugin
|
||||||
Offset = reader.ReadUInt32();
|
Offset = reader.ReadUInt32();
|
||||||
Size = reader.ReadUInt32();
|
Size = reader.ReadUInt32();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateHash() {
|
||||||
|
Hash = CalculateHash(Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ namespace Toolbox.Library
|
||||||
private string _fileName = string.Empty;
|
private string _fileName = string.Empty;
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public string FileName
|
public virtual string FileName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -363,7 +363,10 @@ namespace Toolbox.Library
|
||||||
{
|
{
|
||||||
string NewName = SetFullPath(FileNodes[i].Item2, this);
|
string NewName = SetFullPath(FileNodes[i].Item2, this);
|
||||||
if (NewName != string.Empty)
|
if (NewName != string.Empty)
|
||||||
|
{
|
||||||
|
FileNodes[i].Item1.Name = FileNodes[i].Item2.Text;
|
||||||
FileNodes[i].Item1.FileName = NewName;
|
FileNodes[i].Item1.FileName = NewName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,6 +551,7 @@ namespace Toolbox.Library
|
||||||
if (node is IDirectoryContainer)
|
if (node is IDirectoryContainer)
|
||||||
{
|
{
|
||||||
var folder = new ArchiveFolderNodeWrapper(node.Name, archiveFile, this);
|
var folder = new ArchiveFolderNodeWrapper(node.Name, archiveFile, this);
|
||||||
|
folder.DirectoryContainer = (IDirectoryContainer)node;
|
||||||
parent.Nodes.Add(folder);
|
parent.Nodes.Add(folder);
|
||||||
|
|
||||||
if (((IDirectoryContainer)node).Nodes != null)
|
if (((IDirectoryContainer)node).Nodes != null)
|
||||||
|
@ -642,6 +646,8 @@ namespace Toolbox.Library
|
||||||
|
|
||||||
public virtual object PropertyDisplay { get; set; }
|
public virtual object PropertyDisplay { get; set; }
|
||||||
|
|
||||||
|
public IDirectoryContainer DirectoryContainer { get; set; }
|
||||||
|
|
||||||
public bool CanReplace
|
public bool CanReplace
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
|
@ -758,6 +764,8 @@ namespace Toolbox.Library
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
Text = dialog.textBox1.Text;
|
Text = dialog.textBox1.Text;
|
||||||
|
if (DirectoryContainer != null)
|
||||||
|
DirectoryContainer.Name = Text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue