Skip to content

Commit

Permalink
Update 2.1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
KoraLyn committed Jul 22, 2020
2 parents 57cca30 + 5a7e162 commit 4efea35
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 30 deletions.
13 changes: 6 additions & 7 deletions FFXIV_TexTools/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ public MainWindow(string[] args)
CheckForSettingsUpdate();
LanguageSelection();

// Data Context needs to be set before we call Initialize Component to ensure
// that the bindings get connected immediately, and not after the constructor.
var mainViewModel = new MainViewModel(this);
this.DataContext = mainViewModel;

InitializeComponent();

var ci = new CultureInfo(Properties.Settings.Default.Application_Language)
{
NumberFormat = { NumberDecimalSeparator = "." }
Expand All @@ -94,6 +87,12 @@ public MainWindow(string[] args)
CultureInfo.CurrentCulture = ci;
CultureInfo.CurrentUICulture = ci;

// Data Context needs to be set before we call Initialize Component to ensure
// that the bindings get connected immediately, and not after the constructor.
var mainViewModel = new MainViewModel(this);
this.DataContext = mainViewModel;

InitializeComponent();

var fileVersion = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion;

Expand Down
23 changes: 22 additions & 1 deletion FFXIV_TexTools/Models/SimpleModpackEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
using System.ComponentModel;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Navigation;
using xivModdingFramework.General.Enums;
using xivModdingFramework.Models.FileTypes;
using xivModdingFramework.Mods.Enums;
using xivModdingFramework.Textures.Enums;

namespace xivModdingFramework.Mods.DataContainers
Expand Down Expand Up @@ -206,6 +209,14 @@ public string Part
}
}

private bool? _isActive;


private async Task<XivModStatus> GetModStatus()
{
return await _importerView._modding.IsModEnabled(Json.FullPath, false);
}

/// <summary>
/// The item part
/// </summary>
Expand All @@ -215,7 +226,17 @@ public bool Active
{
if (Mod == null)
{
return false;
if (_isActive == null)
{
var task = Task.Run(GetModStatus);
task.Wait();
var status = task.Result;
_isActive = status == Enums.XivModStatus.Enabled || status == XivModStatus.MatAdd ? true : false;
return (bool)_isActive;
} else
{
return (bool)_isActive;
}
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions FFXIV_TexTools/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyVersion("2.1.0.1")]
[assembly: AssemblyFileVersion("2.1.0.1")]
9 changes: 8 additions & 1 deletion FFXIV_TexTools/ViewModels/ModelViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,11 +1125,18 @@ private void OpenSavedFolder(object obj)
Process.Start(path);
}

private async Task<XivMdl> GetRawMdl()
{
return (await _model.GetRawMdl(_mdl));
}

private void OpenModelInspector(object obj)
{
if (_model != null)
{
var mdl = _model.GetRawMdl(_mdl).GetAwaiter().GetResult();
var task = Task.Run(GetRawMdl);
task.Wait();
var mdl = task.Result;
var modelInspector = new ModelInspector(mdl);
modelInspector.Owner = Window.GetWindow(_view);
modelInspector.ShowDialog();
Expand Down
76 changes: 62 additions & 14 deletions FFXIV_TexTools/Views/ModPack/SimpleModPackCreator.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,50 +397,82 @@ private void ModPackVersion_PreviewMouseUp(object sender, MouseButtonEventArgs e
ModPackVersion.CaretIndex = 0;
}


private bool MatchesFilter(Mod item)
{

if (string.IsNullOrEmpty(SearchTextBox.Text.Trim()))
return true;

string[] searchTerms = SearchTextBox.Text.Split('|');

foreach (string searchTerm in searchTerms)
{
if (item.name.IndexOf(searchTerm.Trim(), StringComparison.OrdinalIgnoreCase) >= 0) return true;
}
return false;
}

/// <summary>
/// The event handler for the select all button clicked
/// </summary>
private void SelectAllButton_Click(object sender, RoutedEventArgs e)
{
ModListView.SelectAll();
ModListView.Focus();


long addedSize = 0;
for (var i = 0; i < ModList.Mods.Count; i++)
{
var mod = ModList.Mods[i];

// Ignore invalid.
if (mod.fullPath.Equals(string.Empty)) continue;
ModpackSize += mod.data.modSize;

// Ignore things not in the filter.
if (!MatchesFilter(mod)) continue;

// Ignore things that are already selected.
if (SelectedMods.Contains(i)) continue;

SelectedMods.Add(i);
addedSize += mod.data.modSize;
}
ModpackSize += addedSize;


foreach (SimpleModpackEntry entry in this.Entries)
{
entry.MarkDirty();
}
ModListView.Focus();
}

/// <summary>
/// The event handler for the select active button clicked
/// </summary>
private void SelectActiveButton_Click(object sender, RoutedEventArgs e)
{
ModListView.UnselectAll();
SelectedMods.Clear();
ModpackSize = 0;

long newSize = 0;
long addedSize = 0;
for(var i = 0; i < ModList.Mods.Count; i++)
{
var mod = ModList.Mods[i];

// Ignore invalid.
if (mod.fullPath.Equals(string.Empty)) continue;

// Ignore disabled mods
if (!mod.enabled) continue;

// Ignore things not in the filter.
if (!MatchesFilter(mod)) continue;

// Ignore things that are already selected.
if (SelectedMods.Contains(i)) continue;


SelectedMods.Add(i);
newSize += mod.data.modSize;
addedSize += mod.data.modSize;
}
ModpackSize = newSize;
ModpackSize += addedSize;


// Entries CANNOT be iterrated to add values. Unloaded entries have
Expand All @@ -459,9 +491,25 @@ private void SelectActiveButton_Click(object sender, RoutedEventArgs e)
/// </summary>
private void ClearSelectedButton_Click(object sender, RoutedEventArgs e)
{
SelectedMods.Clear();
ModpackSize = 0;
ModListView.UnselectAll();
long removedSize = 0;
for (var i = 0; i < ModList.Mods.Count; i++)
{
var mod = ModList.Mods[i];

// Ignore invalid.
if (mod.fullPath.Equals(string.Empty)) continue;

// Ignore things not in the filter.
if (!MatchesFilter(mod)) continue;

// Ignore things that are not selected.
if (!SelectedMods.Contains(i)) continue;

SelectedMods.Remove(i);
removedSize += mod.data.modSize;
}
ModpackSize -= removedSize;

foreach (SimpleModpackEntry entry in this.Entries)
{
entry.MarkDirty();
Expand Down
5 changes: 4 additions & 1 deletion FFXIV_TexTools/Views/ModPack/SimpleModPackImporter.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public partial class SimpleModPackImporter
private ModelViewModel _modelViewModel;
private ModPackJson _packJson;
private bool _silent = false;
public Modding _modding;

[DllImport("Shlwapi.dll", CharSet = CharSet.Auto)]
public static extern long StrFormatByteSize(long fileSize, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder buffer, int bufferSize);
Expand Down Expand Up @@ -100,6 +101,7 @@ public SimpleModPackImporter(DirectoryInfo modPackDirectory, ModPackJson modPack

_modPackDirectory = modPackDirectory;
_gameDirectory = new DirectoryInfo(Properties.Settings.Default.FFXIV_Directory);
_modding = new Modding(_gameDirectory);
_texToolsModPack = new TTMP(new DirectoryInfo(Properties.Settings.Default.ModPack_Directory),
XivStrings.TexTools);
_messageInImport = messageInImport;
Expand Down Expand Up @@ -244,7 +246,6 @@ private async Task ImportOldModPack()
}
});
});
var modding = new Modding(_gameDirectory);

var originalModPackData = await _texToolsModPack.GetOriginalModPackJsonData(_modPackDirectory);

Expand Down Expand Up @@ -705,6 +706,8 @@ private void ClearSelectedButton_Click(object sender, RoutedEventArgs e)
{

SelectedEntries.Clear();
ModListView.UnselectAll();

foreach (var entry in Entries)
{
entry.MarkDirty();
Expand Down
6 changes: 3 additions & 3 deletions FFXIV_TexTools/Views/Models/ImportModelEditView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
</ComboBox>
<Label Content="Group:" HorizontalAlignment="Left" Margin="16,10,0,0" Width="54" VerticalContentAlignment="Center" VerticalAlignment="Top" RenderTransformOrigin="-0.1,0.5" Height="28" FontWeight="Bold"/>
<Label Content="Part:" HorizontalAlignment="Left" Margin="15,10,0,0" Width="40" VerticalContentAlignment="Center" VerticalAlignment="Top" Height="28" FontWeight="Bold" Grid.Column="1"/>
<Rectangle Fill="White" Grid.Row="1" Stroke="Gray" Margin="10,5"/>
<Rectangle Fill="White" Grid.Row="2" Stroke="Gray" Margin="10,5,10,10"/>
<Rectangle Fill="White" Grid.Row="1" Stroke="Gray" Margin="10,5,10,10" Grid.Column="1" Grid.RowSpan="2"/>
<Rectangle Grid.Row="1" Stroke="Gray" Margin="10,5"/>
<Rectangle Grid.Row="2" Stroke="Gray" Margin="10,5,10,10"/>
<Rectangle Grid.Row="1" Stroke="Gray" Margin="10,5,10,10" Grid.Column="1" Grid.RowSpan="2"/>
<Label Content="Material" Margin="10,10,10,0" Grid.Row="1" VerticalAlignment="Top" HorizontalContentAlignment="Center" FontSize="18" FontWeight="Bold" Height="34"/>
<Label Content="Shapes" Margin="10,10,10,0" Grid.Row="2" VerticalAlignment="Top" HorizontalContentAlignment="Center" FontSize="18" FontWeight="Bold" Height="34"/>
<Label Content="Attributes" Margin="10,10,10,0" Grid.Row="1" VerticalAlignment="Top" HorizontalContentAlignment="Center" FontSize="18" FontWeight="Bold" Height="34" Grid.Column="1"/>
Expand Down

0 comments on commit 4efea35

Please sign in to comment.