public static byte[] FigToLz4Bin(CadFigure fig, bool withChild = false) { MpFigure_v1002 mpf = MpFigure_v1002.Create(fig, withChild); var lz4Options = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray); return(MessagePackSerializer.Serialize(mpf, lz4Options)); }
public static void BinRestoreFig(byte[] bin, CadFigure fig, CadObjectDB db = null) { MpFigure_v1002 mpfig = MessagePackSerializer.Deserialize <MpFigure_v1002>(bin); mpfig.RestoreTo(fig); SetChildren(fig, mpfig.ChildIdList, db); }
public static void Lz4BinRestoreFig(byte[] bin, CadFigure fig, CadObjectDB db = null) { var lz4Options = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray); MpFigure_v1002 mpfig = MessagePackSerializer.Deserialize <MpFigure_v1002>(bin, lz4Options); mpfig.RestoreTo(fig); SetChildren(fig, mpfig.ChildIdList, db); }
public static CadFigure BinToFig(byte[] bin, CadObjectDB db = null) { MpFigure_v1002 mpfig = MessagePackSerializer.Deserialize <MpFigure_v1002>(bin); CadFigure fig = mpfig.Restore(); if (db != null) { SetChildren(fig, mpfig.ChildIdList, db); } return(fig); }
public static void CopyTo(CadFigure src, CadFigure dst) { MpFigure_v1002 mpf = MpFigure_v1002.Create(src, false); byte[] data = MessagePackSerializer.Serialize(mpf); MpFigure_v1002 mpfCopy = MessagePackSerializer.Deserialize <MpFigure_v1002>(data); uint id = dst.ID; mpfCopy.RestoreTo(dst); dst.ID = id; }
public static byte[] FigToBin(CadFigure fig, bool withChild) { MpFigure_v1002 mpf = MpFigure_v1002.Create(fig, withChild); return(MessagePackSerializer.Serialize(mpf)); }