Fix build_init vcxproj to correctly detect changes in config.h.
[mono.git] / mcs / class / referencesource / System.WorkflowServices / SR.cs
1 //------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //------------------------------------------------------------
4
5 namespace System.ServiceModel
6 {
7     using System;
8     using System.ComponentModel;
9     using System.Globalization;
10     using System.Reflection;
11     using System.Resources;
12     using System.Runtime;
13
14     [AttributeUsage(AttributeTargets.All)]
15     sealed class SR2DescriptionAttribute : DescriptionAttribute
16     {
17         internal const string SendActivityDescription = "SendActivityDescription";
18         internal const string ReceiveActivityDescription = "ReceiveActivityDescription";
19         internal const string Receive_OperationValidation_Description = "Receive_OperationValidation_Description";
20         internal const string Receive_CanCreateInstance_Description = "Receive_CanCreateInstance_Description";
21         internal const string Receive_ContextToken_Description = "Receive_ContextToken_Description";
22         internal const string Receive_FaultMessage_Description = "Receive_FaultMessage_Description";
23         internal const string Receive_OperationInfo_Description = "Receive_OperationInfo_Description";
24         internal const string Send_AfterResponse_Description = "Send_AfterResponse_Description";
25         internal const string Send_BeforeSend_Description = "Send_BeforeSend_Description";
26         internal const string Send_ChannelToken_Description = "Send_ChannelToken_Description";
27         internal const string Send_CustomAddress_Description = "Send_CustomAddress_Description";
28         internal const string Send_OperationInfo_Description = "Send_OperationInfo_Description";
29         internal const string ContextToken_Name_Description = "ContextToken_Name_Description";
30         internal const string ContextToken_OwnerActivityName_Description = "ContextToken_OwnerActivityName_Description";
31         internal const string ChannelToken_EndpointName_Description = "ChannelToken_EndpointName_Description";
32         internal const string ChannelToken_Name_Description = "ChannelToken_Name_Description";
33         internal const string ChannelToken_OwnerActivityName_Description = "ChannelToken_OwnerActivityName_Description";
34         
35         public SR2DescriptionAttribute(string description)
36         {
37             DescriptionValue = SR2.ResourceManager.GetString(description, SR2.Culture);
38         }
39
40         public SR2DescriptionAttribute(string description, string resourceSet)
41         {
42             ResourceManager rm = new ResourceManager(resourceSet, Assembly.GetExecutingAssembly());
43             DescriptionValue = rm.GetString(description);
44             Fx.Assert(DescriptionValue != null, string.Format(CultureInfo.CurrentCulture, "String resource {0} not found.", new object[] { description }));
45         }
46     }
47
48     [AttributeUsage(AttributeTargets.All)]
49     sealed class SR2CategoryAttribute : CategoryAttribute
50     {
51         string resourceSet = String.Empty;
52         internal const string Activity = "Activity";
53         internal const string Standard = "Standard";
54         internal const string Handlers = "Handlers";
55
56         public SR2CategoryAttribute(string category)
57             : base(category)
58         {
59         }
60
61         public SR2CategoryAttribute(string category, string resourceSet)
62             : base(category)
63         {
64             this.resourceSet = resourceSet;
65         }
66
67         protected override string GetLocalizedString(string value)
68         {
69             if (this.resourceSet.Length > 0)
70             {
71                 ResourceManager rm = new ResourceManager(resourceSet, Assembly.GetExecutingAssembly());
72                 String localizedString = rm.GetString(value);
73                 Fx.Assert(localizedString != null, string.Format(CultureInfo.CurrentCulture, "String resource {0} not found.", new object[] { value }));
74                 return localizedString;
75             }
76             else
77             {
78                 return SR2.ResourceManager.GetString(value, SR2.Culture);
79             }
80         }
81     }    
82     /// <summary>
83     ///    This is a stub for auto-generated resource class, providing GetString function. Usage:
84     ///
85     ///        string s = SR2.GetString(SR2.MyIdenfitier);
86     /// </summary>
87     sealed partial class SR2
88     {
89         internal static string GetString(string name, params object[] args)
90         {
91             return GetString(resourceCulture, name, args);
92         }
93         internal static string GetString(CultureInfo culture, string name, params object[] args)
94         {
95             if (args != null && args.Length > 0)
96             {
97                 return string.Format(culture, name, args);
98             }
99             else
100             {
101                 return name;
102             }
103         }
104     }
105 }