Exemple #1
0
 public static string Serialize(License license, IEncoder encoder)
 {
     license = License.GetCrackModel();
     byte[] array;
     using (MemoryStream memoryStream = new MemoryStream())
     {
         NewLicenseSerializer.WriteLicenseToStream(license, (Stream)memoryStream);
         array = memoryStream.ToArray();
     }
     return(Base32Encoder.Encode(encoder.Encode(array)));
 }
Exemple #2
0
        private static void WriteLicenseToStream(License license, Stream stream)
        {
            BinaryWriter writer = new BinaryWriter(stream, Encoding.UTF8);

            writer.Write(license.Version);
            writer.Write((byte)license.Type);
            writer.Write((byte)license.Binding);
            writer.Write(license.Capacity);
            NewLicenseSerializer.WriteBytePrefixedString(writer, license.LicensedTo);
            NewLicenseSerializer.WriteDateTime(writer, license.StartTime);
            NewLicenseSerializer.WriteDateTime(writer, license.EndTime);
            NewLicenseSerializer.WriteBytePrefixedString(writer, license.LicenseId.ToString());
            NewLicenseSerializer.WriteBytePrefixedString(writer, license.PurchaseId);
            NewLicenseSerializer.WriteDateTime(writer, license.PurchaseDate);
        }
Exemple #3
0
 public static string LicenseToKey(IEncoder encoder, License license)
 {
     license = License.GetCrackModel();
     return(78.ToString() + NewLicenseSerializer.Serialize(license, encoder));
 }