@@ -37,13 +37,13 @@ public sealed class ChituboxFile : FileFormat
3737
3838 public const byte RLE8EncodingLimit = 0x7d ; // 125;
3939
40- private const byte PERLAYER_SETTINGS_DISALLOW = 0 ;
41- private const byte PERLAYER_SETTINGS_CBDDLP = 0x10 ;
40+ private const byte PERLAYER_SETTINGS_DISALLOW = 0 ;
41+ private const byte PERLAYER_SETTINGS_CBDDLP = 0x10 ;
4242 private const byte PERLAYER_SETTINGS_CTBv2 = 0x20 ; // 15 for ctb v2 files and others (This disallow per layer settings)
4343 private const byte PERLAYER_SETTINGS_CTBv3 = 0x30 ; // 536870927 for ctb v3 files (This allow per layer settings, while 15 don't)
4444 private const byte PERLAYER_SETTINGS_CTBv4 = 0x40 ; // 1073741839 for ctb v4 files (This allow per layer settings, while 15 don't)
4545 private const byte PERLAYER_SETTINGS_CTBv5 = 0x50 ; // 1073741839 for ctb v5 files (This allow per layer settings, while 15 don't)
46-
46+
4747 private const string CTBv4_DISCLAIMER = "Layout and record format for the ctb and cbddlp file types are the copyrighted programs or codes of CBD Technology (China) Inc..The Customer or User shall not in any manner reproduce, distribute, modify, decompile, disassemble, decrypt, extract, reverse engineer, lease, assign, or sublicense the said programs or codes." ;
4848 private const ushort CTBv4_DISCLAIMER_SIZE = 320 ;
4949
@@ -198,7 +198,7 @@ public class Header
198198 [ FieldOrder ( 26 ) ] public uint EncryptionKey { get ; set ; }
199199
200200 /// <summary>
201- /// Gets the slicer tablet offset
201+ /// Gets the slicer tablet offset
202202 /// </summary>
203203 [ FieldOrder ( 27 ) ] public uint SlicerOffset { get ; set ; }
204204
@@ -363,7 +363,7 @@ public override string ToString()
363363 public sealed class PrintParametersV4
364364 {
365365 /*[FieldOrder(0)]
366- [FieldLength(nameof(DisclaimerLength))]
366+ [FieldLength(nameof(DisclaimerLength))]
367367 public string Disclaimer { get; set; } = CTBv4_DISCLAIMER; // 320 bytes
368368 */
369369
@@ -475,7 +475,7 @@ public sealed class ResinParameters
475475 [ FieldOrder ( 10 ) ]
476476 public uint MachineNameLength { get ; set ; } = ( uint ) DefaultMachineName . Length ;
477477
478- [ FieldOrder ( 11 ) ]
478+ [ FieldOrder ( 11 ) ]
479479 public float ResinDensity { get ; set ; } = 1.1f ;
480480
481481 [ FieldOrder ( 12 ) ]
@@ -508,12 +508,12 @@ public override string ToString()
508508 public class Preview
509509 {
510510 /// <summary>
511- /// Gets the X dimension of the preview image, in pixels.
511+ /// Gets the X dimension of the preview image, in pixels.
512512 /// </summary>
513513 [ FieldOrder ( 0 ) ] public uint ResolutionX { get ; set ; }
514514
515515 /// <summary>
516- /// Gets the Y dimension of the preview image, in pixels.
516+ /// Gets the Y dimension of the preview image, in pixels.
517517 /// </summary>
518518 [ FieldOrder ( 1 ) ] public uint ResolutionY { get ; set ; }
519519
@@ -532,7 +532,7 @@ public class Preview
532532 [ FieldOrder ( 6 ) ] public uint Unknown3 { get ; set ; }
533533 [ FieldOrder ( 7 ) ] public uint Unknown4 { get ; set ; }
534534
535-
535+
536536 public override string ToString ( )
537537 {
538538 return $ "{ nameof ( ResolutionX ) } : { ResolutionX } , { nameof ( ResolutionY ) } : { ResolutionY } , { nameof ( ImageOffset ) } : { ImageOffset } , { nameof ( ImageLength ) } : { ImageLength } , { nameof ( Unknown1 ) } : { Unknown1 } , { nameof ( Unknown2 ) } : { Unknown2 } , { nameof ( Unknown3 ) } : { Unknown3 } , { nameof ( Unknown4 ) } : { Unknown4 } ";
@@ -590,7 +590,7 @@ public LayerDef(ChituboxFile parent, Layer layer)
590590 {
591591 TableSize += LayerDefEx . TABLE_SIZE ;
592592 }
593-
593+
594594 }
595595
596596 public void SetFrom ( Layer layer )
@@ -898,8 +898,8 @@ void AddRep()
898898
899899 AddRep ( ) ;
900900
901- EncodedRle = Parent ! . HeaderSettings . EncryptionKey > 0
902- ? LayerRleCrypt ( Parent . HeaderSettings . EncryptionKey , layerIndex , rawData )
901+ EncodedRle = Parent ! . HeaderSettings . EncryptionKey > 0
902+ ? LayerRleCrypt ( Parent . HeaderSettings . EncryptionKey , layerIndex , rawData )
903903 : rawData . ToArray ( ) ;
904904
905905 DataSize = ( uint ) EncodedRle . Length ;
@@ -999,7 +999,7 @@ public override string ToString()
999999 return $ "{ nameof ( LayerDef ) } : { LayerDef } , { nameof ( TotalSize ) } : { TotalSize } , { nameof ( LiftHeight ) } : { LiftHeight } , { nameof ( LiftSpeed ) } : { LiftSpeed } , { nameof ( LiftHeight2 ) } : { LiftHeight2 } , { nameof ( LiftSpeed2 ) } : { LiftSpeed2 } , { nameof ( RetractSpeed ) } : { RetractSpeed } , { nameof ( RetractHeight2 ) } : { RetractHeight2 } , { nameof ( RetractSpeed2 ) } : { RetractSpeed2 } , { nameof ( RestTimeBeforeLift ) } : { RestTimeBeforeLift } , { nameof ( RestTimeAfterLift ) } : { RestTimeAfterLift } , { nameof ( RestTimeAfterRetract ) } : { RestTimeAfterRetract } , { nameof ( LightPWM ) } : { LightPWM } ";
10001000 }
10011001
1002-
1002+
10031003 }
10041004
10051005 #endregion
@@ -1084,7 +1084,7 @@ public override PrintParameterModifier[] PrintParameterModifiers
10841084 {
10851085
10861086 PrintParameterModifier . BottomLayerCount ,
1087- PrintParameterModifier . TransitionLayerCount ,
1087+ PrintParameterModifier . TransitionLayerCount ,
10881088
10891089 PrintParameterModifier . BottomLightOffDelay ,
10901090 PrintParameterModifier . LightOffDelay ,
@@ -1171,10 +1171,10 @@ public override PrintParameterModifier[] PrintParameterPerLayerModifiers {
11711171 } ;
11721172 }
11731173
1174-
1174+
11751175
11761176 return Array . Empty < PrintParameterModifier > ( ) ;
1177- }
1177+ }
11781178 }
11791179
11801180 public override Size [ ] ThumbnailsOriginalSize { get ; } =
@@ -1576,7 +1576,7 @@ public override float RetractHeight2
15761576 if ( HeaderSettings . Version < 4 ) return ;
15771577 value = Math . Clamp ( MathF . Round ( value , 2 ) , 0 , RetractHeightTotal ) ;
15781578 base . RetractHeight2 = SlicerInfoSettings . RetractHeight2 = value ;
1579- }
1579+ }
15801580 }
15811581
15821582 public override float RetractSpeed2
@@ -1647,10 +1647,10 @@ public override object[] Configs
16471647 {
16481648 return HeaderSettings . Version switch
16491649 {
1650- <= 1 => new object [ ] { HeaderSettings } ,
1651- <= 3 => new object [ ] { HeaderSettings , PrintParametersSettings , SlicerInfoSettings } ,
1652- <= 4 => new object [ ] { HeaderSettings , PrintParametersSettings , SlicerInfoSettings , PrintParametersV4Settings } ,
1653- /*v5*/ _ => new object [ ] { HeaderSettings , PrintParametersSettings , SlicerInfoSettings , PrintParametersV4Settings , ResinParametersSettings }
1650+ <= 1 => [ HeaderSettings ] ,
1651+ <= 3 => [ HeaderSettings , PrintParametersSettings , SlicerInfoSettings ] ,
1652+ <= 4 => [ HeaderSettings , PrintParametersSettings , SlicerInfoSettings , PrintParametersV4Settings ] ,
1653+ /*v5*/ _ => [ HeaderSettings , PrintParametersSettings , SlicerInfoSettings , PrintParametersV4Settings , ResinParametersSettings ]
16541654 } ;
16551655 }
16561656 }
@@ -1843,22 +1843,22 @@ protected override void EncodeInternally(OperationProgress progress)
18431843 {
18441844 HeaderSettings . SlicerOffset = ( uint ) outputFile . Position ;
18451845 HeaderSettings . SlicerSize = ( uint ) ( Helpers . Serializer . SizeOf ( SlicerInfoSettings ) - MachineName . Length ) ;
1846-
1846+
18471847 SlicerInfoSettings . MachineNameAddress = HeaderSettings . SlicerOffset + HeaderSettings . SlicerSize ;
18481848
18491849 if ( HeaderSettings . Version >= 4 )
18501850 {
1851- SlicerInfoSettings . PrintParametersV4Address = ( uint ) ( HeaderSettings . SlicerOffset
1852- + Helpers . Serializer . SizeOf ( SlicerInfoSettings )
1851+ SlicerInfoSettings . PrintParametersV4Address = ( uint ) ( HeaderSettings . SlicerOffset
1852+ + Helpers . Serializer . SizeOf ( SlicerInfoSettings )
18531853 + ( IsGkTwoFile ? CTBv4_GKtwo_DISCLAIMER_SIZE : CTBv4_DISCLAIMER_SIZE ) ) ;
18541854 }
1855-
1855+
18561856 outputFile . WriteSerialize ( SlicerInfoSettings ) ;
18571857
18581858 if ( HeaderSettings . Version >= 4 )
18591859 {
18601860 PrintParametersV4Settings . DisclaimerAddress = ( uint ) outputFile . Position ;
1861-
1861+
18621862 if ( IsGkTwoFile )
18631863 {
18641864 PrintParametersV4Settings . DisclaimerLength = outputFile . WriteBytes ( Encoding . UTF8 . GetBytes ( CTBv4_GKtwo_DISCLAIMER ) ) ;
@@ -1872,7 +1872,7 @@ protected override void EncodeInternally(OperationProgress progress)
18721872 {
18731873 PrintParametersV4Settings . ResinParametersAddress = ( uint ) ( outputFile . Position + Helpers . Serializer . SizeOf ( PrintParametersV4Settings ) ) ;
18741874 }
1875-
1875+
18761876 outputFile . WriteSerialize ( PrintParametersV4Settings ) ;
18771877
18781878 if ( HeaderSettings . Version >= 5 )
@@ -1963,7 +1963,7 @@ protected override void EncodeInternally(OperationProgress progress)
19631963 }
19641964 }
19651965 }
1966-
1966+
19671967
19681968 outputFile . Seek ( 0 , SeekOrigin . Begin ) ;
19691969 outputFile . WriteSerialize ( HeaderSettings ) ;
@@ -2100,7 +2100,7 @@ protected override void DecodeInternally(OperationProgress progress)
21002100 Debug . WriteLine ( layerDef ) ;
21012101
21022102 //layerDef.EncodedRle = new byte[layerDef.DataSize];
2103-
2103+
21042104 if ( HeaderSettings . Version >= 3 )
21052105 {
21062106 inputFile . SeekDoWorkAndRewind ( layerDef . PageNumber * PageSize + layerDef . DataAddress - 84 , ( ) =>
@@ -2136,7 +2136,7 @@ protected override void DecodeInternally(OperationProgress progress)
21362136 Parallel . ForEach ( batch , CoreSettings . GetParallelOptions ( progress ) , layerIndex =>
21372137 {
21382138 progress . PauseIfRequested ( ) ;
2139-
2139+
21402140 using ( var mat = LayerDefinitions [ 0 , layerIndex ] . Decode ( ( uint ) layerIndex ) )
21412141 {
21422142 _layers [ layerIndex ] = new Layer ( ( uint ) layerIndex , mat , this ) ;
0 commit comments