more coherent colors for UpdateMyConsole + copy stuff on SearchFiles + better fmodel updater form

This commit is contained in:
Asval
2019-08-23 23:27:48 +02:00
parent 90c0202c42
commit 97a7b55e74
18 changed files with 275 additions and 119 deletions

View File

@@ -58,9 +58,6 @@
<setting name="challengesWatermark" serializeAs="String">
<value />
</setting>
<setting name="tryToOpenAssets" serializeAs="String">
<value>True</value>
</setting>
<setting name="UMParameters" serializeAs="String">
<value />
</setting>

View File

@@ -111,7 +111,7 @@ namespace FModel.Forms
if (saveTheDialog.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image.Save(saveTheDialog.FileName, ImageFormat.Png);
new UpdateMyConsole(Path.GetFileNameWithoutExtension(saveTheDialog.FileName), Color.DarkRed).AppendToConsole();
new UpdateMyConsole(Path.GetFileNameWithoutExtension(saveTheDialog.FileName), Color.Crimson).AppendToConsole();
new UpdateMyConsole(" successfully saved", Color.Black, true).AppendToConsole();
}
}

View File

@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SearchFiles));
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.listView1 = new System.Windows.Forms.ListView();
@@ -38,8 +39,14 @@
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.copyFilePathToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copyFileNameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copyFilePathWithoutExtensionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copyFileNameWithoutExtensionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
@@ -74,6 +81,7 @@
this.listView1.VirtualMode = true;
this.listView1.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.listView1_RetrieveVirtualItem);
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
this.listView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ListView1_MouseDown);
//
// columnHeader1
//
@@ -138,6 +146,44 @@
this.textBox1.TabIndex = 0;
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.copyFilePathToolStripMenuItem,
this.copyFileNameToolStripMenuItem,
this.copyFilePathWithoutExtensionToolStripMenuItem,
this.copyFileNameWithoutExtensionToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(256, 114);
//
// copyFilePathToolStripMenuItem
//
this.copyFilePathToolStripMenuItem.Name = "copyFilePathToolStripMenuItem";
this.copyFilePathToolStripMenuItem.Size = new System.Drawing.Size(255, 22);
this.copyFilePathToolStripMenuItem.Text = "Copy File Path";
this.copyFilePathToolStripMenuItem.Click += new System.EventHandler(this.CopyFilePathToolStripMenuItem_Click);
//
// copyFileNameToolStripMenuItem
//
this.copyFileNameToolStripMenuItem.Name = "copyFileNameToolStripMenuItem";
this.copyFileNameToolStripMenuItem.Size = new System.Drawing.Size(255, 22);
this.copyFileNameToolStripMenuItem.Text = "Copy File Name";
this.copyFileNameToolStripMenuItem.Click += new System.EventHandler(this.CopyFileNameToolStripMenuItem_Click);
//
// copyFilePathWithoutExtensionToolStripMenuItem
//
this.copyFilePathWithoutExtensionToolStripMenuItem.Name = "copyFilePathWithoutExtensionToolStripMenuItem";
this.copyFilePathWithoutExtensionToolStripMenuItem.Size = new System.Drawing.Size(255, 22);
this.copyFilePathWithoutExtensionToolStripMenuItem.Text = "Copy File Path without Extension";
this.copyFilePathWithoutExtensionToolStripMenuItem.Click += new System.EventHandler(this.CopyFilePathWithoutExtensionToolStripMenuItem_Click);
//
// copyFileNameWithoutExtensionToolStripMenuItem
//
this.copyFileNameWithoutExtensionToolStripMenuItem.Name = "copyFileNameWithoutExtensionToolStripMenuItem";
this.copyFileNameWithoutExtensionToolStripMenuItem.Size = new System.Drawing.Size(255, 22);
this.copyFileNameWithoutExtensionToolStripMenuItem.Text = "Copy File Name without Extension";
this.copyFileNameWithoutExtensionToolStripMenuItem.Click += new System.EventHandler(this.CopyFileNameWithoutExtensionToolStripMenuItem_Click);
//
// SearchFiles
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -153,6 +199,7 @@
this.tableLayoutPanel1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -168,5 +215,10 @@
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem copyFilePathToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem copyFileNameToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem copyFilePathWithoutExtensionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem copyFileNameWithoutExtensionToolStripMenuItem;
}
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -227,6 +228,55 @@ namespace FModel.Forms
FilesToSearch = true;
Close();
}
private void ListView1_MouseDown(object sender, MouseEventArgs e)
{
if (listView1.Items.Count != 0 && listView1.SelectedItems != null && e.Button == MouseButtons.Right)
{
contextMenuStrip1.Show(Cursor.Position);
}
}
private void CopySelectedFile(bool isName = false, bool withExtension = true)
{
if (listView1.SelectedItems != null)
{
ListView.SelectedIndexCollection col = listView1.SelectedIndices;
string path = listView1.Items[col[0]].Text;
// if file uasset/uexp/ubulk
path = !path.Contains(".") ? (path.Replace("\\", "/") + ".uasset") : path.Replace("\\", "/");
if (isName)
path = Path.GetFileName(path);
if (!withExtension)
path = isName ? Path.GetFileNameWithoutExtension(path) : Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path));
Clipboard.SetText(path);
new UpdateMyConsole(path, Color.CornflowerBlue).AppendToConsole();
new UpdateMyConsole(" Copied!", Color.Black, true).AppendToConsole();
}
}
private void CopyFilePathToolStripMenuItem_Click(object sender, EventArgs e)
{
CopySelectedFile();
}
private void CopyFileNameToolStripMenuItem_Click(object sender, EventArgs e)
{
CopySelectedFile(true);
}
private void CopyFilePathWithoutExtensionToolStripMenuItem_Click(object sender, EventArgs e)
{
CopySelectedFile(false, false);
}
private void CopyFileNameWithoutExtensionToolStripMenuItem_Click(object sender, EventArgs e)
{
CopySelectedFile(true, false);
}
}
class FileInfo

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="contextMenuStrip1.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

@@ -33,7 +33,6 @@ namespace FModel.Forms
this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.checkBox_tryToOpen = new System.Windows.Forms.CheckBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.OKButton = new System.Windows.Forms.Button();
@@ -105,7 +104,6 @@ namespace FModel.Forms
// groupBox2
//
this.groupBox2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.groupBox2.Controls.Add(this.checkBox_tryToOpen);
this.groupBox2.Controls.Add(this.textBox1);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Location = new System.Drawing.Point(12, 67);
@@ -115,21 +113,11 @@ namespace FModel.Forms
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Extraction";
//
// checkBox_tryToOpen
//
this.checkBox_tryToOpen.AutoSize = true;
this.checkBox_tryToOpen.Location = new System.Drawing.Point(397, 22);
this.checkBox_tryToOpen.Name = "checkBox_tryToOpen";
this.checkBox_tryToOpen.Size = new System.Drawing.Size(157, 17);
this.checkBox_tryToOpen.TabIndex = 8;
this.checkBox_tryToOpen.Text = "Try to open Extracted Asset";
this.checkBox_tryToOpen.UseVisualStyleBackColor = true;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(54, 19);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(337, 20);
this.textBox1.Size = new System.Drawing.Size(500, 20);
this.textBox1.TabIndex = 2;
//
// label1
@@ -515,7 +503,6 @@ namespace FModel.Forms
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.PictureBox pictureBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.CheckBox checkBox2;

View File

@@ -35,8 +35,6 @@ namespace FModel.Forms
textBox6.Text = "@UseTheWatermarkBecauseWhyNot - {Date}";
}
checkBox_tryToOpen.Checked = Properties.Settings.Default.tryToOpenAssets;
// Check if watermark exists
Utilities.CheckWatermark();
@@ -122,8 +120,6 @@ namespace FModel.Forms
Properties.Settings.Default.challengesOpacity = trackBar3.Value;
Properties.Settings.Default.challengesColors = headerColor.R + "," + headerColor.G + "," + headerColor.B;
Properties.Settings.Default.tryToOpenAssets = checkBox_tryToOpen.Checked;
Properties.Settings.Default.rarityDesign = comboBox2.SelectedItem.ToString();
//WATERMARK

View File

@@ -153,7 +153,11 @@ namespace FModel
AddPaKs(Path.GetFileName(arCurrentUsedPak)); //add to toolstrip
}
}
else { new UpdateMyConsole("[FModel] " + Path.GetFileName(arCurrentUsedPak) + " is locked by another process.", Color.Red, true).AppendToConsole(); }
else
{
new UpdateMyConsole(Path.GetFileName(arCurrentUsedPak), Color.CornflowerBlue).AppendToConsole();
new UpdateMyConsole(" is locked by another process.", Color.Black, true).AppendToConsole();
}
}
}
}
@@ -161,6 +165,7 @@ namespace FModel
//EVENTS
private async void MainWindow_Load(object sender, EventArgs e)
{
AutoUpdater.CheckForUpdateEvent += Utilities.AutoUpdaterOnCheckForUpdateEvent;
AutoUpdater.Start("https://dl.dropbox.com/s/3kv2pukqu6tj1r0/FModel.xml?dl=0");
DLLImport.SetTreeViewTheme(treeView1.Handle);
@@ -367,7 +372,7 @@ namespace FModel
{
Invoke(new Action(() =>
{
new UpdateMyConsole("Items Removed/Renamed:", Color.Red, true).AppendToConsole();
new UpdateMyConsole("Items Removed/Renamed:", Color.Crimson, true).AppendToConsole();
removedItems = removedItems.Distinct().ToList();
for (int ii = 0; ii < removedItems.Count; ii++)
new UpdateMyConsole(" - " + removedItems[ii], Color.Black, true).AppendToConsole();
@@ -376,7 +381,7 @@ namespace FModel
}
else
{
new UpdateMyConsole("Canceled! ", Color.Red).AppendToConsole();
new UpdateMyConsole("Canceled! ", Color.Crimson).AppendToConsole();
new UpdateMyConsole("All pak files loaded...", Color.Black, true).AppendToConsole();
return;
}
@@ -870,7 +875,7 @@ namespace FModel
}
catch (JsonReaderException)
{
new UpdateMyConsole(ThePak.CurrentUsedItem + " ", Color.Red).AppendToConsole();
new UpdateMyConsole(ThePak.CurrentUsedItem + " ", Color.Crimson).AppendToConsole();
new UpdateMyConsole(".JSON file can't be displayed", Color.Black, true).AppendToConsole();
}
finally
@@ -974,7 +979,7 @@ namespace FModel
{
if (Checking.UmWorking)
{
new UpdateMyConsole(ex.Message, Color.Red, true).AppendToConsole();
new UpdateMyConsole(ex.Message, Color.Crimson, true).AppendToConsole();
}
else
{
@@ -1073,9 +1078,9 @@ namespace FModel
for (int i = 0; i < BundleInfos.BundleData.Count; i++)
{
new UpdateMyConsole(BundleInfos.BundleData[i].questDescr, Color.SteelBlue).AppendToConsole();
new UpdateMyConsole("\t\tCount: " + BundleInfos.BundleData[i].questCount, Color.DarkRed).AppendToConsole();
new UpdateMyConsole("\t\t" + BundleInfos.BundleData[i].rewardItemId + ":" + BundleInfos.BundleData[i].rewardItemQuantity, Color.DarkGreen, true).AppendToConsole();
new UpdateMyConsole(BundleInfos.BundleData[i].questDescr, Color.RoyalBlue).AppendToConsole();
new UpdateMyConsole("\t\tCount: " + BundleInfos.BundleData[i].questCount, Color.Goldenrod).AppendToConsole();
new UpdateMyConsole("\t\t" + BundleInfos.BundleData[i].rewardItemId + ":" + BundleInfos.BundleData[i].rewardItemQuantity, Color.Crimson, true).AppendToConsole();
BundleDesign.theY += 90;
@@ -1172,7 +1177,7 @@ namespace FModel
{
pictureBox1.Image.Save(App.DefaultOutputPath + "\\Icons\\" + ThePak.CurrentUsedItem + ".png", ImageFormat.Png);
}));
new UpdateMyConsole(ThePak.CurrentUsedItem, Color.DarkRed).AppendToConsole();
new UpdateMyConsole(ThePak.CurrentUsedItem, Color.Crimson).AppendToConsole();
new UpdateMyConsole(" successfully saved", Color.Black, true).AppendToConsole();
}
}
@@ -1186,11 +1191,8 @@ namespace FModel
if (File.Exists(soundPathConverted))
{
if (Properties.Settings.Default.tryToOpenAssets)
{
Utilities.OpenWithDefaultProgramAndNoFocus(soundPathConverted);
new UpdateMyState("Opening " + ThePak.CurrentUsedItem + ".ogg", "Success").ChangeProcessState();
} else { new UpdateMyState("Extracted " + ThePak.CurrentUsedItem + ".ogg", "Success").ChangeProcessState(); }
new UpdateMyState("Opening " + ThePak.CurrentUsedItem + ".ogg", "Success").ChangeProcessState();
Utilities.OpenWithDefaultProgramAndNoFocus(soundPathConverted);
}
else
new UpdateMyState("Couldn't convert " + ThePak.CurrentUsedItem, "Error").ChangeProcessState();
@@ -1320,7 +1322,7 @@ namespace FModel
if (saveTheDialog.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image.Save(saveTheDialog.FileName, ImageFormat.Png);
new UpdateMyConsole(Path.GetFileNameWithoutExtension(saveTheDialog.FileName), Color.DarkRed).AppendToConsole();
new UpdateMyConsole(Path.GetFileNameWithoutExtension(saveTheDialog.FileName), Color.Crimson).AppendToConsole();
new UpdateMyConsole(" successfully saved", Color.Black, true).AppendToConsole();
}
}
@@ -1499,7 +1501,8 @@ namespace FModel
path = isName ? Path.GetFileNameWithoutExtension(path) : Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path));
Clipboard.SetText(path);
new UpdateMyConsole(path + " Copied!", Color.Green, true).AppendToConsole();
new UpdateMyConsole(path, Color.CornflowerBlue).AppendToConsole();
new UpdateMyConsole(" Copied!", Color.Black, true).AppendToConsole();
}
}
@@ -1521,14 +1524,9 @@ namespace FModel
File.WriteAllText(saveTheDialog.FileName, scintilla1.Text);
if (File.Exists(saveTheDialog.FileName))
{
new UpdateMyConsole(ThePak.CurrentUsedItem, Color.DarkRed).AppendToConsole();
new UpdateMyConsole(ThePak.CurrentUsedItem, Color.Crimson).AppendToConsole();
new UpdateMyConsole(" successfully saved", Color.Black, true).AppendToConsole();
}
else
{
new UpdateMyConsole("Fail to save ", Color.Black).AppendToConsole();
new UpdateMyConsole(ThePak.CurrentUsedItem, Color.DarkRed, true).AppendToConsole();
}
}
}
}
@@ -1549,14 +1547,9 @@ namespace FModel
if (File.Exists(App.DefaultOutputPath + "\\Saved_JSON\\" + filename + ".json"))
{
new UpdateMyConsole(ThePak.CurrentUsedItem, Color.DarkRed).AppendToConsole();
new UpdateMyConsole(ThePak.CurrentUsedItem, Color.Crimson).AppendToConsole();
new UpdateMyConsole("'s properties successfully saved", Color.Black, true).AppendToConsole();
}
else
{
new UpdateMyConsole("Fail to save ", Color.Black).AppendToConsole();
new UpdateMyConsole(ThePak.CurrentUsedItem, Color.DarkRed, true).AppendToConsole();
}
}
}
}
@@ -1571,7 +1564,7 @@ namespace FModel
if (File.Exists(App.DefaultOutputPath + "\\Icons\\" + ThePak.CurrentUsedItem + ".png"))
{
new UpdateMyConsole(ThePak.CurrentUsedItem, Color.DarkRed).AppendToConsole();
new UpdateMyConsole(ThePak.CurrentUsedItem, Color.Crimson).AppendToConsole();
new UpdateMyConsole("'s image successfully saved", Color.Black, true).AppendToConsole();
}
}

View File

@@ -131,7 +131,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABa
CAAAAk1TRnQBSQFMAgEBAgEAAUABAgFAAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAUgBAgFIAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@@ -50,7 +50,6 @@ namespace FModel
DynamicKeysManager.serialize("", item.thePak);
}
}
new UpdateMyConsole("", Color.Green, true).AppendToConsole();
}
}
@@ -68,20 +67,20 @@ namespace FModel
if (DLLImport.IsInternetAvailable())
{
string data = Keychain.GetEndpoint("http://benbotfn.tk:8080/api/aes");
if (string.IsNullOrEmpty(data)) { new UpdateMyConsole("[BenBot API] API Down or Rate Limit Exceeded", Color.Red, true).AppendToConsole(); return null; }
if (string.IsNullOrEmpty(data)) { new UpdateMyConsole("API Down or Rate Limit Exceeded", Color.CornflowerBlue, true).AppendToConsole(); return null; }
JToken dynamicPaks = JObject.Parse(data).FindTokens("additionalKeys").FirstOrDefault();
return JToken.Parse(dynamicPaks.ToString()).ToString().TrimStart('[').TrimEnd(']');
}
else
{
new UpdateMyConsole("Your internet connection is currently unavailable, can't check for dynamic keys at the moment.", Color.Red, true).AppendToConsole();
new UpdateMyConsole("Your internet connection is currently unavailable, can't check for dynamic keys at the moment.", Color.CornflowerBlue, true).AppendToConsole();
return null;
}
}
catch (Exception)
{
new UpdateMyConsole("[BenBot API] Error while checking for dynamic keys", Color.Red, true).AppendToConsole();
new UpdateMyConsole("Error while checking for dynamic keys", Color.Crimson, true).AppendToConsole();
return null;
}
}
@@ -99,14 +98,14 @@ namespace FModel
bool wasThereBeforeStartup = _oldKeysList.Where(i => i.theKey == pakKey).Any();
if (!wasThereBeforeStartup)
{
new UpdateMyConsole(pakName, Color.Firebrick).AppendToConsole();
new UpdateMyConsole(pakName, Color.CornflowerBlue).AppendToConsole();
new UpdateMyConsole(" can now be opened.", Color.Black, true).AppendToConsole();
}
}
else
{
//display all paks that can be opened
new UpdateMyConsole(pakName, Color.Firebrick).AppendToConsole();
new UpdateMyConsole(pakName, Color.CornflowerBlue).AppendToConsole();
new UpdateMyConsole(" can be opened.", Color.Black, true).AppendToConsole();
}
}

View File

@@ -284,7 +284,7 @@ namespace FModel
}
catch (KeyNotFoundException)
{
new UpdateMyConsole("[FModel] Can't extract " + questFile, Color.Red, true);
new UpdateMyConsole("Can't extract " + questFile, Color.CornflowerBlue, true);
}
}
}

View File

@@ -36,21 +36,24 @@ namespace FModel
pen = new Pen(border, 5);
pen.Alignment = PenAlignment.Inset;
toDrawOn.DrawRectangle(pen, new Rectangle(-1, -1, 522, 522));
toDrawOn.DrawRectangle(pen, new Rectangle(-1, -1, 523, 523));
break;
case "Default":
int circleSize = 750; // not that bad like that
int circlePos = (522 - circleSize) / 2;
p = new GraphicsPath();
p.AddEllipse(-266, -266, 1044, 1044);
p.AddEllipse(circlePos, circlePos, circleSize, circleSize);
pthGrBrush = new PathGradientBrush(p);
pthGrBrush.CenterColor = background;
pthGrBrush.SurroundColors = colors;
toDrawOn.FillEllipse(pthGrBrush, -266, -266, 1044, 1044);
toDrawOn.FillEllipse(pthGrBrush, circlePos, circlePos, circleSize, circleSize);
pen = new Pen(border, 5);
pen.Alignment = PenAlignment.Inset;
toDrawOn.DrawRectangle(pen, new Rectangle(-1, -1, 522, 522));
toDrawOn.DrawRectangle(pen, new Rectangle(-1, -1, 523, 523));
break;
}
}

View File

@@ -72,8 +72,10 @@ namespace FModel
}
else
{
new UpdateMyConsole("[FModel] BR Localization File Not Found - Icon Language set to English", Color.DarkRed, true).AppendToConsole();
new UpdateMyConsole("", Color.Black, true).AppendToConsole();
new UpdateMyConsole("Game_BR.locres ", Color.Crimson).AppendToConsole();
new UpdateMyConsole("not found", Color.Black, true).AppendToConsole();
new UpdateMyConsole("Icon language set to ", Color.Black).AppendToConsole();
new UpdateMyConsole("English", Color.CornflowerBlue, true).AppendToConsole();
Properties.Settings.Default.IconLanguage = "English";
Properties.Settings.Default.Save();
@@ -87,11 +89,8 @@ namespace FModel
}
else
{
new UpdateMyConsole("[FModel] STW Localization File Not Found - Icon Language set to English", Color.DarkRed, true).AppendToConsole();
new UpdateMyConsole("", Color.Black, true).AppendToConsole();
Properties.Settings.Default.IconLanguage = "English";
Properties.Settings.Default.Save();
new UpdateMyConsole("Game_StW.locres ", Color.Crimson).AppendToConsole();
new UpdateMyConsole("not found", Color.Black, true).AppendToConsole();
}
}
}

View File

@@ -25,11 +25,13 @@ namespace FModel
{
extractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + ThePak.mainPaksList[i].thePak, Settings.Default.AESKey);
}
catch (Exception)
catch (Exception ex)
{
new UpdateMyConsole("0x" + Settings.Default.AESKey + " doesn't work with the main paks.", Color.Red, true).AppendToConsole();
extractor.Dispose();
break;
if (string.Equals(ex.Message, "Extraction failed")) { PakHelper.DisplayError(); }
else { PakHelper.DisplayEmergencyError(ex); return; }
if (extractor != null) { extractor.Dispose(); }
break; //if one of the main pak file doesn't work, all the other doesn't work either
}
if (extractor.GetFileList().ToArray() != null)
@@ -57,10 +59,12 @@ namespace FModel
{
extractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + pakName, pakKey);
}
catch (Exception)
catch (Exception ex)
{
new UpdateMyConsole("0x" + pakKey + " doesn't work with " + ThePak.dynamicPaksList[i].thePak, Color.Red, true).AppendToConsole();
extractor.Dispose();
if (string.Equals(ex.Message, "Extraction failed")) { PakHelper.DisplayError(pakName, pakKey); }
else { PakHelper.DisplayEmergencyError(ex); return; }
if (extractor != null) { extractor.Dispose(); }
continue;
}
@@ -74,7 +78,7 @@ namespace FModel
sb.Append(fileListWithMountPoint[ii] + "\n");
}
new UpdateMyConsole("Backing up ", Color.Black).AppendToConsole();
new UpdateMyConsole(ThePak.dynamicPaksList[i].thePak, Color.DarkRed, true).AppendToConsole();
new UpdateMyConsole(ThePak.dynamicPaksList[i].thePak, Color.CornflowerBlue, true).AppendToConsole();
}
extractor.Dispose();
}
@@ -112,12 +116,12 @@ namespace FModel
}
else
{
new UpdateMyConsole("Your internet connection is currently unavailable, can't check for backup files at the moment.", Color.Red, true).AppendToConsole();
new UpdateMyConsole("Your internet connection is currently unavailable, can't check for backup files at the moment.", Color.CornflowerBlue, true).AppendToConsole();
}
}
catch (Exception)
{
new UpdateMyConsole("[FModel] Error while checking for backup files", Color.Red, true).AppendToConsole();
new UpdateMyConsole("Error while checking for backup files", Color.Crimson, true).AppendToConsole();
}
}
}

View File

@@ -39,8 +39,8 @@ namespace FModel
}
catch (Exception ex)
{
if (!string.Equals(ex.Message, "Extraction failed")) { new UpdateMyConsole("Message: " + ex.Message + "\nSource: " + ex.Source + "\nTarget: " + ex.TargetSite + "\n\nContact me: @AsvalFN on Twitter or open an issue on GitHub", Color.Red, true).AppendToConsole(); return; }
else { new UpdateMyConsole("0x" + Settings.Default.AESKey + " doesn't work with the main pak files", Color.Red, true).AppendToConsole(); }
if (string.Equals(ex.Message, "Extraction failed")) { DisplayError(); }
else { DisplayEmergencyError(ex); return; }
if (theExtractor != null) { theExtractor.Dispose(); }
break; //if one of the main pak file doesn't work, all the other doesn't work either
@@ -74,8 +74,8 @@ namespace FModel
}
catch (Exception ex)
{
if (string.Equals(ex.Message, "Extraction failed")) { new UpdateMyConsole("0x" + pakKey + " doesn't work with " + ThePak.dynamicPaksList[i].thePak, Color.Red, true).AppendToConsole(); }
else { new UpdateMyConsole("Message: " + ex.Message + "\nSource: " + ex.Source + "\nTarget: " + ex.TargetSite + "\n\nContact me: @AsvalFN on Twitter or open an issue on GitHub", Color.Red, true).AppendToConsole(); return; }
if (string.Equals(ex.Message, "Extraction failed")) { DisplayError(pakName, pakKey); }
else { DisplayEmergencyError(ex); return; }
if (theExtractor != null) { theExtractor.Dispose(); }
continue;
@@ -140,5 +140,33 @@ namespace FModel
if (weLoadAll) { new UpdateMyState(".PAK mount point: " + mountPoint.Substring(9), "Waiting").ChangeProcessState(); }
if (theSinglePak != null && thePakName == theSinglePak.ClickedItem.Text) { PakAsTxt = thePakLines; }
}
public static void DisplayError(string pak = null, string key = null)
{
if (string.IsNullOrEmpty(pak) && string.IsNullOrEmpty(key))
{
new UpdateMyConsole("0x" + Settings.Default.AESKey, Color.Crimson).AppendToConsole();
new UpdateMyConsole(" doesn't work with the main pak files", Color.Black, true).AppendToConsole();
}
else
{
new UpdateMyConsole("0x" + key, Color.Crimson).AppendToConsole();
new UpdateMyConsole(" doesn't work with ", Color.Black).AppendToConsole();
new UpdateMyConsole(pak, Color.Crimson, true).AppendToConsole();
}
}
public static void DisplayEmergencyError(Exception ex)
{
new UpdateMyConsole("Message: ", Color.Crimson).AppendToConsole();
new UpdateMyConsole(ex.Message, Color.Black, true).AppendToConsole();
new UpdateMyConsole("Source: ", Color.Crimson).AppendToConsole();
new UpdateMyConsole(ex.Source, Color.Black, true).AppendToConsole();
new UpdateMyConsole("Target: ", Color.Crimson).AppendToConsole();
new UpdateMyConsole(ex.TargetSite.ToString(), Color.Black, true).AppendToConsole();
new UpdateMyConsole("\nContact me: @AsvalFN on Twitter or open an issue on GitHub", Color.Crimson, true).AppendToConsole();
}
}
}

View File

@@ -8,6 +8,7 @@ using System.Security.AccessControl;
using System.Security.Principal;
using System.Windows.Forms;
using System.Collections.Generic;
using AutoUpdaterDotNET;
namespace FModel
{
@@ -19,10 +20,17 @@ namespace FModel
/// <param name="path"> path is the path to the converted sound file (in "Sounds" subfolder) </param>
public static void OpenWithDefaultProgramAndNoFocus(string path)
{
Process fileopener = new Process();
fileopener.StartInfo.FileName = "explorer";
fileopener.StartInfo.Arguments = "\"" + path + "\"";
fileopener.Start();
try
{
Process fileopener = new Process();
fileopener.StartInfo.FileName = "explorer";
fileopener.StartInfo.Arguments = "\"" + path + "\"";
fileopener.Start();
}
catch (Exception)
{
throw new ArgumentException("Error while trying to open " + ThePak.CurrentUsedItem);
}
}
/// <summary>
@@ -175,31 +183,31 @@ namespace FModel
public static void CheckWatermark()
{
if (!string.IsNullOrEmpty(Properties.Settings.Default.wFilename) &&
!File.Exists(Properties.Settings.Default.wFilename))
if (!string.IsNullOrEmpty(Settings.Default.wFilename) &&
!File.Exists(Settings.Default.wFilename))
{
Properties.Settings.Default.wFilename = string.Empty;
Properties.Settings.Default.isWatermark = false;
new UpdateMyConsole("Watermark file not found, watermarking disabled.", Color.Red, true).AppendToConsole();
Settings.Default.wFilename = string.Empty;
Settings.Default.isWatermark = false;
new UpdateMyConsole("Watermark file not found, watermarking disabled.", Color.CornflowerBlue, true).AppendToConsole();
}
if (!string.IsNullOrEmpty(Properties.Settings.Default.UMFilename) &&
!File.Exists(Properties.Settings.Default.UMFilename))
if (!string.IsNullOrEmpty(Settings.Default.UMFilename) &&
!File.Exists(Settings.Default.UMFilename))
{
Properties.Settings.Default.UMFilename = string.Empty;
Properties.Settings.Default.UMWatermark = false;
new UpdateMyConsole("Watermark file not found, watermarking in Update Mode disabled.", Color.Red, true).AppendToConsole();
Settings.Default.UMFilename = string.Empty;
Settings.Default.UMWatermark = false;
new UpdateMyConsole("Watermark file not found, watermarking in Update Mode disabled.", Color.CornflowerBlue, true).AppendToConsole();
}
if (!string.IsNullOrEmpty(Properties.Settings.Default.challengesBannerFileName) &&
!File.Exists(Properties.Settings.Default.challengesBannerFileName))
if (!string.IsNullOrEmpty(Settings.Default.challengesBannerFileName) &&
!File.Exists(Settings.Default.challengesBannerFileName))
{
Properties.Settings.Default.challengesBannerFileName = string.Empty;
Properties.Settings.Default.isChallengesTheme = false;
new UpdateMyConsole("Banner file not found, challenges custom theme disabled.", Color.Red, true).AppendToConsole();
Settings.Default.challengesBannerFileName = string.Empty;
Settings.Default.isChallengesTheme = false;
new UpdateMyConsole("Banner file not found, challenges custom theme disabled.", Color.CornflowerBlue, true).AppendToConsole();
}
Properties.Settings.Default.Save();
Settings.Default.Save();
}
public static IEnumerable<TItem> GetAncestors<TItem>(TItem item, Func<TItem, TItem> getParentFunc)
@@ -220,5 +228,57 @@ namespace FModel
return Color.FromArgb((int)(color.R * coef), (int)(color.G * coef),
(int)(color.B * coef));
}
public static void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
{
if (args != null)
{
if (args.IsUpdateAvailable)
{
DialogResult dialogResult;
if (args.Mandatory)
{
dialogResult =
MessageBox.Show(
$@"There is new version {args.CurrentVersion} available. You are using version {args.InstalledVersion}. This is required update. Press Ok to begin updating the application.", @"Update Available",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
else
{
dialogResult =
MessageBox.Show(
$@"There is new version {args.CurrentVersion} available. You are using version {
args.InstalledVersion
}. Do you want to update the application now?", @"Update Available",
MessageBoxButtons.YesNo,
MessageBoxIcon.Information);
}
if (dialogResult.Equals(DialogResult.Yes) || dialogResult.Equals(DialogResult.OK))
{
try
{
Process.Start(args.ChangelogURL);
if (AutoUpdater.DownloadUpdate())
{
Application.Exit();
}
}
catch (Exception exception)
{
MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
}
else
{
MessageBox.Show(
@"There is a problem reaching update server please check your internet connection and try again later.",
@"Update check failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@@ -215,18 +215,6 @@ namespace FModel.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool tryToOpenAssets {
get {
return ((bool)(this["tryToOpenAssets"]));
}
set {
this["tryToOpenAssets"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]

View File

@@ -50,9 +50,6 @@
<Setting Name="challengesWatermark" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="tryToOpenAssets" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="UMParameters" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>