Skip to content

Commit 7fb5df7

Browse files
committed
first commit
0 parents  commit 7fb5df7

17 files changed

Lines changed: 2974 additions & 0 deletions

.gitignore

Lines changed: 473 additions & 0 deletions
Large diffs are not rendered by default.

BitLockerManager.csproj

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
6+
<UseWindowsForms>true</UseWindowsForms>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
<ApplicationManifest>app.manifest</ApplicationManifest>
10+
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
11+
12+
<!-- Assembly Information -->
13+
<AssemblyTitle>BitLocker Drive Manager</AssemblyTitle>
14+
<AssemblyDescription>BitLocker Drive Manager - Secure drive encryption management tool</AssemblyDescription>
15+
<AssemblyCompany>Bibek Chand Sah</AssemblyCompany>
16+
<AssemblyProduct>BitLocker Drive Manager</AssemblyProduct>
17+
<AssemblyCopyright>Copyright © 2025 Bibek Chand Sah</AssemblyCopyright>
18+
<AssemblyVersion>1.0.0.0</AssemblyVersion>
19+
<FileVersion>1.0.0.0</FileVersion>
20+
</PropertyGroup>
21+
22+
<ItemGroup>
23+
<Content Include="icon.png">
24+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
25+
</Content>
26+
<Content Include="icon.ico">
27+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
28+
</Content>
29+
</ItemGroup>
30+
31+
<ItemGroup>
32+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.0" />
33+
<PackageReference Include="System.Management.Automation" Version="7.4.0" />
34+
</ItemGroup>
35+
36+
</Project>

IconHelper.cs

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
using System;
2+
using System.Drawing;
3+
using System.Drawing.Imaging;
4+
using System.IO;
5+
6+
namespace BitLockerManager
7+
{
8+
public static class IconHelper
9+
{
10+
public static Icon CreateIconFromPng(string pngPath)
11+
{
12+
try
13+
{
14+
// Try to load ICO file first (better quality)
15+
var icoPath = pngPath.Replace(".png", ".ico");
16+
if (File.Exists(icoPath))
17+
{
18+
return new Icon(icoPath);
19+
}
20+
21+
// Fallback to PNG
22+
if (File.Exists(pngPath))
23+
{
24+
using (var bitmap = new Bitmap(pngPath))
25+
{
26+
// Create a 32x32 version for the icon
27+
using (var resized = new Bitmap(bitmap, 32, 32))
28+
{
29+
return Icon.FromHandle(resized.GetHicon());
30+
}
31+
}
32+
}
33+
else
34+
{
35+
return CreateFallbackIcon();
36+
}
37+
}
38+
catch
39+
{
40+
return CreateFallbackIcon();
41+
}
42+
}
43+
44+
public static Icon CreateFallbackIcon()
45+
{
46+
var bitmap = new Bitmap(32, 32);
47+
using (var g = Graphics.FromImage(bitmap))
48+
{
49+
g.Clear(Color.Transparent);
50+
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
51+
52+
// Create a BitLocker-style shield icon
53+
using (var blueBrush = new SolidBrush(Color.FromArgb(0, 120, 215)))
54+
using (var whiteBrush = new SolidBrush(Color.White))
55+
using (var darkBrush = new SolidBrush(Color.FromArgb(0, 90, 180)))
56+
{
57+
// Draw shield background
58+
var shieldPoints = new Point[]
59+
{
60+
new Point(16, 3),
61+
new Point(27, 9),
62+
new Point(27, 19),
63+
new Point(16, 29),
64+
new Point(5, 19),
65+
new Point(5, 9)
66+
};
67+
68+
g.FillPolygon(blueBrush, shieldPoints);
69+
70+
// Draw lock symbol
71+
// Lock body
72+
g.FillRectangle(whiteBrush, 11, 17, 10, 8);
73+
g.DrawRectangle(Pens.Black, 11, 17, 10, 8);
74+
75+
// Lock shackle
76+
using (var pen = new Pen(Color.Black, 2))
77+
{
78+
g.DrawArc(pen, 13, 11, 6, 8, 0, 180);
79+
}
80+
81+
// Lock keyhole
82+
g.FillEllipse(Brushes.Black, 15, 20, 2, 2);
83+
}
84+
}
85+
86+
return Icon.FromHandle(bitmap.GetHicon());
87+
}
88+
}
89+
}

0 commit comments

Comments
 (0)