-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
7,310 additions
and
7,582 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Drawing; | ||
using System.Drawing.Imaging; | ||
|
||
namespace ATray.Tools | ||
{ | ||
public static class BitmapTools | ||
{ | ||
public static void ApplyPerPixel(this Bitmap bmp, Action<IntPtr> modifier) | ||
{ | ||
if (bmp.PixelFormat != PixelFormat.Format32bppArgb) | ||
throw new Exception("Ahhh my icon has changed format"); | ||
var rect = new Rectangle(0, 0, bmp.Width, bmp.Height); | ||
var bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, bmp.PixelFormat); | ||
|
||
var bitsPerPixel = Image.GetPixelFormatSize(bmpData.PixelFormat); | ||
var bytesPerPixel = (bitsPerPixel + 7) / 8; | ||
var unusedBytes = bmpData.Stride - (bmpData.Width * bytesPerPixel); | ||
|
||
unsafe | ||
{ | ||
var scan0 = (byte*)bmpData.Scan0.ToPointer(); | ||
var pixelPointer = scan0; | ||
for (var i = 0; i < bmpData.Height; ++i) | ||
{ | ||
for (var j = 0; j < bmpData.Width; ++j) | ||
{ | ||
modifier((IntPtr) pixelPointer); | ||
pixelPointer += bytesPerPixel; | ||
} | ||
|
||
pixelPointer += unusedBytes; | ||
} | ||
} | ||
bmp.UnlockBits(bmpData); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Drawing; | ||
using RepositoryManager; | ||
|
||
namespace ATray.Tools | ||
{ | ||
public enum OverallStatusType | ||
{ | ||
Ok=0, | ||
WarnAhead=1, | ||
WarnBehind=2, | ||
CodeRed=3 | ||
} | ||
|
||
public static class Extensions | ||
{ | ||
public static OverallStatusType ToOverallStatus(this RepoStatus status) | ||
{ | ||
switch (status) | ||
{ | ||
case RepoStatus.Conflict: | ||
return OverallStatusType.CodeRed; | ||
case RepoStatus.Behind: | ||
return OverallStatusType.WarnBehind; | ||
case RepoStatus.Dirty: | ||
return OverallStatusType.WarnAhead; | ||
default: | ||
return OverallStatusType.Ok; | ||
} | ||
} | ||
|
||
public static OverallStatusType WorstOf(this OverallStatusType overallStatus,RepoStatus status) | ||
{ | ||
var converted = status.ToOverallStatus(); | ||
return converted > overallStatus ? converted : overallStatus; | ||
} | ||
|
||
public static Color ToColor(OverallStatusType overallStatus) | ||
{ | ||
switch (overallStatus) | ||
{ | ||
case OverallStatusType.Ok: return Color.Transparent; | ||
case OverallStatusType.WarnAhead: return Color.FromArgb(0x80, 0xB1, 0xB1, 0xFF); | ||
case OverallStatusType.CodeRed: return Color.FromArgb(0x80, Color.Red); | ||
case OverallStatusType.WarnBehind: return Color.FromArgb(0x80, Color.Yellow); | ||
default: throw new ArgumentOutOfRangeException(nameof(overallStatus), overallStatus, null); | ||
} | ||
} | ||
} | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.