Files
PepApi.Core/PepApi.Core/Extensions.cs
AJ Isaacs 9088af52de refactor(PepLib.Core): reorganize files into logical folder structure
Move 38 files from root directory into organized subfolders:
- Enums/ (7 files): StatusType, ApplicationType, DrawingType, etc.
- Geometry/ (5 files): Vector, Box, Size, Spacing, Node
- Models/ (15 files): Nest, Plate, Part, Program, Report, etc.
- Utilities/ (7 files): MathHelper, Tolerance, ZipHelper, etc.
- Extensions/ (2 files): PartListExtensions, PlateListExtensions
- Interfaces/ (1 file): IMovable

Update namespaces to follow folder hierarchy (e.g., PepLib.Models).
Add GlobalUsings.cs for internal backward compatibility.
Update Codes/ and IO/ files with new using statements.
Update PepApi.Core consumers to reference new namespaces.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 09:29:13 -05:00

69 lines
1.8 KiB
C#

using PepApi.Core.Models;
using PepLib.Models;
namespace PepApi.Core
{
public static class Extensions
{
public static bool IsNullOrWhiteSpace(this string s)
{
return string.IsNullOrWhiteSpace(s);
}
public static bool IsNullOrEmpty(this string s)
{
return string.IsNullOrEmpty(s);
}
public static bool IsNaN(this double d)
{
return double.IsNaN(d);
}
public static bool IsInfinity(this double d)
{
return double.IsInfinity(d);
}
public static bool IsNegativeInfinity(this double d)
{
return double.IsNegativeInfinity(d);
}
public static bool IsPositiveInfinity(this double d)
{
return double.IsPositiveInfinity(d);
}
public static bool IsEven(this int i)
{
return i % 2 == 0;
}
public static bool IsOdd(this int i)
{
return i % 2 != 0;
}
public static NestSummary ConvertToNestSummary(this NestInfo nest)
{
return new NestSummary
{
Name = nest.Name,
DateCreated = nest.DateCreated,
DateLastModified = nest.DateLastModified,
Status = nest.Status.ToString(),
Comments = nest.Comments,
Customer = nest.Customer,
ProgrammedBy = nest.ProgrammedBy,
MaterialNumber = nest.MaterialNumber,
MaterialGrade = nest.MaterialGrade,
Notes = nest.Notes,
HasErrors = !nest.Errors.IsNullOrWhiteSpace(),
Revision = nest.UserDefined1,
Application = "N/A"
};
}
}
}