public void Initialize(IExecutable executableObject, SetupData setupData, XmlNode setupNode) { _setupNode = setupNode; InitNodes(); InitPorts(); }
public ExecutePlanNode(IExecutable statement) { if (statement == null) throw new ArgumentNullException("statement"); Statement = statement; }
public static void AddCallback(ICoreBaseObject _instance, string group, IExecutable callback) { if (_instance.Callbacks [group] == null) _instance.Callbacks [group] = new List<IExecutable> (); _instance.Callbacks [group].Add (callback); }
public void Dispose() { ReleaseAsynchronousEngine(); ReleaseSynchronousEngine(); Object = null; GC.SuppressFinalize(this); }
public void Initialize(IExecutable executableObject, SetupData setupData, XmlNode setupNode) { this.m_setupData = setupData; this.m_setupNode = setupNode; this.m_portAddress = this.m_setupData.GetInteger(this.m_setupNode, "port", 0); this.m_port = new PortMapping(this.m_portAddress); }
public void SetUp() { _mockExecutable = MockRepository.GenerateStub<IExecutable>(); _subject = new MSTestRunner(_mockExecutable); _dummyData = "testData"; _dummyFile = new FluentFs.Core.File("dummy"); }
public VixenPlusRoadie(IExecutable iExecutable = null, bool pluginsOnly = false) { InitializeComponent(); Text = Vendor.ProductName + " - " + Vendor.ModuleManager; Icon = Resources.VixenPlus; MinimumSize = Size; _suppressErrors = Preference2.GetInstance().GetBoolean("SilenceProfileErrors"); _isPluginsOnly = pluginsOnly; if (!_isPluginsOnly && null != iExecutable && string.IsNullOrEmpty(iExecutable.Name)) { AddProfile((Profile) iExecutable); } InitializeControls(); if (_isPluginsOnly) { tcProfile.TabPages.RemoveByKey(TabChannels); _contextProfile = iExecutable; gbProfiles.Visible = false; } if (null != iExecutable && !_isPluginsOnly) { SetProfileIndex(iExecutable.Name); } else { cbProfiles.SelectedIndex = 0; } }
public void SetUp() { _mockFileHelper = MockRepository.GenerateStub<IFileSystemHelper>(); _mockExe = MockRepository.GenerateStub<IExecutable>(); _subject = new NuGetPublisher(_mockFileHelper, _mockExe); _nuGetOptionals = _subject.DeployFolder(new Directory("somedir")).ProjectId("FluentBuild").Version("1.2.3.4").Description("Project 1").Authors("author1").ApiKey("123"); }
internal NuGetPublisher(IFileSystemHelper fileSystemHelper, IExecutable executable) { _fileSystemHelper = fileSystemHelper; _executable = executable; _references = new List<string>(); _frameworkAssemblies = new List<FrameworkAssembly>(); _depenencyGroups = new List<DependencyGroup>(); }
public void BeforeTest() { SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); this.nedisQueue = new NedisQueue(); this.executable = MockRepository.GenerateMock<IExecutable>(); this.nedisQueue.Clear("to_index"); }
public void AddFunction(string name, IExecutable exe, params string[] parameters) { List<string> pr; pr = new List<string>(); foreach (string i in parameters) pr.Add(i); _symbols.Add(name, new FunctionBLock(pr, exe)); }
public void Initialize(IExecutable executableObject, SetupData setupData, XmlNode setupNode) { this.m_setupData = setupData; this.m_setupNode = setupNode; this.SetPort(); byte[] buffer = new byte[3]; buffer[0] = 0xff; this.m_packet = buffer; this.m_shadow = new byte[executableObject.Channels.Count]; }
public void Initialize(IExecutable executableObject, SetupData setupData, XmlNode setupNode, ITickSource timer) { this.m_executable = executableObject; this.m_timer = timer; this.m_setupData = setupData; this.m_setupNode = setupNode; this.m_portAddress = (ushort) this.m_setupData.GetInteger(this.m_setupNode, "address", 0x378); this.m_useWithScript = this.m_setupData.GetBoolean(this.m_setupNode, "useWithScript", false); executableObject.UserData = this.m_frames; }
public void Initialize(IExecutable executableObject, SetupData setupData, XmlNode setupNode) { _channels.Clear(); _channels.AddRange(executableObject.FullChannels); _setupNode = setupNode; if (_setupNode.SelectSingleNode("Settings") == null) { Xml.GetNodeAlways(_setupNode, "Settings"); } }
public void Initialize(IExecutable executableObject, SetupData setupData, XmlNode setupNode) { this.m_dataNode = setupNode; if (this.m_hardware == null) { this.m_hardware = new EZ_8(); } string innerText = Xml.GetNodeAlways(this.m_dataNode, "Port").InnerText; this.m_hardware.PortName = (innerText.Length != 0) ? innerText : null; }
public void Initialize(IExecutable executableObject, SetupData setupData, XmlNode setupNode) { _channels.Clear(); _channels.AddRange(executableObject.FullChannels); _setupData = setupData; _setupNode = setupNode; if (_setupNode.Attributes != null) { _startChannel = Convert.ToInt32(_setupNode.Attributes["from"].Value) - 1; } setupData.GetBytes(_setupNode, "BackgroundImage", new byte[0]); }
public void Initialize(IExecutable executableObject, SetupData setupData, XmlNode setupNode) { this.m_setupData = setupData; this.m_setupNode = setupNode; this.m_channelCount = executableObject.Channels.Count; this.m_deviceStarts[0] = setupData.GetInteger(setupNode, "Device0", 0); this.m_deviceStarts[1] = setupData.GetInteger(setupNode, "Device1", 8); this.m_deviceStarts[2] = setupData.GetInteger(setupNode, "Device2", 0x10); this.m_deviceStarts[3] = setupData.GetInteger(setupNode, "Device3", 24); this.m_offset = int.Parse(this.m_setupNode.Attributes["from"].Value) - 1; }
public static void Handle(Exception exception, IExecutable executable) { if (executable.HandlesException(exception)) { ((dynamic)executable).HandleException((dynamic)exception); } else { HandleUnknownExceptions(); } }
public IExecution Get(IExecutable executable) { if (executable is IEtl) { var factory = new EtlRunnerFactory(); var instance = factory.Get(executable as IEtl); return instance; } else throw new ArgumentException(); }
public void Initialize(IExecutable executableObject, SetupData setupData, XmlNode setupNode) { this.m_setupData = setupData; this.m_setupNode = setupNode; this.m_filePath = Xml.GetNodeAlways(this.m_setupNode, "LastFilePath").InnerText; if (this.m_filePath == string.Empty) { this.m_filePath = Path.GetTempFileName(); Xml.GetNodeAlways(this.m_setupNode, "LastFilePath").InnerText = this.m_filePath; } }
public FunctionScript(object item) { if (item is FunctionInstance) _executable = new FuncExe(item as FunctionInstance); else { _executable = new CompExe(new CompiledMethod(Program._engine, item.ToString())); #if(DEBUG) Console.WriteLine("Compiled Script: \"{0}\"", item.ToString()); #endif } }
public void Execute_ShouldCreateBehaviorContextForBehaviors(IExecutable<ICustomExtension> testee) { var first = new Mock<IBehavior<ICustomExtension>>(); var second = new Mock<IBehavior<ICustomExtension>>(); testee.Add(first.Object); testee.Add(second.Object); testee.Execute(Enumerable.Empty<ICustomExtension>(), this.executableContext.Object); this.executableContext.Verify(e => e.CreateBehaviorContext(first.Object)); this.executableContext.Verify(e => e.CreateBehaviorContext(second.Object)); }
public void Execute(IExecutable executable) { bool lockQueryCache = session.Factory.Settings.IsQueryCacheEnabled; if (executable.HasAfterTransactionCompletion() || lockQueryCache) { executions.Add(executable); } if (lockQueryCache) { session.Factory.UpdateTimestampsCache.PreInvalidate(executable.PropertySpaces); } executable.Execute(); }
public void Extensions_Should_ReturnEntityFrameworkExecutable_When_Queryable() { // arrange // act IExecutable <Author> executable = _context .Authors .AsQueryable() .AsEntityFrameworkExecutable(); // assert Assert.IsType <EntityFrameworkExecutable <Author> >(executable); executable.Print().MatchSnapshot(); }
public RouterContext(byte[] engineBuffer, SetupData pluginData, IExecutable executableObject) { EngineBuffer = engineBuffer; PluginData = pluginData; ExecutableObject = executableObject; OutputPluginList = new List<MappedOutputPlugIn>(); foreach (var item in from XmlNode node in PluginData.GetAllPluginData(SetupData.PluginType.Output, true) where node.Attributes != null select new MappedOutputPlugIn(OutputPlugins.FindPlugin(node.Attributes["name"].Value, true), Convert.ToInt32(node.Attributes["from"].Value), Convert.ToInt32(node.Attributes["to"].Value), node)) { OutputPluginList.Add(item); } }
public void Execute_ShouldExecuteBehavior(IExecutable<ICustomExtension> testee) { var first = new Mock<IBehavior<ICustomExtension>>(); var second = new Mock<IBehavior<ICustomExtension>>(); var extensions = Enumerable.Empty<ICustomExtension>(); testee.Add(first.Object); testee.Add(second.Object); testee.Execute(extensions, this.executableContext.Object); first.Verify(b => b.Behave(extensions)); second.Verify(b => b.Behave(extensions)); }
public IExecutable InterpretCommand(string[] data, string commandName) { var commandArr = commandName.ToCharArray(); commandArr[0] = char.ToUpper(commandArr[0]); commandName = string.Join("", commandArr); var typeFullName = $"P03_BarraksWars.Core.Commands.{commandName}"; var commandType = Type.GetType(typeFullName); IExecutable command = (IExecutable)Activator.CreateInstance(commandType, new object[] { data, repository, unitFactory }); return(command); }
private IExecutable ParseCommand(string commandName, string[] commandArgs) { object[] parametersData = { commandArgs }; Type commandType = Assembly.GetExecutingAssembly().GetTypes() .First(t => t.Name.ToLower().Contains(commandName.ToLower())); IExecutable command = (IExecutable)Activator.CreateInstance(commandType, parametersData); return(command); }
public void Execute(IExecutable target) { if (target == null) { throw new ArgumentNullException("target"); } using (new TimeTracer()) { Output.WriteLine(StartLogMessage); target.Execute(); Output.WriteLine(EndLogMessage); } }
public ChannelsTab(IExecutable iExecutable, VixenPlusRoadie parent) { _internalUpdate = true; InitializeComponent(); _parentControl = parent; _contextProfile = iExecutable as Profile; _controlPanelSzie = new Size(Width - dgvChannels.Width, Height - dgvChannels.Height); ShowPanel(pChannels); SetParentText("Channels"); InitializeChannels(); _internalUpdate = false; }
protected override ValueTask <Connection> SliceAsync( IResolverContext context, object source, CursorPagingArguments arguments) { CancellationToken ct = context.RequestAborted; return(source switch { IQueryable <TEntity> q => ResolveAsync(q, arguments, ct), IEnumerable <TEntity> e => ResolveAsync(e.AsQueryable(), arguments, ct), IExecutable <TEntity> ex => SliceAsync(context, ex.Source, arguments), _ => throw new GraphQLException("Cannot handle the specified data source.") });
public void Initialize(IExecutable executableObject, SetupData setupData, XmlNode setupNode) { if ((executableObject.Channels.Count % 8) != 0) { this.m_packet = new byte[((executableObject.Channels.Count / 8) + 1) * 8]; } else { this.m_packet = new byte[executableObject.Channels.Count]; } this.m_setupData = setupData; this.m_setupNode = setupNode; this.SetPort(); }
public void InjectDependencies(IExecutable command) { var defaultAttributeType = typeof(Inject); var fieldsForInjection = command.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic) .Where(x => x.GetCustomAttributes().Any(z => z.GetType() == defaultAttributeType)); var fieldsToInject = this.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic); foreach (var fieldInfo in fieldsForInjection) { fieldInfo.SetValue(command, fieldsToInject.First(x => x.FieldType == fieldInfo.FieldType).GetValue(this)); } }
public void Run(string[] args) { Type type = FactoriesUtility.GetType(args[0] + "Command"); if (!typeof(IExecutable).IsAssignableFrom(type)) { throw new ArgumentException(); } IExecutable exec = (IExecutable)Activator.CreateInstance(type, new object[] { weapons }); InjectCustomFields(exec); exec.Execute(args.Skip(1).ToArray()); }
public static IEnumerable <string> GetOutputLines( this IExecutable executable, ArgumentString arguments = default, byte[] input = null, Encoding outputEncoding = null, bool stripAnsiEscapeCodes = true) { // TODO make this method async, maybe via IAsyncEnumerable<...>? if (outputEncoding == null) { outputEncoding = _defaultOutputEncoding.Value; } using (var process = executable.Start(arguments, createWindow: false, redirectInput: input != null, redirectOutput: true, outputEncoding)) { if (input != null) { process.StandardInput.BaseStream.Write(input, 0, input.Length); process.StandardInput.Close(); } while (true) { var line = process.StandardOutput.ReadLine(); if (line == null) { break; } yield return(CleanString(stripAnsiEscapeCodes, line)); } while (true) { var line = process.StandardError.ReadLine(); if (line == null) { break; } yield return(CleanString(stripAnsiEscapeCodes, line)); } process.WaitForExit(); } }
public static void VerifyPlugIns(IExecutable _object) { var allPluginData = _object.PlugInData.GetAllPluginData(SetupData.PluginType.Output); if (allPluginData.Count == 0) { return; } var builder = new StringBuilder(); var plugins = new StringBuilder(); foreach (XmlNode node in allPluginData) { if (node.Attributes == null) { continue; } var pluginName = node.Attributes["name"].Value; if (FindPlugin(pluginName) != null) { continue; } if (node.OwnerDocument != null && node.OwnerDocument.DocumentElement != null) { var targetDoc = Xml.CreateXmlDocument(node.OwnerDocument.DocumentElement.Name); Xml.CloneNode(targetDoc, node, true); Host.GetUniqueKey(); var str = string.Format( "{0}.{1}.{2}.{3}.vda", _object.Name, node.Attributes["name"].Value, DateTime.Today.ToString("MMddyyyy"), DateTime.Now.ToString("HHmmssfff")); targetDoc.Save(Path.Combine(Paths.ImportExportPath, str)); builder.Append(str + "\n"); plugins.Append(pluginName + "\n"); } _object.PlugInData.RemovePlugInData(node.Attributes["id"].Value); } if (builder.Length == 0) { return; } var msg = string.Format("Output plugins used by this {1} were missing or have not been implemented by {2}.\n\n" + "The following exports were created containing the data for those missing plugins:\n\n" + "{0}\nThe data has been removed from the {1}, but it has not been saved.\n\n" + "NOTE: You may need to edit your profile(s) and remove the\n\n{3}\nplugin(s) so that you don't continue to see this message", builder, (_object is EventSequence) ? "sequence" : "program", Vendor.ProductName, plugins); MessageBox.Show(msg, Vendor.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
private void AddExecutableToRunningList(IExecutable executable) { if (executable == null || _liveExecutables.ContainsKey(executable.Id)) { return; } LogService.Log(LogType.System, LogMessageType.Debug, GetType().Name, string.Format(CultureInfo.InvariantCulture, "Adding IExecutable '{0}' to the running list.", executable.Name)); // Stop listening to the machine's started event. executable.Started -= HandleExecutableStarted; // Hold a reference until the machine is completed. _liveExecutables.TryAdd(executable.Id, executable); }
public WhileStatement( IValueGetter continueExpression, IExecutable loopBody, KeywordToken keywordToken) { if (continueExpression.GetValueType() != typeof(bool)) { throw new ScriptParsingException( source: keywordToken, message: $"ContinueExpression of {keywordToken} statement is not a boolean value: type {continueExpression.GetValueType().Name}"); } this.continueExpression = continueExpression; this.loopBody = loopBody; }
public IExecutable InterpretCommand(string[] data, string commandName) { string fullCommandName = char.ToUpper(commandName[0]) + commandName.Substring(1) + CommandClassSuffix; Type commandNameType = Assembly .GetExecutingAssembly() .GetTypes() .FirstOrDefault(t => t.Name == fullCommandName); IExecutable command = (Command)Activator.CreateInstance(commandNameType, new object[] { data }); this.InjectDependencies(command); return(command); }
private IExecutable GetCommand(string[] data, string commandName) { Type commandType = GetTypesOfCommands(commandName); object[] parameters = new object[] { data }; IExecutable command = (Command)Activator.CreateInstance(commandType, parameters); FieldInfo[] commandFieldInfos = commandType.GetFields(BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo[] engineFieldInfos = typeof(Engine).GetFields(BindingFlags.Instance | BindingFlags.NonPublic); SetFields(command, commandFieldInfos, engineFieldInfos); return(command); }
public void InterpretCommand(string input) { string[] data = input.Split(' '); string commandName = data[0]; try { IExecutable command = this.ParseCommand(input, commandName, data); command.Execute(); } catch (InvalidCommandException ex) { OutputWriter.DisplayException(InvalidCommandException.InvalidCommand + ex.Message); } }
public void Initialize(IExecutable executableObject, SetupData setupData, XmlNode setupNode) { this.m_setupData = setupData; this.m_setupNode = setupNode; if (this.m_serialPort == null) { this.SetPort(); } this.m_useRamps = false; if (executableObject is EventSequence) { this.m_eventPeriod = ((EventSequence)executableObject).EventPeriod; this.m_useRamps = this.m_setupData.GetBoolean(this.m_setupNode, "Ramps", false); } }
public void Run() { while (true) { string line = this.reader.ReadLine(); if (line == "END") { break; } IExecutable cmd = this.cmdFactory.GetCommand(this.db, line, this.output); cmd.Execute(); } }
public ExecutorTest() { this.firstExecutable = A.Fake <IExecutable <IExtension> >(); this.secondExecutable = A.Fake <IExecutable <IExtension> >(); this.executionContext = A.Fake <IExecutionContext>(); this.executables = new List <IExecutable <IExtension> > { this.firstExecutable, this.secondExecutable }; this.syntax = A.Fake <ISyntax <IExtension> >(); this.extensions = new List <IExtension> { A.Fake <IExtension>(), }; }
public void Build() { if (!this.IsValid) { return; } IExecutable startupProject = this.solution.StartupProject; if (startupProject == null || !startupProject.IsExecuting) { this.solution.Save(false); IProjectBuildContext projectBuildContext = this.solution.ProjectBuildContext; this.projectManager.BuildManager.Build(projectBuildContext, startupProject, false); } }
private void RegisterCleanupActions(IExecutable executable) { if (executable is IAsyncExecutable asyncExecutable) { RegisterProcess(asyncExecutable.BeforeTransactionCompletionProcess); RegisterProcess(asyncExecutable.AfterTransactionCompletionProcess); } else { #pragma warning disable 618,619 RegisterProcess(executable.BeforeTransactionCompletionProcess); RegisterProcess(executable.AfterTransactionCompletionProcess); #pragma warning restore 618,619 } }
public void InterpretCommand(string input) { string[] data = input.Split(' '); string commandName = data[0].ToLower(); try { IExecutable command = this.ParseCommand(input, data, commandName); command.Execute(); } catch (Exception e) { OutputWriter.DisplayException(e.Message); } }
/// <summary> /// 実行します。 /// </summary> /// <param name="target">実行可能なもの</param> public void Execute(IExecutable target) { if (target == null) { throw new ArgumentNullException(nameof(target)); } using (new TimeTracer()) { Output.WriteLine($"[EXAMPLE] {target.GetType().Name}"); Output.WriteLine(this.StartLogMessage); target.Execute(); Output.WriteLine(this.EndLogMessage); } }
public void LoadProgram(IExecutable Program) { if (Disposed) { throw new ObjectDisposedException(nameof(Process)); } Device.Log.PrintInfo(LogClass.Loader, $"Image base at 0x{ImageBase:x16}."); Executable Executable = new Executable(Program, MemoryManager, Memory, ImageBase); Executables.Add(Executable); ImageBase = IntUtils.AlignUp(Executable.ImageEnd, KMemoryManager.PageSize); }
public long LoadProgram(IExecutable Program, long ExecutableBase) { if (Disposed) { throw new ObjectDisposedException(nameof(Process)); } Logger.PrintInfo(LogClass.Loader, $"Image base at 0x{ExecutableBase:x16}."); Executable Executable = new Executable(Program, MemoryManager, Memory, ExecutableBase); Executables.Add(Executable); return(Executable.ImageEnd); }
public void LoadProgram(IExecutable Program) { if (Disposed) { throw new ObjectDisposedException(nameof(Process)); } Logging.Info(LogClass.Loader, $"Image base at 0x{ImageBase:x16}."); Executable Executable = new Executable(Program, Memory, ImageBase); Executables.Add(Executable); ImageBase = AMemoryHelper.PageRoundUp(Executable.ImageEnd); }
private void InjectDependencies(IExecutable command) { BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic; FieldInfo[] commandFields = command.GetType().GetFields(flags).Where(f => f.GetCustomAttribute(typeof(InjectAttribute)) != null).ToArray(); FieldInfo[] interpreterFields = this.GetType().GetFields(flags); foreach (FieldInfo fieldOfCommand in commandFields) { if (interpreterFields.Any(interpreterField => interpreterField.FieldType == fieldOfCommand.FieldType)) { fieldOfCommand.SetValue(command, interpreterFields.First(interpreterField => interpreterField.FieldType == fieldOfCommand.FieldType).GetValue(this)); } } }
public void LoadProgram(string filePath) { Npdm metaData = GetDefaultNpdm(); bool isNro = Path.GetExtension(filePath).ToLower() == ".nro"; using (FileStream input = new FileStream(filePath, FileMode.Open)) { IExecutable staticObject = isNro ? (IExecutable) new NxRelocatableObject(input) : new NxStaticObject(input); ProgramLoader.LoadStaticObjects(this, metaData, new IExecutable[] { staticObject }); } }
private void InnerExecute(IExecutable executable) { try { executable.Execute(); } finally { if (executable.PropertySpaces != null) { executedSpaces.UnionWith(executable.PropertySpaces); } RegisterCleanupActions(executable); } }
public IExecutable InterpretCommand(string[] data, string commandName) { Assembly assembly = Assembly.GetExecutingAssembly(); Type type = assembly.GetTypes() .FirstOrDefault(t => t.Name.ToLower() == commandName + "command"); IExecutable executable = (IExecutable)Activator.CreateInstance(type, new object[] { data, this.repository, this.unitFactory }); return(executable); }
private void GetDependencies(IExecutable instance) { var fields = instance.GetType() .GetFields(BindingFlags.NonPublic | BindingFlags.Instance); foreach (var field in fields) { var value = typeof(Dependencies) .GetFields(BindingFlags.NonPublic | BindingFlags.Instance) .FirstOrDefault(f => f.Name == field.Name) .GetValue(this.dependencies); field.SetValue(instance, value); } }
public IWorkflowBuilder Connect(Pin pin1, IExecutable executable) { if (pin1 == null) throw new ArgumentNullException("pin1"); if (executable == null) throw new ArgumentNullException("executable"); if (!Nodes.Contains(pin1.Node)) { Add(pin1.Node); } if (!Nodes.Contains(executable as WorkflowNode)) { Add(executable as WorkflowNode); } FlowConnections.Add(Tuple.Create(pin1, executable)); return this; }
public void Register(IExecutable operation) { _operations.Add(operation); _numberOfOperations = _operations.Count; // subscribing for ExecutionCompleted event // so we can know that each operation executed operation.ExecutionCompleted += delegate { --_numberOfOperations; if (_numberOfOperations > 0) return; if (ExecutionCompleted != null) ExecutionCompleted(); }; }
public RouterContext CreateContext(byte[] engineBuffer, SetupData pluginData, IExecutable executableObject) { var item = new RouterContext(engineBuffer, pluginData, executableObject); var newSize = Math.Max((_data == null) ? 0 : _data.Length, item.EngineBuffer.Length); if (_data == null) { _data = new byte[newSize]; } else if (_data.Length < newSize) { Array.Resize(ref _data, newSize); } foreach (var outputPlugIn in item.OutputPluginList) { lock (_outputPlugins) { _outputPlugins.Add(outputPlugIn); } } _instances.Add(item); return item; }