void ITemplatingViewModel.BeginTemplating(CaptureInfo capture) { lock (m_StateLock) { m_StateMgr.State.BeginTemplating(capture); } }
public async Task <IProcessingResult> OpenCaptureAsync(Uri uri) { IProcessingResult processingResult; var captureInfo = new CaptureInfo(uri); var settings = new LoadBalancerSettings(BaseConfig); var config = this.ClusterSettings.Config.WithFallback(BaseConfig); // var seedNodes = config.GetStringList("akka.cluster.seed-nodes"); using (var system = ActorSystem.Create("NTPAC-Cluster", config)) { var loadBalancerActor = this._onlineLoadBalancerActorFactory.Create(system, settings); var startProcessingRequest = new CaptureProcessingRequest { CaptureInfo = captureInfo }; processingResult = await loadBalancerActor.Ask <ProcessingResult>(startProcessingRequest).ConfigureAwait(false); await Akka.Cluster.Cluster.Get(system).LeaveAsync(); await system.Terminate(); } return(processingResult); }
protected override void WriteEndMatch(CaptureInfo capture) { var match = (Match)capture.Capture !; string result = ReplaceOptions.Replace(match); WriteReplacement(match, result); if (Options.IncludeLineNumber) { int endIndex = capture.Index + capture.Length; if (endIndex > 0 && Input[endIndex - 1] == '\n') { if (result.Length > 0 && result[result.Length - 1] != '\n') { WriteLine(); Write(Options.Indent); } WriteLineNumber(((LineNumberValueWriter)ValueWriter).LineNumber); } } base.WriteEndMatch(capture); }
public async Task <IProcessingResult> OpenCaptureAsync(Uri uri) { IProcessingResult processingResult; var captureInfo = new CaptureInfo(uri); var settings = new LoadBalancerSettings(BaseConfig); var config = this.ClusterSettings.Config.WithFallback(BaseConfig); var seedNodes = config.GetStringList("akka.cluster.seed-nodes"); using (var system = ActorSystem.Create("NTPAC-Cluster", config)) { var loadBalancerActor = this._onlineLoadBalancerActorFactory.Create(system, settings); var startProcessingRequest = new CaptureProcessingRequest { CaptureInfo = captureInfo }; processingResult = await loadBalancerActor.Ask <ProcessingResult>(startProcessingRequest).ConfigureAwait(false); await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false); await CoordinatedShutdown.Get(system).Run(CoordinatedShutdown.ClusterLeavingReason.Instance).ConfigureAwait(false); // Console.WriteLine("Pre-dispose delay"); await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false); } // Console.WriteLine("Post-dispose delay"); await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false); return(processingResult); }
public void OnCaptureInfo(CaptureInfo captureInfo) { this._rawPacketBatchParserActor = this._rawPacketBatchParserActorFactory.Create(this._context, this._captureControllerActor, captureInfo); this.ReplayPacketBatchReorderBuffer(); }
private void ReadCapFiles() { LoadingForm LoadForm = new LoadingForm(); LoadForm.Show(); //CapFiles.Clear(); List <CapFile> CapFiles = new List <CapFile>(); foreach (string capFilePath in Directory.GetFiles(Environment.CurrentDirectory + "\\Data\\Captures", "*.cap")) { CapFile capFile = new CapFile(); LoadForm.SetCapFile(capFile); LoadForm.SetFileName(new FileInfo(capFilePath).Name); capFile.ReadCap(capFilePath); CapFiles.Add(capFile); } this.captureInfo = new CaptureInfo(); LoadForm.SetCaptureInfo(this.captureInfo); captureInfo.AddCapturefiles(CapFiles.ToArray()); CapFiles.Clear(); LoadForm.Close(); }
public override void BeginTemplating(CaptureInfo capture) { // Prepare to start templating a new capture // Clear the UI of any previous work Outer.m_DispatcherHelper.Invoke(new Action(() => { Outer.Minutae.Clear(); })); // Record the new capture Outer.Capture = capture; if (Outer.Capture.TemplateData != null) { // If there is a template in the capture info, load it. IEnumerable <MinutiaRecord> template = IsoTemplateHelper .ToMinutae(Outer.Capture.TemplateData); foreach (MinutiaRecord rec in template) { // Ensure we use the UI thread to add to the ObservableCollection. App.Current.Dispatcher.Invoke(new Action(() => { Outer.Minutae.Add(rec); })); } } TransitionTo(typeof(WaitLocation)); }
protected override void WriteNonEmptyMatchValue(CaptureInfo capture) { if (Options.HighlightMatch) { base.WriteNonEmptyMatchValue(capture); } }
protected override void WriteEndMatch(CaptureInfo capture) { var match = (Match)capture.Capture !; string result = ReplaceOptions.Replace(match); WriteReplacement(match, result); }
public RawPacketBatchParserActor(ICaptureTrackingActorFactory captureTrackingActorFactory, IActorRef contractor, CaptureInfo captureInfo) { this.Contractor = contractor; this.CaptureTrackingActor = captureTrackingActorFactory.Create(Context, captureInfo, this.Self); this.Become(this.ParsingRawPacketBatches); }
private Capture CreateCaptureEntity(CaptureInfo captureInfo) { var address = Context.Self.Path.Address; var capture = new Capture(captureInfo, address.HasGlobalScope ? address.ToString() : null); this._captureFacade.InsertAsync(capture).Wait(); return(capture); }
public MatchState() { Capture = new CaptureInfo[LUA_MAXCAPTURES]; for (int i = 0; i < LUA_MAXCAPTURES; ++i) { Capture[i] = new CaptureInfo(); } }
protected override void WriteStartMatch(CaptureInfo capture) { Write(Options.Indent); if (OutputInfo != null) { Write(OutputInfo.GetText(capture, MatchCount + 1, groupName: Options.GroupName)); } }
private CaptureInfo GetCapture(ScannerType scannerType, CancellationToken token) { Log.DebugFormat("GetCapture(scannerType={0}, token={1}) called", scannerType, token); CaptureInfo captureInfo = null; DataRequestResult result = DataRequestResult.None; bool isRunning = true; int attempts = 0; while (isRunning) { // Check if cancellation requested token.ThrowIfCancellationRequested(); // First query the database to get an image file name. CaptureDb captureCandidate = GetCaptureFromDatabase(scannerType); if (captureCandidate != null) { // Try to find an image file using the file name. byte[] imageData; bool isFound = TryGetImageFromName(captureCandidate.HumanId, out imageData); if (isFound) { // Matching file found. Log.DebugFormat("Matching file found for capture={0}", captureCandidate.HumanId); isRunning = false; captureInfo = new CaptureInfo( captureCandidate.Id, imageData, captureCandidate.GoldTemplate); result = DataRequestResult.Success; } else { // Give up if the number of attemps exceeds limit. attempts++; if (attempts > MAX_OPEN_FILE_ATTEMPTS) { Log.WarnFormat("Exceeded maximum number of file searches (attempts={0})", attempts); isRunning = false; result = DataRequestResult.Failed; } } } else { // Queries are not returning any more candidates, give up immediately. Log.Warn("No candidate filename obtained from the database"); result = DataRequestResult.Failed; break; } } IntegrityCheck.AreNotEqual(DataRequestResult.None, result); return(captureInfo); }
protected override void WriteMatch(CaptureInfo capture) { _textWriter.Write(Input.AsSpan(_writerIndex, capture.Index - _writerIndex)); string result = ReplaceOptions.Replace((Match)capture.Capture !); _textWriter.Write(result); _writerIndex = capture.Index + capture.Length; }
private void OnCaptureInfo(CaptureInfo captureInfo) { if (!this._contractorToCaptureControllerMap.TryGetValue(this.Sender, out var captureController)) { this._logger.Warning("Contractor not found (CaptureInfo) !"); return; } captureController.OnCaptureInfo(captureInfo); }
protected override void WriteEndMatch(CaptureInfo capture) { WriteLine(); if (Ask && ConsoleHelpers.AskToContinue(Options.Indent) == DialogResult.YesToAll) { Ask = false; } }
public L7ConversationStorageActor(CaptureInfo captureInfo, IActorRef contractor, ICaptureFacade captureFacade, IL7ConversationFacade conversationL7Facade) { this._contractor = contractor; this._captureFacade = captureFacade; this._conversationL7Facade = conversationL7Facade; this.Become(this.StoringCaptureInfo); this.Self.Tell(captureInfo); }
/// <summary> /// Initializes a new instance of the <see cref="GetCaptureCompleteEventArgs"/> class in /// the case where the request was successful. /// </summary> /// <param name="capture">The capture.</param> /// <param name="requestId">The request unique identifier.</param> public GetCaptureCompleteEventArgs(CaptureInfo capture, Guid requestId, DataRequestResult result) { IntegrityCheck.IsNotNull(requestId); IntegrityCheck.IsNotNull(result); if (result == DataRequestResult.Success) { IntegrityCheck.IsNotNull(capture); } m_Capture = capture; m_RequestId = requestId; m_Result = result; }
private void OnCaptureProcessingRequest(CaptureProcessingRequest request) { this._captureInfo = request.CaptureInfo; this._contractor = this.Sender; this.askProxy = new AskableReassemblerEntityMessageProxy(this.Self, this._clusterProxy); this.Become(this.ProcessingCaptureBehaviour); this.TryStartProcessingAsync().PipeTo(this.Self); this.Become(this.ProcessingCaptureBehaviour); }
protected override void WriteNonEmptyMatchValue(CaptureInfo capture) { if (Options.HighlightMatch) { base.WriteNonEmptyMatchValue(capture); } else if (Options.IncludeLineNumber) { ((LineNumberValueWriter)ValueWriter).LineNumber += TextHelpers.CountLines( Input, capture.Index, capture.Length); } }
private void RunBenchmark(String pcapFilePath, IActorRef subject) { var captureInfo = new CaptureInfo(new Uri(pcapFilePath)); var req = new BenchmarkRequest { CaptureInfo = captureInfo, PcapLoader = this._services.GetService <IPcapLoader>() }; var probe = this.CreateTestProbe(); subject.Tell(req, probe); var result = probe.ExpectMsg <ProcessingResult>(TimeSpan.FromSeconds(60)); this._output.WriteLine($"Total time: {result.TotalTime}"); }
private void OnStartProcessingRequest(CaptureProcessingRequest request) { this.Contractor = this.Sender; this.SelfLoadBalancerActor = this.Self; this.CaptureInfo = request.CaptureInfo; this.DistributionSw = new Stopwatch(); this.TotalSw = new Stopwatch(); this.IPIpv4DefragmentationEngine = new Ipv4DefragmentationEngine(new AkkaLoggingAdapter <Ipv4DefragmentationEngine>(Context.GetLogger())); this.ReassemblerMessageProxy = new AskableReassemblerEntityMessageProxy(this.SelfLoadBalancerActor, this.ClusterProxy); this.Become(this.ProcessingCaptureBehaviour); this.TryStartProcessingAsync().PipeTo(this.Self); }
protected override void WriteEndReplacement(Match match, string result) { int endIndex = match.Index + match.Length; int eolIndex = FindEndOfLine(CaptureInfo.FromCapture(match)); WriteEndLine(endIndex, eolIndex); if (Options.ContextAfter > 0) { WriteContextAfter(eolIndex, Input.Length, _lineNumber); } base.WriteEndReplacement(match, result); }
protected override void WriteStartMatch(CaptureInfo capture) { ResultStorage?.Add(capture.Value); if (MatchCount == 0 || Options.Separator?.EndsWith('\n') != false) { Write(Options.Indent); } if (OutputInfo != null) { Write(OutputInfo.GetText(capture, MatchCount + 1, groupName: Options.GroupName)); } }
/// <summary> /// 缺岗请求 /// </summary> /// <param name="captureInfo"></param> /// <param name="identity"></param> public void SendCapture(CaptureInfo captureInfo, Event.Command command, string identity, string head = "request") { MSG msg = new MSG() { type = MSG.Type.EVENT, sequence = 11, timestamp = ProtoBufHelp.TimeSpan(), evt = new Event() { command = command, captureinfo = captureInfo } }; dealer.Send(msg, identity, head); }
protected override void WriteMatch(CaptureInfo capture) { int index = capture.Index; if (index >= _lastEndIndex) { int solIndex = FindStartOfLine(index); if (solIndex > _lastEndIndex) { if (solIndex > 0) { solIndex--; if (solIndex > 0 && Input[solIndex - 1] == '\r') { solIndex--; } } WriteUnmatchedLines(solIndex); } _lineNumber++; } if (Options.IncludeLineNumber) { _lineNumber += TextHelpers.CountLines(Input, index, capture.Length); } int i = index + capture.Length; while (i < Input.Length) { if (Input[i] == '\n') { i++; break; } i++; } _lastEndIndex = i; }
protected override void WriteStartMatch(CaptureInfo capture) { ResultStorage?.Add(capture.Value); if (Options.IncludeLineNumber) { _lineNumber += TextHelpers.CountLines(Input, _solIndex, capture.Index - _solIndex); ((LineNumberValueWriter)ValueWriter).LineNumber = _lineNumber; } int solIndex = FindStartOfLine(capture); if (Options.ContextBefore > 0) { WriteContextBefore(0, solIndex, _lineNumber); } Write(Options.Indent); if (Options.IncludeLineNumber) { WriteLineNumber(_lineNumber); } if (capture.Index >= _eolIndex) { MatchingLineCount++; int length = capture.Length; if (length > 0) { if (Input[capture.Index + length - 1] == '\n') { length--; } MatchingLineCount += TextHelpers.CountLines(Input, capture.Index, length); } } _solIndex = solIndex; _eolIndex = FindEndOfLine(capture); WriteStartLine(_solIndex, capture.Index); }
public RawPacketBatchParserActorTests() { var uri = new Uri(@"test://"); var captureInfo = new CaptureInfo(uri); this._loadBalancerActorTestProbe = this.CreateTestProbe("LoadBalancerActor"); this._captureActorTestProbe = this.CreateTestProbe("CaptureTrackingActor"); this._captureTrackingActorFactoryMock = new Mock <ICaptureTrackingActorFactory>(); this._captureTrackingActorFactoryMock .Setup(factory => factory.Create(It.IsAny <IActorContext>(), captureInfo, It.IsAny <IActorRef>())) .Returns(this._captureActorTestProbe); this._rawPacketBatchParserActorRefSUT = this.Sys.ActorOf(Props.Create(() => new RawPacketBatchParserActor(this._captureTrackingActorFactoryMock.Object, this._loadBalancerActorTestProbe, captureInfo))); }
public CaptureTrackingActor(CaptureInfo captureInfo, IActorRef contractor, IL3ConversationTrackingActorFactory l3ConversationTrackingActorFactory, IL7ConversationStorageActorFactory l7ConversationStorageActorFactory) { this._captureInfo = captureInfo; this._contractor = contractor; this._l3ConversationTrackingActorFactory = l3ConversationTrackingActorFactory; this._l7ConversationStorageActorFactory = l7ConversationStorageActorFactory; this._ipv4DefragmentationEngine = new Ipv4DefragmentationEngine(new AkkaLoggingAdapter <Ipv4DefragmentationEngine>(this._logger)); this._logger.Info($"Started for {captureInfo.Uri.AbsoluteUri}"); this._l7ConversationStorageActor = this.CreateL7ConversationStorageActor(); this.Become(this.AnalysisBehavior); }
private IEnumerator captureScreenshotCor( CallBackTex2D callback, string fileName, string folderName, bool isOverWrite) { string folderPath = this.getFolderPath(folderName); #if UNITY_IOS // iOSだとiCloudにバックアップを取りすぎるとリジェクトされる為,バックアップ属性指定フォルダのバックアップ属性を外す. Device.SetNoBackupFlag( folderName ); #endif fileName += PICTURE_EXTENSION; string filePath = folderPath + fileName; yield return new WaitForEndOfFrame(); // 撮影. Texture2D tex = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false); tex.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0, false); tex.Apply(); // キャプチャ用の情報を作成. string captureID = this.getNowTimeString(); CaptureInfo info = new CaptureInfo(filePath, captureID, tex.EncodeToPNG()); this.captureList.Add(captureID, info); // コールバックでスプライトを先に渡す. callback(tex, filePath); // 別スレッドを作成しそっちで保存. Thread thread = new Thread(new ParameterizedThreadStart(this.saveCaptureImageThd)); thread.Start(captureID); while (!this.captureList[captureID].IsFinished) { yield return new WaitForSeconds(0); } yield return new WaitForEndOfFrame(); }
public MatchState() { Capture = new CaptureInfo[LUA_MAXCAPTURES]; for(int i =0; i < LUA_MAXCAPTURES; ++i) Capture[i] = new CaptureInfo(); }
private CaptureInfo CaptureFillForms(PdfForms fillForms) { var ret = new CaptureInfo(); if (fillForms == null) return ret; ret.forms = fillForms; ret.sync = fillForms.SynchronizingObject; fillForms.SynchronizingObject = new DispatcherISyncInvoke(Dispatcher); ret.color = fillForms.SetHighlightColorEx(FormFieldTypes.FPDF_FORMFIELD_UNKNOWN, Helpers.ToArgb(FormHighlightColor)); fillForms.AppBeep += FormsAppBeep; fillForms.DoGotoAction += FormsDoGotoAction; fillForms.DoNamedAction += FormsDoNamedAction; fillForms.GotoPage += FormsGotoPage; fillForms.Invalidate += FormsInvalidate; fillForms.OutputSelectedRect += FormsOutputSelectedRect; fillForms.SetCursor += FormsSetCursor; return ret; }
private void ReleaseFillForms(CaptureInfo captureInfo) { if (captureInfo.forms == null) return; captureInfo.forms.AppBeep -= FormsAppBeep; captureInfo.forms.DoGotoAction -= FormsDoGotoAction; captureInfo.forms.DoNamedAction -= FormsDoNamedAction; captureInfo.forms.GotoPage -= FormsGotoPage; captureInfo.forms.Invalidate -= FormsInvalidate; captureInfo.forms.OutputSelectedRect -= FormsOutputSelectedRect; captureInfo.forms.SetCursor -= FormsSetCursor; captureInfo.forms.SynchronizingObject = captureInfo.sync; captureInfo.forms.SetHighlightColorEx(FormFieldTypes.FPDF_FORMFIELD_UNKNOWN, captureInfo.color); }