Skip to content

Commit

Permalink
Update v3.0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunaretic committed Jul 15, 2024
2 parents 4eb0320 + 6b2988c commit c938cf0
Show file tree
Hide file tree
Showing 14 changed files with 329 additions and 102 deletions.
15 changes: 12 additions & 3 deletions FFXIV_TexTools/FFXIV_TexTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
<Product>FFXIV_TexTools</Product>
<Copyright>Copyright © 2024</Copyright>

<ApplicationVersion>3.0.6.1</ApplicationVersion>
<AssemblyVersion>3.0.6.1</AssemblyVersion>
<FileVersion>3.0.6.1</FileVersion>
<ApplicationVersion>3.0.6.2</ApplicationVersion>
<AssemblyVersion>3.0.6.2</AssemblyVersion>
<FileVersion>3.0.6.2</FileVersion>

<LangVersion>9.0</LangVersion>
<UseWPF>true</UseWPF>
Expand Down Expand Up @@ -156,6 +156,10 @@
<LastGenOutput>XivStringRaces.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Update="Resources\XivStrings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>XivStrings.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.manifest" />
<Resource Include="Resources\rgbaChannels.cso" />
</ItemGroup>
Expand Down Expand Up @@ -198,6 +202,11 @@
<AutoGen>True</AutoGen>
<DependentUpon>UIStrings.resx</DependentUpon>
</Compile>
<Compile Update="Resources\XivStrings.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>XivStrings.resx</DependentUpon>
</Compile>
<Compile Update="Views\FileControls\MaterialFileControl.xaml.cs">
<SubType>Code</SubType>
</Compile>
Expand Down
83 changes: 49 additions & 34 deletions FFXIV_TexTools/Helpers/ModpackUpgraderWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,58 +22,73 @@ public static async Task UpgradeModpackPrompted(bool includePartials = true)
InitialDirectory = Path.GetFullPath(Settings.Default.ModPack_Directory),
};

ofd.Multiselect = true;
if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
{
return;
}

var path = ofd.FileName;

var paths = ofd.FileNames;


await mw.LockUi("Upgrading Modpack", "Please Wait...\n\nIf this takes more than 3-5 minutes, please close TexTools and retry with \nOptions => Settings => 'Compress Upgrade Textures' turned off.");
try
{
var i = 1;
foreach (var path in paths)
{
if(paths.Length > 1)
{
mw._lockProgressController.SetMessage("Updating Mod #" + i + "/" + paths.Length);
}

var data = await xivModdingFramework.Mods.ModpackUpgrader.UpgradeModpack(path, includePartials);
var data = await xivModdingFramework.Mods.ModpackUpgrader.UpgradeModpack(path, includePartials);

if(!data.AnyChanges)
{
FlexibleMessageBox.Show(ViewHelpers.GetWin32Window(MainWindow.GetMainWindow()),
"The upgrader found nothing to upgrade in the modpack.\n\nThis typically means the mod either does not need to be upgraded, must be manually upgraded, or was already upgraded, possibly by another tool (Ex. Penumbra).",
"No Upgrade Needed",
MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (!data.AnyChanges && paths.Length == 1)
{
FlexibleMessageBox.Show(ViewHelpers.GetWin32Window(MainWindow.GetMainWindow()),
"The upgrader found nothing to upgrade in the modpack.\n\nThis typically means the mod either does not need to be upgraded, must be manually upgraded, or was already upgraded, possibly by another tool (Ex. Penumbra).",
"No Upgrade Needed",
MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}

var ext = Path.GetExtension(path);
var ext = Path.GetExtension(path);

var name = Path.GetFileNameWithoutExtension(path);
if (ext == ".json")
{
name = IOUtil.MakePathSafe(data.Data.MetaPage.Name, false);
}
var name = Path.GetFileNameWithoutExtension(path);
if (ext == ".json")
{
name = IOUtil.MakePathSafe(data.Data.MetaPage.Name, false);
}

if (ext != ".ttmp2" && ext != ".pmp")
{
ext = ".pmp";
}
if (ext != ".ttmp2" && ext != ".pmp")
{
ext = ".pmp";
}


// Final Save location
var dir = Path.GetDirectoryName(path);
var fName = name + "_dt" + ext;
var sfd = new SaveFileDialog()
{
FileName = fName,
Filter = ViewHelpers.ModpackFileFilter,
InitialDirectory = dir,
};
if (sfd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
{
return;
// Final Save location
var dir = Path.GetDirectoryName(path);
var fName = name + "_dt" + ext;
var newPath = Path.GetFullPath(Path.Combine(dir, fName));
if (paths.Length == 1)
{
var sfd = new SaveFileDialog()
{
FileName = fName,
Filter = ViewHelpers.ModpackFileFilter,
InitialDirectory = dir,
};
if (sfd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
{
return;
}
newPath = sfd.FileName;
}

await data.Data.WriteModpack(newPath, true);
}
var newPath = sfd.FileName;
await data.Data.WriteModpack(newPath, true);
}
catch (Exception ex)
{
Expand Down
4 changes: 2 additions & 2 deletions FFXIV_TexTools/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@

<MenuItem Header="{Binding Source={x:Static resx:UIStrings.Raw_File_Operations}}">
<MenuItem Header="Import FFXIV Folder Tree" Click="Menu_ImportFolder_Click"/>
<MenuItem x:Name="Menu_ExtractRaw" Header="{Binding Source={x:Static resx:UIStrings.Extract_Raw}}" Click="Menu_ExtractRaw_Click"/>
<MenuItem x:Name="Menu_ImportRaw" Header="{Binding Source={x:Static resx:UIStrings.Import_Raw}}" Click="Menu_ImportRaw_Click"/>
<MenuItem x:Name="Menu_ExtractRaw" Header="{Binding Source={x:Static resx:UIStrings.Extract_File}}" Click="Menu_ExtractRaw_Click"/>
<MenuItem x:Name="Menu_ImportRaw" Header="{Binding Source={x:Static resx:UIStrings.Import_File}}" Click="Menu_ImportRaw_Click"/>
<MenuItem x:Name="Menu_CopyFile" Header="{Binding Source={x:Static resx:UIStrings.Copy_File}}" Click="Menu_CopyFile_Click"/>
</MenuItem>

Expand Down
2 changes: 1 addition & 1 deletion FFXIV_TexTools/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public bool IsUiLocked
public IProgress<string> LockProgress { get { return _lockProgress; } }


private ProgressDialogController _lockProgressController ;
internal ProgressDialogController _lockProgressController ;

/// <summary>
/// Fired when the old tree is about to be discarded.
Expand Down
39 changes: 32 additions & 7 deletions FFXIV_TexTools/Models/PenumbraUpgradeStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
using System.Diagnostics;
using xivModdingFramework.Mods;
using xivModdingFramework.Exd.FileTypes;
using FFXIV_TexTools.Views.Upgrades;

namespace FFXIV_TexTools.Models
{
public class PenumbraUpgradeStatus
public class PenumbraUpgradeStatus : ICloneable
{
[JsonConverter(typeof(StringEnumConverter))]
public enum EUpgradeResult
Expand All @@ -28,7 +29,7 @@ public enum EUpgradeResult

public Dictionary<string, EUpgradeResult> Upgrades = new Dictionary<string, EUpgradeResult>();

public async Task<EUpgradeResult> ProcessMod(string baseDir, string targetDir, string mod)
public async Task<EUpgradeResult> ProcessMod(string baseDir, string targetDir, string mod, bool compress = true)
{
var source = Path.GetFullPath(Path.Combine(baseDir, mod));
var target = Path.GetFullPath(Path.Combine(targetDir, mod));
Expand All @@ -42,8 +43,19 @@ public async Task<EUpgradeResult> ProcessMod(string baseDir, string targetDir, s
var res = EUpgradeResult.Failure;
try
{
var s = await ModpackUpgrader.UpgradeModpack(source, target);
res = s ? EUpgradeResult.Success : EUpgradeResult.Unchanged;
var result = await ModpackUpgrader.UpgradeModpack(source, target, false);

if (!result)
{
// If we did nothing, just direct copy the mod, rather than doing the more expensive
// PMP write.
IOUtil.CopyFolder(source, target);
}

res = result ? EUpgradeResult.Success : EUpgradeResult.Unchanged;



} catch (Exception ex)
{
if (Directory.Exists(target))
Expand Down Expand Up @@ -74,13 +86,26 @@ public async Task<EUpgradeResult> ProcessMod(string baseDir, string targetDir, s
Trace.WriteLine(ex);
}

await IOUtil.CompressWindowsDirectory(target);
if (compress)
{
await IOUtil.CompressWindowsDirectory(target);
}

if (Upgrades.ContainsKey(mod))
lock (PenumbraLibraryUpgradeWindow._ResultsLock)
{
Upgrades[mod] = res;
if (Upgrades.ContainsKey(mod))
{
Upgrades[mod] = res;
}
}
return res;
}

public object Clone()
{
var cl = (PenumbraUpgradeStatus) MemberwiseClone();
cl.Upgrades = new Dictionary<string, EUpgradeResult>(Upgrades);
return cl;
}
}
}
4 changes: 2 additions & 2 deletions FFXIV_TexTools/Resources/UIStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions FFXIV_TexTools/Resources/UIStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ If you would like to enable this, first import a texture for the selected item.<
<value>Import Raw File</value>
</data>
<data name="Raw_File_Operations" xml:space="preserve">
<value>Raw File Operations</value>
<value>File Operations</value>
</data>
<data name="Clean_Up_ModList" xml:space="preserve">
<value>Clean Up Modlist</value>
Expand Down Expand Up @@ -1163,7 +1163,7 @@ If you would like to enable this, first import a texture for the selected item.<
<value>Extract File</value>
</data>
<data name="Import Raw File" xml:space="preserve">
<value>Import Raw File</value>
<value>Import File</value>
</data>
<data name="Destination Path:" xml:space="preserve">
<value>Destination Path:</value>
Expand Down
68 changes: 46 additions & 22 deletions FFXIV_TexTools/Resources/XivStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c938cf0

Please sign in to comment.