VisualSVN是vs上非常好用的svn插件。可以快速方便得查看修改差异。并支持相关svn操作。

目录

C:\Users{username}\AppData\Local\Microsoft\VisualStudio\17.0_d873d0f6\Extensions\5xuf2xea.r4x

  1. VisualSVN.Core.L.dll
  2. ├───VisualSVN.Core
  3. └───VisualSVN.Core.Licensing
  4. ├───License
  5. └───CreatePregeneratedLicense
  6. ├───LicenseConverter
  7. ├───KeyToLicense
  8. └───KeyToLicenseUnsafe
  9. └───PlainLicenseSerializer
  10. ├───Deserialize
  11. └───ParsePlainDate

VisualSVN.Core.Licensing

License

许可证类

CreatePregeneratedLicense

  1. // Token: 0x0600001C RID: 28 RVA: 0x00002448 File Offset: 0x00001448
  2. public static License CreatePregeneratedLicense(DateTime startTime)
  3. {
  4. License license = new License();
  5. license.StartTime = startTime;
  6. license.EndTime = license.StartTime.AddDays(30.0);
  7. license.Type = LicenseType.Evaluation;
  8. license.LicensedTo = "Evaluation User";
  9. license.IsPregenerated = true;
  10. license.Capacity = 1;
  11. license.Binding = LicenseBinding.Seat;
  12. return license;
  13. }

从以上代码可知,试用期许可证的结束时间为开始时间加上30天(30天试用期)。
该方法被PlainLicenseSerializer.Deserialize引用

LicenseConverter

KeyToLicense

  1. // Token: 0x06000022 RID: 34 RVA: 0x00002670 File Offset: 0x00001670
  2. public static License KeyToLicense(IDecoder decoder, string key)
  3. {
  4. try
  5. {
  6. return LicenseConverter.KeyToLicenseUnsafe(decoder, key);
  7. }
  8. catch (Exception ex)
  9. {
  10. Log.ReportException(ex);
  11. }
  12. return null;
  13. }

KeyToLicenseUnsafe

  1. // Token: 0x06000021 RID: 33 RVA: 0x0000262C File Offset: 0x0000162C
  2. public static License KeyToLicenseUnsafe(IDecoder decoder, string key)
  3. {
  4. char c;
  5. string text = LicenseConverter.ExtractKeyBody(key, out c);
  6. if (text == null)
  7. {
  8. return null;
  9. }
  10. if (c == 'C')
  11. {
  12. return OldLicenseSerializer.Deserialize(text, decoder);
  13. }
  14. if (c == 'N')
  15. {
  16. return NewLicenseSerializer.Deserialize(text, decoder);
  17. }
  18. if (c == 'P')
  19. {
  20. return PlainLicenseSerializer.Deserialize(text);
  21. }
  22. return null;
  23. }

该方法被LicenseConverter.KeyToLicense引用

PlainLicenseSerializer

Deserialize

  1. // Token: 0x0600004B RID: 75 RVA: 0x00003348 File Offset: 0x00002348
  2. public static License Deserialize(string key)
  3. {
  4. DateTime startTime = PlainLicenseSerializer.ParsePlainDate(key);
  5. return License.CreatePregeneratedLicense(startTime);
  6. }

该方法被LicenseConverter.KeyToLicenseUnsafe引用

ParsePlainDate

  1. // Token: 0x0600004C RID: 76 RVA: 0x00003364 File Offset: 0x00002364
  2. private static DateTime ParsePlainDate(string plainKey)
  3. {
  4. DateTime result;
  5. try
  6. {
  7. if (plainKey.Length < 10)
  8. {
  9. throw new LicensingException("Cannot parse license date.");
  10. }
  11. string text = "";
  12. for (int i = 0; i < plainKey.Length; i++)
  13. {
  14. text += (plainKey[i] - '\n').ToString();
  15. }
  16. int day = int.Parse(text.Substring(4, 2));
  17. int month = int.Parse(text.Substring(18, 2));
  18. int year = int.Parse(text.Substring(10, 4));
  19. result = new DateTime(year, month, day);
  20. }
  21. catch (FormatException inner)
  22. {
  23. throw new LicensingException("Cannot parse license date. Date format is invalid.", inner);
  24. }
  25. catch (OverflowException inner2)
  26. {
  27. throw new LicensingException("Cannot parse license date. Date is not in correct range.", inner2);
  28. }
  29. return result;
  30. }

该方法被PlainLicenseSerializer.Deserialize引用