Update DataProtection to use a K-generated .resx designer file instead of the VS-generated .resx designer file.

This commit is contained in:
Levi Broderick 2014-03-07 14:46:19 -08:00
parent adf2adabc0
commit 6748897083
8 changed files with 100 additions and 128 deletions

View File

@ -1,7 +1,6 @@
using System;
using System.Globalization;
using System.Reflection;
using Microsoft.AspNet.Security.DataProtection.Resources;
using Microsoft.AspNet.Security.DataProtection.Util;
namespace Microsoft.AspNet.Security.DataProtection

View File

@ -1,7 +1,6 @@
using System;
using System.Diagnostics;
using System.Security.Cryptography;
using Microsoft.AspNet.Security.DataProtection.Resources;
using Microsoft.AspNet.Security.DataProtection.Util;
namespace Microsoft.AspNet.Security.DataProtection

View File

@ -3,7 +3,6 @@ using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using Microsoft.AspNet.Security.DataProtection.Resources;
using Microsoft.AspNet.Security.DataProtection.Util;
namespace Microsoft.AspNet.Security.DataProtection

View File

@ -22,15 +22,15 @@ namespace Microsoft.AspNet.Security.DataProtection
{
if (String.IsNullOrEmpty(algorithmName))
{
throw new ArgumentNullException("algorithmName");
throw new ArgumentException(Res.Common_NullOrEmpty, "algorithmName");
}
if (password == null || password.Length == 0)
{
throw new ArgumentNullException("password");
throw new ArgumentException(Res.Common_NullOrEmpty, "password");
}
if (salt == null || salt.Length == 0)
{
throw new ArgumentNullException("salt");
throw new ArgumentException(Res.Common_NullOrEmpty, "salt");
}
if (iterationCount <= 0)
{

View File

@ -1,32 +0,0 @@
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.AspNet.Security.DataProtection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Microsoft.AspNet.Security.DataProtection")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("130d9afa-6535-42bf-ba70-610b677d5acf")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
// for OOB servicing
[assembly: AssemblyMetadata("Serviceable", "True")]

View File

@ -0,0 +1,94 @@
// <auto-generated />
namespace Microsoft.AspNet.Security.DataProtection
{
using System.Globalization;
using System.Reflection;
using System.Resources;
internal static class Res
{
private static readonly ResourceManager _resourceManager
= new ResourceManager("Microsoft.AspNet.Security.DataProtection.Res", typeof(Res).GetTypeInfo().Assembly);
/// <summary>
/// Argument cannot be null or empty.
/// </summary>
internal static string Common_NullOrEmpty
{
get { return GetString("Common_NullOrEmpty"); }
}
/// <summary>
/// Argument cannot be null or empty.
/// </summary>
internal static string FormatCommon_NullOrEmpty()
{
return GetString("Common_NullOrEmpty");
}
/// <summary>
/// The master key is too short. It must be at least {0} bytes in length.
/// </summary>
internal static string DataProtectorFactory_MasterKeyTooShort
{
get { return GetString("DataProtectorFactory_MasterKeyTooShort"); }
}
/// <summary>
/// The master key is too short. It must be at least {0} bytes in length.
/// </summary>
internal static string FormatDataProtectorFactory_MasterKeyTooShort(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("DataProtectorFactory_MasterKeyTooShort"), p0);
}
/// <summary>
/// The data to decrypt is invalid.
/// </summary>
internal static string DataProtectorImpl_BadEncryptedData
{
get { return GetString("DataProtectorImpl_BadEncryptedData"); }
}
/// <summary>
/// The data to decrypt is invalid.
/// </summary>
internal static string FormatDataProtectorImpl_BadEncryptedData()
{
return GetString("DataProtectorImpl_BadEncryptedData");
}
/// <summary>
/// Couldn't protect data. Perhaps the user profile isn't loaded?
/// </summary>
internal static string DpapiDataProtectorImpl_ProfileNotLoaded
{
get { return GetString("DpapiDataProtectorImpl_ProfileNotLoaded"); }
}
/// <summary>
/// Couldn't protect data. Perhaps the user profile isn't loaded?
/// </summary>
internal static string FormatDpapiDataProtectorImpl_ProfileNotLoaded()
{
return GetString("DpapiDataProtectorImpl_ProfileNotLoaded");
}
private static string GetString(string name, params string[] formatterNames)
{
var value = _resourceManager.GetString(name);
System.Diagnostics.Debug.Assert(value != null);
if (formatterNames != null)
{
for (var i = 0; i < formatterNames.Length; i++)
{
value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
}
}
return value;
}
}
}

View File

@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Common_NullOrEmpty" xml:space="preserve">
<value>Argument cannot be null or empty.</value>
</data>
<data name="DataProtectorFactory_MasterKeyTooShort" xml:space="preserve">
<value>The master key is too short. It must be at least {0} bytes in length.</value>
</data>

View File

@ -1,90 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.AspNet.Security.DataProtection.Resources {
using System;
using System.Reflection;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Res {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Res() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AspNet.Security.DataProtection.Res", typeof(Res).GetTypeInfo().Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to The master key is too short. It must be at least {0} bytes in length..
/// </summary>
internal static string DataProtectorFactory_MasterKeyTooShort {
get {
return ResourceManager.GetString("DataProtectorFactory_MasterKeyTooShort", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The data to decrypt is invalid..
/// </summary>
internal static string DataProtectorImpl_BadEncryptedData {
get {
return ResourceManager.GetString("DataProtectorImpl_BadEncryptedData", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Couldn&apos;t protect data. Perhaps the user profile isn&apos;t loaded?.
/// </summary>
internal static string DpapiDataProtectorImpl_ProfileNotLoaded {
get {
return ResourceManager.GetString("DpapiDataProtectorImpl_ProfileNotLoaded", resourceCulture);
}
}
}
}