Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
silence some alarms
  • Loading branch information
LoneWandererProductions committed Nov 24, 2023
1 parent 695de2d commit e62bf99
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 240 deletions.
3 changes: 2 additions & 1 deletion CommonControls/Thumbnails.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public sealed partial class Thumbnails
/// <summary>
/// The Thumb Cell Size
/// </summary>
public static readonly DependencyProperty ThumbnailCellSize = DependencyProperty.Register(nameof(ThumbnailCellSize),
public static readonly DependencyProperty ThumbnailCellSize = DependencyProperty.Register(
nameof(ThumbnailCellSize),
typeof(int),
typeof(Thumbnails), null);

Expand Down
2 changes: 1 addition & 1 deletion FileHandler/FileHandleSort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace FileHandler
public static class FileHandleSort
{
/// <summary>
/// Path Sort. Sorts a list of strings in a more sane way.
/// Path Sort. Sorts a list of strings in a more sane way.
/// </summary>
/// <param name="value">The list.</param>
/// <returns>The sorted list.</returns>
Expand Down
4 changes: 2 additions & 2 deletions Imaging/IImageRender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ internal interface IImageRender
List<ImageSource> LoadGif(string path);

/// <summary>
/// Initializes a new instance of the <see cref="IImageRender"/> interface.
/// Initializes a new instance of the <see cref="IImageRender" /> interface.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="target">The target.</param>
void CreateGif(string path, string target);
}
}
}
5 changes: 1 addition & 4 deletions Imaging/ImageGif.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ public string GifSource
private void Initialize()
{
//check if Image exists
if (!File.Exists(GifSource))
{
return;
}
if (!File.Exists(GifSource)) return;

var info = ImageGifHandler.GetImageInfo(GifSource);

Expand Down
36 changes: 15 additions & 21 deletions Imaging/ImageGifHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,9 @@ public static ImageGifInfo GetImageInfo(string path)
info.Name = Path.GetFileName(path);
info.Size = image.Size;

if (!image.RawFormat.Equals(ImageFormat.Gif))
{
return null;
}
if (!image.RawFormat.Equals(ImageFormat.Gif)) return null;

if (!ImageAnimator.CanAnimate(image))
{
return info;
}
if (!ImageAnimator.CanAnimate(image)) return info;

var frameDimension = new FrameDimension(image.FrameDimensionsList[0]);

Expand Down Expand Up @@ -155,10 +149,10 @@ internal static List<ImageSource> LoadGif(string path)
}

/// <summary>
/// Creates the gif.
/// The gif is slightly bigger for now
/// Sources:
/// https://stackoverflow.com/questions/18719302/net-creating-a-looping-gif-using-gifbitmapencoder
/// Creates the gif.
/// The gif is slightly bigger for now
/// Sources:
/// https://stackoverflow.com/questions/18719302/net-creating-a-looping-gif-using-gifbitmapencoder
/// </summary>
/// <param name="path">The path to the folder.</param>
/// <param name="target">The target path.</param>
Expand All @@ -178,21 +172,21 @@ internal static void CreateGif(string path, string target)

//TODO encode and change to one size, add more sanity checks

foreach (var src in btm.Select(bmpImage => bmpImage.GetHbitmap()).Select(bmp => System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
bmp,
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions())))
{
foreach (var src in btm.Select(bmpImage => bmpImage.GetHbitmap()).Select(bmp =>
System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
bmp,
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions())))
gEnc.Frames.Add(BitmapFrame.Create(src));
}

using var ms = new MemoryStream();
gEnc.Save(ms);
var fileBytes = ms.ToArray();
// write custom header
// This is the NETSCAPE2.0 Application Extension.
var applicationExtension = new byte[] { 33, 255, 11, 78, 69, 84, 83, 67, 65, 80, 69, 50, 46, 48, 3, 1, 0, 0, 0 };
var applicationExtension = new byte[]
{ 33, 255, 11, 78, 69, 84, 83, 67, 65, 80, 69, 50, 46, 48, 3, 1, 0, 0, 0 };
var newBytes = new List<byte>();
newBytes.AddRange(fileBytes.Take(13));
newBytes.AddRange(applicationExtension);
Expand Down Expand Up @@ -270,4 +264,4 @@ public sealed class ImageGifInfo
/// </value>
public Size Size { get; internal set; }
}
}
}
4 changes: 2 additions & 2 deletions Imaging/ImageRender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public List<ImageSource> LoadGif(string path)

/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="IImageRender" /> interface.
/// Initializes a new instance of the <see cref="IImageRender" /> interface.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="target">The target.</param>
Expand All @@ -421,4 +421,4 @@ public void CreateGif(string path, string target)
ImageGifHandler.CreateGif(path, target);
}
}
}
}
38 changes: 19 additions & 19 deletions Imaging/Imaging.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DataFormatter\DataFormatter.csproj" />
<ProjectReference Include="..\ExtendedSystemObjects\ExtendedSystemObjects.csproj" />
<ProjectReference Include="..\FileHandler\FileHandler.csproj" />
<ProjectReference Include="..\Mathematics\Mathematics.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DataFormatter\DataFormatter.csproj" />
<ProjectReference Include="..\ExtendedSystemObjects\ExtendedSystemObjects.csproj" />
<ProjectReference Include="..\FileHandler\FileHandler.csproj" />
<ProjectReference Include="..\Mathematics\Mathematics.csproj" />
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>CommonLibraryTests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>CommonLibraryTests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Imaging/ImagingResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ public static class ImagingResources
TifExt
};
}
}
}
32 changes: 7 additions & 25 deletions Mathematics/BaseMatrix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ public void Dispose()
/// </param>
private void Dispose(bool disposing)
{
if (Disposed)
{
return;
}
if (Disposed) return;

if (disposing)
{
Expand Down Expand Up @@ -180,10 +177,7 @@ public double Determinant()
public static BaseMatrix operator *(BaseMatrix first, BaseMatrix second)
{
//Todo rework check
if (first.Width != second.Width && first.Width != second.Height)
{
throw new ArithmeticException();
}
if (first.Width != second.Width && first.Width != second.Height) throw new ArithmeticException();

return MatrixUtility.UnsafeMultiplication(first, second);
}
Expand All @@ -198,15 +192,9 @@ public double Determinant()
/// </returns>
public static BaseMatrix operator +(BaseMatrix first, BaseMatrix second)
{
if (first.Width != second.Width)
{
throw new ArithmeticException();
}
if (first.Width != second.Width) throw new ArithmeticException();

if (first.Height != second.Height)
{
throw new ArithmeticException();
}
if (first.Height != second.Height) throw new ArithmeticException();

return MatrixUtility.UnsafeAddition(first, second);
}
Expand All @@ -221,17 +209,11 @@ public double Determinant()
/// </returns>
public static BaseMatrix operator -(BaseMatrix first, BaseMatrix second)
{
if (first.Width != second.Width)
{
throw new ArithmeticException();
}
if (first.Width != second.Width) throw new ArithmeticException();

if (first.Height != second.Height)
{
throw new ArithmeticException();
}
if (first.Height != second.Height) throw new ArithmeticException();

return MatrixUtility.UnsafeSubtraction(first, second);
}
}
}
}
2 changes: 1 addition & 1 deletion Mathematics/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ public static class Constants
{ 360, 1 }
};
}
}
}
19 changes: 5 additions & 14 deletions Mathematics/Dispersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public sealed class Dispersion
/// <param name="row">The row.</param>
public Dispersion(List<double> row)
{
if (row == null || row.Count == 0)
{
return;
}
if (row == null || row.Count == 0) return;

Row = row;
CalcArithmeticMean();
Expand Down Expand Up @@ -140,15 +137,9 @@ private void CalcSpan()

foreach (var element in Row)
{
if (min >= element)
{
min = element;
}

if (max <= element)
{
max = element;
}
if (min >= element) min = element;

if (max <= element) max = element;
}

Span = max - min;
Expand All @@ -165,4 +156,4 @@ private void CalcMeanAbsoluteDeviation()
MeanAbsoluteDeviation = variance / Row.Count;
}
}
}
}
12 changes: 3 additions & 9 deletions Mathematics/ExtendedMath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ public static double CalcCos(int degree)
cos = Constants.CoSinus[Math.Abs(degree)];

//catch negative degrees
if (degree < 0)
{
cos *= -1;
}
if (degree < 0) cos *= -1;
}
else
{
Expand All @@ -90,10 +87,7 @@ public static double CalcSin(int degree)
sin = Constants.Sinus[Math.Abs(degree)];

//catch negative degrees
if (degree < 0)
{
sin *= -1;
}
if (degree < 0) sin *= -1;
}
else
{
Expand All @@ -104,4 +98,4 @@ public static double CalcSin(int degree)
return sin;
}
}
}
}
Loading

0 comments on commit e62bf99

Please sign in to comment.