public UnixSocketEnvironment(ScriptingLanguage language, UnixSocketFuzzLocation fuzzLocation) : base(language) { _fuzzLocation = fuzzLocation; _extraImports.Add ("Fuzzer.Scripting.Environments"); ParameterInfo fuzzLocationParameterInfo = new ParameterInfo ("fuzzLocation", typeof(UnixSocketFuzzLocation)); base.GlobalParameters.Add (fuzzLocationParameterInfo); base.SetParameter (fuzzLocationParameterInfo, fuzzLocation); MethodInfo hookTypeGetterInfo = new MethodInfo ("HookType", typeof(UnixSocketHookType)); base.GlobalMethods.Add (hookTypeGetterInfo); base.SetMethod (hookTypeGetterInfo, new GetHookTypeDelegate (GetHookType)); }
public TestEnvironment(ScriptingLanguage language, TextWriter strWriter) : base(language) { _writer = strWriter; MethodInfo fooMethodInfo = new MethodInfo("Foo", null, new ParameterInfo("text", typeof(string))); MethodInfo barMethodInfo = new MethodInfo("Bar", typeof(string)); base.GlobalMethods.Add(fooMethodInfo); base.SetMethod(fooMethodInfo, new Action<string>(FooMethod)); base.GlobalMethods.Add(barMethodInfo); base.SetMethod(barMethodInfo, new BarMethodDelegate(BarMethod)); ParameterInfo writerParameterInfo = new ParameterInfo("Writer", typeof(TextWriter)); base.GlobalParameters.Add(writerParameterInfo); base.SetParameter(writerParameterInfo, _writer); }
public ScriptedDataGeneratorEnvironment( ScriptingLanguage language, Action<byte[]> setDataCallback, IDictionary<string, string> config) : base(language) { _extraImports.Add ("Iaik.Utils"); _setDataCallback = setDataCallback; foreach (KeyValuePair<string, string> kvPair in config) { if (kvPair.Key.StartsWith ("scriptval_")) _scriptValues.Add (kvPair.Key, kvPair.Value); } MethodInfo setDataMethodInfo = new MethodInfo ("SetData", null, new ParameterInfo ("data", typeof(byte[]))); GlobalMethods.Add (setDataMethodInfo); SetMethod (setDataMethodInfo, _setDataCallback); MethodInfo valueIsSetMethodInfo = new MethodInfo ("IsValueSet", typeof(bool), new ParameterInfo ("name", typeof(string))); GlobalMethods.Add (valueIsSetMethodInfo); SetMethod (valueIsSetMethodInfo, new ValueIsSetDelegate (ValueIsSet)); MethodInfo getValueMethodInfo = new MethodInfo ("GetValue", typeof(object), new ParameterInfo ("name", typeof(string))); GlobalMethods.Add (getValueMethodInfo); SetMethod (getValueMethodInfo, new GetValueDelegate (GetValue)); MethodInfo setValueMethodInfo = new MethodInfo ("SetValue", null, new ParameterInfo ("name", typeof(string)), new ParameterInfo ("value", typeof(object))); GlobalMethods.Add (setValueMethodInfo); SetMethod (setValueMethodInfo, new SetValueDelegate (SetValue)); }