Roslyn Source generators are not supposed to access I/O. To get around this we have to use `AdditionalFiles` to give the analyzer access to read/load the schema files. To write the schema files we have to use a separate program altogether. - [X] Adds SerializationSchemaGenerator - [X] Splits out the SerializationGenerator code
27 lines
598 B
C#
27 lines
598 B
C#
using System.Collections.Generic;
|
|
|
|
namespace SerializableMigration
|
|
{
|
|
public class SerializableMetadataComparer : IComparer<SerializableMetadata>
|
|
{
|
|
public int Compare(SerializableMetadata x, SerializableMetadata y)
|
|
{
|
|
if (ReferenceEquals(x, y))
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
if (ReferenceEquals(null, y))
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
if (ReferenceEquals(null, x))
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
return x.Version.CompareTo(y.Version);
|
|
}
|
|
}
|
|
}
|