File tree Expand file tree Collapse file tree
sandbox/SandboxConsoleApp
MemoryPack.Unity/Assets/Plugins/MemoryPack/Runtime/MemoryPack.Generator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,13 @@ public class NewBase
2424 public long Description { get ; set ; }
2525}
2626
27+ [ MemoryPackable ]
28+ public partial struct FooUnman
29+ {
30+ public float MyProperty { get ; set ; }
31+ public float MyProperty2 { get ; set ; }
32+ }
33+
2734[ MemoryPackable ]
2835public partial class NewProp : NewBase , IMore
2936{
Original file line number Diff line number Diff line change @@ -181,15 +181,26 @@ string WithEscape(ISymbol symbol)
181181 {
182182 if ( type . IsUnmanagedType )
183183 {
184- sb . Append ( "unmanaged " ) ;
184+ sb . Append ( "GanerateType unmanaged " ) ;
185+ }
186+ else
187+ {
188+ sb . Append ( "GenerateType " + type . GenerateType . ToString ( ) + " " ) ;
185189 }
186190 sb . AppendLine ( WithEscape ( type . Symbol ) ) ;
187191 sb . AppendLine ( "---" ) ;
188192 }
189193 else
190194 {
191195 sb . AppendLine ( "/// <remarks>" ) ;
192- sb . AppendLine ( "/// MemoryPack serialize members:<br/>" ) ;
196+ if ( type . IsUnmanagedType )
197+ {
198+ sb . AppendLine ( "/// MemoryPack GenerateType: unmanaged<br/>" ) ;
199+ }
200+ else
201+ {
202+ sb . AppendLine ( "/// MemoryPack GenerateType: " + type . GenerateType . ToString ( ) + "<br/>" ) ;
203+ }
193204 sb . AppendLine ( "/// <code>" ) ;
194205 }
195206
Original file line number Diff line number Diff line change @@ -270,21 +270,21 @@ public bool Contains(ITypeSymbol symbol)
270270 {
271271 if ( array . IsSZArray )
272272 {
273- return $ "MemoryPack.Formatters.ArrayFormatter<{ type . FullyQualifiedToString ( ) } >";
273+ return $ "MemoryPack.Formatters.ArrayFormatter<{ array . ElementType . FullyQualifiedToString ( ) } >";
274274 }
275275 else
276276 {
277277 if ( array . Rank == 2 )
278278 {
279- return $ "MemoryPack.Formatters.TwoDimensionalArrayFormatter<{ type . FullyQualifiedToString ( ) } >";
279+ return $ "MemoryPack.Formatters.TwoDimensionalArrayFormatter<{ array . ElementType . FullyQualifiedToString ( ) } >";
280280 }
281281 else if ( array . Rank == 3 )
282282 {
283- return $ "MemoryPack.Formatters.ThreeDimensionalArrayFormatter<{ type . FullyQualifiedToString ( ) } >";
283+ return $ "MemoryPack.Formatters.ThreeDimensionalArrayFormatter<{ array . ElementType . FullyQualifiedToString ( ) } >";
284284 }
285285 else if ( array . Rank == 4 )
286286 {
287- return $ "MemoryPack.Formatters.FourDimensionalArrayFormatter<{ type . FullyQualifiedToString ( ) } >";
287+ return $ "MemoryPack.Formatters.FourDimensionalArrayFormatter<{ array . ElementType . FullyQualifiedToString ( ) } >";
288288 }
289289 }
290290 }
You can’t perform that action at this time.
0 commit comments