Skip to content

Commit

Permalink
Updated Tex Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jones-HM committed Mar 12, 2023
1 parent 4083198 commit 021fa0b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 28 deletions.
29 changes: 6 additions & 23 deletions IGIEditor/IGIEditorUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4804,6 +4804,11 @@ private void selectTexturesBtn_Click(object sender, EventArgs e)
{
try
{
// Clean the temp data first.
QUtils.CleanUpTmpFiles();
textureSelectedPath = null;
texFiles = null;

var folderBrowser = new OpenFileDialog();
folderBrowser.ValidateNames = false;
folderBrowser.CheckFileExists = false;
Expand Down Expand Up @@ -5053,31 +5058,9 @@ private void textureBox_MouseUp(object sender, MouseEventArgs e)
textureBox.Image = bitmap;
}


private void clearTempToolStripMenuItem_Click(object sender, EventArgs e)
{

// Clear the PictureBox
textureBox.Image = null;

// Cleaning up directories
QUtils.AddLog(MethodBase.GetCurrentMethod().Name, "Cleaning up directories");
string[] dconvFiles = Directory.GetFiles(Path.Combine(QUtils.qTools, @"DConv\input")).Concat(Directory.GetFiles(Path.Combine(QUtils.qTools, @"DConv\output"))).ToArray();
string[] tgaConvFiles = Directory.GetFiles(Path.Combine(QUtils.qTools, @"TGAConv")).ToArray();
foreach (string file in dconvFiles.Concat(tgaConvFiles))
{
try
{
if (file.Contains(".exe")) continue; // Skip the TGAConv file.
File.Delete(file);
QUtils.AddLog(MethodBase.GetCurrentMethod().Name, $"Removed file: {file} successfully.");
}
catch (Exception ex)
{
QUtils.LogException(MethodBase.GetCurrentMethod().Name, ex);
}
}

QUtils.CleanUpTmpFiles();
SetStatusText("Temp data cleared success.");
}

Expand Down
40 changes: 35 additions & 5 deletions IGIEditor/QUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ internal class WeaponGroup

#region App Version
internal static string versionFileName = "VERSION";
internal static string appEditorSubVersion = "0.8.0.0";
internal static string appEditorSubVersion = "0.8.0.1";
internal static float viewPortDelta = 10000.0f;
#endregion

Expand Down Expand Up @@ -305,7 +305,7 @@ internal class WeaponGroup
#region About Info
internal static string keyBase = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths";
internal static string aboutStr = "IGI Editor is powerful editor to edit game levels" + "\n" + "Offers upto " + GAME_MAX_LEVEL + " level\nVersion: v"
+ appEditorSubVersion + " BETA.\n\nTools/Language: C#(5.0) VS-Studio/Code\nCreated by Haseeb Mir.\n\nCredits & People\nUI Designing - Dark\nResearch data - Dimon Yoejin and GM123.\nQScript/DConv Tools - Artiom.\nTester - Orwa\nIGI-VK Community.";
+ appEditorSubVersion + " BETA.\n\nTools/Language: C#(5.0) VS-Studio/Code\nCreated by Haseeb Mir.\n\nCredits & People\nUI Designing - Dark\nResearch data - Dimon Yoejin and GM123.\nQScript/DConv Tools - Artiom.\nTester - Orwa\nTexture Editor - Neoxaero\nIGI-VK Community.";
#endregion

#region Mask Constants
Expand Down Expand Up @@ -1874,6 +1874,27 @@ internal static int GameitemsCount()
return (int)gameitems;
}

private void ClearTempFiles()
{
// Cleaning up directories
QUtils.AddLog(MethodBase.GetCurrentMethod().Name, "Cleaning up directories");
string[] dconvFiles = Directory.GetFiles(Path.Combine(QUtils.qTools, @"DConv\input")).Concat(Directory.GetFiles(Path.Combine(QUtils.qTools, @"DConv\output"))).ToArray();
string[] tgaConvFiles = Directory.GetFiles(Path.Combine(QUtils.qTools, @"TGAConv")).ToArray();
foreach (string file in dconvFiles.Concat(tgaConvFiles))
{
try
{
if (file.Contains(".exe")) continue; // Skip the TGAConv file.
File.Delete(file);
QUtils.AddLog(MethodBase.GetCurrentMethod().Name, $"Removed file: {file} successfully.");
}
catch (Exception ex)
{
QUtils.LogException(MethodBase.GetCurrentMethod().Name, ex);
}
}
}

internal static void CleanUpAiFiles()
{
if (!gameReset) return;
Expand All @@ -1892,13 +1913,22 @@ internal static void CleanUpAiFiles()

internal static void CleanUpTmpFiles()
{
foreach (string file in Directory.EnumerateFiles(cachePath, "*.dll"))
// Cleaning up directories
QUtils.AddLog(MethodBase.GetCurrentMethod().Name, "Cleaning up temp directories");
string[] dconvFiles = Directory.GetFiles(Path.Combine(QUtils.qTools, @"DConv\input")).Concat(Directory.GetFiles(Path.Combine(QUtils.qTools, @"DConv\output"))).ToArray();
string[] tgaConvFiles = Directory.GetFiles(Path.Combine(QUtils.qTools, @"TGAConv")).ToArray();
foreach (string file in dconvFiles.Concat(tgaConvFiles))
{
try
{
FileIODelete(file);
if (file.Contains(".exe")) continue; // Skip the TGAConv file.
File.Delete(file);
QUtils.AddLog(MethodBase.GetCurrentMethod().Name, $"Removed file: {file} successfully.");
}
catch (Exception ex)
{
QUtils.LogException(MethodBase.GetCurrentMethod().Name, ex);
}
catch (Exception ex) { }
}
}

Expand Down

0 comments on commit 021fa0b

Please sign in to comment.