blob: 6620f7ff3e33109d065bdfc6a1a9039635ed357f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
//-----------------------------------------------------------------------
// <copyright file="MessagePartAttribute.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DotNetOAuth.Messaging {
using System;
using System.Net.Security;
using System.Reflection;
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
internal sealed class MessagePartAttribute : Attribute {
private bool initialized;
private string name;
internal MessagePartAttribute() {
}
internal MessagePartAttribute(string name) {
this.Name = name;
}
public string Name {
get { return this.name; }
set { this.name = string.IsNullOrEmpty(value) ? null : value; }
}
public ProtectionLevel Signed { get; set; }
public bool Optional { get; set; }
internal void Initialize(MemberInfo member) {
if (member == null) {
throw new ArgumentNullException("member");
}
if (!this.initialized) {
if (String.IsNullOrEmpty(this.Name)) {
this.Name = member.Name;
}
this.initialized = true;
}
}
}
}
|