OnlyPropertiesCode.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. using System.IO;
  2. using System.Linq;
  3. using System.Reflection;
  4. using System.Threading.Tasks;
  5. namespace Avalonia.Generators.Tests.OnlyProperties.GeneratedCode;
  6. public static class OnlyPropertiesCode
  7. {
  8. public const string NamedControl = "NamedControl.txt";
  9. public const string NamedControls = "NamedControls.txt";
  10. public const string XNamedControl = "xNamedControl.txt";
  11. public const string XNamedControls = "xNamedControls.txt";
  12. public const string NoNamedControls = "NoNamedControls.txt";
  13. public const string CustomControls = "CustomControls.txt";
  14. public const string DataTemplates = "DataTemplates.txt";
  15. public const string SignUpView = "SignUpView.txt";
  16. public const string AttachedProps = "AttachedProps.txt";
  17. public const string FieldModifier = "FieldModifier.txt";
  18. public const string ControlWithoutWindow = "ControlWithoutWindow.txt";
  19. public static async Task<string> Load(string generatedCodeResourceName)
  20. {
  21. var assembly = typeof(XamlXNameResolverTests).Assembly;
  22. var fullResourceName = assembly
  23. .GetManifestResourceNames()
  24. .First(name => name.Contains("OnlyProperties") && name.EndsWith(generatedCodeResourceName));
  25. await using var stream = assembly.GetManifestResourceStream(fullResourceName);
  26. using var reader = new StreamReader(stream!);
  27. return await reader.ReadToEndAsync();
  28. }
  29. }