Esempio n. 1
0
        public void Lockout_Template_NullParameter_Test()
        {
            var template = new Lockout(null);
            var output   = template.TransformText();

            Assert.NotNull(output);
            Assert.NotEmpty(output);
        }
Esempio n. 2
0
        public void Lockout_Template_Test()
        {
            var template = new Lockout(new SmartAppInfo {
                Id = ApplicationId
            });
            var output = template.TransformText();

            Assert.NotNull(output);
            Assert.NotEmpty(output);
        }
Esempio n. 3
0
    public object Clone()
    {
        Lockout clone = new Lockout
        {
            LockoutRate = LockoutRate,
            LastAttempt = LastAttempt
        };

        return(clone);
    }
Esempio n. 4
0
        public async Task <bool> UpdateLockout(int value)
        {
            Lockout lockout = new Lockout
            {
                Id     = 1,
                Locked = value
            };

            _content.Lockouts.Update(lockout);
            return(await _content.SaveChangesAsync() > 0);
        }
Esempio n. 5
0
 public T Combine()
 {
     var output = User;
     if (Logins != null)
         output.Logins = new List<UserLoginInfo>(Logins.Select(l => l.ToUserLoginInfo()));
     if (Claims != null)
         output.Claims = new List<SimplifiedClaim>(Claims);
     if (Lockout != null)
         output.Lockout = Lockout.SingleOrDefault();
     if(Roles != null)
         output.Roles = new List<Neo4jIdentityRole>(Roles);
     
     return output;
 }
Esempio n. 6
0
        public async void LoadLogsAsync(string path)
        {
            ProgressProgressBar.IsIndeterminate = true;
            ProgressProgressBar.Visibility      = Visibility.Visible;
            ErrorsTreeView.IsEnabled            = false;

            var TotalTime = Stopwatch.StartNew();

            OutputListView.Items.Add("Starting Count");

            var time = Stopwatch.StartNew();

            using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                List <int> Parts = new List <int>();

                Parts = await TotalLines(path);

                OutputListView.Items.Add("Finished Count");
                OutputListView.Items.Add($"Count took: { time.Elapsed.ToString() }");

                time.Restart();
                OutputListView.Items.Add("Starting Procress");

                List <Task <List <Core.Objects.Log> > > worker = new List <Task <List <Core.Objects.Log> > >();

                int offset = 0;
                int start  = 0;

                OutputListView.Items.Add($"Using { Parts.Count } Workers");

                foreach (int pos in Parts)
                {
                    int size = (pos) - offset;

                    worker.Add(
                        Task.Run(() =>
                    {
                        byte[] data = new byte[size];
                        fs.Read(data, start, size);

                        List <Core.Objects.Log> logs = ProcressBytes(data);

                        return(logs);
                    }));

                    offset += size;
                }

                var res = await Task.WhenAll(worker);

                List <Core.Objects.GroupedLogs> GroupedLogs = new List <Core.Objects.GroupedLogs>();

                int count = 0;

                foreach (var item in res)
                {
                    count += item.Count;

                    item.ForEach(log =>
                    {
                        Core.Objects.GroupedLogs groupedLogs = GroupedLogs.Find(A => A.Username == log.Username);

                        if (groupedLogs != null)
                        {
                            groupedLogs.Logs.Add(log);
                        }
                        else
                        {
                            GroupedLogs.Add(new Core.Objects.GroupedLogs()
                            {
                                Username = log.Username,
                                Logs     = { log }
                            });
                        }
                    });
                }

                GroupedLogs.ForEach(item =>
                {
                    TreeViewItem viewItem = new TreeViewItem();
                    viewItem.Header       = item.Username;
                    viewItem.IsExpanded   = true;

                    item.Logs.OrderByDescending(a => a.DateTime).ToList().ForEach(Lockout =>
                    {
                        viewItem.Items.Add(Lockout.GetDetails());
                    });

                    ErrorsTreeView.Items.Add(viewItem);
                });

                OutputListView.Items.Add("Completed Procress");
                time.Stop();
                OutputListView.Items.Add($"Count took: { time.Elapsed.ToString() }");

                OutputListView.Items.Add($"Total Number Of Items: { count }");
            }

            OutputListView.Items.Add($"Total Time: { TotalTime.Elapsed.ToString() }");

            ProgressProgressBar.Visibility = Visibility.Hidden;
            ErrorsTreeView.IsEnabled       = true;
        }
Esempio n. 7
0
        private void TransformViewsAccountLockout(SmartAppInfo manifest)
        {
            var template = new Lockout(manifest);

            _writingService.WriteFile(Path.Combine(_context.BasePath, template.OutputPath), template.TransformText());
        }