diff --git a/src/TEXTool/MainForm.Designer.cs b/src/TEXTool/MainForm.Designer.cs
index 73e466a..e197fbd 100644
--- a/src/TEXTool/MainForm.Designer.cs
+++ b/src/TEXTool/MainForm.Designer.cs
@@ -96,6 +96,7 @@ private void InitializeComponent()
this.atlasElementXToolStrip = new System.Windows.Forms.ToolStripLabel();
this.atlasElementYToolStripLabel = new System.Windows.Forms.ToolStripLabel();
this.atlasElementYToolStrip = new System.Windows.Forms.ToolStripLabel();
+ this.backgroundWorker = new System.ComponentModel.BackgroundWorker();
this.toolStripContainer1.BottomToolStripPanel.SuspendLayout();
this.toolStripContainer1.ContentPanel.SuspendLayout();
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
@@ -435,6 +436,11 @@ private void InitializeComponent()
this.atlasElementYToolStrip.Size = new System.Drawing.Size(13, 22);
this.atlasElementYToolStrip.Text = "0";
//
+ // backgroundWorker
+ //
+ this.backgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker_DoWork);
+ this.backgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker_RunWorkerCompleted);
+ //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -503,6 +509,7 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripLabel atlasElementBorderColorToolStripLabel;
private System.Windows.Forms.ToolStripComboBox atlasElementBorderColors;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
+ private System.ComponentModel.BackgroundWorker backgroundWorker;
}
diff --git a/src/TEXTool/MainForm.cs b/src/TEXTool/MainForm.cs
index 829788b..4f0312e 100644
--- a/src/TEXTool/MainForm.cs
+++ b/src/TEXTool/MainForm.cs
@@ -29,6 +29,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Reflection;
using System.Windows.Forms;
+using System.ComponentModel;
+
using System.Drawing;
using System.Drawing.Drawing2D;
@@ -37,6 +39,8 @@ namespace TEXTool
public partial class MainForm : Form
{
public TEXTool Tool;
+ public ProgressForm ProgressForm;
+
GraphicsPath graphicsPath;
float offsetX = 0, offsetY = 0, scaleX = 1, scaleY = 1;
@@ -45,6 +49,7 @@ public MainForm()
Tool = new TEXTool();
Tool.FileOpened += new FileOpenedEventHandler(TEXTool_FileOpened);
Tool.FileRawImage += new FileRawImageEventHandler(tool_FileRawImage);
+ Tool.OnProgressUpdate += tool_OnProgressUpdate;
InitializeComponent();
FillZoomLevelComboBox();
@@ -110,7 +115,10 @@ private void OpenFileDialog()
if (dialog.ShowDialog(this) == DialogResult.OK)
{
- Tool.OpenFile(dialog.FileName, dialog.OpenFile());
+ ProgressForm = new ProgressForm();
+ ProgressForm.StartPosition = FormStartPosition.CenterParent;
+ backgroundWorker.RunWorkerAsync(dialog);
+ ProgressForm.ShowDialog(this);
}
}
}
@@ -301,6 +309,30 @@ private void imageBox_Paint(object sender, PaintEventArgs e)
}
}
+ private void tool_OnProgressUpdate(int value)
+ {
+ base.Invoke((Action)delegate
+ {
+ ProgressForm.ReportProgress(value);
+ });
+ }
+
+ private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
+ {
+ var dialog = (OpenFileDialog)e.Argument;
+ Tool.OpenFile(dialog.FileName, dialog.OpenFile());
+ }
+
+ private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
+ {
+ if (ProgressForm != null)
+ {
+ ProgressForm.Close();
+ ProgressForm.Dispose();
+ }
+ }
+
#endregion
+
}
}
diff --git a/src/TEXTool/MainForm.resx b/src/TEXTool/MainForm.resx
index 86d6964..86268ba 100644
--- a/src/TEXTool/MainForm.resx
+++ b/src/TEXTool/MainForm.resx
@@ -126,6 +126,9 @@
485, 17
+
+ 650, 17
+
diff --git a/src/TEXTool/ProgressForm.Designer.cs b/src/TEXTool/ProgressForm.Designer.cs
new file mode 100644
index 0000000..fb34ac0
--- /dev/null
+++ b/src/TEXTool/ProgressForm.Designer.cs
@@ -0,0 +1,65 @@
+namespace TEXTool
+{
+ partial class ProgressForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.progressBar = new System.Windows.Forms.ProgressBar();
+ this.SuspendLayout();
+ //
+ // progressBar
+ //
+ this.progressBar.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.progressBar.Location = new System.Drawing.Point(0, 0);
+ this.progressBar.Name = "progressBar";
+ this.progressBar.Size = new System.Drawing.Size(349, 22);
+ this.progressBar.TabIndex = 0;
+ //
+ // ProgressForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(349, 22);
+ this.ControlBox = false;
+ this.Controls.Add(this.progressBar);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "ProgressForm";
+ this.ShowIcon = false;
+ this.ShowInTaskbar = false;
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ProgressBar progressBar;
+
+
+ }
+}
\ No newline at end of file
diff --git a/src/TEXTool/ProgressForm.cs b/src/TEXTool/ProgressForm.cs
new file mode 100644
index 0000000..92d9ebe
--- /dev/null
+++ b/src/TEXTool/ProgressForm.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace TEXTool
+{
+ public partial class ProgressForm : Form
+ {
+ public ProgressForm()
+ {
+ InitializeComponent();
+ }
+ public void ReportProgress(int i)
+ {
+ progressBar.Value = i;
+ }
+ }
+}
diff --git a/src/TEXTool/ProgressForm.resx b/src/TEXTool/ProgressForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/src/TEXTool/ProgressForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/src/TEXTool/Properties/AssemblyInfo.cs b/src/TEXTool/Properties/AssemblyInfo.cs
index d2d9487..39a0380 100644
--- a/src/TEXTool/Properties/AssemblyInfo.cs
+++ b/src/TEXTool/Properties/AssemblyInfo.cs
@@ -40,5 +40,5 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
[assembly: Guid("76bbf4d2-c278-4dae-a48c-18f660bc6e61")]
-[assembly: AssemblyVersion("1.4.0.0")]
+[assembly: AssemblyVersion("1.4.1.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/TEXTool/TEXTool.cs b/src/TEXTool/TEXTool.cs
index 5627497..56bf788 100644
--- a/src/TEXTool/TEXTool.cs
+++ b/src/TEXTool/TEXTool.cs
@@ -85,6 +85,7 @@ public FileRawImageEventArgs(Bitmap image, List element
public delegate void FileOpenedEventHandler(object sender, FileOpenedEventArgs e);
public delegate void FileRawImageEventHandler(object sender, FileRawImageEventArgs e);
+ public delegate void ProgressUpdate(int value);
public class TEXTool
{
@@ -94,6 +95,9 @@ public class TEXTool
public event FileOpenedEventHandler FileOpened;
public event FileRawImageEventHandler FileRawImage;
+ public event ProgressUpdate OnProgressUpdate;
+
+
#region Util
public static class EnumHelper
@@ -191,6 +195,7 @@ public void OpenFile(string filename, Stream stream)
Bitmap pt = new Bitmap((int)mipmap.Width, (int)mipmap.Height);
for (int y = 0; y < mipmap.Height; y++)
+ {
for (int x = 0; x < mipmap.Width; x++)
{
byte r = imgReader.ReadByte();
@@ -199,7 +204,12 @@ public void OpenFile(string filename, Stream stream)
byte a = imgReader.ReadByte();
pt.SetPixel(x, y, Color.FromArgb(a, r, g, b));
}
-
+ if (OnProgressUpdate != null)
+ {
+ OnProgressUpdate(y * 100 / mipmap.Height);
+ }
+ }
+
pt.RotateFlip(RotateFlipType.RotateNoneFlipY);
CurrentFileRaw = pt;
diff --git a/src/TEXTool/TEXTool.csproj b/src/TEXTool/TEXTool.csproj
index 9ef640d..4d3a8ac 100644
--- a/src/TEXTool/TEXTool.csproj
+++ b/src/TEXTool/TEXTool.csproj
@@ -60,11 +60,20 @@
MainForm.cs
+
+ Form
+
+
+ ProgressForm.cs
+
MainForm.cs
+
+ ProgressForm.cs
+
ResXFileCodeGenerator
Resources.Designer.cs