add version 0.0.1

This commit is contained in:
2023-02-26 19:03:30 +01:00
parent cedb0bda76
commit 9da07371e9
39 changed files with 2226 additions and 0 deletions

View File

@@ -0,0 +1,125 @@
using ResourceString.Net.Contract;
using System;
using System.Globalization;
using System.Resources;
using System.Threading;
namespace ResourceString.Net.Logic.Properties
{
internal static class Resources
{
#region ResourceManager
private static readonly Type _Type = typeof(Resources);
private static readonly Lazy<ResourceManager> _ResourceManager = new Lazy<ResourceManager>(
() => new ResourceManager(_Type.FullName ?? string.Empty, _Type.Assembly),
LazyThreadSafetyMode.PublicationOnly
);
public static ResourceManager ResourceManager => _ResourceManager.Value;
#endregion // ResourceManager
internal static class ResourceStringMembers
{
private static readonly Lazy<IResourceString> LazyFormat = new Lazy<IResourceString>(
() => new ResourceManagerString("ResourceStringMembers", ResourceManager, CultureInfo.CurrentCulture),
LazyThreadSafetyMode.PublicationOnly
);
public static IResourceString Format => LazyFormat.Value;
public static IResourceString From(IResourceString resourceId, IResourceString resourceManagerPropertyName) => new FormattedResourceString(
Format,
resourceId,
resourceManagerPropertyName
);
}
internal static class ResourceFormatClassMembers
{
private static readonly Lazy<IResourceString> LazyFormat = new Lazy<IResourceString>(
() => new ResourceManagerString("ResourceFormatClassMembers", ResourceManager, CultureInfo.CurrentCulture),
LazyThreadSafetyMode.PublicationOnly
);
public static IResourceString Format => LazyFormat.Value;
public static IResourceString From(IResourceString resourceId, IResourceString resourceManagerPropertyName, IResourceString fromMethodDefinition) => new FormattedResourceString(
Format,
resourceId,
resourceManagerPropertyName,
fromMethodDefinition
);
}
internal static class ResourceFormatClassFromMethod
{
private static readonly Lazy<IResourceString> LazyFormat = new Lazy<IResourceString>(
() => new ResourceManagerString("ResourceFormatClassFromMethod", ResourceManager, CultureInfo.CurrentCulture),
LazyThreadSafetyMode.PublicationOnly
);
public static IResourceString Format => LazyFormat.Value;
public static IResourceString From(IResourceString fromMethodSignature, IResourceString parameterNames) => new FormattedResourceString(
Format,
fromMethodSignature,
parameterNames
);
}
internal static class ResourcesClassTemplate
{
private static readonly Lazy<IResourceString> LazyFormat = new Lazy<IResourceString>(
() => new ResourceManagerString("ResourcesClassTemplate", ResourceManager, CultureInfo.CurrentCulture),
LazyThreadSafetyMode.PublicationOnly
);
public static IResourceString Format => LazyFormat.Value;
public static IResourceString From(IResourceString ns, IResourceString className, IResourceString resourceManagerRegion, IResourceString resourceRegions) => new FormattedResourceString(
Format,
ns,
className,
resourceManagerRegion,
resourceRegions
);
}
internal static class ResourceManagerMemberTemplate
{
private static readonly Lazy<IResourceString> LazyFormat = new Lazy<IResourceString>(
() => new ResourceManagerString("ResourceManagerMemberTemplate", ResourceManager, CultureInfo.CurrentCulture),
LazyThreadSafetyMode.PublicationOnly
);
public static IResourceString Format => LazyFormat.Value;
public static IResourceString From(IResourceString resourceManagerTypeName) => new FormattedResourceString(
Format,
resourceManagerTypeName
);
}
#region DefaultPropertyName_ResourceManager
private static readonly Lazy<IResourceString> LazyDefaultPropertyName_ResourceManager = new Lazy<IResourceString>(
() => new ResourceManagerString("DefaultPropertyName_ResourceManager", ResourceManager, CultureInfo.CurrentCulture),
LazyThreadSafetyMode.PublicationOnly
);
public static IResourceString DefaultPropertyName_ResourceManager => LazyDefaultPropertyName_ResourceManager.Value;
#endregion // DefaultPropertyName_ResourceManager
}
}

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<data name="ResourceStringMembers" xml:space="preserve">
<value>
#region {0}
private static readonly Lazy&lt;IResourceString> Lazy{0} = new Lazy&lt;IResourceString>(
() => new ResourceManagerString("{0}", {1}, CultureInfo.CurrentCulture),
LazyThreadSafetyMode.PublicationOnly
);
public static IResourceString {0} => Lazy{0}.Value;
#endregion // {0}
</value>
<comment>0 = ResourceId, 1 = ResourceManagerPropertyName</comment>
</data>
<data name="ResourceFormatClassMembers" xml:space="preserve">
<value>
internal static class {0}
{{
private static readonly Lazy&lt;IResourceString> LazyFormat = new Lazy&lt;IResourceString>(
() => new ResourceManagerString("{0}", {1}, CultureInfo.CurrentCulture),
LazyThreadSafetyMode.PublicationOnly
);
public static IResourceString Format => LazyFormat.Value;
{2}
}}
</value>
<comment>0 = ResourceId, 1 = ResourceManagerPropertyName, 2 = FromMethodDefinition</comment>
</data>
<data name="ResourceFormatClassFromMethod" xml:space="preserve">
<value>
public static IResourceString From({0}) => new FormattedResourceString(
Format,
{1}
);
</value>
<comment>0 = FromMethodSignature, 1 = ParameterNames</comment>
</data>
<data name="ResourcesClassTemplate" xml:space="preserve">
<value>
using ResourceString.Net.Contract;
using System;
using System.Globalization;
using System.Resources;
using System.Threading;
namespace {0}
{{
internal static class {1}
{{
{2}
{3}
}}
}}
</value>
<comment>0 = ns, 1 = ClassName, 2 = ResourceManagerRegion, 3 = ResourceRegions</comment>
</data>
<data name="ResourceManagerMemberTemplate" xml:space="preserve">
<value>
#region ResourceManager
private static readonly Type _Type = typeof({0});
private static readonly Lazy&lt;ResourceManager> _ResourceManager = new Lazy&lt;ResourceManager>(
() => new ResourceManager(_Type.FullName ?? string.Empty, _Type.Assembly),
LazyThreadSafetyMode.PublicationOnly
);
public static ResourceManager ResourceManager => _ResourceManager.Value;
#endregion // ResourceManager
</value>
<comment>0 = ResourceManagerTypeName</comment>
</data>
<data name="DefaultPropertyName_ResourceManager">
<value>ResourceManager</value>
</data>
</root>