private void ScheduleCallback() { _isCallbackScheduled = true; var current = _context.StatementContext.SchedulingService.Time; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug( ".scheduleCallback Scheduled new callback for " + " now=" + current + " currentReferencePoint=" + _currentReferencePoint + " spec=" + _factory.ScheduleSpec); } var callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QOutputRateConditionScheduledEval(), i => i.AOutputRateConditionScheduledEval(), () => { _isCallbackScheduled = false; OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); ScheduleCallback(); }) }; var handle = new EPStatementHandleCallback(_context.EpStatementAgentInstanceHandle, callback); var schedulingService = _context.StatementContext.SchedulingService; var nextScheduledTime = ScheduleComputeHelper.ComputeDeltaNextOccurance( _factory.ScheduleSpec, schedulingService.Time, _context.StatementContext.MethodResolutionService.EngineImportService.TimeZone); schedulingService.Add(nextScheduledTime, handle, _scheduleSlot); }
private void ScheduleCallback() { _isCallbackScheduled = true; long current = _agentInstanceContext.StatementContext.SchedulingService.Time; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug( ".scheduleCallback Scheduled new callback for " + " afterMsec=" + 0 + " now=" + current); } ScheduleHandleCallback callback = new ProxyScheduleHandleCallback() { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QOutputRateConditionScheduledEval(), i => i.AOutputRateConditionScheduledEval(), () => { _isCallbackScheduled = false; OutputCallback.Invoke(true, true); ResetBuiltinProperties(); }) }; _scheduleHandle = new EPStatementHandleCallback( _agentInstanceContext.EpStatementAgentInstanceHandle, callback); _agentInstanceContext.StatementContext.SchedulingService.Add(0, _scheduleHandle, _scheduleSlot); _agentInstanceContext.AddTerminationCallback(Stop); // execute assignments ExecuteThenAssignments(); }
private void ContinueOutputProcessing(bool forceUpdate) { var doOutput = !_witnessedFirst; OutputCallback.Invoke(doOutput, forceUpdate); _witnessedFirst = false; }
public override void UpdateOutputCondition(int newDataCount, int oldDataCount) { if (_variableReader != null) { var value = _variableReader.Value; if (value != null) { _eventRate = value.AsLong(); } } _newEventsCount += newDataCount; _oldEventsCount += oldDataCount; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".updateBatchCondition, " + " newEventsCount==" + _newEventsCount + " oldEventsCount==" + _oldEventsCount); } if (IsSatisfied) { if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".UpdateOutputCondition() condition satisfied"); } _newEventsCount = 0; _oldEventsCount = 0; OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); } }
public OutputProcessViewConditionDefault(ResultSetProcessor resultSetProcessor, long?afterConditionTime, int?afterConditionNumberOfEvents, bool afterConditionSatisfied, OutputProcessViewConditionFactory parent, AgentInstanceContext agentInstanceContext) : base(resultSetProcessor, afterConditionTime, afterConditionNumberOfEvents, afterConditionSatisfied) { _parent = parent; OutputCallback outputCallback = GetCallbackToLocal(parent.StreamCount); _outputCondition = parent.OutputConditionFactory.Make(agentInstanceContext, outputCallback); }
public OutputConditionCount( OutputCallback outputCallback, long eventRate, VariableReader variableReader) : base(outputCallback) { this.eventRate = eventRate; this.variableReader = variableReader; }
public void SetUp() { _listener = new SupportUpdateListener(); _callback = new OutputCallback( (doOutput, forceUpdate) => _listener.Update(null, null)); _condition = new OutputConditionNull(_callback); }
public static void PublishFile(string bicepFilePath, string target, OutputCallback writeVerbose = null, OutputCallback writeWarning = null) { if (!FileUtilities.DataStore.FileExists(bicepFilePath)) { throw new AzPSArgumentException(Properties.Resources.InvalidBicepFilePath, "File"); } RunBicepCommand($"bicep publish '{bicepFilePath}' --target '{target}'", MinimalVersionRequirementForBicepPublish, writeVerbose, writeWarning); }
public OutputConditionFirst(OutputCallback outputCallback, AgentInstanceContext agentInstanceContext, OutputConditionFactory innerConditionFactory) : base(outputCallback) { OutputCallback localCallback = CreateCallbackToLocal(); _innerCondition = innerConditionFactory.Make(agentInstanceContext, localCallback); _witnessedFirst = false; }
public TestSetup() { UserDocDir = Environment.GetFolderPath(Environment.SpecialFolder.Personal); UserTestDir = UserDocDir; Console.OutputEncoding = System.Text.Encoding.Unicode; sgx = false; output = this.OutputConsole; // Or change it to somewhere else if you prefer //UserTestDir = String.Format("{0}\\CLI PW Testing", UserDocDir); }
public override void UpdateOutputCondition(int newEventsCount, int oldEventsCount) { if (!_witnessedFirst) { _witnessedFirst = true; const bool doOutput = true; const bool forceUpdate = false; OutputCallback.Invoke(doOutput, forceUpdate); } _innerCondition.UpdateOutputCondition(newEventsCount, oldEventsCount); }
public TestSuite(TestSetup setup_in) { mgr = new PasswordManagerCore(); setup = setup_in; if (setup.getSGXSupport()) { mgr.set_sgx_support(); } output = setup.getOutputCallback(); }
public OutputConditionCrontab(OutputCallback outputCallback, AgentInstanceContext context, OutputConditionCrontabFactory factory, bool isStartConditionOnCreation) : base(outputCallback) { _context = context; _factory = factory; _scheduleSlot = context.StatementContext.ScheduleBucket.AllocateSlot(); if (isStartConditionOnCreation) { UpdateOutputCondition(0, 0); } }
public WFCMapGenerator(string folderName, OutputCallback callback = null) { if (!IOManager.DirectoryExists(folderName)) { throw new InvalidFolderPathException(folderName); Logger.Log(DebugChannel.Warning, "Creating Directory: " + folderName, 10); } _folderName = folderName; sampleTextures = IOManager.GetFiles(folderName, "*.png").ToList(); _callback = callback; }
public OutputCondition Make(AgentInstanceContext agentInstanceContext, OutputCallback outputCallback) { VariableReader variableReader = null; if (VariableMetaData != null) { variableReader = agentInstanceContext.StatementContext.VariableService.GetReader( VariableMetaData.VariableName, agentInstanceContext.AgentInstanceId); } return(new OutputConditionCount(outputCallback, EventRate, variableReader)); }
public Server2Control(TcpClient client, OutputCallback output, DisplayControlDataCallback DisplayControlData) { this.client = client; this.outputCallback = output; this.displayControlDataCallback = DisplayControlData; netStream = client.GetStream(); isExit = false; controldata = new ControlData(); remotedata = new RemoteData(); netStream.BeginRead(controldata.databuffer, 0, controldata.length, ReadCallback, null); outputCallback("初始化"); }
public OutputCondition InstantiateOutputCondition( AgentInstanceContext agentInstanceContext, OutputCallback outputCallback) { var scheduleSpec = ScheduleExpressionUtil.CrontabScheduleBuild( scheduleSpecEvaluators, agentInstanceContext); return new OutputConditionCrontab( outputCallback, agentInstanceContext, isStartConditionOnCreation, scheduleSpec); }
public OutputCondition InstantiateOutputCondition( AgentInstanceContext agentInstanceContext, OutputCallback outputCallback) { VariableReader variableReader = null; if (variable != null) { variableReader = agentInstanceContext.StatementContext.VariableManagementService.GetReader( variable.DeploymentId, variable.MetaData.VariableName, agentInstanceContext.AgentInstanceId); } return new OutputConditionCount(outputCallback, eventRate, variableReader); }
public OutputConditionCrontab( OutputCallback outputCallback, AgentInstanceContext context, bool isStartConditionOnCreation, ScheduleSpec scheduleSpec) : base(outputCallback) { this.context = context; this.scheduleSpec = scheduleSpec; scheduleSlot = context.StatementContext.ScheduleBucket.AllocateSlot(); if (isStartConditionOnCreation) { UpdateOutputCondition(0, 0); } }
public OutputConditionTime( OutputCallback outputCallback, AgentInstanceContext context, OutputConditionTimeFactory outputConditionTimeFactory, bool isStartConditionOnCreation) : base(outputCallback) { this.context = context; this.parent = outputConditionTimeFactory; this.scheduleSlot = context.StatementContext.ScheduleBucket.AllocateSlot(); if (isStartConditionOnCreation) { UpdateOutputCondition(0, 0); } }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { var uiDel = new ThreadStart(() => { var window = new CancelWindow(); var outputCallBack = new OutputCallback(window.RecordOutput); RevitContext.BindOutput(outputCallBack); window.ShowDialog(); }); var t = new Thread(uiDel); t.SetApartmentState(ApartmentState.STA); t.Start(); return(Result.Succeeded); }
public override void UpdateOutputCondition(int newEventsCount, int oldEventsCount) { _totalNewEventsCount += newEventsCount; _totalOldEventsCount += oldEventsCount; _totalNewEventsSum += newEventsCount; _totalOldEventsSum += oldEventsCount; bool isOutput = Evaluate(_parent.WhenExpressionNodeEval); if (isOutput) { ExecuteThenAssignments(); OutputCallback.Invoke(true, true); ResetBuiltinProperties(); } }
public mainForm() { InitializeComponent(); outputCallback = OutputCallbackMethod; AmandaHook.SetOutputCallback(outputCallback); AmandaObj = Amanda.GetInstance(); tbConsole.AppendText(tempOutput.ToString()); tempOutput.Clear(); runButton.Click += new EventHandler(RunCodeHandler); loadButton.Click += (sender, e) => { if (fileManager.SelectedTabTextBox.Text == "") { return; } if (AmandaObj.Load(fileManager.SelectedTabTextBox.Text) == true) { MessageBox.Show("File Loaded"); fileManager.UpdateAutocompleteIdentifiers(AmandaObj.GetIdentifiers()); } // Print if error // tbConsole.AppendText("\n\n"); tbConsole.AppendText(tempOutput.ToString()); tempOutput.Clear(); tbConsole.SelectionStart = tbConsole.TextLength; tbConsole.ScrollToCaret(); }; // fileManager.UpdateAutocompleteIdentifiers(AmandaObj.GetIdentifiers()); bwInterpret.WorkerSupportsCancellation = true; bwInterpret.WorkerReportsProgress = false; bwInterpret.DoWork += new DoWorkEventHandler(bwInterpret_doWork); bwInterpret.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwInterpret_runWorkerCompleted); bwTextToConsole.WorkerSupportsCancellation = true; bwTextToConsole.WorkerReportsProgress = false; bwTextToConsole.DoWork += new DoWorkEventHandler(bwTextToConsole_doWork); bwTextToConsole.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwTextToConsole_runWorkerCompleted); }
public OutputConditionExpression( OutputCallback outputCallback, AgentInstanceContext agentInstanceContext, OutputConditionExpressionFactory parent) : base(outputCallback) { this.agentInstanceContext = agentInstanceContext; this.parent = parent; scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); eventsPerStream = new EventBean[1]; if (parent.BuiltinPropertiesEventType != null) { builtinProperties = new ObjectArrayEventBean( OutputConditionExpressionTypeUtil.OAPrototype, parent.BuiltinPropertiesEventType); lastOutputTimestamp = agentInstanceContext.StatementContext.SchedulingService.Time; } if (parent.Variables != null && parent.Variables.Length > 0) { // if using variables, register a callback on the change of the variable foreach (var variable in parent.Variables) { var theVariableDepId = variable.DeploymentId; var theVariableName = variable.MetaData.VariableName; agentInstanceContext.VariableManagementService.RegisterCallback( theVariableDepId, theVariableName, agentInstanceContext.AgentInstanceId, this); agentInstanceContext.AddTerminationCallback( new ProxyAgentInstanceMgmtCallback { ProcStop = services => { services.AgentInstanceContext.VariableManagementService.UnregisterCallback( theVariableDepId, theVariableName, agentInstanceContext.AgentInstanceId, this); } }); } } if (parent.IsStartConditionOnCreation) { Update(0, 0); } }
public static GameObject CreateWFCPreview(Vector3 position, string folderName, bool attachDebugRenderer = true, OutputCallback outputCallback = null) { //Ground Mesh mesh = MeshLoader.FileToMesh("assets/models/cube_flat.obj"); GameObject obj = new GameObject(position, "WFCPreview"); obj.AddComponent(new WFCMapGenerator(folderName, outputCallback)); if (attachDebugRenderer) { obj.AddComponent(new LitMeshRendererComponent(DefaultFilepaths.DefaultLitShader, mesh, TextureLoader.FileToTexture("assets/textures/TEST.png"), 1)); } obj.Scale = new Vector3(5, 5, 5); return(obj); }
public mainForm() { InitializeComponent(); outputCallback = OutputCallbackMethod; AmandaHook.SetOutputCallback(outputCallback); AmandaObj = Amanda.GetInstance(); tbConsole.AppendText(tempOutput.ToString()); tempOutput.Clear(); runButton.Click += new EventHandler(RunCodeHandler); loadButton.Click += (sender, e) => { if (fileManager.SelectedTabTextBox.Text == "") return; if (AmandaObj.Load(fileManager.SelectedTabTextBox.Text) == true) { MessageBox.Show("File Loaded"); fileManager.UpdateAutocompleteIdentifiers(AmandaObj.GetIdentifiers()); } // Print if error // tbConsole.AppendText("\n\n"); tbConsole.AppendText(tempOutput.ToString()); tempOutput.Clear(); tbConsole.SelectionStart = tbConsole.TextLength; tbConsole.ScrollToCaret(); }; // fileManager.UpdateAutocompleteIdentifiers(AmandaObj.GetIdentifiers()); bwInterpret.WorkerSupportsCancellation = true; bwInterpret.WorkerReportsProgress = false; bwInterpret.DoWork += new DoWorkEventHandler(bwInterpret_doWork); bwInterpret.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwInterpret_runWorkerCompleted); bwTextToConsole.WorkerSupportsCancellation = true; bwTextToConsole.WorkerReportsProgress = false; bwTextToConsole.DoWork += new DoWorkEventHandler(bwTextToConsole_doWork); bwTextToConsole.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwTextToConsole_runWorkerCompleted); }
/// <summary> /// /// </summary> /// <param name="conv_"></param> /// <param name="user"></param> /// <param name="output_"></param> /// <param name="useBufPool">是否使用内存池,如果true,则</param> /// <param name="bufpoolUnitSize">内存池单元尺寸,默认为4K</param> /// <param name="bufpoolSize">内存池总尺寸,默认8MB</param> public KCPLib(uint conv_, object user, OutputCallback output_, bool useNativeBufPool = false) { if (useNativeBufPool) { if (BufferPoolForNative.m_inited == false) { throw new Exception("内存池BufferChunk尚未初始化,请先调用BufferChunk.Init"); } m_BufAlloc = BufAlloc; m_BufFree = BufFree; kcp_native.ikcp_allocator(m_BufAlloc, m_BufFree); } m_useNativeBufpool = useNativeBufPool; //kcp_native.ikcp_allocator(m_BufAlloc, m_BufFree); m_kcp = kcp_native.ikcp_create((int)conv_, IntPtr.Zero); if (m_kcp == IntPtr.Zero) { throw new Exception("初始化KCP失败"); } kcp_native.ikcp_setoutput(m_kcp, output_); }
public OutputConditionExpression( OutputCallback outputCallback, AgentInstanceContext agentInstanceContext, OutputConditionExpressionFactory parent, bool isStartConditionOnCreation) : base(outputCallback) { _agentInstanceContext = agentInstanceContext; _parent = parent; _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); _eventsPerStream = new EventBean[1]; if (parent.BuiltinPropertiesEventType != null) { _builtinProperties = new ObjectArrayEventBean( OutputConditionExpressionTypeUtil.OAPrototype, parent.BuiltinPropertiesEventType); _lastOutputTimestamp = agentInstanceContext.StatementContext.SchedulingService.Time; } if (parent.VariableNames != null) { // if using variables, register a callback on the change of the variable foreach (String variableName in parent.VariableNames) { var theVariableName = variableName; agentInstanceContext.StatementContext.VariableService.RegisterCallback( variableName, agentInstanceContext.AgentInstanceId, Update); agentInstanceContext.AddTerminationCallback( new ProxyStopCallback( () => _agentInstanceContext.StatementContext.VariableService.UnregisterCallback( theVariableName, agentInstanceContext.AgentInstanceId, Update))); } } if (isStartConditionOnCreation) { Update(0, 0); } }
public static string BuildFile(string bicepTemplateFilePath, OutputCallback writeVerbose = null, OutputCallback writeWarning = null) { if (!FileUtilities.DataStore.FileExists(bicepTemplateFilePath)) { throw new AzPSArgumentException(Properties.Resources.InvalidBicepFilePath, "TemplateFile"); } string tempDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(tempDirectory); RunBicepCommand($"bicep build '{bicepTemplateFilePath}' --outdir '{tempDirectory}'", MinimalVersionRequirement, writeVerbose, writeWarning); string buildResultPath = Path.Combine(tempDirectory, Path.GetFileName(bicepTemplateFilePath)).Replace(".bicep", ".json"); if (!FileUtilities.DataStore.FileExists(buildResultPath)) { throw new AzPSApplicationException(string.Format(Properties.Resources.BuildBicepFileToJsonFailed, bicepTemplateFilePath)); } return(buildResultPath); }
private void ScheduleCallback() { _isCallbackScheduled = true; var current = _context.StatementContext.SchedulingService.Time; var delta = _parent.TimePeriod.NonconstEvaluator().DeltaAddWReference(current, _currentReferencePoint.Value, null, true, _context); var deltaTime = delta.Delta; _currentReferencePoint = delta.LastReference; _currentScheduledTime = deltaTime; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".scheduleCallback Scheduled new callback for " + " afterMsec=" + deltaTime + " now=" + current + " currentReferencePoint=" + _currentReferencePoint); } var callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = (extensionServicesContext) => { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QOutputRateConditionScheduledEval(); } _isCallbackScheduled = false; OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); ScheduleCallback(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AOutputRateConditionScheduledEval(); } } }; _handle = new EPStatementHandleCallback(_context.EpStatementAgentInstanceHandle, callback); _context.StatementContext.SchedulingService.Add(deltaTime, _handle, _scheduleSlot); _context.AddTerminationCallback(this); }
private void ScheduleCallback() { _isCallbackScheduled = true; long current = _context.StatementContext.SchedulingService.Time; ExprTimePeriodEvalDeltaResult delta = _parent.TimePeriod.NonconstEvaluator().DeltaMillisecondsAddWReference( current, _currentReferencePoint.Value, null, true, _context); long afterMSec = delta.Delta; _currentReferencePoint = delta.LastReference; _currentScheduledTime = afterMSec; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug( ".scheduleCallback Scheduled new callback for " + " afterMsec=" + afterMSec + " now=" + current + " currentReferencePoint=" + _currentReferencePoint); } ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QOutputRateConditionScheduledEval(), i => i.AOutputRateConditionScheduledEval(), () => { _isCallbackScheduled = false; OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); ScheduleCallback(); }) }; _handle = new EPStatementHandleCallback(_context.EpStatementAgentInstanceHandle, callback); _context.StatementContext.SchedulingService.Add(afterMSec, _handle, _scheduleSlot); _context.AddTerminationCallback(new ProxyStopCallback(Stop)); }
public CallbackOutput(OutputCallback callback) { _callback = callback; }
internal static extern void SetOutputCallback(IntPtr hSpi, OutputCallback cb);
internal HostLogger(StreamWriter streamWriter = null, OutputCallback callback = null) { _streamWriter = streamWriter; _callback = callback; }