Update API

This commit is contained in:
Chris Chen
2022-09-30 09:40:42 -07:00
parent 184db15773
commit b33c0d8286
55 changed files with 3877 additions and 360 deletions
@@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
</ItemGroup>
+3 -3
View File
@@ -9,7 +9,7 @@ namespace Church.Net.Utility
public static class DateTimeHelper
{
private static TimeZoneInfo pacificZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific SA Standard Time");
private static TimeZoneInfo pacificZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
public static DateTime GetNextWeekday(DateTime start, DayOfWeek day)
{
// The (... + 7) % 7 ensures we end up with a value in the range [0, 6]
@@ -18,11 +18,11 @@ namespace Church.Net.Utility
}
public static DateTime Now()
{
return DateTime.SpecifyKind(TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, pacificZone),DateTimeKind.Local);
return TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, pacificZone);
}
public static DateTime Today()
{
return TimeZoneInfo.ConvertTimeFromUtc(DateTime.Today, pacificZone);
return Now().Date;
}
}
}
+11 -2
View File
@@ -1,4 +1,5 @@
using System;
using SixLabors.ImageSharp.Processing;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
@@ -248,7 +249,7 @@ namespace Church.Net.Utility
}
public static class Image
public static class ImageHelper
{
public static Bitmap CreateThumbnail(string lcFilename, int lnWidth, int lnHeight)
{
@@ -369,6 +370,14 @@ namespace Church.Net.Utility
return bmp.Resize(bmp.Width * percentage / 100, bmp.Height * percentage / 100);
}
public static void Scalling(this SixLabors.ImageSharp.Image image, int percentage)
{
var scale = (double)percentage/100;
var scaleWidth = (int)(image.Width * scale);
var scaleHeight = (int)(image.Height * scale);
image.Mutate(o => o.Resize(new SixLabors.ImageSharp.Size(scaleWidth, scaleHeight)));
}
public static Bitmap Superimpose(Bitmap largeBmp, Bitmap smallBmp, int? x = null, int? y = null)