示例#1
0
 public LicenseInfo AddCodeExecution(object instance)
 {
     if (instance != null)
     {
         var assemblyData = File.ReadAllBytes(instance.GetType().Assembly.Location);
         CodeExecutionChain.Add(instance.GetType().FullName, assemblyData);
     }
     return(this);
 }
示例#2
0
 public string Serialize()
 {
     return(new XElement("license",
                         new XElement("issued", Issued.ToFileTimeUtc()),
                         new XElement("valid", ValidTo.ToFileTimeUtc()),
                         new XElement("params",
                                      Features.Select(x => new XElement("feature", new XAttribute("name", x.Key), new XAttribute("value", x.Value))),
                                      Limits.Select(x => new XElement("limit", new XAttribute("name", x.Key), new XAttribute("value", x.Value))),
                                      CodeExecutionChain.Select(x => new XElement("execute", new XAttribute("entry", x.Key), new XCData(DataEncoder.ToString(x.Value)))),
                                      CustomValidators.Select(x => new XElement("validate", new XCData(DataEncoder.ToString(x)))))
                         ).ToString(SaveOptions.DisableFormatting));
 }