mirror of
https://github.com/4sval/FModel.git
synced 2026-09-13 20:16:38 -05:00
added save directory and copy multiple paths / names
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
{
|
||||
Path,
|
||||
PathNoExt,
|
||||
PathNoFile,
|
||||
File,
|
||||
FileNoExt
|
||||
}
|
||||
|
||||
@@ -210,6 +210,11 @@
|
||||
<Image Source="Resources/share-all.png"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="FModel_MI_Directory_Save" Header="{x:Static properties:Resources.SaveDirectory}" Click="FModel_MI_Directory_Save_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/content-save.png"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Header="{x:Static properties:Resources.FCopy}">
|
||||
<MenuItem.Icon>
|
||||
|
||||
@@ -385,6 +385,11 @@ namespace FModel
|
||||
if (FModel_AssetsPathTree.HasItems && FModel_AssetsPathTree.SelectedItem is TreeviewViewModel treeItem)
|
||||
await SortedTreeviewVm.ExtractFolder(treeItem).ConfigureAwait(false);
|
||||
}
|
||||
private void FModel_MI_Directory_Save_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (FModel_AssetsPathTree.HasItems && FModel_AssetsPathTree.SelectedItem is TreeviewViewModel treeItem)
|
||||
MenuItems.AddCustomGoTo(treeItem.Header, treeItem.GetFullPath().Substring(1) + "/");
|
||||
}
|
||||
private async void CM_Asset_Save_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (FModel_AssetsList.HasItems && FModel_AssetsList.SelectedIndex >= 0 && FModel_AssetsList.SelectedItem is ListBoxViewModel selectedItem)
|
||||
@@ -403,28 +408,28 @@ namespace FModel
|
||||
{
|
||||
if (FModel_AssetsPathTree.HasItems && FModel_AssetsPathTree.SelectedItem is TreeviewViewModel treeItem)
|
||||
Assets.Copy(treeItem.GetFullPath().Substring(1) + "/");
|
||||
else if (FModel_AssetsList.HasItems && FModel_AssetsList.SelectedIndex >= 0 && FModel_AssetsList.SelectedItem is ListBoxViewModel listItem)
|
||||
Assets.Copy(listItem.PakEntry.GetPathWithoutFile());
|
||||
else if (FModel_AssetsList.HasItems && FModel_AssetsList.SelectedIndex >= 0)
|
||||
Assets.Copy(FModel_AssetsList.SelectedItems, ECopy.PathNoFile);
|
||||
}
|
||||
private void CM_Copy_FPath_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (FModel_AssetsList.HasItems && FModel_AssetsList.SelectedIndex >= 0 && FModel_AssetsList.SelectedItem is ListBoxViewModel selectedItem)
|
||||
Assets.Copy(selectedItem.PakEntry, ECopy.Path);
|
||||
if (FModel_AssetsList.HasItems && FModel_AssetsList.SelectedIndex >= 0)
|
||||
Assets.Copy(FModel_AssetsList.SelectedItems, ECopy.Path);
|
||||
}
|
||||
private void CM_Copy_FName_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (FModel_AssetsList.HasItems && FModel_AssetsList.SelectedIndex >= 0 && FModel_AssetsList.SelectedItem is ListBoxViewModel selectedItem)
|
||||
Assets.Copy(selectedItem.PakEntry, ECopy.File);
|
||||
if (FModel_AssetsList.HasItems && FModel_AssetsList.SelectedIndex >= 0)
|
||||
Assets.Copy(FModel_AssetsList.SelectedItems, ECopy.File);
|
||||
}
|
||||
private void CM_Copy_FPath_NoExt_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (FModel_AssetsList.HasItems && FModel_AssetsList.SelectedIndex >= 0 && FModel_AssetsList.SelectedItem is ListBoxViewModel selectedItem)
|
||||
Assets.Copy(selectedItem.PakEntry, ECopy.PathNoExt);
|
||||
if (FModel_AssetsList.HasItems && FModel_AssetsList.SelectedIndex >= 0)
|
||||
Assets.Copy(FModel_AssetsList.SelectedItems, ECopy.PathNoExt);
|
||||
}
|
||||
private void CM_Copy_FName_NoExt_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (FModel_AssetsList.HasItems && FModel_AssetsList.SelectedIndex >= 0 && FModel_AssetsList.SelectedItem is ListBoxViewModel selectedItem)
|
||||
Assets.Copy(selectedItem.PakEntry, ECopy.FileNoExt);
|
||||
if (FModel_AssetsList.HasItems && FModel_AssetsList.SelectedIndex >= 0)
|
||||
Assets.Copy(FModel_AssetsList.SelectedItems, ECopy.FileNoExt);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
9
FModel/Properties/Resources.Designer.cs
generated
9
FModel/Properties/Resources.Designer.cs
generated
@@ -2241,6 +2241,15 @@ namespace FModel.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recherche une chaîne localisée semblable à Save Directory.
|
||||
/// </summary>
|
||||
public static string SaveDirectory {
|
||||
get {
|
||||
return ResourceManager.GetString("SaveDirectory", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recherche une chaîne localisée semblable à Save Image.
|
||||
/// </summary>
|
||||
|
||||
@@ -850,4 +850,7 @@ C'est maintenant le logiciel gratuit le plus utilisé pour leak sur Fortnite.</v
|
||||
<data name="UseDiscordRpc" xml:space="preserve">
|
||||
<value>Utiliser Discord RPC</value>
|
||||
</data>
|
||||
<data name="SaveDirectory" xml:space="preserve">
|
||||
<value>Sauvegarder le Répertoire</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -808,4 +808,7 @@ Col tempo sono state aggiunte nuove funzioni e molti altri utenti hanno comincia
|
||||
<data name="UseDiscordRpc" xml:space="preserve">
|
||||
<value>Usa Discord RPC</value>
|
||||
</data>
|
||||
<data name="SaveDirectory" xml:space="preserve">
|
||||
<value>Salva Directory</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1085,4 +1085,7 @@ It's now the most used free software to leak on Fortnite.</value>
|
||||
<value>Use Discord RPC</value>
|
||||
<comment>Should Discord Rich Presence be enabled?</comment>
|
||||
</data>
|
||||
<data name="SaveDirectory" xml:space="preserve">
|
||||
<value>Save Directory</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -22,6 +22,8 @@ using FModel.ViewModels.Buttons;
|
||||
using System.Threading;
|
||||
using static FModel.Creator.Creator;
|
||||
using SkiaSharp;
|
||||
using System.Text;
|
||||
using FModel.ViewModels.DataGrid;
|
||||
|
||||
namespace FModel.Utils
|
||||
{
|
||||
@@ -379,7 +381,26 @@ namespace FModel.Utils
|
||||
}
|
||||
}
|
||||
|
||||
public static void Copy(FPakEntry entry, ECopy mode)
|
||||
public static void Copy(IList entries, ECopy mode)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (entries[0] is ListBoxViewModel)
|
||||
{
|
||||
foreach (ListBoxViewModel selectedItem in entries)
|
||||
{
|
||||
sb.AppendLine(Copy(selectedItem.PakEntry, mode));
|
||||
}
|
||||
}
|
||||
else if (entries[0] is DataGridViewModel)
|
||||
{
|
||||
foreach (DataGridViewModel selectedItem in entries)
|
||||
{
|
||||
sb.AppendLine(Copy(selectedItem.Name, mode));
|
||||
}
|
||||
}
|
||||
Copy(sb.ToString().Trim());
|
||||
}
|
||||
public static string Copy(FPakEntry entry, ECopy mode)
|
||||
{
|
||||
if (Globals.CachedPakFiles.TryGetValue(entry.PakFileName, out var r))
|
||||
{
|
||||
@@ -388,27 +409,30 @@ namespace FModel.Utils
|
||||
toCopy += entry.Name;
|
||||
else if (mode == ECopy.PathNoExt)
|
||||
toCopy += entry.GetPathWithoutExtension();
|
||||
else if (mode == ECopy.PathNoFile)
|
||||
toCopy += entry.GetPathWithoutFile();
|
||||
else if (mode == ECopy.File)
|
||||
toCopy = entry.GetNameWithExtension();
|
||||
else if (mode == ECopy.FileNoExt)
|
||||
toCopy = entry.GetNameWithoutExtension();
|
||||
|
||||
Copy(toCopy);
|
||||
return toCopy;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
public static void Copy(string fullPath, ECopy mode)
|
||||
public static string Copy(string fullPath, ECopy mode)
|
||||
{
|
||||
string toCopy = string.Empty;
|
||||
if (mode == ECopy.Path)
|
||||
toCopy = fullPath;
|
||||
else if (mode == ECopy.PathNoExt)
|
||||
toCopy = fullPath.Substring(0, fullPath.LastIndexOf("."));
|
||||
else if (mode == ECopy.PathNoFile)
|
||||
toCopy = fullPath.Substring(0, fullPath.LastIndexOf("/") + 1);
|
||||
else if (mode == ECopy.File)
|
||||
toCopy = fullPath.Substring(fullPath.LastIndexOf("/") + 1);
|
||||
else if (mode == ECopy.FileNoExt)
|
||||
toCopy = fullPath.Substring(fullPath.LastIndexOf("/") + 1, fullPath.LastIndexOf(".") - (fullPath.LastIndexOf("/") + 1));
|
||||
|
||||
Copy(toCopy);
|
||||
return toCopy;
|
||||
}
|
||||
public static void Copy(string toCopy)
|
||||
{
|
||||
|
||||
@@ -40,10 +40,10 @@ namespace FModel.Utils
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// if OutputPath is empty the .Exe directory will be OutputPath
|
||||
/// </summary>
|
||||
private static void FixNoOutputPath()
|
||||
/// <summary>
|
||||
/// if OutputPath is empty the .Exe directory will be OutputPath
|
||||
/// </summary>
|
||||
private static void FixNoOutputPath()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Properties.Settings.Default.OutputPath))
|
||||
{
|
||||
|
||||
@@ -111,44 +111,7 @@ namespace FModel.ViewModels.MenuItem
|
||||
}
|
||||
|
||||
private bool DirectoryAddCanExecute() => Header.Equals(Properties.Resources.AddDirectory);
|
||||
private void AddDirectory()
|
||||
{
|
||||
var input = new GoToUserInput();
|
||||
if ((bool)input.ShowDialog())
|
||||
{
|
||||
var newDir = new GotoMenuItemViewModel
|
||||
{
|
||||
Header = input.Name,
|
||||
DirectoryPath = input.Directory
|
||||
};
|
||||
newDir.Childrens = new ObservableCollection<GotoMenuItemViewModel>
|
||||
{
|
||||
new GotoMenuItemViewModel
|
||||
{
|
||||
Header = Properties.Resources.GoTo,
|
||||
Icon = new Image { Source = new BitmapImage(new Uri("/FModel;component/Resources/share.png", UriKind.Relative)) },
|
||||
Parent = newDir
|
||||
},
|
||||
new GotoMenuItemViewModel
|
||||
{
|
||||
Header = Properties.Resources.EditDirectory,
|
||||
Icon = new Image { Source = new BitmapImage(new Uri("/FModel;component/Resources/pencil.png", UriKind.Relative)) },
|
||||
Parent = newDir
|
||||
},
|
||||
new GotoMenuItemViewModel
|
||||
{
|
||||
Header = Properties.Resources.RemoveDirectory,
|
||||
Icon = new Image { Source = new BitmapImage(new Uri("/FModel;component/Resources/delete-forever.png", UriKind.Relative)) },
|
||||
StaysOpenOnClick = true,
|
||||
Parent = newDir
|
||||
}
|
||||
};
|
||||
|
||||
MenuItems.customGoTos.Add(newDir);
|
||||
Properties.Settings.Default.CustomGoTos = JsonConvert.SerializeObject(MenuItems.customGoTos.Skip(2), Formatting.None);
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
private void AddDirectory() => MenuItems.AddCustomGoTo();
|
||||
|
||||
private bool DirectoryEditCanExecute() => Header.Equals(Properties.Resources.EditDirectory);
|
||||
private void EditDirectory()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using FModel.Windows.UserInput;
|
||||
using Newtonsoft.Json;
|
||||
using PakReader.Pak;
|
||||
using PakReader.Parsers.Objects;
|
||||
using System;
|
||||
@@ -59,6 +60,46 @@ namespace FModel.ViewModels.MenuItem
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddCustomGoTo() => AddCustomGoTo(string.Empty, string.Empty);
|
||||
public static void AddCustomGoTo(string name, string dir)
|
||||
{
|
||||
var input = new GoToUserInput(name, dir);
|
||||
if ((bool)input.ShowDialog())
|
||||
{
|
||||
var newDir = new GotoMenuItemViewModel
|
||||
{
|
||||
Header = input.Name,
|
||||
DirectoryPath = input.Directory
|
||||
};
|
||||
newDir.Childrens = new ObservableCollection<GotoMenuItemViewModel>
|
||||
{
|
||||
new GotoMenuItemViewModel
|
||||
{
|
||||
Header = Properties.Resources.GoTo,
|
||||
Icon = new Image { Source = new BitmapImage(new Uri("/FModel;component/Resources/share.png", UriKind.Relative)) },
|
||||
Parent = newDir
|
||||
},
|
||||
new GotoMenuItemViewModel
|
||||
{
|
||||
Header = Properties.Resources.EditDirectory,
|
||||
Icon = new Image { Source = new BitmapImage(new Uri("/FModel;component/Resources/pencil.png", UriKind.Relative)) },
|
||||
Parent = newDir
|
||||
},
|
||||
new GotoMenuItemViewModel
|
||||
{
|
||||
Header = Properties.Resources.RemoveDirectory,
|
||||
Icon = new Image { Source = new BitmapImage(new Uri("/FModel;component/Resources/delete-forever.png", UriKind.Relative)) },
|
||||
StaysOpenOnClick = true,
|
||||
Parent = newDir
|
||||
}
|
||||
};
|
||||
|
||||
customGoTos.Add(newDir);
|
||||
Properties.Settings.Default.CustomGoTos = JsonConvert.SerializeObject(MenuItems.customGoTos.Skip(2), Formatting.None);
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
// PLEASE DON'T USE THIS FOR BACKUP FILES
|
||||
// comment methods you don't use, thx
|
||||
public static bool AtLeastOnePak(this ObservableCollection<dynamic> o) => o.Any(x => !x.GetType().Equals(typeof(Separator)) && x.PakFile != null);
|
||||
|
||||
@@ -91,28 +91,28 @@ namespace FModel.Windows.Search
|
||||
|
||||
private void CM_Copy_DPath_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Assets_DtGrd.HasItems && Assets_DtGrd.SelectedIndex >= 0 && Assets_DtGrd.SelectedItem is DataGridViewModel selectedItem)
|
||||
Assets.Copy(selectedItem.Name.Substring(0, selectedItem.Name.LastIndexOf("/") + 1));
|
||||
if (Assets_DtGrd.HasItems && Assets_DtGrd.SelectedIndex >= 0)
|
||||
Assets.Copy(Assets_DtGrd.SelectedItems, ECopy.PathNoFile);
|
||||
}
|
||||
private void CM_Copy_FPath_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Assets_DtGrd.HasItems && Assets_DtGrd.SelectedIndex >= 0 && Assets_DtGrd.SelectedItem is DataGridViewModel selectedItem)
|
||||
Assets.Copy(selectedItem.Name, ECopy.Path);
|
||||
if (Assets_DtGrd.HasItems && Assets_DtGrd.SelectedIndex >= 0)
|
||||
Assets.Copy(Assets_DtGrd.SelectedItems, ECopy.Path);
|
||||
}
|
||||
private void CM_Copy_FName_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Assets_DtGrd.HasItems && Assets_DtGrd.SelectedIndex >= 0 && Assets_DtGrd.SelectedItem is DataGridViewModel selectedItem)
|
||||
Assets.Copy(selectedItem.Name, ECopy.File);
|
||||
if (Assets_DtGrd.HasItems && Assets_DtGrd.SelectedIndex >= 0)
|
||||
Assets.Copy(Assets_DtGrd.SelectedItems, ECopy.File);
|
||||
}
|
||||
private void CM_Copy_FPath_NoExt_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Assets_DtGrd.HasItems && Assets_DtGrd.SelectedIndex >= 0 && Assets_DtGrd.SelectedItem is DataGridViewModel selectedItem)
|
||||
Assets.Copy(selectedItem.Name, ECopy.PathNoExt);
|
||||
if (Assets_DtGrd.HasItems && Assets_DtGrd.SelectedIndex >= 0)
|
||||
Assets.Copy(Assets_DtGrd.SelectedItems, ECopy.PathNoExt);
|
||||
}
|
||||
private void CM_Copy_FName_NoExt_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Assets_DtGrd.HasItems && Assets_DtGrd.SelectedIndex >= 0 && Assets_DtGrd.SelectedItem is DataGridViewModel selectedItem)
|
||||
Assets.Copy(selectedItem.Name, ECopy.FileNoExt);
|
||||
if (Assets_DtGrd.HasItems && Assets_DtGrd.SelectedIndex >= 0)
|
||||
Assets.Copy(Assets_DtGrd.SelectedItems, ECopy.FileNoExt);
|
||||
}
|
||||
|
||||
private void OnSelectedItemChanged(object sender, SelectionChangedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user