diff --git a/Win_1337_Patch/1337.Designer.cs b/Win_1337_Patch/1337.Designer.cs index ba472be..5963524 100644 --- a/Win_1337_Patch/1337.Designer.cs +++ b/Win_1337_Patch/1337.Designer.cs @@ -200,7 +200,7 @@ this.MinimumSize = new System.Drawing.Size(448, 122); this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Win 1337 Apply Patch File v1.7..."; + this.Text = "Win 1337 Apply Patch File v1.8..."; this.Load += new System.EventHandler(this.DFoX_Load); this.ResumeLayout(false); this.PerformLayout(); diff --git a/Win_1337_Patch/1337.cs b/Win_1337_Patch/1337.cs index 0590cac..a9be69a 100644 --- a/Win_1337_Patch/1337.cs +++ b/Win_1337_Patch/1337.cs @@ -18,7 +18,52 @@ namespace Win_1337_Patch { InitializeComponent(); } - + private void set() + { + t1337.Text = Ellipsis.Compact(f1337, t1337, EllipsisFormat.Path); + toolTip1.SetToolTip(t1337, f1337); + Properties.Settings.Default["url1337"] = f1337; + Properties.Settings.Default.Save(); + string[] lines = File.ReadAllLines(f1337); + if (!check_Symbol(lines[0])) + return; + string unf = lines[0].Substring(1).ToLower().Trim(); + string nf = Path.GetFileName(unf); + string ext = Path.GetExtension(unf); + OpenFileDialog apriDialogoFile1 = new OpenFileDialog(); + apriDialogoFile1.FileName = nf; + apriDialogoFile1.Filter = "File " + ext + "|" + nf; + apriDialogoFile1.FilterIndex = 0; + apriDialogoFile1.Title = "Select the file \"" + nf + "\" File..."; + if (apriDialogoFile1.ShowDialog() == DialogResult.OK) + { + exe = apriDialogoFile1.FileName; + texe.Text = Ellipsis.Compact(Path.GetFileName(exe), texe, EllipsisFormat.Path); + toolTip1.SetToolTip(texe, exe); + Properties.Settings.Default["urlexe"] = exe; + Properties.Settings.Default.Save(); + } + else + { + t1337.Text = "Select .1337 File..."; + texe.Text = "Name of Exe/Dll to Patch..."; + f1337 = String.Empty; + exe = String.Empty; + } + } + private void t1337_DragDrop(object sender, DragEventArgs e) + { + try + { + f1337 = ((string[])e.Data.GetData(DataFormats.FileDrop, false))[0]; + set(); + } + catch + { + //Nothing; + } + return; + } private void btnSelect1337_Click(object sender, EventArgs e) { try @@ -33,36 +78,7 @@ namespace Win_1337_Patch if (apriDialogoFile1.ShowDialog() == DialogResult.OK) { f1337 = apriDialogoFile1.FileName; - t1337.Text = Ellipsis.Compact(f1337, t1337, EllipsisFormat.Path); - toolTip1.SetToolTip(t1337, f1337); - Properties.Settings.Default["url1337"] = f1337; - Properties.Settings.Default.Save(); - string[] lines = File.ReadAllLines(f1337); - if (lines[0].Substring(0, 1) != ">") - { - MessageBox.Show("File 1337 is not valid...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - string unf = lines[0].Substring(1).ToLower().Trim(); - string nf = Path.GetFileName(unf); - string ext = Path.GetExtension(unf); - apriDialogoFile1.FileName = nf; - apriDialogoFile1.Filter = "File " + ext + "|" + nf; - apriDialogoFile1.FilterIndex = 0; - apriDialogoFile1.Title = "Select the file \"" + nf + "\" File..."; - if (apriDialogoFile1.ShowDialog() == DialogResult.OK) - { - exe = apriDialogoFile1.FileName; - texe.Text = Ellipsis.Compact(Path.GetFileName(exe), texe, EllipsisFormat.Path); - toolTip1.SetToolTip(texe, exe); - Properties.Settings.Default["urlexe"] = exe; - Properties.Settings.Default.Save(); - } - else - { - t1337.Text = "Select .1337 File..."; - f1337 = String.Empty; - } + set(); } } catch @@ -77,48 +93,14 @@ namespace Win_1337_Patch e.Effect = DragDropEffects.All; } - private void t1337_DragDrop(object sender, DragEventArgs e) + private bool check_Symbol(string s) { - try + if (!s.StartsWith(">")) { - f1337 = ((string[])e.Data.GetData(DataFormats.FileDrop, false))[0]; - t1337.Text = Ellipsis.Compact(f1337, t1337, EllipsisFormat.Path); - toolTip1.SetToolTip(t1337, f1337); - Properties.Settings.Default["url1337"] = f1337; - Properties.Settings.Default.Save(); - string[] lines = File.ReadAllLines(f1337); - if (lines[0].Substring(0, 1) != ">") - { - MessageBox.Show("File 1337 is not valid...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - string unf = lines[0].Substring(1).ToLower().Trim(); - string nf = Path.GetFileName(unf); - string ext = Path.GetExtension(unf); - OpenFileDialog apriDialogoFile1 = new OpenFileDialog(); - apriDialogoFile1.FileName = nf; - apriDialogoFile1.Filter = "File " + ext + "|" + nf; - apriDialogoFile1.FilterIndex = 0; - apriDialogoFile1.Title = "Select the file \"" + nf + "\" File..."; - if (apriDialogoFile1.ShowDialog() == DialogResult.OK) - { - exe = apriDialogoFile1.FileName; - texe.Text = Ellipsis.Compact(Path.GetFileName(exe), texe, EllipsisFormat.Path); - toolTip1.SetToolTip(texe, exe); - Properties.Settings.Default["urlexe"] = exe; - Properties.Settings.Default.Save(); - } - else - { - t1337.Text = "Select .1337 File..."; - f1337 = String.Empty; - } + MessageBox.Show("File 1337 is not valid...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; } - catch - { - //Nothing; - } - return; + return true; } private void Esci_Click(object sender, EventArgs e) { @@ -154,11 +136,8 @@ namespace Win_1337_Patch return; } string[] lines = File.ReadAllLines(f1337); - if (lines[0].Substring(0, 1) != ">") - { - MessageBox.Show("File 1337 is not valid...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error); + if (!check_Symbol(lines[0])) return; - } if (lines[0].Substring(1).ToLower().Trim() != Path.GetFileName(exe).ToLower().Trim()) { MessageBox.Show("File 1337 is not valid for selected exe/dll...\n\n(\"" + lines[0].Substring(1).ToLower() + "\" but you have selected \"" + Path.GetFileName(exe).ToLower() + "\")", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error); diff --git a/Win_1337_Patch/Properties/AssemblyInfo.cs b/Win_1337_Patch/Properties/AssemblyInfo.cs index 42f429a..c89e728 100644 --- a/Win_1337_Patch/Properties/AssemblyInfo.cs +++ b/Win_1337_Patch/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("DeFconX")] [assembly: AssemblyProduct("Win_1337_Patch")] -[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("DeltaFoX")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build // usando l'asterisco '*' come illustrato di seguito: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.7.0.0")] -[assembly: AssemblyFileVersion("1.7.0.0")] +[assembly: AssemblyVersion("1.8.0.0")] +[assembly: AssemblyFileVersion("1.8.0.0")]