Antigravity 초안

This commit is contained in:
Lectom C Han
2026-01-08 15:32:15 +09:00
commit 12262b4479
32 changed files with 3048 additions and 0 deletions

69
ExcelKv.Core/SiUnit.cs Normal file
View File

@@ -0,0 +1,69 @@
namespace ExcelKv.Core.Units;
public enum UnitCategory
{
None = 0,
Length,
Area,
Volume,
Weight,
Count, // ex: EA, Set
Time // ex: Hour, Day
}
public enum SiUnit
{
// Default
None = 0,
// Length (Base: Meter)
Meter = 100,
Millimeter = 101,
Centimeter = 102,
Kilometer = 103,
// Area (Base: SquareMeter)
SquareMeter = 200,
Hectare = 201,
// Volume (Base: CubicMeter)
CubicMeter = 300,
Liter = 301,
// Weight/Mass (Base: Kilogram)
Kilogram = 400,
Ton = 401,
Gram = 402,
// Count
Each = 900,
Set = 901
}
public static class SiUnitExtensions
{
public static UnitCategory GetCategory(this SiUnit unit)
{
int id = (int)unit;
if (id >= 100 && id < 200) return UnitCategory.Length;
if (id >= 200 && id < 300) return UnitCategory.Area;
if (id >= 300 && id < 400) return UnitCategory.Volume;
if (id >= 400 && id < 500) return UnitCategory.Weight;
if (id >= 900 && id < 1000) return UnitCategory.Count;
return UnitCategory.None;
}
public static string ToSymbol(this SiUnit unit) => unit switch
{
SiUnit.Meter => "m",
SiUnit.Millimeter => "mm",
SiUnit.Centimeter => "cm",
SiUnit.Kilometer => "km",
SiUnit.SquareMeter => "m2",
SiUnit.CubicMeter => "m3",
SiUnit.Kilogram => "kg",
SiUnit.Ton => "ton",
SiUnit.Each => "EA",
_ => ""
};
}