public static void startScannerActivity(Context context, ScannerType type) { Intent intent = new Intent(context, typeof(ScannerActivity)); intent.PutExtra(TYPE_EXTRA, type); context.StartActivity(intent); }
public static void SetDefaultSettings() { FileNamePLY = "DepthAndColor.ply"; FileNameOBJ = "DepthAndColor.obj"; FileNameDepthOBJ = "Depth.obj"; ScannerMode = PointCloudUtils.ScannerMode.Depth; ScannerTypeDefault = PointCloudUtils.ScannerType.MicrosoftKinect; DisplayType = PointCloudUtils.DisplayType.Depth; BackgroundRemoved = false; InterpolateFrames = true; EntropyImage = true; SaveAndStop = true; CutFrames = true; CutFrameMaxDistance = 7500; CutFrameMinDistance = 500; SaveImageIfQualityIsBetterThan = 50; RotatePointCloud = true; SaveSettings(); InterpolationNumberOfFrames = 10; SnapshotNumberOfImages = 5; ShowOpenGLWindow = false; Height = 600; Width = 1000; ScanOnStartProgram = false; OpenGLRefreshAt = 5; ShowOnlyCalibrationPointCloud = false; ShowSkeleton = false; ShowFace = false; ShowFaceScanEllipse = false; }
/// <summary> /// Displays the scanner that is appropriate for the element in focus /// </summary> /// <param name="monitorInfo">Foreground window info</param> /// <param name="handled">set to true if handled</param> private void autoDisplayScanner(WindowActivityMonitorInfo monitorInfo, ref bool handled) { handled = true; if (_explorerElements.IsFavoritesWindow(monitorInfo.FocusedElement) || _explorerElements.IsHistoryWindow(monitorInfo.FocusedElement) || _explorerElements.IsFeedsWindow(monitorInfo.FocusedElement)) { if (!_scannerType.HasFlag(ScannerType.Favorites)) { showPanel(this, new PanelRequestEventArgs(PanelClasses.MenuContextMenu, ScannerTitle, monitorInfo, true)); _scannerType = ScannerType.Favorites; } } else if (_explorerElements.IsSearchControl(monitorInfo.FocusedElement) || _explorerElements.IsFindControl(monitorInfo.FocusedElement) || _explorerElements.IsAddressWindow(monitorInfo.FocusedElement)) { if (!_scannerType.HasFlag(ScannerType.Address)) { showPanel(this, new PanelRequestEventArgs(PanelClasses.Alphabet, monitorInfo)); _scannerType = ScannerType.Address; } } else if (!_scannerType.HasFlag(ScannerType.Other)) { showPanel(this, new PanelRequestEventArgs("InternetExplorerContextMenu", ScannerTitle, monitorInfo)); _scannerType = ScannerType.Other; } }
public override void SetScannerType(ScannerType type) { // TODO: Prompt if user wants to save their work? // if (Outer.m_Minutia) // { // } // TransitionTo(typeof(Loading)); }
// TODO: Note that there is a contract here, CaptureComplete SHALL follow, in a timely manner Guid IDataController.BeginGetCapture(ScannerType scannerType) { Log.DebugFormat("BeginGetCapture(scannterType={0}) called", scannerType); IntegrityCheck.IsNotNull(scannerType); return(StartLogic((Guid guid, CancellationToken token) => StartCaptureTask(scannerType, guid, token))); }
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); }
private static void SetScannerType(string stringMode) { for (int i = 0; i < Enum.GetValues(typeof(ScannerType)).GetLength(0); i++) { string strVal = Enum.GetValues(typeof(ScannerType)).GetValue(i).ToString(); if (stringMode == strVal) { ScannerTypeDefault = (ScannerType)Enum.GetValues(typeof(ScannerType)).GetValue(i); } } }
public Scanner(string section) { id = section; bInUse = (Util.ConstIni.IntValue(id, "InUse") == 1); if (Util.ConstIni.StringValue(id, "Type") == "GPIB") { dev = new GPIBDevice("GPIB0::" + Util.ConstIni.StringValue(id, "Address") + "::INSTR"); } else { dev = new SerialDevice("COM" + Util.ConstIni.StringValue(id, "Address"), 9600, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One); } stype = (ScannerType)Util.ConstIni.IntValue(id, "Model"); }
/// <summary> /// /// </summary> /// <param name="scannerTypes"></param> public void Open(params ScannerType[] scannerTypes) { Int32 status; if (scannerTypes.Length == 0) { scannerTypes = new ScannerType[] { ScannerType.All } } ; this.coreScanner .Open(0, scannerTypes, (Int16)scannerTypes.Length, out status); ((Status)status).ThrowIfError(); this.isOpen = true; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_scanner); ScannerType type = (ScannerType)Intent.GetSerializableExtra(TYPE_EXTRA); mrzScanner = (MRZScanner)SupportFragmentManager.FindFragmentById(Resource.Id.scannerFragment); mrzScanner.SetScannerType(type); // Options: [ScannerTypeMrz, ScannerTypeDocImageId, ScannerTypeDocImagePassport]. Default: MRZ. MRZScanner.SetIDActive(true); // Enable/disable the ID document type. Default: true. MRZScanner.SetPassportActive(true); // Enable/disable the Passport document type. Default: true. MRZScanner.SetVisaActive(true); // Enable/disable the Visa document type. Default: true. MRZScanner.SetMaxThreads(2); // Set the max CPU threads that the scanner can use. Default: 2. MRZScanner.RegisterWithLicenseKey(this, "licenseKey", this); }
private CaptureDb GetCaptureFromDatabase(ScannerType scannerType) { CaptureDb capture; string withTemplateString = "NULL"; string query; if (scannerType == ScannerType.None) { query = String.Format(CAPTURE_QUERY_STRING, withTemplateString); } else { query = String.Format(CAPTURE_GIVEN_SCANNER_QUERY_STRING, withTemplateString, scannerType); } capture = m_Database.ExecuteQuery <CaptureDb>(query).FirstOrDefault(); return(capture); }
public static void AddThese(string format, ScannerType type) { IScanner pe = (IScanner)AVEngine.PETypeScanner; IScanner ARCH = (IScanner)AVEngine.ArchiveTypeScanner; IScanner hash = (IScanner)AVEngine.HashScanner; IScanner ascii = (IScanner)AVEngine.ScriptTypeScanner; IScanner no = (IScanner)AVEngine.NothingScanner; if (type == ScannerType.ArchiveScanner) { if (!FileFormatDB.ContainsKey(format.ToLower())) { FileFormatDB.Add(format, ARCH); } } else if (type == ScannerType.NoScanner) { if (!FileFormatDB.ContainsKey(format.ToLower())) { FileFormatDB.Add(format, no); } } else if (type == ScannerType.PEScanner) { if (!FileFormatDB.ContainsKey(format.ToLower())) { FileFormatDB.Add(format, pe); } } else if (type == ScannerType.ASCIIScanner) { if (!FileFormatDB.ContainsKey(format.ToLower())) { FileFormatDB.Add(format, ascii); } } else if (type == ScannerType.HashScanner) { if (!FileFormatDB.ContainsKey(format.ToLower())) { FileFormatDB.Add(format, hash); } } }
protected override void StartCaptureTask(ScannerType scannerType, Guid guid, CancellationToken token) { Log.DebugFormat("Starting task with Guid={0}", guid); // Make HTTP request Task <string> responseText = m_Client.GetStringAsync( SimTemplateServerHelper.GetCaptureRequestUri(scannerType)); // When task is complete, raise GetCaptureComplete event // Pass the task the cancellation token so that this action may be skipped responseText.ContinueWith((Task <string> gCT) => { // Check for cancellation (race) if (!token.IsCancellationRequested) { // HTTP requests are not cancellable IntegrityCheck.IsFalse(gCT.IsCanceled); if (gCT.IsCompleted) { CaptureInfo capture; try { capture = ProcessResponse(gCT.Result); OnGetCaptureComplete( new GetCaptureCompleteEventArgs(capture, guid, DataRequestResult.Success)); } catch (SimTemplateException ex) { Log.Error("Failed to process xml response:", ex); OnGetCaptureComplete( new GetCaptureCompleteEventArgs(null, guid, DataRequestResult.Failed)); } } else if (gCT.IsFaulted) { // An exception was thrown during the request. Log.Error("GetCapture task failed: " + gCT.Exception.Message, gCT.Exception); OnGetCaptureComplete( new GetCaptureCompleteEventArgs(null, guid, DataRequestResult.TaskFailed)); } } }, token); }
protected override void StartCaptureTask(ScannerType scannerType, Guid guid, CancellationToken token) { // Construct a request for a capture RestRequest request = new RestRequest(HUMAN_TEMPLATE_RESOURCE, Method.GET); request.AddParameter(TOKEN_PARAMETER, m_Token, ParameterType.QueryString); // Begin the request ResourceRequest( request, (HumanTemplate response) => { CaptureInfo capture = new CaptureInfo( response.Id, Convert.FromBase64String(response.Base64Image), null); // Raise GetCaptureComplete event. OnGetCaptureComplete(new GetCaptureCompleteEventArgs(capture, guid, DataRequestResult.Success)); }, () => OnGetCaptureComplete(new GetCaptureCompleteEventArgs(null, guid, DataRequestResult.Failed))); }
protected override void StartCaptureTask(ScannerType scannerType, Guid guid, CancellationToken token) { // Define and run the task, passing in the token. Task getCaptureTask = Task.Run(() => { Log.Debug("Get capture task running."); // Get a capture CaptureInfo capture = GetCapture(scannerType, token); // Raise GetCaptureComplete event. OnGetCaptureComplete(new GetCaptureCompleteEventArgs(capture, guid, DataRequestResult.Success)); }, token); // Raise the GetCaptureComplete event in the case where the Task faults. getCaptureTask.ContinueWith((Task t) => { if (t.IsFaulted) { Log.Error("Failed to save template: " + t.Exception.Message, t.Exception); OnGetCaptureComplete(new GetCaptureCompleteEventArgs(null, guid, DataRequestResult.TaskFailed)); } }); }
public static Int32 GetCode( this BarcodeDataType dataType, ScannerType scannerType) { switch (scannerType) { case ScannerType.SNAPI: switch (dataType) { case BarcodeDataType.Code39: return(1); case BarcodeDataType.Codabar: return(2); case BarcodeDataType.Code128: return(3); case BarcodeDataType.Discrete2of5: return(4); default: throw new ArgumentOutOfRangeException("dataType"); } default: throw new ArgumentOutOfRangeException("mode"); } }
/// <summary> /// TODO implement this to get the correct scanner type. /// </summary> /// <param name="barcodeDataType"></param> /// <param name="scannerType"></param> /// <returns></returns> public static BarcodeDataType ConvertToBarcodeDataType(this String barcodeDataType, ScannerType scannerType) { Int32 barcodeDataTypeValue = barcodeDataType.ToInt32(); switch (scannerType) { case ScannerType.SNAPI: return((BarcodeDataType)barcodeDataTypeValue); case ScannerType.NIXMODB: throw new NotImplementedException(); case ScannerType.IBMHID: throw new NotImplementedException(); case ScannerType.SSI: throw new NotSupportedException(); case ScannerType.RSM: throw new NotSupportedException(); case ScannerType.Imaging: throw new NotSupportedException(); case ScannerType.HIDKB: throw new NotSupportedException(); default: throw new ArgumentOutOfRangeException(); } }
protected abstract void StartCaptureTask(ScannerType scannerType, Guid guid, CancellationToken token);
public Scanner(string section) { id = section; bInUse = (Util.ConstIni.IntValue(id, "InUse") == 1); if (!bInUse) return; if (Util.ConstIni.StringValue(id, "Type") == "GPIB") dev = new GPIBDevice("GPIB0::" + Util.ConstIni.StringValue(id, "Address") + "::INSTR"); else dev = new SerialDevice("COM" + Util.ConstIni.StringValue(id, "Address"), 9600, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One); ch_start = Util.ConstIni.IntValue(id, "Channel_Start"); ch_end = Util.ConstIni.IntValue(id, "Channel_End"); stype = (ScannerType)Util.ConstIni.IntValue(id, "Model"); }
public override void SetScannerType(ScannerType type) { // Ignore. }
public XssScanner(ScannerType paramScannerType) => scannerType = paramScannerType;
public CookieFlagScanner(ScannerType paramScannerType) => scannerType = paramScannerType;
public static Uri GetCaptureRequestUri(ScannerType type) { return(new Uri(String.Format("{0}/Capture?scanner={1}", ROOT_URL, type))); }
/// <summary> /// Focus shifted to another window. This agent is getting deactivated /// </summary> public override void OnFocusLost() { base.OnFocusLost(); _scannerType = ScannerType.None; }
private void StartScan() { scannerType = (ScannerType)comboBoxScannerType.SelectedValue; scanMethod = (ScanMethod)comboBoxScanMethod.SelectedValue; delay = Int32.Parse(textBoxDelay.Text); timeout = Int32.Parse(textBoxTimeout.Text); string[] hosts = textBoxHost.Text.Trim().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); hostEntries = new IPHostEntry[hosts.Length]; for (int i = 0; i < hosts.Length; i++) { hostEntries[i] = Dns.GetHostEntry(hosts[i]); } fromPort = Int32.Parse(textBoxFromPort.Text); if (textBoxToPort.Visible) { toPort = Int32.Parse(textBoxToPort.Text); } device = chooseDeviceUserControl.Device; // Matching selected interface with .NET's facilities in order to get gateway's ip address // that is a property of the network interface of interest. NetworkInterface adapter = GetMatchingNetworkInterface(device.Interface, nics); if (adapter == null) { throw new Exception("Network interface not found."); } if (scanMethod == ScanMethod.SynScan) { if (device.Opened) { MessageBox.Show("The sniffing process must be stopped in order to perform SYN Scan.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } IPInterfaceProperties properties = adapter.GetIPProperties(); GatewayIPAddressInformationCollection gateways = properties.GatewayAddresses; if (gateways.Count > 0) { gateway = gateways[0].Address; } else { throw new Exception("No gateway address found."); } } textBoxScanResult.Clear(); buttonStartScan.Enabled = false; buttonSaveLog.Enabled = false; backgroundWorkerScan.RunWorkerAsync(); }
/// <summary> /// Focus shifted to another window. This agent is getting deactivated /// </summary> public override void OnFocusLost() { base.OnFocusLost(); _scannerType = ScannerType.None; _scannerShown = false; }
/// <summary> /// Displays the scanner that is appropriate for the element in focus /// </summary> /// <param name="monitorInfo">Foreground window info</param> /// <param name="handled">set to true if handled</param> private void autoDisplayScanner(WindowActivityMonitorInfo monitorInfo, ref bool handled) { handled = true; if (_explorerElements.IsFavoritesWindow(monitorInfo.FocusedElement) || _explorerElements.IsHistoryWindow(monitorInfo.FocusedElement) || _explorerElements.IsFeedsWindow(monitorInfo.FocusedElement)) { if (!_scannerType.HasFlag(ScannerType.Favorites)) { var args = new PanelRequestEventArgs(PanelClasses.MenuContextMenu, ScannerTitle, monitorInfo) { UseCurrentScreenAsParent = true }; showPanel(this, args); _scannerType = ScannerType.Favorites; } } else if (_explorerElements.IsSearchControl(monitorInfo.FocusedElement) || _explorerElements.IsFindControl(monitorInfo.FocusedElement) || _explorerElements.IsAddressWindow(monitorInfo.FocusedElement)) { if (!_scannerType.HasFlag(ScannerType.Address)) { showPanel(this, new PanelRequestEventArgs(PanelClasses.Alphabet, monitorInfo)); _scannerType = ScannerType.Address; } } else if (!_scannerType.HasFlag(ScannerType.Other)) { showPanel(this, new PanelRequestEventArgs("InternetExplorerContextMenu", ScannerTitle, monitorInfo)); _scannerType = ScannerType.Other; } }
public virtual void SetScannerType(ScannerType type) { MethodNotImplemented(); }