diff --git a/.gitignore b/.gitignore index 467fada..9251da6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ bin/Debug/net6.0-windows/EmptyRecycleBin.deps.json *.lock bin/Debug/net6.0-windows/EmptyRecycleBin.runtimeconfig.json *.cache -*.txt obj/Debug/net6.0-windows/EmptyRecycleBin.designer.deps.json obj/Debug/net6.0-windows/EmptyRecycleBin.AssemblyInfo.cs obj/Debug/net6.0-windows/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs @@ -22,3 +21,5 @@ obj/Debug/net6.0-windows/EmptyRecycleBin.GlobalUsings.g.cs obj/Debug/net6.0-windows/EmptyRecycleBin.GeneratedMSBuildEditorConfig.editorconfig obj/Debug/net6.0-windows/EmptyRecycleBin.designer.runtimeconfig.json obj/EmptyRecycleBin.csproj.nuget.dgspec.json +obj/Debug/net6.0-windows/EmptyRecycleBin.csproj.FileListAbsolute.txt +obj/Debug/net6.0-windows/EmptyRecycleBin.Properties.Resources.resources diff --git a/EmptyRecycleBin.csproj b/EmptyRecycleBin.csproj index c0e85f2..e0f344e 100644 --- a/EmptyRecycleBin.csproj +++ b/EmptyRecycleBin.csproj @@ -10,6 +10,21 @@ A helper tool to one-click delete the contents of you PCs Recycle Bin and therefore gain some disk space Andrew Poženel True + LICENSE.txt + True + 1.1 + 1.1 + First work of the tool! + + git + README.md + https://github.com/anderlli0053/EmptyRecycleBin.git + https://github.com/anderlli0053/EmptyRecycleBin + icon.png + icon.ico + Empty Recycle Bin + Andrew Poženel + Empty Recycle Bin @@ -21,6 +36,15 @@ + + + + + + True + True + Resources.resx + True True @@ -29,10 +53,29 @@ + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + True + \ + + + True + \ + SettingsSingleFileGenerator Settings.Designer.cs + + True + \ + \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..b9a7675 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,31 @@ +/*************************************************************************/ +/* Main.cs */ +/*************************************************************************/ +/* This file is part of: */ +/* EmptyRecycleBin */ +/* https://godotengine.org */ +/*************************************************************************/ +/* */ +/* Copyright (c) 2021-2022 Andrew Poženel */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +// Andrew Poženel AKA SloDevTeam \ No newline at end of file diff --git a/Main.Designer.cs b/Main.Designer.cs index 7bd3d84..91d2aad 100644 --- a/Main.Designer.cs +++ b/Main.Designer.cs @@ -30,7 +30,7 @@ private void InitializeComponent() { this.DoEmpty = new System.Windows.Forms.Button(); this.DoExit = new System.Windows.Forms.Button(); - this.linkLabel1 = new System.Windows.Forms.LinkLabel(); + this.LINK = new System.Windows.Forms.LinkLabel(); this.SuspendLayout(); // // DoEmpty @@ -38,9 +38,12 @@ private void InitializeComponent() this.DoEmpty.AutoSize = true; this.DoEmpty.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.DoEmpty.ForeColor = System.Drawing.Color.SteelBlue; - this.DoEmpty.Location = new System.Drawing.Point(12, 12); + this.DoEmpty.Image = global::EmptyRecycleBin.Properties.Resources.icon_scaled; + this.DoEmpty.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.DoEmpty.Location = new System.Drawing.Point(14, 16); + this.DoEmpty.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.DoEmpty.Name = "DoEmpty"; - this.DoEmpty.Size = new System.Drawing.Size(182, 207); + this.DoEmpty.Size = new System.Drawing.Size(208, 276); this.DoEmpty.TabIndex = 0; this.DoEmpty.Text = "Empty Recycle Bin"; this.DoEmpty.UseVisualStyleBackColor = true; @@ -51,42 +54,48 @@ private void InitializeComponent() this.DoExit.AutoSize = true; this.DoExit.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.DoExit.ForeColor = System.Drawing.Color.OrangeRed; - this.DoExit.Location = new System.Drawing.Point(200, 12); + this.DoExit.Image = global::EmptyRecycleBin.Properties.Resources.icon2_scaled; + this.DoExit.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.DoExit.Location = new System.Drawing.Point(229, 16); + this.DoExit.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.DoExit.Name = "DoExit"; - this.DoExit.Size = new System.Drawing.Size(137, 207); + this.DoExit.Size = new System.Drawing.Size(157, 276); this.DoExit.TabIndex = 1; this.DoExit.Text = "Quit"; this.DoExit.UseVisualStyleBackColor = true; this.DoExit.Click += new System.EventHandler(this.DoExit_Click); // - // linkLabel1 + // LINK // - this.linkLabel1.AutoEllipsis = true; - this.linkLabel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.linkLabel1.Font = new System.Drawing.Font("Segoe Print", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; - this.linkLabel1.LinkColor = System.Drawing.Color.Red; - this.linkLabel1.Location = new System.Drawing.Point(12, 230); - this.linkLabel1.Name = "linkLabel1"; - this.linkLabel1.Size = new System.Drawing.Size(325, 35); - this.linkLabel1.TabIndex = 2; - this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "Created by Andrew Poženel"; - this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.linkLabel1.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.LINK.AutoEllipsis = true; + this.LINK.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.LINK.Font = new System.Drawing.Font("Segoe Print", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.LINK.ForeColor = System.Drawing.Color.Red; + this.LINK.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.LINK.LinkColor = System.Drawing.Color.Red; + this.LINK.Location = new System.Drawing.Point(14, 307); + this.LINK.Name = "LINK"; + this.LINK.Size = new System.Drawing.Size(371, 47); + this.LINK.TabIndex = 2; + this.LINK.TabStop = true; + this.LINK.Text = "Created by Andrew Poženel"; + this.LINK.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.LINK.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.LINK.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LINK_LinkClicked); // // MAIN // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoSize = true; - this.ClientSize = new System.Drawing.Size(349, 274); + this.ClientSize = new System.Drawing.Size(399, 365); this.ControlBox = false; - this.Controls.Add(this.linkLabel1); + this.Controls.Add(this.LINK); this.Controls.Add(this.DoExit); this.Controls.Add(this.DoEmpty); this.Cursor = System.Windows.Forms.Cursors.Cross; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.MaximizeBox = false; this.Name = "MAIN"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; @@ -101,6 +110,6 @@ private void InitializeComponent() private Button DoEmpty; private Button DoExit; - private LinkLabel linkLabel1; + private LinkLabel LINK; } } \ No newline at end of file diff --git a/Main.cs b/Main.cs index 71151a6..f14d12d 100644 --- a/Main.cs +++ b/Main.cs @@ -35,10 +35,11 @@ using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; - - - - +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Windows; +using System.Net; @@ -58,15 +59,7 @@ enum RecycleFlags : int } [DllImport("Shell32.dll", CharSet = CharSet.Unicode)] - static extern uint SHEmptyRecycleBin(IntPtr hwnd, string pszRootPath, RecycleFlags dwFlags); - - - - - - - - + static extern uint SHEmptyRecycleBin(IntPtr hwnd, string? pszRootPath, RecycleFlags dwFlags); @@ -75,6 +68,7 @@ public MAIN() InitializeComponent(); } + private void DoExit_Click(object sender, EventArgs e) { @@ -95,12 +89,12 @@ private void DoEmpty_Click(object sender, EventArgs e) { // Execute the method with the required parameters uint IsSuccess = SHEmptyRecycleBin(IntPtr.Zero, null, RecycleFlags.SHRB_NOCONFIRMATION); - MessageBox.Show("The recycle bin has been succesfully recycled !", "Clear recycle bin", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("The recycle bin has been succesfully emptied !", "Empty recycle bin", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { // Handle exceptions - MessageBox.Show("The recycle bin couldn't be recycled" + ex.Message, "Clear recycle bin", MessageBoxButtons.OK, MessageBoxIcon.Stop); + MessageBox.Show("The recycle bin couldn't be emptied" + ex.Message, "Empty recycle bin", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } @@ -115,5 +109,32 @@ private void MAIN_Load(object sender, EventArgs e) { } + + private void LINK_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + + + try + { + VisitLink(); + } + catch (Exception ex) + { + MessageBox.Show("Unable to open link that was clicked!"); + } + + } + + private void VisitLink() + { + + System.Diagnostics.Process.Start("https://slo-dev-team.000webhostapp.com/"); + LINK.LinkVisited = true; + + //ProcessStartInfo sInfo = new ProcessStartInfo("https://slo-dev-team.000webhostapp.com/"); + //Process.Start(sInfo); + } + + } } \ No newline at end of file diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..feac7e1 --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,93 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace EmptyRecycleBin.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EmptyRecycleBin.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon { + get { + object obj = ResourceManager.GetObject("icon", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon_scaled { + get { + object obj = ResourceManager.GetObject("icon_scaled", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon2_scaled { + get { + object obj = ResourceManager.GetObject("icon2_scaled", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..f89640d --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + ..\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon_scaled.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon2_scaled.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000..b015d47 Binary files /dev/null and b/icon.ico differ diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..01f27b0 Binary files /dev/null and b/icon.png differ diff --git a/icon2_scaled.png b/icon2_scaled.png new file mode 100644 index 0000000..cf4ea9d Binary files /dev/null and b/icon2_scaled.png differ diff --git a/icon_scaled.png b/icon_scaled.png new file mode 100644 index 0000000..50a5eec Binary files /dev/null and b/icon_scaled.png differ