PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/Mono.Cecil/Resource.cs

http://github.com/jbevain/cecil
C# | 58 lines | 37 code | 12 blank | 9 comment | 0 complexity | 974b63ea23e2aaddae5164f464e2999e MD5 | raw file
 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
11namespace Mono.Cecil {
12
13	public enum ResourceType {
14		Linked,
15		Embedded,
16		AssemblyLinked,
17	}
18
19	public abstract class Resource {
20
21		string name;
22		uint attributes;
23
24		public string Name {
25			get { return name; }
26			set { name = value; }
27		}
28
29		public ManifestResourceAttributes Attributes {
30			get { return (ManifestResourceAttributes) attributes; }
31			set { attributes = (uint) value; }
32		}
33
34		public abstract ResourceType ResourceType {
35			get;
36		}
37
38		#region ManifestResourceAttributes
39
40		public bool IsPublic {
41			get { return attributes.GetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Public); }
42			set { attributes = attributes.SetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Public, value); }
43		}
44
45		public bool IsPrivate {
46			get { return attributes.GetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Private); }
47			set { attributes = attributes.SetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Private, value); }
48		}
49
50		#endregion
51
52		internal Resource (string name, ManifestResourceAttributes attributes)
53		{
54			this.name = name;
55			this.attributes = (uint) attributes;
56		}
57	}
58}