Skip to content

Commit

Permalink
Update v3.0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunaretic committed Jun 29, 2024
2 parents 46a0bfe + 1eb1721 commit 9f58f02
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 7 deletions.
4 changes: 2 additions & 2 deletions FFXIV_TexTools/FFXIV_TexTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<AssemblyTitle>FFXIV_TexTools</AssemblyTitle>
<Product>FFXIV_TexTools</Product>
<Copyright>Copyright © 2024</Copyright>
<AssemblyVersion>3.0.1.1</AssemblyVersion>
<FileVersion>3.0.1.1</FileVersion>
<AssemblyVersion>3.0.1.2</AssemblyVersion>
<FileVersion>3.0.1.2</FileVersion>
<LangVersion>9.0</LangVersion>
<OutputPath>bin\$(Configuration)\</OutputPath>
<UseWPF>true</UseWPF>
Expand Down
26 changes: 25 additions & 1 deletion FFXIV_TexTools/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ namespace FFXIV_TexTools
/// </summary>
public partial class MainWindow
{
private bool _Loaded = false;
private int _LockCount = 0;
private static MainWindow _mainWindow;
public readonly System.Windows.Forms.IWin32Window Win32Window;
Expand All @@ -98,6 +99,14 @@ public static bool IsBetaVersion {
}
}

public bool MainWindowLoaded
{
get
{
return _Loaded;
}
}

public event EventHandler<int> SelectedPrimaryItemValueChanged;

private int _selectedPrimaryItemValue = -1;
Expand Down Expand Up @@ -635,6 +644,11 @@ private async Task CheckItemLoadComplete()

public async Task LockUi(string title = null, string msg = null, object caller = null)
{
if(!this.IsInitialized || !ViewHelpers.IsWindowOpen(this))
{
return;
}

await _lockScreenSemaphore.WaitAsync();
try
{
Expand All @@ -654,7 +668,15 @@ public async Task LockUi(string title = null, string msg = null, object caller =
msg = UIStrings.Please_Wait;
}

_lockProgressController = await this.ShowProgressAsync(title, msg);
try
{
_lockProgressController = await this.ShowProgressAsync(title, msg);
}
catch
{
// Window wasn't actually visible/etc.
return;
}
_lockProgress = new Progress<string>((update) =>
{
_lockProgressController.SetMessage(update);
Expand Down Expand Up @@ -1638,6 +1660,8 @@ private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
var tmps = fileVersion.Split('.');
var pre = tmps[tmps.Length - 1] == "0" ? "" : $".{tmps[tmps.Length - 1]}";
Title += $" {fileVersion.Substring(0, fileVersion.LastIndexOf("."))}{pre}";

_Loaded = true;
}

private void GithubButton_Click(object sender, RoutedEventArgs e)
Expand Down
16 changes: 16 additions & 0 deletions FFXIV_TexTools/Views/ModListView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@
<ListView.ItemTemplate>
<DataTemplate>
<Border BorderBrush="{Binding ActiveBorder}" BorderThickness="2" Background="{Binding Active}" Opacity="{Binding ActiveOpacity}" ToolTip="{Binding Path=FilePath}" Width="160">

<Border.ContextMenu>
<ContextMenu>
<MenuItem Header="View/Edit File" Click="OpenFile_Click">
</MenuItem>
<MenuItem Click="CopyPath_Click">
<MenuItem.Header>
<TextBlock>
<Run>Copy Path: </Run>
<Run Text="{Binding Path=FilePath}"></Run>
</TextBlock>
</MenuItem.Header>
</MenuItem>
</ContextMenu>
</Border.ContextMenu>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
Expand All @@ -85,6 +100,7 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>


<!-- Top Line Header -->
<!-- Row 0 Data-->
<Border BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" BorderThickness="1" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
Expand Down
31 changes: 31 additions & 0 deletions FFXIV_TexTools/Views/ModListView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
using System.Windows.Shapes;
using System.Collections.Generic;
using SharpDX;
using FFXIV_TexTools.Views.Controls;
using static FFXIV_TexTools.ViewModels.ModListViewModel;

namespace FFXIV_TexTools.Views
{
Expand Down Expand Up @@ -316,5 +318,34 @@ private void MetroWindow_Closed(object sender, EventArgs e)
(DataContext as ModListViewModel).Dispose();
_cts?.Dispose();
}

private void CopyPath_Click(object sender, RoutedEventArgs e)
{
if (sender == null) return;

var ml = (sender as FrameworkElement).DataContext as ModListModel;
if (ml == null) return;


System.Windows.Clipboard.SetText(ml.FilePath);

}

private async void OpenFile_Click(object sender, RoutedEventArgs e)
{
if (sender == null) return;

var ml = (sender as FrameworkElement).DataContext as ModListModel;
if (ml == null) return;


try
{
await SimpleFileViewWindow.OpenFile(ml.FilePath);
} catch (Exception Ex)
{
Trace.WriteLine(Ex);
}
}
}
}
6 changes: 5 additions & 1 deletion FFXIV_TexTools/Views/ModPack/Simple/FileListImporter.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ public static void ShowModpackImport(string modpackPath, IEnumerable<string> fil
{
if (owner == null)
{
owner = MainWindow.GetMainWindow();
var mw = MainWindow.GetMainWindow();
if (mw != null && mw.MainWindowLoaded)
{
owner = MainWindow.GetMainWindow();
}
}

var wind = new FileListImporter(files, modpackPath);
Expand Down
72 changes: 70 additions & 2 deletions FFXIV_TexTools/Views/ModPack/Wizard/EditWizardGroupWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
using TeximpNet.DDS;
using xivModdingFramework.Cache;
using xivModdingFramework.Exd.FileTypes;
using xivModdingFramework.General;
using xivModdingFramework.General.DataContainers;
using xivModdingFramework.General.Enums;
using xivModdingFramework.Helpers;
using xivModdingFramework.Items.Categories;
Expand Down Expand Up @@ -1107,6 +1109,58 @@ private void AddMetadataManipulations(ItemMetadata metadata)
LockCount--;
}
}
private void AddRgspManipulations(RacialGenderScalingParameter rgsp)
{
if (SelectedOption == null) return;


if (SelectedOption.StandardData.Manipulations == null)
{
SelectedOption.StandardData.Manipulations = new List<PMPManipulationWrapperJson>();
}

LockCount++;
try
{
var toRemove = new List<PMPManipulationWrapperJson>();
var manips = SelectedOption.StandardData.Manipulations;

var entries = PMPRspManipulationJson.FromRgspEntry(rgsp);


foreach (var m in manips)
{
var rm = m.GetManipulation() as PMPRspManipulationJson;
if (rm == null) continue;

if(entries.Any(x => x.SubRace == rm.SubRace && x.Attribute == rm.Attribute)){
toRemove.Add(m);
}

}

foreach (var m in toRemove)
{
manips.Remove(m);
}

var wrapped = new List<PMPRspManipulationWrapperJson>();

foreach(var e in entries)
{
var w = new PMPRspManipulationWrapperJson() { Manipulation = e, Type = "Rsp" };
wrapped.Add(w);
}

manips.AddRange(wrapped);
SelectedOption.StandardData.SortManipulations();
UpdateManipulationText();
}
finally
{
LockCount--;
}
}

private async void AddMetadataButton_Click(object sender, RoutedEventArgs e)
{
Expand Down Expand Up @@ -1215,7 +1269,7 @@ private void DeselectAllButton_Click(object sender, RoutedEventArgs e)
ModpackContents.UnselectAll();
}

private void AddButton_Click(object sender, RoutedEventArgs e)
private async void AddButton_Click(object sender, RoutedEventArgs e)
{
foreach (var i in ModpackContents.SelectedItems)
{
Expand All @@ -1226,7 +1280,21 @@ private void AddButton_Click(object sender, RoutedEventArgs e)
Path = item.FilePath
};

_ = AddFile(fi, item.StorageInfo);
if (fi.Path.EndsWith(".meta"))
{
var data = await TransactionDataHandler.GetUncompressedFile(item.StorageInfo);
var meta = await ItemMetadata.Deserialize(data);
AddMetadataManipulations(meta);
} else if (fi.Path.EndsWith(".rgsp"))
{
var data = await TransactionDataHandler.GetUncompressedFile(item.StorageInfo);
var n = new RacialGenderScalingParameter(data);
AddRgspManipulations(n);
}
else
{
await AddFile(fi, item.StorageInfo);
}
}
}

Expand Down
15 changes: 15 additions & 0 deletions FFXIV_TexTools/Views/ViewHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
Expand Down Expand Up @@ -586,6 +587,20 @@ public static bool CheckFileWrite(this DependencyObject obj, ModTransaction tx =
}
public static bool IsWindowOpen<T>(T wind) where T : Window
{
if(wind == null)
{
return false;
}

if(typeof(T) == typeof(MainWindow))
{
var mw = wind as MainWindow;
if (!mw.MainWindowLoaded)
{
return false;
}
}

var w = Application.Current.Windows.OfType<T>().FirstOrDefault(x => x == wind);
if(w == null)
{
Expand Down

0 comments on commit 9f58f02

Please sign in to comment.