コード例 #1
0
        /// <summary>
        /// 验证两枚指纹模板是否相同
        /// </summary>
        /// <exception cref="ArgumentNullException"/>
        /// <param name="fingerprint"></param>
        /// <param name="left"></param>
        /// <param name="right"></param>
        /// <returns></returns>
        public static bool Verify(this IFingerprint fingerprint, byte[] left, byte[] right)
        {
            var _left  = new FingerprintInfo(FingerprintType.Template, left);
            var _right = new FingerprintInfo(FingerprintType.Template, right);

            return(fingerprint.Verify(_left, _right));
        }
コード例 #2
0
        public IApplicationVersion RegisterApplicationVersionUsage(IFingerprint applicationVersionFingerprint, Guid applicationId, string version, string supportToolkitNameVersion, DateTime?buildTime, string environment)
        {
            Version tmp;

            if (string.IsNullOrEmpty(version))
            {
                throw new ArgumentException("No version provided for application.");
            }
            if (!Version.TryParse(version, out tmp))
            {
                throw new ArgumentException("Invalid version format.");
            }

            var applicationVersion = RegisterExistingApplicationVersionUsage((Fingerprint)applicationVersionFingerprint, applicationId, environment);

            if (applicationVersion != null)
            {
                return(applicationVersion);
            }

            applicationVersion = new ApplicationVersion((Fingerprint)applicationVersionFingerprint, applicationId, version, new List <IIssueType>(), null, false, false, supportToolkitNameVersion, buildTime, new List <string>()
            {
                environment
            });

            AddApplicationVersion(applicationVersion);

            //TODO:
            //_counterBusiness.UpdateApplicationVersionCounters();

            return(applicationVersion);
        }
コード例 #3
0
        /// <summary>
        /// Implementation of IEquatable
        /// </summary>
        /// <param name="other">The other IFingerprint object to compare against</param>
        /// <returns>true if 2 objects are fully equivalent</returns>
        public bool Equals(IFingerprint other)
        {
            if (other == null)
            {
                return(false);
            }

            // Our check only works for ScanResultFingerprint objects
            ScanResultFingerprint typedOther = other as ScanResultFingerprint;

            if (typedOther == null)
            {
                return(false);
            }

            if (TypedCompareTo(typedOther) != 0)
            {
                return(false);
            }

            // Do the expensive check last!
            for (int loop = 0; loop < Contributions.Count; loop++)
            {
                if (!Contributions[loop].Equals(other.Contributions[loop]))
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: hoku850/dp2
        // 通道打开成功后,窗口应该显示成一种特定的状态
        int StartChannel(
            string strUrl,
            out string strError)
        {
            strError = "";

            //Register the channel with ChannelServices.
            ChannelServices.RegisterChannel(m_fingerprintChannel, false);

            try
            {
                m_fingerprintObj = (IFingerprint)Activator.GetObject(typeof(IFingerprint),
                                                                     strUrl);
                if (m_fingerprintObj == null)
                {
                    strError = "could not locate Fingerprint Server";
                    return(-1);
                }
            }
            finally
            {
            }

            //this.ToolStripMenuItem_start.Enabled = false;
            return(0);
        }
コード例 #5
0
        public FingerprintPage(EventHandler evt, IFingerprint fp, string pass)
        {
            InitializeComponent();

            if (pass != "")
            {
                fp.GetFingerprint(new EventHandler((o, e) =>
                {
                    byte[] data = (byte[])o;
                    evt(data, new EventArgs());
                }), true, Encoding.UTF8.GetBytes(pass));
            }
            else
            {
                fp.GetFingerprint(new EventHandler((o, e) =>
                {
                    byte[] data = (byte[])o;
                    evt(data, new EventArgs());
                }), false, ConfigFactory.GetInstance().EncryptedPassword);
            }



            btn_skip.Clicked += new EventHandler((o, e) =>
            {
                fp.CancelFingerprint();
                evt(null, new EventArgs());
            });
        }
コード例 #6
0
        public void TryFindIssue_IssueIsInStore_ReturnsTrueWithCorrectIssue()
        {
            using (ShimsContext.Create())
            {
                IFingerprint actualFingerprint   = null;
                IFingerprint expectedFingerprint = new StubIFingerprint
                {
                    EqualsIFingerprint = (f) => { actualFingerprint = f; return(true); },
                };
                Issue actualIssue   = null;
                Issue expectedIssue = new ShimIssue();

                using (IIssueStore store = new OutputFileIssueStore(TestFile, Enumerable.Empty <A11yElement>(), (f, e, s) =>
                {
                    s.Add(expectedFingerprint, expectedIssue);
                }))
                {
                    Assert.IsNull(actualFingerprint);
                    Assert.IsNull(actualIssue);
                    Assert.IsTrue(store.TryFindIssue(expectedFingerprint, out actualIssue));
                    Assert.AreSame(expectedFingerprint, actualFingerprint);
                    Assert.AreSame(expectedIssue, actualIssue);
                }
            }
        }
コード例 #7
0
        public void TryFindIssue_FingerprintDoesMatch_ReturnsTrueAndCorrectIssue()
        {
            using (InMemoryIssueStore store = new InMemoryIssueStore())
            {
                using (ShimsContext.Create())
                {
                    IFingerprint actualFingerprint = null;
                    IFingerprint fingerprint       = new StubIFingerprint
                    {
                        EqualsIFingerprint = (f) =>
                        {
                            actualFingerprint = f;
                            return(true);
                        },
                    };

                    Issue issue = new ShimIssue
                    {
                        FingerprintGet = () => fingerprint,
                    };

                    store.AddIssue(issue);
                    Assert.IsTrue(store.TryFindIssue(fingerprint, out Issue actualIssue));
                    Assert.AreSame(fingerprint, actualFingerprint);
                    Assert.AreSame(issue, actualIssue);
                }
            }
        }
コード例 #8
0
        public void AddIssue_IssueIsInList_DoesNotAddIssueAndReturnsCorrectResult()
        {
            using (InMemoryIssueStore store = new InMemoryIssueStore())
            {
                using (ShimsContext.Create())
                {
                    IFingerprint actualFingerprint = null;
                    IFingerprint fingerprint       = new StubIFingerprint
                    {
                        EqualsIFingerprint = (f) =>
                        {
                            actualFingerprint = f;
                            return(true);
                        }
                    };

                    Issue issue1 = new ShimIssue
                    {
                        FingerprintGet = () => fingerprint,
                    };
                    Assert.AreEqual(AddResult.ItemAdded, store.AddIssue(issue1));
                    Assert.IsNull(actualFingerprint);

                    Issue issue2 = new ShimIssue
                    {
                        FingerprintGet = () => fingerprint,
                    };
                    Assert.AreEqual(AddResult.ItemAlreadyExists, store.AddIssue(issue2));
                    Assert.AreSame(fingerprint, actualFingerprint);
                    List <Issue> issueList = store.Issues.ToList();
                    Assert.AreEqual(1, issueList.Count);
                    Assert.AreSame(issue1, issueList[0]);
                }
            }
        }
コード例 #9
0
ファイル: App.cs プロジェクト: patel-pragnesh/mobile
        public App(
            string uri,
            IAuthService authService,
            IConnectivity connectivity,
            IUserDialogs userDialogs,
            IDatabaseService databaseService,
            ISyncService syncService,
            IFingerprint fingerprint,
            ISettings settings,
            ILockService lockService,
            IGoogleAnalyticsService googleAnalyticsService,
            ILocalizeService localizeService,
            IAppInfoService appInfoService)
        {
            _uri                    = uri;
            _databaseService        = databaseService;
            _connectivity           = connectivity;
            _userDialogs            = userDialogs;
            _syncService            = syncService;
            _authService            = authService;
            _fingerprint            = fingerprint;
            _settings               = settings;
            _lockService            = lockService;
            _googleAnalyticsService = googleAnalyticsService;
            _localizeService        = localizeService;
            _appInfoService         = appInfoService;

            SetCulture();
            SetStyles();

            if (authService.IsAuthenticated && _uri != null)
            {
                MainPage = new ExtendedNavigationPage(new VaultAutofillListLoginsPage(_uri));
            }
            else if (authService.IsAuthenticated)
            {
                MainPage = new MainPage();
            }
            else
            {
                MainPage = new ExtendedNavigationPage(new HomePage());
            }

            MessagingCenter.Subscribe <Application, bool>(Current, "Resumed", async(sender, args) =>
            {
                Device.BeginInvokeOnMainThread(async() => await CheckLockAsync(args));
                await Task.Run(() => FullSyncAsync()).ConfigureAwait(false);
            });

            MessagingCenter.Subscribe <Application, bool>(Current, "Lock", (sender, args) =>
            {
                Device.BeginInvokeOnMainThread(async() => await CheckLockAsync(args));
            });

            MessagingCenter.Subscribe <Application, string>(Current, "Logout", (sender, args) =>
            {
                Logout(args);
            });
        }
コード例 #10
0
        /// <summary>
        /// 已异步的方式注册指纹
        /// </summary>
        /// <param name="fingerprint"></param>
        /// <param name="action">提示方法</param>
        /// <param name="describes">提示语句</param>
        /// <param name="cancellation"></param>
        /// <returns></returns>
        public static async Task <FingerprintInfo> RegisterAsync(this IFingerprint fingerprint, Action <string, MessageType> action, string[] describes, CancellationToken cancellation)
        {
            if (describes == null)
            {
                throw new ArgumentNullException(nameof(describes));
            }

            string[] _describes = new string[5];
            for (int i = 0; i < _describes.Length; i++)
            {
                if (i < describes.Length)
                {
                    _describes[i] = describes[i];
                }
                else
                {
                    _describes[i] = Describes[i];
                }
            }

            FingerprintInfo[] _fingerprints = new FingerprintInfo[3];
            action(_describes[0], MessageType.info); // 注册指纹需要按下三次手指
            for (int i = 0; i < 3;)
            {
                FingerprintInfo _fingerprint = await fingerprint.GetFingerprintAsync(cancellation);

                if (cancellation.IsCancellationRequested)
                {
                    return(null);
                }
                if (_fingerprint != null)
                {
                    if (i == 0)
                    {
                        _fingerprints[i] = _fingerprint;
                        i++;
                    }
                    else if (i > 0)
                    {
                        if (fingerprint.Verify(_fingerprint, _fingerprints[i - 1]))
                        {
                            _fingerprints[i] = _fingerprint;
                            i++;
                        }
                        else
                        {
                            action(_describes[4], MessageType.Error);// 请使用同一手指
                        }
                    }
                }
                if (i < 3)
                {
                    action(_describes[i], MessageType.info);
                    // 还需要按下{3 - i}次手指
                }
            }
            action(_describes[3], MessageType.Success);// 请使用同一手指
            return(fingerprint.Merge(_fingerprints));
        }
コード例 #11
0
        public LockFingerprintPage(bool checkFingerprintImmediately)
        {
            _checkFingerprintImmediately = checkFingerprintImmediately;
            _fingerprint = Resolver.Resolve <IFingerprint>();
            _settings    = Resolver.Resolve <ISettings>();
            _appSettings = Resolver.Resolve <IAppSettingsService>();

            Init();
        }
コード例 #12
0
 public LockService(
     ISettings settings,
     IAuthService authService,
     IFingerprint fingerprint)
 {
     _settings    = settings;
     _authService = authService;
     _fingerprint = fingerprint;
 }
コード例 #13
0
        /// <summary>
        /// 将三枚指纹模板合并成一枚指纹模板
        /// </summary>
        /// <exception cref="ArgumentNullException"/>
        /// <param name="fingerprint"></param>
        /// <param name="templates">指纹模板</param>
        /// <returns></returns>
        public static byte[] Merge(this IFingerprint fingerprint, params byte[][] templates)
        {
            FingerprintInfo[] fingerprints = new FingerprintInfo[3];
            fingerprints[0] = new FingerprintInfo(FingerprintType.Template, templates[0]);
            fingerprints[1] = new FingerprintInfo(FingerprintType.Template, templates[1]);
            fingerprints[2] = new FingerprintInfo(FingerprintType.Template, templates[2]);

            return(fingerprint.Merge(fingerprints).Template);
        }
コード例 #14
0
        public void RegisterUser(IFingerprint id, string userName)
        {
            var user = _repository.GetUser((Fingerprint)id);

            if (user == null)
            {
                _repository.AddUser(new User((Fingerprint)id, userName));
            }
        }
コード例 #15
0
        public LockFingerprintPage(bool checkFingerprintImmediately)
            : base(false, false)
        {
            _checkFingerprintImmediately = checkFingerprintImmediately;
            _fingerprint = Resolver.Resolve <IFingerprint>();
            _userDialogs = Resolver.Resolve <IUserDialogs>();
            _settings    = Resolver.Resolve <ISettings>();

            Init();
        }
コード例 #16
0
ファイル: MainForm.cs プロジェクト: hoku850/dp2
 void EndChannel()
 {
     // TODO: 这里有点乱。应该是通过 m_fingerprintChannel 是否为空来判断
     if (this.m_fingerprintObj != null)
     {
         ChannelServices.UnregisterChannel(m_fingerprintChannel);
         this.m_fingerprintObj = null;
         //this.ToolStripMenuItem_start.Enabled = true;
     }
 }
        /// <summary>
        /// Generates the fingerprint contributions
        /// </summary>
        /// <param name="element"> The element for which the fingerprint is being generated</param>
        /// <param name="ruleResult"> Used to determine the rule and the ruke result </param>
        /// <returns>Fingerprint contributions for the element</returns>
        internal static IDictionary <string, string> GetFingerPrintContributions(A11yElement element, RuleResult ruleResult)
        {
            Dictionary <string, string> fingerPrintContributions = new Dictionary <string, string>();
            IFingerprint scanResultFingerprint = FingerprintFactory.GetFingerPrint(element, ruleResult.Rule, ruleResult.Status);

            foreach (FingerprintContribution contribution in scanResultFingerprint.Contributions)
            {
                fingerPrintContributions.Add(contribution.Key, contribution.Value);
            }
            return(fingerPrintContributions);
        }
コード例 #18
0
        // TODO: Model binding context?

        public SettingsPage()
        {
            _authService            = Resolver.Resolve <IAuthService>();
            _userDialogs            = Resolver.Resolve <IUserDialogs>();
            _settings               = Resolver.Resolve <ISettings>();
            _fingerprint            = Resolver.Resolve <IFingerprint>();
            _pushNotification       = Resolver.Resolve <IPushNotification>();
            _googleAnalyticsService = Resolver.Resolve <IGoogleAnalyticsService>();

            Init();
        }
コード例 #19
0
ファイル: SettingsPage.cs プロジェクト: whjvenyl/mobile
        // TODO: Model binding context?

        public SettingsPage()
        {
            _authService            = Resolver.Resolve <IAuthService>();
            _settings               = Resolver.Resolve <ISettings>();
            _fingerprint            = Resolver.Resolve <IFingerprint>();
            _pushNotification       = Resolver.Resolve <IPushNotificationService>();
            _googleAnalyticsService = Resolver.Resolve <IGoogleAnalyticsService>();
            _deviceActionService    = Resolver.Resolve <IDeviceActionService>();
            _deviceInfoService      = Resolver.Resolve <IDeviceInfoService>();
            _lockService            = Resolver.Resolve <ILockService>();

            Init();
        }
コード例 #20
0
        /// <summary>
        /// Implementation of IComparable
        /// </summary>
        /// <param name="other">The other object to consider for comparison</param>
        /// <returns>-1: this is before other
        ///           0: this is in same position as other
        ///           1: this is after other</returns>
        public int CompareTo(IFingerprint other)
        {
            other.ArgumentIsNotNull(nameof(other));

            ScanResultFingerprint typedOther = other as ScanResultFingerprint;

            if (typedOther == null)
            {
                throw new InvalidOperationException("This operation is only supported on ScanResultFingerprint objects");
            }

            return(TypedCompareTo(typedOther));
        }
コード例 #21
0
 /// <summary>
 ///     The constructor.
 /// </summary>
 /// <param name="secretKey">The merchant secret key.</param>
 /// <param name="requestMappingIntercessor">The API request mapper.</param>
 /// <param name="fingerprint">The client Fingerprint.</param>
 public BillPaymentsClient(
     string secretKey,
     RequestMappingIntercessor requestMappingIntercessor,
     IFingerprint fingerprint
     )
 {
     _headers = new Dictionary <string, string>
     {
         { "Content-Type", "application/json" },
         { "Accept", "application/json" },
         { "Authorization", "Bearer " + secretKey }
     };
     _requestMappingIntercessor = requestMappingIntercessor;
     _fingerprint = fingerprint;
 }
コード例 #22
0
        public override void ViewDidLoad()
        {
            _settings    = Resolver.Resolve <ISettings>();
            _fingerprint = Resolver.Resolve <IFingerprint>();

            View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);

            var descriptor = UIFontDescriptor.PreferredBody;

            UseButton.Font            = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
            UseButton.BackgroundColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f);
            UseButton.TintColor       = UIColor.White;
            UseButton.TouchUpInside  += UseButton_TouchUpInside;

            base.ViewDidLoad();
        }
コード例 #23
0
 public static BillPaymentsClient Create(
     string secretKey,
     IClient client             = null,
     IObjectMapper objectMapper = null,
     IFingerprint fingerprint   = null
     )
 {
     return(new BillPaymentsClient(
                secretKey,
                new RequestMappingIntercessor(
                    client ?? ClientFactory.Create(),
                    objectMapper ?? ObjectMapperFactory.Create()
                    ),
                fingerprint ?? FingerprintFactory.Create()
                ));
 }
コード例 #24
0
        public void MergeIssuesFromStore_SourceIssueIsInTarget_AddsLocationToIssue_AddSucceeds_ReturnsOne()
        {
            using (ShimsContext.Create())
            {
                IFingerprint actualFingerprint   = null;
                ILocation    actualLocation      = null;
                IFingerprint expectedFingerprint = new StubIFingerprint();
                ILocation    expectedLocation    = new StubILocation();
                Issue        expectedIssue       = new ShimIssue
                {
                    FingerprintGet = () => expectedFingerprint,
                    LocationsGet   = () => new List <ILocation> {
                        expectedLocation
                    },
                    AddLocationILocation = (l) =>
                    {
                        actualLocation = l;
                        return(AddResult.ExistingItemUpdated);
                    },
                };

                using (IIssueStore sourceStore = new StubIIssueStore
                {
                    IsEnumerableGet = () => true,
                    IssuesGet = () => new List <Issue> {
                        expectedIssue
                    },
                })
                    using (IIssueStore targetStore = new StubIIssueStore
                    {
                        IsUpdatableGet = () => true,
                        TryFindIssueIFingerprintIssueOut = (IFingerprint f, out Issue i) =>
                        {
                            actualFingerprint = f;
                            i = expectedIssue;
                            return(true);
                        },
                    })
                    {
                        Assert.IsNull(actualFingerprint);
                        Assert.IsNull(actualLocation);
                        Assert.AreEqual(1, targetStore.MergeIssuesFromStore(sourceStore));
                        Assert.AreSame(expectedFingerprint, actualFingerprint);
                        Assert.AreSame(expectedLocation, actualLocation);
                    }
            }
        }
コード例 #25
0
        public void RegisterMachine(IFingerprint id, string name, IDictionary <string, string> data)
        {
            var machine = _repository.GetMachine((Fingerprint)id);

            if (machine == null)
            {
                _repository.AddMachine(new Machine((Fingerprint)id, name, data));
            }
            else
            {
                var newMachine = new Machine((Fingerprint)id, machine.Name, data);
                if (!machine.AreEqual(newMachine))
                {
                    _repository.UpdateMachine(newMachine);
                }
            }
        }
コード例 #26
0
        public void MergeIssuesFromStore_SourceIssueIsNotInTarget_AddsIssueToTarget_AddSucceeds_ReturnsOne()
        {
            using (ShimsContext.Create())
            {
                IFingerprint actualFingerprint   = null;
                Issue        actualIssue         = null;
                IFingerprint expectedFingerprint = new StubIFingerprint();
                Issue        expectedIssue       = new ShimIssue
                {
                    FingerprintGet = () => expectedFingerprint,
                };

                using (IIssueStore sourceStore = new StubIIssueStore
                {
                    IsEnumerableGet = () => true,
                    IssuesGet = () => new List <Issue> {
                        expectedIssue
                    },
                })
                    using (IIssueStore targetStore = new StubIIssueStore
                    {
                        IsUpdatableGet = () => true,
                        TryFindIssueIFingerprintIssueOut = (IFingerprint f, out Issue i) =>
                        {
                            actualFingerprint = f;
                            i = null;
                            return(false);
                        },
                        AddIssueIssue = (i) =>
                        {
                            actualIssue = i;
                            return(AddResult.ItemAdded);
                        },
                    })
                    {
                        Assert.IsNull(actualFingerprint);
                        Assert.IsNull(actualIssue);
                        Assert.AreEqual(1, targetStore.MergeIssuesFromStore(sourceStore));
                        Assert.AreSame(expectedFingerprint, actualFingerprint);
                        Assert.AreSame(expectedIssue, actualIssue);
                    }
            }
        }
コード例 #27
0
        public override void ViewDidLoad()
        {
            _settings    = Resolver.Resolve <ISettings>();
            _fingerprint = Resolver.Resolve <IFingerprint>();

            NavItem.Title        = AppResources.VerifyFingerprint;
            CancelButton.Title   = AppResources.Cancel;
            View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);

            UseButton.SetTitle(AppResources.UseFingerprintToUnlock, UIControlState.Normal);
            var descriptor = UIFontDescriptor.PreferredBody;

            UseButton.Font            = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
            UseButton.BackgroundColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f);
            UseButton.TintColor       = UIColor.White;
            UseButton.TouchUpInside  += UseButton_TouchUpInside;

            base.ViewDidLoad();
        }
コード例 #28
0
        private static void TestCreateBill_Assert(CreateBillInfo createBillInfo, IFingerprint fingerprint,
                                                  BillResponse billResponse)
        {
            var query = HttpUtility.ParseQueryString(billResponse.PayUrl.Query);

            Assert.AreEqual(createBillInfo.BillId, billResponse.BillId, "Same bill id");
            Assert.AreEqual(createBillInfo.Amount.ValueDecimal, billResponse.Amount.ValueDecimal, "Same amount value");
            Assert.AreEqual(createBillInfo.Amount.CurrencyEnum, billResponse.Amount.CurrencyEnum,
                            "Same amount currency");
            Assert.AreEqual(createBillInfo.Comment, billResponse.Comment, "Same comment");
            Assert.AreEqual(createBillInfo.ExpirationDateTime, billResponse.ExpirationDateTime,
                            "Same expiration dateTime");
            Assert.AreEqual(createBillInfo.Customer.Email, billResponse.Customer.Email, "Same email");
            Assert.AreEqual(createBillInfo.Customer.Account, billResponse.Customer.Account, "Same account");
            Assert.AreEqual(createBillInfo.Customer.Phone, billResponse.Customer.Phone, "Same phone");
            Assert.AreEqual(createBillInfo.SuccessUrl, query["successUrl"], "Same success url");
            Assert.AreEqual(BillStatusEnum.Waiting, billResponse.Status.ValueEnum, "Status value preset");
            Assert.AreEqual(fingerprint.GetClientName(), billResponse.CustomFields.ApiClient, "Api client preset");
            Assert.AreEqual(fingerprint.GetClientVersion(), billResponse.CustomFields.ApiClientVersion,
                            "Api client preset");
        }
コード例 #29
0
        /// <summary>
        /// Convert the provided elements to issues for the store. In a separate method to assist with unit testing
        /// </summary>
        /// <param name="fileName">Path to the file that provided the elements</param>
        /// <param name="elementSet">Elements from the provided file</param>
        /// <param name="store">The list of elements that we need to update</param>
        internal static void ExtractIssues(string fileName, IEnumerable <A11yElement> elementSet, IDictionary <IFingerprint, Issue> store)
        {
            fileName.ArgumentIsNotTrivialString(nameof(fileName));
            elementSet.ArgumentIsNotNull(nameof(elementSet));

            foreach (A11yElement element in elementSet)
            {
                if (element.ScanResults == null)
                {
                    continue;
                }

                ScanStatus status = element.ScanResults.Status;

                // Include only elements with failures or uncertains
                if (status != ScanStatus.Fail && status != ScanStatus.Uncertain)
                {
                    continue;
                }

                foreach (ScanResult scanResults in element.ScanResults.Items)
                {
                    foreach (RuleResult ruleResult in scanResults.Items)
                    {
                        // Update the issue store--duplicate fingerprints are possible
                        // with some UIA trees
                        IFingerprint fingerprint = BuildFingerprint(element, ruleResult.Rule, ruleResult.Status);
                        ILocation    location    = BuildLocation(element, fileName);

                        if (!store.TryGetValue(fingerprint, out Issue issue))
                        {
                            store.Add(fingerprint, issue = BuildIssue(SynthesizeIssueType(ruleResult.Rule, ruleResult.Status), fingerprint));
                        }
                        issue.AddLocation(location);
                    }
                }
            }
        }
コード例 #30
0
        public override void ViewDidLoad()
        {
            _appSettingsService = Resolver.Resolve <IAppSettingsService>();
            _fingerprint        = Resolver.Resolve <IFingerprint>();
            _deviceInfo         = Resolver.Resolve <IDeviceInfoService>();

            BaseNavItem.Title      = _deviceInfo.HasFaceIdSupport ? AppResources.VerifyFaceID : AppResources.VerifyFingerprint;
            BaseCancelButton.Title = AppResources.Cancel;
            View.BackgroundColor   = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);

            BaseUseButton.SetTitle(_deviceInfo.HasFaceIdSupport ? AppResources.UseFaceIDToUnlock :
                                   AppResources.UseFingerprintToUnlock, UIControlState.Normal);
            var descriptor = UIFontDescriptor.PreferredBody;

            BaseUseButton.Font            = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
            BaseUseButton.BackgroundColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f);
            BaseUseButton.TintColor       = UIColor.White;
            BaseUseButton.TouchUpInside  += UseButton_TouchUpInside;

            BaseFingerprintButton.SetImage(new UIImage(_deviceInfo.HasFaceIdSupport ? "smile.png" : "fingerprint.png"),
                                           UIControlState.Normal);

            base.ViewDidLoad();
        }
コード例 #31
0
ファイル: ReaderInfoForm.cs プロジェクト: paopaofeng/dp2
        int StartFingerprintChannel(
            string strUrl,
            out string strError)
        {
            strError = "";

            //Register the channel with ChannelServices.
            ChannelServices.RegisterChannel(m_fingerPrintChannel, true);

            try
            {
                m_fingerPrintObj = (IFingerprint)Activator.GetObject(typeof(IFingerprint),
                    strUrl);
                if (m_fingerPrintObj == null)
                {
                    strError = "无法连接到服务器 " + strUrl;
                    return -1;
                }
            }
            finally
            {
            }

            return 0;
        }