Resource.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // Author:
  3. // Jb Evain (jbevain@gmail.com)
  4. //
  5. // Copyright (c) 2008 - 2015 Jb Evain
  6. // Copyright (c) 2008 - 2011 Novell, Inc.
  7. //
  8. // Licensed under the MIT/X11 license.
  9. //
  10. namespace ILRuntime.Mono.Cecil {
  11. public enum ResourceType {
  12. Linked,
  13. Embedded,
  14. AssemblyLinked,
  15. }
  16. public abstract class Resource {
  17. string name;
  18. uint attributes;
  19. public string Name {
  20. get { return name; }
  21. set { name = value; }
  22. }
  23. public ManifestResourceAttributes Attributes {
  24. get { return (ManifestResourceAttributes) attributes; }
  25. set { attributes = (uint) value; }
  26. }
  27. public abstract ResourceType ResourceType {
  28. get;
  29. }
  30. #region ManifestResourceAttributes
  31. public bool IsPublic {
  32. get { return attributes.GetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Public); }
  33. set { attributes = attributes.SetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Public, value); }
  34. }
  35. public bool IsPrivate {
  36. get { return attributes.GetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Private); }
  37. set { attributes = attributes.SetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Private, value); }
  38. }
  39. #endregion
  40. internal Resource (string name, ManifestResourceAttributes attributes)
  41. {
  42. this.name = name;
  43. this.attributes = (uint) attributes;
  44. }
  45. }
  46. }