mirror of
https://github.com/actions/runner.git
synced 2026-01-10 04:28:20 +08:00
Compare updated template evaluator (#4092)
This commit is contained in:
277
src/Sdk/Expressions/Resources/ExpressionResources.cs
Normal file
277
src/Sdk/Expressions/Resources/ExpressionResources.cs
Normal file
@@ -0,0 +1,277 @@
|
||||
// <auto-generated/>
|
||||
// *** AUTOMATICALLY GENERATED BY GenResourceClass -- DO NOT EDIT!!! ***
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
|
||||
namespace GitHub.Actions.Expressions {
|
||||
|
||||
|
||||
internal static class ExpressionResources
|
||||
{
|
||||
|
||||
|
||||
//********************************************************************************************
|
||||
/// Creates the resource manager instance.
|
||||
//********************************************************************************************
|
||||
static ExpressionResources()
|
||||
{
|
||||
s_resMgr = new ResourceManager("GitHub.Actions.Expressions.ExpressionResources", typeof(ExpressionResources).GetTypeInfo().Assembly);
|
||||
}
|
||||
|
||||
public static ResourceManager Manager
|
||||
{
|
||||
get
|
||||
{
|
||||
return s_resMgr;
|
||||
}
|
||||
}
|
||||
|
||||
//********************************************************************************************
|
||||
/// Returns a localized string given a resource string name.
|
||||
//********************************************************************************************
|
||||
public static String Get(
|
||||
String resourceName)
|
||||
{
|
||||
return s_resMgr.GetString(resourceName, CultureInfo.CurrentUICulture);
|
||||
}
|
||||
|
||||
//********************************************************************************************
|
||||
/// Returns a localized integer given a resource string name.
|
||||
//********************************************************************************************
|
||||
public static int GetInt(
|
||||
String resourceName)
|
||||
{
|
||||
return (int)s_resMgr.GetObject(resourceName, CultureInfo.CurrentUICulture);
|
||||
}
|
||||
|
||||
//********************************************************************************************
|
||||
/// Returns a localized string given a resource string name.
|
||||
//********************************************************************************************
|
||||
public static bool GetBool(
|
||||
String resourceName)
|
||||
{
|
||||
return (bool)s_resMgr.GetObject(resourceName, CultureInfo.CurrentUICulture);
|
||||
}
|
||||
|
||||
|
||||
//********************************************************************************************
|
||||
/// A little helper function to alleviate some typing associated with loading resources and
|
||||
/// formatting the strings. In DEBUG builds, it also asserts that the number of format
|
||||
/// arguments and the length of args match.
|
||||
//********************************************************************************************
|
||||
private static String Format( // The formatted resource string.
|
||||
String resourceName, // The name of the resource.
|
||||
params Object[] args) // Arguments to format.
|
||||
{
|
||||
String resource = Get(resourceName);
|
||||
|
||||
#if DEBUG
|
||||
// Check to make sure that the number of format string arguments matches the number of
|
||||
// arguments passed in.
|
||||
int formatArgCount = 0;
|
||||
bool[] argSeen = new bool[100];
|
||||
for (int i = 0; i < resource.Length; i++)
|
||||
{
|
||||
if (resource[i] == '{')
|
||||
{
|
||||
if (i + 1 < resource.Length &&
|
||||
resource[i + 1] == '{')
|
||||
{
|
||||
i++; // Skip the escaped curly braces.
|
||||
}
|
||||
else
|
||||
{
|
||||
// Move past the curly brace and leading whitespace.
|
||||
i++;
|
||||
while (Char.IsWhiteSpace(resource[i]))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
// Get the argument number.
|
||||
int length = 0;
|
||||
while (i + length < resource.Length && Char.IsDigit(resource[i + length]))
|
||||
{
|
||||
length++;
|
||||
}
|
||||
|
||||
// Record it if it hasn't already been seen.
|
||||
int argNumber = int.Parse(resource.Substring(i, length), CultureInfo.InvariantCulture);
|
||||
if (!argSeen[argNumber])
|
||||
{
|
||||
formatArgCount++; // Count it as a formatting argument.
|
||||
argSeen[argNumber] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Assert(args != null || formatArgCount == 0,
|
||||
String.Format(CultureInfo.InvariantCulture, "The number of format arguments is {0}, but the args parameter is null.", formatArgCount));
|
||||
Debug.Assert(args == null || formatArgCount == args.Length,
|
||||
String.Format(CultureInfo.InvariantCulture, "Coding error using resource \"{0}\": The number of format arguments {1} != number of args {2}",
|
||||
resourceName, formatArgCount, args != null ? args.Length : 0));
|
||||
#endif // DEBUG
|
||||
|
||||
|
||||
if (args == null)
|
||||
{
|
||||
return resource;
|
||||
}
|
||||
|
||||
// If there are any DateTime structs in the arguments, we need to bracket them
|
||||
// to make sure they are within the supported range of the current calendar.
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
// DateTime is a struct, we cannot use the as operator and null check.
|
||||
if (args[i] is DateTime)
|
||||
{
|
||||
DateTime dateTime = (DateTime)args[i];
|
||||
|
||||
// We need to fetch the calendar on each Format call since it may change.
|
||||
// Since we don't have more than one DateTime for resource, do not
|
||||
// bother to cache this for the duration of the for loop.
|
||||
Calendar calendar = DateTimeFormatInfo.CurrentInfo.Calendar;
|
||||
if (dateTime > calendar.MaxSupportedDateTime)
|
||||
{
|
||||
args[i] = calendar.MaxSupportedDateTime;
|
||||
}
|
||||
else if (dateTime < calendar.MinSupportedDateTime)
|
||||
{
|
||||
args[i] = calendar.MinSupportedDateTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return String.Format(CultureInfo.CurrentCulture, resource, args);
|
||||
}
|
||||
|
||||
// According to the documentation for the ResourceManager class, it should be sufficient to
|
||||
// create a single static instance. The following is an excerpt from the 1.1 documentation.
|
||||
// Using the methods of ResourceManager, a caller can access the resources for a particular
|
||||
// culture using the GetObject and GetString methods. By default, these methods return the
|
||||
// resource for the culture determined by the current cultural settings of the thread that made
|
||||
// the call.
|
||||
private static ResourceManager s_resMgr;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum allowed memory size was exceeded while evaluating the following expression: {0}
|
||||
/// </summary>
|
||||
public static String ExceededAllowedMemory(object arg0) { return Format("ExceededAllowedMemory", arg0); }
|
||||
|
||||
/// <summary>
|
||||
/// 0 is replaced with a number.
|
||||
///
|
||||
/// Exceeded max expression depth {0}
|
||||
/// </summary>
|
||||
public static String ExceededMaxExpressionDepth(object arg0) { return Format("ExceededMaxExpressionDepth", arg0); }
|
||||
|
||||
/// <summary>
|
||||
/// 0 is replaced with a number.
|
||||
///
|
||||
/// Exceeded max expression length {0}
|
||||
/// </summary>
|
||||
public static String ExceededMaxExpressionLength(object arg0) { return Format("ExceededMaxExpressionLength", arg0); }
|
||||
|
||||
/// <summary>
|
||||
/// Expected a property name to follow the dereference operator '.'
|
||||
/// </summary>
|
||||
public static String ExpectedPropertyName() { return Get("ExpectedPropertyName"); }
|
||||
|
||||
/// <summary>
|
||||
/// Expected '(' to follow a function
|
||||
/// </summary>
|
||||
public static String ExpectedStartParameter() { return Get("ExpectedStartParameter"); }
|
||||
|
||||
/// <summary>
|
||||
/// The following format string references more arguments than were supplied: {0}
|
||||
/// </summary>
|
||||
public static String InvalidFormatArgIndex(object arg0) { return Format("InvalidFormatArgIndex", arg0); }
|
||||
|
||||
/// <summary>
|
||||
/// The format specifiers '{0}' are not valid for objects of type '{1}'
|
||||
/// </summary>
|
||||
public static String InvalidFormatSpecifiers(object arg0, object arg1) { return Format("InvalidFormatSpecifiers", arg0, arg1); }
|
||||
|
||||
/// <summary>
|
||||
/// The following format string is invalid: {0}
|
||||
/// </summary>
|
||||
public static String InvalidFormatString(object arg0) { return Format("InvalidFormatString", arg0); }
|
||||
|
||||
/// <summary>
|
||||
/// Key not found '{0}'
|
||||
/// </summary>
|
||||
public static String KeyNotFound(object arg0) { return Format("KeyNotFound", arg0); }
|
||||
|
||||
/// <summary>
|
||||
/// 0 is replaced with the error message
|
||||
///
|
||||
/// {0}.
|
||||
/// </summary>
|
||||
public static String ParseErrorWithFwlink(object arg0) { return Format("ParseErrorWithFwlink", arg0); }
|
||||
|
||||
/// <summary>
|
||||
/// 0 is replaced with the parse error message
|
||||
/// 1 is replaced with the token
|
||||
/// 2 is replaced with the character position within the string
|
||||
/// 3 is replaced with the full statement
|
||||
///
|
||||
/// {0}: '{1}'. Located at position {2} within expression: {3}.
|
||||
/// </summary>
|
||||
public static String ParseErrorWithTokenInfo(object arg0, object arg1, object arg2, object arg3) { return Format("ParseErrorWithTokenInfo", arg0, arg1, arg2, arg3); }
|
||||
|
||||
/// <summary>
|
||||
/// 0 is replaced with the from-type.
|
||||
/// 1 is replaced with the to-type.
|
||||
/// 2 is replaced with the value.
|
||||
///
|
||||
/// Unable to convert from {0} to {1}. Value: {2}
|
||||
/// </summary>
|
||||
public static String TypeCastError(object arg0, object arg1, object arg2) { return Format("TypeCastError", arg0, arg1, arg2); }
|
||||
|
||||
/// <summary>
|
||||
/// 0 is replaced with the from-type.
|
||||
/// 1 is replaced with the to-type.
|
||||
///
|
||||
/// Unable to convert from {0} to {1}.
|
||||
/// </summary>
|
||||
public static String TypeCastErrorNoValue(object arg0, object arg1) { return Format("TypeCastErrorNoValue", arg0, arg1); }
|
||||
|
||||
/// <summary>
|
||||
/// 0 is replaced with the from-type.
|
||||
/// 1 is replaced with the to-type.
|
||||
/// 2 is replaced with the value.
|
||||
/// 3 is replaced with the error message.
|
||||
///
|
||||
/// Unable to convert from {0} to {1}. Value: {2}. Error: {3}
|
||||
/// </summary>
|
||||
public static String TypeCastErrorWithError(object arg0, object arg1, object arg2, object arg3) { return Format("TypeCastErrorWithError", arg0, arg1, arg2, arg3); }
|
||||
|
||||
/// <summary>
|
||||
/// Unclosed function
|
||||
/// </summary>
|
||||
public static String UnclosedFunction() { return Get("UnclosedFunction"); }
|
||||
|
||||
/// <summary>
|
||||
/// Unclosed indexer
|
||||
/// </summary>
|
||||
public static String UnclosedIndexer() { return Get("UnclosedIndexer"); }
|
||||
|
||||
/// <summary>
|
||||
/// Unexpected symbol
|
||||
/// </summary>
|
||||
public static String UnexpectedSymbol() { return Get("UnexpectedSymbol"); }
|
||||
|
||||
/// <summary>
|
||||
/// Unrecognized value
|
||||
/// </summary>
|
||||
public static String UnrecognizedValue() { return Get("UnrecognizedValue"); }
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace
|
||||
190
src/Sdk/Expressions/Resources/ExpressionResources.resx
Normal file
190
src/Sdk/Expressions/Resources/ExpressionResources.resx
Normal file
@@ -0,0 +1,190 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="ExceededAllowedMemory" xml:space="preserve">
|
||||
<value>The maximum allowed memory size was exceeded while evaluating the following expression: {0}</value>
|
||||
</data>
|
||||
<data name="ExceededMaxExpressionDepth" xml:space="preserve">
|
||||
<value>Exceeded max expression depth {0}</value>
|
||||
<comment>0 is replaced with a number.</comment>
|
||||
</data>
|
||||
<data name="ExceededMaxExpressionLength" xml:space="preserve">
|
||||
<value>Exceeded max expression length {0}</value>
|
||||
<comment>0 is replaced with a number.</comment>
|
||||
</data>
|
||||
<data name="ExpectedPropertyName" xml:space="preserve">
|
||||
<value>Expected a property name to follow the dereference operator '.'</value>
|
||||
</data>
|
||||
<data name="ExpectedStartParameter" xml:space="preserve">
|
||||
<value>Expected '(' to follow a function</value>
|
||||
</data>
|
||||
<data name="InvalidFormatArgIndex" xml:space="preserve">
|
||||
<value>The following format string references more arguments than were supplied: {0}</value>
|
||||
</data>
|
||||
<data name="InvalidFormatSpecifiers" xml:space="preserve">
|
||||
<value>The format specifiers '{0}' are not valid for objects of type '{1}'</value>
|
||||
</data>
|
||||
<data name="InvalidFormatString" xml:space="preserve">
|
||||
<value>The following format string is invalid: {0}</value>
|
||||
</data>
|
||||
<data name="KeyNotFound" xml:space="preserve">
|
||||
<value>Key not found '{0}'</value>
|
||||
</data>
|
||||
<data name="ParseErrorWithFwlink" xml:space="preserve">
|
||||
<value>{0}.</value>
|
||||
<comment>0 is replaced with the error message</comment>
|
||||
</data>
|
||||
<data name="ParseErrorWithTokenInfo" xml:space="preserve">
|
||||
<value>{0}: '{1}'. Located at position {2} within expression: {3}.</value>
|
||||
<comment>0 is replaced with the parse error message
|
||||
1 is replaced with the token
|
||||
2 is replaced with the character position within the string
|
||||
3 is replaced with the full statement</comment>
|
||||
</data>
|
||||
<data name="TypeCastError" xml:space="preserve">
|
||||
<value>Unable to convert from {0} to {1}. Value: {2}</value>
|
||||
<comment>0 is replaced with the from-type.
|
||||
1 is replaced with the to-type.
|
||||
2 is replaced with the value.</comment>
|
||||
</data>
|
||||
<data name="TypeCastErrorNoValue" xml:space="preserve">
|
||||
<value>Unable to convert from {0} to {1}.</value>
|
||||
<comment>0 is replaced with the from-type.
|
||||
1 is replaced with the to-type.</comment>
|
||||
</data>
|
||||
<data name="TypeCastErrorWithError" xml:space="preserve">
|
||||
<value>Unable to convert from {0} to {1}. Value: {2}. Error: {3}</value>
|
||||
<comment>0 is replaced with the from-type.
|
||||
1 is replaced with the to-type.
|
||||
2 is replaced with the value.
|
||||
3 is replaced with the error message.</comment>
|
||||
</data>
|
||||
<data name="UnclosedFunction" xml:space="preserve">
|
||||
<value>Unclosed function</value>
|
||||
</data>
|
||||
<data name="UnclosedIndexer" xml:space="preserve">
|
||||
<value>Unclosed indexer</value>
|
||||
</data>
|
||||
<data name="UnexpectedSymbol" xml:space="preserve">
|
||||
<value>Unexpected symbol</value>
|
||||
</data>
|
||||
<data name="UnrecognizedValue" xml:space="preserve">
|
||||
<value>Unrecognized value</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user