DTLib/Dtsod/DtsodVersionConverter.cs
2021-12-31 00:17:32 +03:00

14 lines
566 B
C#

namespace DTLib.Dtsod;
public static class DtsodVersionConverter
{
public static IDtsod Convert(IDtsod src, DtsodVersion targetVersion)
=> targetVersion switch
{
DtsodVersion.V21 => new DtsodV21(src.ToDictionary()),
DtsodVersion.V22 => throw new NotImplementedException("Converting dtsods to V22 isn't implemented"),
DtsodVersion.V30 => new DtsodV30(src.ToDictionary()),
_ => throw new Exception($"DtsodVersionConverter.Convert() error: unknown target version <{targetVersion}>"),
};
}