暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SolutionGuidGenerator.cs 765B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Security.Cryptography;
  3. using System.Text;
  4. namespace Packages.Rider.Editor.ProjectGeneration
  5. {
  6. internal static class SolutionGuidGenerator
  7. {
  8. public static string GuidForProject(string projectName)
  9. {
  10. return ComputeGuidHashFor(projectName + "salt");
  11. }
  12. public static string GuidForSolution()
  13. {
  14. // GUID for a C# class library: http://www.codeproject.com/Reference/720512/List-of-Visual-Studio-Project-Type-GUIDs
  15. return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC";
  16. }
  17. static string ComputeGuidHashFor(string input)
  18. {
  19. using (var md5 = MD5.Create())
  20. {
  21. var hash = md5.ComputeHash(Encoding.Default.GetBytes(input));
  22. return new Guid(hash).ToString();
  23. }
  24. }
  25. }
  26. }