本文整理汇总了C#中IValue.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IValue.ToString方法的具体用法?C# IValue.ToString怎么用?C# IValue.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IValue
的用法示例。
在下文中一共展示了IValue.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecryptDataAES
public static ByteValue DecryptDataAES(IValue cipherText, byte[] Key, byte[] IV)
{
// Check arguments.
if (cipherText == null || cipherText.ToString().Length <= 0)
throw new ArgumentNullException("cipherText");
if (Key == null || Key.Length <= 0)
throw new ArgumentNullException("Key");
if (IV == null || IV.Length <= 0)
throw new ArgumentNullException("Key");
// Declare the string used to hold
// the decrypted text.
string plaintext = null;
// Create an AesManaged object
// with the specified key and IV.
using (AesManaged aesAlg = new AesManaged())
{
aesAlg.Key = Key;
aesAlg.IV = IV;
// Create a decrytor to perform the stream transform.
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
// Create the streams used for decryption.
using (MemoryStream msDecrypt = new MemoryStream(StreamFactory.GetBytes(cipherText.ToString())))
// using (MemoryStream msDecrypt = new MemoryStream(cipherText.GetBytes()))
{
using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
{
using (StreamReader srDecrypt = new StreamReader(csDecrypt))
{
// Read the decrypted bytes from the decrypting stream
// and place them in a string.
plaintext = srDecrypt.ReadToEnd();
}
}
}
}
return new ByteValue(StreamFactory.GetBytes(plaintext));
}
示例2: StatementRecordPairValues
/// <summary>
/// Save how we are going to go after the statement and generate it.
/// </summary>
/// <param name="mapStorage">We own this variable - we can change its name</param>
/// <param name="indexVar"></param>
/// <param name="indexValue"></param>
public StatementRecordPairValues(IDeclaredParameter mapStorage, IValue indexVar, IValue indexValue)
{
//
// Input checks.
//
if (mapStorage == null)
throw new ArgumentNullException("mapStorage");
if (indexVar == null)
throw new ArgumentNullException("indexVar");
if (indexValue == null)
throw new ArgumentNullException("indexValue");
//
// Save for later
//
this._index = indexVar;
AddSaver(mapStorage, indexValue);
Debug.WriteLine("Emit StatementRecordPairValues: IndexVar {0}, indexValue {1}", indexVar.ToString(), indexValue.ToString());
}
示例3: EncryptDataAES
public static ByteValue EncryptDataAES(IValue plainText, byte[] Key, byte[] IV) {
// Check arguments.
if (plainText == null || plainText.ToString().Length <= 0)
throw new ArgumentNullException("plainText");
if (Key == null || Key.Length <= 0)
throw new ArgumentNullException("Key");
if (IV == null || IV.Length <= 0)
throw new ArgumentNullException("Key");
byte[] encrypted;
// Create an AesManaged object
// with the specified key and IV.
using (AesManaged aesAlg = new AesManaged())
{
aesAlg.Key = Key;
aesAlg.IV = IV;
// Create a decrytor to perform the stream transform.
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
// Create the streams used for encryption.
using (MemoryStream msEncrypt = new MemoryStream())
{
using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
{
using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
{
//Write all data to the stream.
swEncrypt.Write(plainText.ToString());
}
encrypted = msEncrypt.ToArray();
}
}
}
// Return the encrypted bytes from the memory stream.
return new ByteValue(encrypted);
}
示例4: Less
// left < right
public virtual bool Less(IValue left, IValue right)
{
throw new TypeInconsistancyException("Cannot compare " + left.ToString() + " with " + right.ToString());
}
示例5: ProcessValue
/// <summary>
/// Process each token that is to be used.
/// </summary>
/// <param name="value"></param>
/// <returns>The value of the token after evaluation.</returns>
protected override string ProcessValue(IValue value)
{
try
{
IValue converted = value.Evaluate(Element, true);
if (!converted.IsExpression)
return converted.StringValue;
if (value.IsVariableExpression)
return " ";
return converted.ToString();
}
catch
{
return value.ToString();
}
}
示例6: RememberSubExpression
/// <summary>
/// Remember a sub-expression. We will hide a previously made association!
/// </summary>
/// <param name="expr"></param>
/// <param name="r"></param>
public void RememberSubExpression(Expression expr, IValue r)
{
var key = GetSubExpressionKey(expr);
if (key == null)
return;
CurrentRememberedExpressions[key] = r;
Debug.WriteLine("RememberSubExpression: {0} => {1}", key, r.ToString());
}