- enahcedstringevaluate.zip
- EnahcedStringEvaluate
- EhancedStringEvalute.sln
- EhancedStringEvalute.suo
- EnhancedStringEvaluate
- EvaluateTest
- bin
- Debug
- EnhancedStringEvaluate.dll
- EnhancedStringEvaluate.pdb
- EvaluateSampleTest.dll
- EvaluateSampleTest.pdb
- EvaluateTest.dll
- EvaluateTest.pdb
- TestEvaluation.exe
- TestEvaluation.pdb
- EnhancedStringEvaluateTest.cs
- EvaluateSampleTest.csproj
- EvaluateSampleTest.csproj.vs10x
- EvaluateTest.csproj.vs10x
- Properties
- TestEvaluate
- Enhanced String Handling.pdf
- ehancedstringevalute.zip
- EhancedStringEvalute.sln
- EhancedStringEvalute.suo
- EnhancedStringEvaluate
- EvaluateTest
- bin
- Debug
- EnhancedStringEvaluate.dll
- EnhancedStringEvaluate.pdb
- EvaluateSampleTest.dll
- EvaluateSampleTest.pdb
- EvaluateTest.dll
- EvaluateTest.pdb
- TestEvaluation.exe
- TestEvaluation.pdb
- EnhancedStringEvaluateTest.cs
- EvaluateSampleTest.csproj
- EvaluateSampleTest.csproj.vs10x
- EvaluateTest.csproj.vs10x
- obj
- Debug
- Properties
- TestEvaluate
- TestResults
- Avi Farah_TEST-PC 2010-08-21 00_24_34.trx
- Avi Farah_TEST-PC 2010-08-21 00_27_42.trx
- Avi Farah_TEST-PC 2010-09-13 14_37_39.trx
- Avi Farah_TEST-PC 2010-09-13 14_38_10.trx
- Avi Farah_TEST-PC 2010-09-13 14_39_19.trx
- Avi Farah_TEST-PC 2010-09-13 14_39_49.trx
- Avi Farah_TEST-PC 2010-09-13 14_42_18.trx
- Avi Farah_TEST-PC 2010-09-13 14_49_58.trx
- Avi Farah_TEST-PC 2010-09-24 01_46_50.trx
- Avi Farah_TEST-PC 2010-09-24 01_48_16.trx
- Avi Farah_TEST-PC 2010-10-23 20_55_40.trx
- Avi Farah_TEST-PC 2010-11-19 19_40_15.trx
- Avi Farah_TEST-PC 2010-11-19 19_40_15
- In
- Out
|
using System;
using System.Collections.Generic;
using EnhancedStringEvaluate;
using System.Configuration;
using TestEvaluation.ProcessEvaluate;
using System.Text.RegularExpressions;
namespace TestEvaluation
{
class Program
{
static void Main(string[] args)
{
var config = new Dictionary<string,string>();
foreach (var name in ConfigurationManager.AppSettings.AllKeys)
config.Add(name, ConfigurationManager.AppSettings[name]);
// handling
var context = new List<IProcessEvaluate>();
context.Add(new ProcessDate());
context.Add(new ProcessKey(config));
context.Add(new ProcessForeignKey());
context.Add(new ProcessIf());
context.Add(new ProcessLiteral());
IProcessEvaluate evalCurrentDir = new ProcessCurrentDir();
context.Add(evalCurrentDir);
context.Add(new ProcessCurrentTime());
EnhancedStringEval eval = new EnhancedStringEval(context);
try
{
ProcessCurrentDir currDir = (ProcessCurrentDir)evalCurrentDir;
currDir.CurrentDir = @"C:\Directory 1";
string key = "Flat";
string test = eval.EvaluateString(config[key]);
Console.WriteLine("{0} (orig: {1}): {2}", key, ConfigurationManager.AppSettings[key], test);
key = "Static flat";
test = eval.EvaluateString(config[key]);
Console.WriteLine("{0} (orig: {1}): {2}", key, ConfigurationManager.AppSettings[key], test);
key = "Static date";
test = eval.EvaluateString(config[key]);
Console.WriteLine("{0} (orig: {1}): {2}", key, ConfigurationManager.AppSettings[key], test);
key = "Dynamic current directory";
test = eval.EvaluateString(config[key]);
Console.WriteLine("{0} (orig: {1}): {2}", key, ConfigurationManager.AppSettings[key], test);
key = "temp";
test = eval.EvaluateString(config[key]);
Console.WriteLine("{0} (orig: {1}): {2}", key, ConfigurationManager.AppSettings[key], test);
key = "Dynamic current path";
test = eval.EvaluateString(config[key]);
Console.WriteLine("{0} (orig: {1}): {2}", key, ConfigurationManager.AppSettings[key], test);
key = "Stamp";
test = eval.EvaluateString(config[key]);
Console.WriteLine("{0} (orig: {1}): {2}", key, ConfigurationManager.AppSettings[key], test);
key = "Stamp2";
test = eval.EvaluateString(config[key]);
Console.WriteLine("{0} (orig: {1}): {2}", key, ConfigurationManager.AppSettings[key], test);
key = "Stamp3";
test = eval.EvaluateString(config[key]);
Console.WriteLine("{0} (orig: {1}): {2}", key, ConfigurationManager.AppSettings[key], test);
}
catch (EnhancedStringException ex1)
{
string msg = ex1.Message;
int counter = 1;
for (Exception iEx = ex1.InnerException; iEx != null; iEx = iEx.InnerException)
msg += string.Format("{0}\t{1}.\t{2}", Environment.NewLine, counter++, iEx.Message);
Console.WriteLine("ID: \"{0}\", {1}, {2}", ex1.Identifier, ex1.Element, msg);
}
Console.ReadKey();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.