improved MergeImages form with real time preview + added EChallengeBundleQuestUnlockType::RequiresBattlePass icon as separator

This commit is contained in:
Asval
2019-08-08 18:21:33 +02:00
parent 6d4b73cfbd
commit f24948dd05
13 changed files with 305 additions and 309 deletions

View File

@@ -31,12 +31,6 @@
<setting name="isWatermark" serializeAs="String">
<value>False</value>
</setting>
<setting name="mergerFileName" serializeAs="String">
<value />
</setting>
<setting name="mergerImagesRow" serializeAs="String">
<value>0</value>
</setting>
<setting name="AESKey" serializeAs="String">
<value />
</setting>
@@ -67,9 +61,6 @@
<setting name="tryToOpenAssets" serializeAs="String">
<value>True</value>
</setting>
<setting name="mergerImagesSaveAs" serializeAs="String">
<value>False</value>
</setting>
<setting name="tConsKey" serializeAs="String">
<value />
</setting>

View File

@@ -164,7 +164,6 @@
<Compile Include="Methods\IconGenerator\SchematicGenerator\SchematicItemInfos.cs" />
<Compile Include="Methods\IconGenerator\Translations\LoadLocRes.cs" />
<Compile Include="Methods\IconGenerator\Translations\SearchResource.cs" />
<Compile Include="Methods\ImagesMerger\ImagesMerger.cs" />
<Compile Include="Methods\PakHelper\BackupFilesEntry.cs" />
<Compile Include="Methods\PakHelper\CreateBackup.cs" />
<Compile Include="Methods\PakHelper\PakHelper.cs" />

View File

@@ -34,44 +34,51 @@ namespace FModel.Forms
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.trackBar1 = new System.Windows.Forms.TrackBar();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button5 = new System.Windows.Forms.Button();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.label1 = new System.Windows.Forms.Label();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(12, 12);
this.listBox1.Location = new System.Drawing.Point(6, 48);
this.listBox1.Name = "listBox1";
this.listBox1.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.listBox1.Size = new System.Drawing.Size(194, 251);
this.listBox1.Size = new System.Drawing.Size(251, 264);
this.listBox1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(225, 12);
this.button1.Location = new System.Drawing.Point(6, 19);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "Search";
this.button1.Text = "Add Images";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.ForeColor = System.Drawing.SystemColors.ControlText;
this.button2.Location = new System.Drawing.Point(225, 64);
this.button2.Location = new System.Drawing.Point(459, 309);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.Size = new System.Drawing.Size(100, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Merge";
this.button2.Text = "Save Image";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(225, 131);
this.button3.Location = new System.Drawing.Point(95, 19);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 3;
@@ -82,7 +89,7 @@ namespace FModel.Forms
// button4
//
this.button4.ForeColor = System.Drawing.Color.Red;
this.button4.Location = new System.Drawing.Point(225, 160);
this.button4.Location = new System.Drawing.Point(182, 19);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 4;
@@ -90,39 +97,100 @@ namespace FModel.Forms
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.listBox1);
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.button4);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(263, 320);
this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Settings";
//
// trackBar1
//
this.trackBar1.LargeChange = 0;
this.trackBar1.Location = new System.Drawing.Point(281, 268);
this.trackBar1.Maximum = 20;
this.trackBar1.Minimum = 1;
this.trackBar1.Name = "trackBar1";
this.trackBar1.Size = new System.Drawing.Size(278, 45);
this.trackBar1.SmallChange = 0;
this.trackBar1.TabIndex = 1;
this.trackBar1.Value = 7;
this.trackBar1.Scroll += new System.EventHandler(this.TrackBar1_Scroll);
//
// pictureBox1
//
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Location = new System.Drawing.Point(281, 18);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(278, 244);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 9;
this.pictureBox1.TabStop = false;
//
// button5
//
this.button5.ForeColor = System.Drawing.SystemColors.ControlText;
this.button5.Location = new System.Drawing.Point(353, 309);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(100, 23);
this.button5.TabIndex = 10;
this.button5.Text = "Open Image";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.Button5_Click);
//
// backgroundWorker1
//
this.backgroundWorker1.WorkerReportsProgress = true;
this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.BackgroundWorker1_DoWork);
this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.BackgroundWorker1_ProgressChanged);
this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.BackgroundWorker1_RunWorkerCompleted);
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(12, 338);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(547, 16);
this.progressBar1.Step = 1;
this.progressBar1.TabIndex = 11;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(222, 217);
this.label1.ForeColor = System.Drawing.Color.Red;
this.label1.Location = new System.Drawing.Point(281, 314);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Images Per Row:";
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(225, 233);
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(81, 20);
this.numericUpDown1.TabIndex = 6;
this.label1.Size = new System.Drawing.Size(68, 13);
this.label1.TabIndex = 12;
this.label1.Text = "Delay 300ms";
//
// MergeImages
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(318, 281);
this.Controls.Add(this.numericUpDown1);
this.ClientSize = new System.Drawing.Size(571, 364);
this.Controls.Add(this.label1);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.button5);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.trackBar1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "MergeImages";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Merge Images";
this.Load += new System.EventHandler(this.MergeImages_Load);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -135,7 +203,12 @@ namespace FModel.Forms
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TrackBar trackBar1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button5;
private System.ComponentModel.BackgroundWorker backgroundWorker1;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.NumericUpDown numericUpDown1;
}
}

View File

@@ -5,11 +5,19 @@ using System.IO;
using System.Windows.Forms;
using System.Web.UI.WebControls;
using Image = System.Drawing.Image;
using System.Drawing;
using System.Globalization;
using FModel.Properties;
using System.Drawing.Imaging;
namespace FModel.Forms
{
public partial class MergeImages : Form
{
private static List<Image> selectedImages { get; set; }
private static Bitmap bmp { get; set; }
private static Timer _scrollingTimer = null;
public MergeImages()
{
InitializeComponent();
@@ -18,16 +26,27 @@ namespace FModel.Forms
private void MergeImages_Load(object sender, EventArgs e)
{
listBox1.Items.Clear();
numericUpDown1.Value = Properties.Settings.Default.mergerImagesRow;
}
private void button1_Click(object sender, EventArgs e)
{
ImagesMerger.AskMergeImages(this);
}
OpenFileDialog theDialog = new OpenFileDialog();
theDialog.Multiselect = true;
theDialog.InitialDirectory = App.DefaultOutputPath + "\\Icons\\";
theDialog.Title = @"Choose your images";
theDialog.Filter = @"PNG Files (*.png)|*.png|JPEG Files (*.jpg)|*.jpg|BMP Files (*.bmp)|*.bmp|All Files (*.*)|*.*";
public void AddFiles(string[] files)
if (theDialog.ShowDialog() == DialogResult.OK)
{
AddFiles(theDialog.FileNames);
if (backgroundWorker1.IsBusy != true)
{
backgroundWorker1.RunWorkerAsync();
}
}
}
private void AddFiles(string[] files)
{
if (files.Count() > 0)
{
@@ -37,21 +56,64 @@ namespace FModel.Forms
}
}
}
private void mergeImages(List<Image> mySelectedImages)
{
int numperrow = 7;
Invoke(new Action(() =>
{
numperrow = trackBar1.Value;
}));
var w = 527 * numperrow;
if (mySelectedImages.Count * 527 < 527 * numperrow)
{
w = mySelectedImages.Count * 527;
}
int h = int.Parse(Math.Ceiling(double.Parse(mySelectedImages.Count.ToString()) / numperrow).ToString(CultureInfo.InvariantCulture)) * 527;
bmp = new Bitmap(w - 5, h - 5);
var num = 1;
var curW = 0;
var curH = 0;
for (int i = 0; i < mySelectedImages.Count; i++)
{
int percentage = (i + 1) * 100 / mySelectedImages.Count;
backgroundWorker1.ReportProgress(percentage);
using (Graphics g = Graphics.FromImage(bmp))
{
g.DrawImage(ImageUtilities.ResizeImage(mySelectedImages[i], 522, 522), new PointF(curW, curH));
if (num % numperrow == 0)
{
curW = 0;
curH += 527;
num += 1;
}
else
{
curW += 527;
num += 1;
}
}
}
}
private void button2_Click(object sender, EventArgs e)
{
Properties.Settings.Default.mergerImagesRow = Decimal.ToInt32(numericUpDown1.Value);
Properties.Settings.Default.Save();
if (listBox1.Items.Count > 0)
if (pictureBox1.Image != null)
{
List<Image> selectedImages = new List<Image>();
for (int i = 0; i < listBox1.Items.Count; ++i)
SaveFileDialog saveTheDialog = new SaveFileDialog();
saveTheDialog.Title = @"Save Icon";
saveTheDialog.Filter = @"PNG Files (*.png)|*.png";
saveTheDialog.InitialDirectory = App.DefaultOutputPath;
saveTheDialog.FileName = "Merger";
if (saveTheDialog.ShowDialog() == DialogResult.OK)
{
selectedImages.Add(Image.FromFile(((ListItem)listBox1.Items[i]).Value));
pictureBox1.Image.Save(saveTheDialog.FileName, ImageFormat.Png);
new UpdateMyConsole(Path.GetFileNameWithoutExtension(saveTheDialog.FileName), Color.DarkRed).AppendToConsole();
new UpdateMyConsole(" successfully saved", Color.Black, true).AppendToConsole();
}
ImagesMerger.MergeSelected(selectedImages);
}
}
@@ -63,12 +125,104 @@ namespace FModel.Forms
{
listBox1.Items.RemoveAt(listBox1.SelectedIndices[i]);
}
if (backgroundWorker1.IsBusy != true)
{
backgroundWorker1.RunWorkerAsync();
}
}
}
private void button4_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
pictureBox1.Image = null;
progressBar1.Value = 0;
}
private void Button5_Click(object sender, EventArgs e)
{
if (pictureBox1.Image != null)
{
var newForm = new Form();
PictureBox pb = new PictureBox();
pb.Dock = DockStyle.Fill;
pb.Image = pictureBox1.Image;
pb.SizeMode = PictureBoxSizeMode.Zoom;
newForm.WindowState = FormWindowState.Maximized;
newForm.Size = pb.Image.Size;
newForm.Icon = Resources.FModel;
newForm.Text = "Temporary Merged Image";
newForm.StartPosition = FormStartPosition.CenterScreen;
newForm.Controls.Add(pb);
newForm.Show();
}
}
private void BackgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
if ((selectedImages != null && selectedImages.Count > 0) || listBox1.Items.Count > 0)
{
selectedImages = new List<Image>();
for (int i = 0; i < listBox1.Items.Count; ++i)
{
selectedImages.Add(Image.FromFile(((ListItem)listBox1.Items[i]).Value));
}
mergeImages(selectedImages);
}
}
private void BackgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
{
if (bmp != null)
{
pictureBox1.Image = bmp;
}
GC.Collect();
backgroundWorker1.Dispose();
}
private void BackgroundWorker1_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
}
private void TrackBar1_Scroll(object sender, EventArgs e)
{
if (_scrollingTimer == null)
{
_scrollingTimer = new Timer()
{
Enabled = false,
Interval = 300,
Tag = (sender as TrackBar).Value
};
_scrollingTimer.Tick += (s, ea) =>
{
// check to see if the value has changed since we last ticked
if (trackBar1.Value == (int)_scrollingTimer.Tag)
{
// scrolling has stopped so we are good to go ahead and do stuff
_scrollingTimer.Stop();
if (backgroundWorker1.IsBusy != true)
{
backgroundWorker1.RunWorkerAsync();
}
_scrollingTimer.Dispose();
_scrollingTimer = null;
}
else
{
// record the last value seen
_scrollingTimer.Tag = trackBar1.Value;
}
};
_scrollingTimer.Start();
}
}
}
}

View File

@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@@ -50,10 +50,6 @@ namespace FModel.Forms
this.label8 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.wPictureBox = new System.Windows.Forms.PictureBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.checkBoxSaveAsMergeImages = new System.Windows.Forms.CheckBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
@@ -71,7 +67,6 @@ namespace FModel.Forms
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.wPictureBox)).BeginInit();
this.groupBox1.SuspendLayout();
this.groupBox6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@@ -148,7 +143,7 @@ namespace FModel.Forms
//
this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OKButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.OKButton.Location = new System.Drawing.Point(475, 546);
this.OKButton.Location = new System.Drawing.Point(475, 493);
this.OKButton.Name = "OKButton";
this.OKButton.Size = new System.Drawing.Size(97, 21);
this.OKButton.TabIndex = 15;
@@ -315,47 +310,6 @@ namespace FModel.Forms
this.wPictureBox.TabIndex = 18;
this.wPictureBox.TabStop = false;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.checkBoxSaveAsMergeImages);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Location = new System.Drawing.Point(12, 487);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(560, 49);
this.groupBox1.TabIndex = 17;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Merger";
//
// checkBoxSaveAsMergeImages
//
this.checkBoxSaveAsMergeImages.AutoSize = true;
this.checkBoxSaveAsMergeImages.Checked = true;
this.checkBoxSaveAsMergeImages.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxSaveAsMergeImages.Location = new System.Drawing.Point(298, 21);
this.checkBoxSaveAsMergeImages.Name = "checkBoxSaveAsMergeImages";
this.checkBoxSaveAsMergeImages.Size = new System.Drawing.Size(120, 17);
this.checkBoxSaveAsMergeImages.TabIndex = 13;
this.checkBoxSaveAsMergeImages.Text = "Enable \"Save as...\"";
this.checkBoxSaveAsMergeImages.UseVisualStyleBackColor = true;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(69, 19);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(206, 20);
this.textBox3.TabIndex = 8;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 22);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(57, 13);
this.label4.TabIndex = 9;
this.label4.Text = "File Name:";
//
// groupBox6
//
this.groupBox6.Controls.Add(this.button3);
@@ -480,9 +434,8 @@ namespace FModel.Forms
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 579);
this.ClientSize = new System.Drawing.Size(584, 526);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.OKButton);
this.Controls.Add(this.groupBox2);
@@ -504,8 +457,6 @@ namespace FModel.Forms
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.wPictureBox)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar3)).EndInit();
@@ -533,16 +484,12 @@ namespace FModel.Forms
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.PictureBox wPictureBox;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.CheckBox checkBox_tryToOpen;
private System.Windows.Forms.CheckBox checkBoxSaveAsMergeImages;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button2;

View File

@@ -40,10 +40,6 @@ namespace FModel.Forms
checkBox_tryToOpen.Checked = Properties.Settings.Default.tryToOpenAssets;
//MERGER
textBox3.Text = Properties.Settings.Default.mergerFileName;
checkBoxSaveAsMergeImages.Checked = Properties.Settings.Default.mergerImagesSaveAs;
// Check if watermark exists
Utilities.CheckWatermark();
@@ -127,10 +123,6 @@ namespace FModel.Forms
Properties.Settings.Default.rarityNew = checkBox1.Checked;
//MERGER
Properties.Settings.Default.mergerFileName = textBox3.Text;
Properties.Settings.Default.mergerImagesSaveAs = checkBoxSaveAsMergeImages.Checked;
//WATERMARK
Properties.Settings.Default.isWatermark = checkBox7.Checked;
Properties.Settings.Default.wSize = trackBar2.Value;

View File

@@ -615,6 +615,7 @@ namespace FModel
}
_selectedItemsArray = null;
backgroundWorker2.Dispose();
Checking.UmWorking = false;
GC.Collect();
Invoke(new Action(() =>
@@ -1028,6 +1029,9 @@ namespace FModel
BundleDesign.toDrawOn.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
BundleDesign.toDrawOn.SmoothingMode = SmoothingMode.HighQuality;
BundleDesign.myItem = theItem;
BundleDesign.isBundleLevelup = false;
BundleDesign.isGrantWithBundle = false;
BundleDesign.isRequiresBattlePass = false;
BundleDesign.drawBackground(bmp, theItem);
@@ -1043,7 +1047,6 @@ namespace FModel
});
}
bool isSeparatorAlreadyAdded = false;
for (int i = 0; i < BundleInfos.BundleData.Count; i++)
{
new UpdateMyConsole(BundleInfos.BundleData[i].questDescr, Color.SteelBlue).AppendToConsole();
@@ -1052,10 +1055,9 @@ namespace FModel
BundleDesign.theY += 90;
if (!string.IsNullOrEmpty(BundleInfos.BundleData[i].questUnlockType) && !isSeparatorAlreadyAdded)
if (!string.IsNullOrEmpty(BundleInfos.BundleData[i].questUnlockType))
{
BundleDesign.drawPrestigeSeparator();
isSeparatorAlreadyAdded = true;
BundleDesign.drawSeparator(BundleInfos.BundleData[i].questUnlockType);
}
//draw quest description
@@ -1209,6 +1211,7 @@ namespace FModel
}
_selectedItemsArray = null;
backgroundWorker1.Dispose();
GC.Collect();
Invoke(new Action(() =>
{

View File

@@ -15,6 +15,9 @@ namespace FModel
public static Graphics toDrawOn { get; set; }
public static JToken myItem { get; set; }
private static Color headerColor { get; set; }
public static bool isBundleLevelup { get; set; }
public static bool isRequiresBattlePass { get; set; }
public static bool isGrantWithBundle { get; set; }
/// <summary>
/// get a random color in case DisplayStyle doesn't exist in drawBackground()
@@ -355,9 +358,25 @@ namespace FModel
toDrawOn.DrawString(text, new Font(FontUtilities.pfc.Families[0], 15), new SolidBrush(Color.FromArgb(150, 255, 255, 255)), new Point(myBitmap.Width - 10, 210), FontUtilities.rightString);
}
public static void drawPrestigeSeparator()
public static void drawSeparator(string unlockType)
{
string texture = JohnWick.AssetToTexture2D("T-FNBR-MissionIcon-L");
switch (unlockType)
{
case "EChallengeBundleQuestUnlockType::BundleLevelup":
if (!isBundleLevelup) { drawIconSeparator("T-FNBR-MissionIcon-L"); isBundleLevelup = true; }
break;
case "EChallengeBundleQuestUnlockType::RequiresBattlePass":
if (!isRequiresBattlePass) { drawIconSeparator("T-FNBR-BattlePass-L"); isRequiresBattlePass = true; }
break;
/*case "EChallengeBundleQuestUnlockType::GrantWithBundle": //GrantWithBundle doesn't mean free or paid battle pass so idk i just leave this here
if (!isGrantWithBundle) { drawPrestigeSeparator("T-FNBR-BattlePassChallenge-Silver-L"); isGrantWithBundle = true; }
break;*/
}
}
private static void drawIconSeparator(string iconName)
{
string texture = JohnWick.AssetToTexture2D(iconName);
if (File.Exists(texture))
{
Image itemIcon;

View File

@@ -141,7 +141,7 @@ namespace FModel
//prestige challenge check
JToken questUnlockType = questInfo["QuestUnlockType"];
string unlockType = string.Empty;
if (questUnlockType != null && questUnlockType.Value<string>().Equals("EChallengeBundleQuestUnlockType::BundleLevelup"))
if (questUnlockType != null)
{
unlockType = questUnlockType.Value<string>();
}

View File

@@ -1,140 +0,0 @@
using FModel.Forms;
using FModel.Properties;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Globalization;
using System.Windows.Forms;
namespace FModel
{
static class ImagesMerger
{
/// <summary>
/// open a FileDialog to choose our images to merge, add them to the list of images
/// use this list to merge, with MergeSelected()
/// </summary>
public static void AskMergeImages(MergeImages mergeImagesForm)
{
if (string.IsNullOrEmpty(Properties.Settings.Default.mergerFileName))
{
Properties.Settings.Default.mergerFileName = "Merger";
Properties.Settings.Default.Save();
}
OpenFileDialog theDialog = new OpenFileDialog();
theDialog.Multiselect = true;
theDialog.InitialDirectory = App.DefaultOutputPath + "\\Icons\\";
theDialog.Title = @"Choose your images";
theDialog.Filter = @"PNG Files (*.png)|*.png|JPEG Files (*.jpg)|*.jpg|BMP Files (*.bmp)|*.bmp|All Files (*.*)|*.*";
if (theDialog.ShowDialog() == DialogResult.OK)
{
if (mergeImagesForm != null && Application.OpenForms[mergeImagesForm.Name] != null)
mergeImagesForm.AddFiles(theDialog.FileNames);
}
}
/// <summary>
/// take all the selected images and draw them one after the other depending on mergerImagesRow
/// at the end, save and open the generated image with OpenMerged()
/// </summary>
/// <param name="mySelectedImages"></param>
public static void MergeSelected(List<Image> mySelectedImages)
{
string mergeFileName = Properties.Settings.Default.mergerFileName;
if (Properties.Settings.Default.mergerImagesSaveAs)
{
SaveFileDialog saveFileMergerImages = new SaveFileDialog();
saveFileMergerImages.InitialDirectory = App.DefaultOutputPath;
saveFileMergerImages.DefaultExt = "png";
saveFileMergerImages.Filter = "Image PNG (.png)|*.png";
saveFileMergerImages.FileName = mergeFileName;
if (saveFileMergerImages.ShowDialog() != DialogResult.OK)
return;
mergeFileName = Path.GetFileName(saveFileMergerImages.FileName);
}
if (Properties.Settings.Default.mergerImagesRow == 0)
{
Properties.Settings.Default.mergerImagesRow = 7;
Properties.Settings.Default.Save();
}
int numperrow = Properties.Settings.Default.mergerImagesRow;
var w = 527 * numperrow;
if (mySelectedImages.Count * 527 < 527 * numperrow)
{
w = mySelectedImages.Count * 527;
}
int h = int.Parse(Math.Ceiling(double.Parse(mySelectedImages.Count.ToString()) / numperrow).ToString(CultureInfo.InvariantCulture)) * 527;
try
{
Bitmap bmp = new Bitmap(w - 5, h - 5);
var num = 1;
var curW = 0;
var curH = 0;
for (int i = 0; i < mySelectedImages.Count; i++)
{
using (Graphics g = Graphics.FromImage(bmp))
{
g.DrawImage(ImageUtilities.ResizeImage(mySelectedImages[i], 522, 522), new PointF(curW, curH));
if (num % numperrow == 0)
{
curW = 0;
curH += 527;
num += 1;
}
else
{
curW += 527;
num += 1;
}
}
}
if (!mergeFileName.Contains(".png"))
mergeFileName += ".png";
bmp.Save(App.DefaultOutputPath + "\\" + mergeFileName, ImageFormat.Png);
bmp.Dispose();
OpenMerged(App.DefaultOutputPath + "\\" + mergeFileName);
}
catch (Exception ex)
{
new UpdateMyConsole("[Merge Images]: " + ex.Message, Color.Red, true).AppendToConsole();
}
}
/// <summary>
/// if bitmap exist, open a new form in fullscreen and display the bitmap in a picturebox
/// </summary>
/// <param name="mergedImage"></param>
private static void OpenMerged(string mergedImagePath)
{
if (File.Exists(mergedImagePath))
{
var newForm = new Form();
PictureBox pb = new PictureBox();
pb.Dock = DockStyle.Fill;
pb.Image = Image.FromFile(mergedImagePath);
pb.SizeMode = PictureBoxSizeMode.Zoom;
newForm.WindowState = FormWindowState.Maximized;
newForm.Size = pb.Image.Size;
newForm.Icon = Resources.FModel;
newForm.Text = App.DefaultOutputPath + @"\" + Properties.Settings.Default.mergerFileName + @".png";
newForm.StartPosition = FormStartPosition.CenterScreen;
newForm.Controls.Add(pb);
newForm.Show();
}
}
}
}

View File

@@ -107,30 +107,6 @@ namespace FModel.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string mergerFileName {
get {
return ((string)(this["mergerFileName"]));
}
set {
this["mergerFileName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int mergerImagesRow {
get {
return ((int)(this["mergerImagesRow"]));
}
set {
this["mergerImagesRow"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
@@ -251,18 +227,6 @@ namespace FModel.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool mergerImagesSaveAs {
get {
return ((bool)(this["mergerImagesSaveAs"]));
}
set {
this["mergerImagesSaveAs"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]

View File

@@ -23,12 +23,6 @@
<Setting Name="isWatermark" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="mergerFileName" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="mergerImagesRow" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="AESKey" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
@@ -59,9 +53,6 @@
<Setting Name="tryToOpenAssets" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="mergerImagesSaveAs" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="tConsKey" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>