Пример #1
0
        public ThreadFileObj(int index, int core, string fileName, IUserForm userForm)
        {
            Index    = index;
            Core     = core;
            FileName = fileName;
            UserForm = userForm;

            FileType = FileType.None;
        }
Пример #2
0
        public InterceptionView(IUserForm userform, bool documentView = false)
        {
            if (userform == null)
            {
                throw new ArgumentNullException(nameof(userform));
            }

            _logger       = new Logger();
            this.UserForm = userform;

            BuildUI(documentView);
        }
Пример #3
0
 public UsersController(IHttpContextAccessor _httpContextAccessor,
                        AdminContext context,
                        IRbacService rbacService,
                        IUserViewModel userViewModel,
                        IUserForm userForm,
                        IStorageService storage)
 {
     httpContextAccessor = _httpContextAccessor;
     _context            = context;
     rbac      = rbacService;
     _userForm = userForm;
     _storage  = storage;
 }
Пример #4
0
        public void SetTestPage(FrameworkElement elem)
        {
            this.Title += elem.GetType().Name;

            _userdata = new XElement("UserData");
            testContainer.Children.Add(elem);

            _userform = elem as IUserForm;
            if (_userform != null)
            {
                _userform.SetData(_userdata, 1, 1, 1);
            }

            RefreshXmlText();
        }
Пример #5
0
        public static void CalculateFileHash(ThreadFileObj fileObj)
        {
            string    fileName = fileObj.FileName;
            IUserForm userForm = fileObj.UserForm;

            byte[] buffer;
            byte[] oldBuffer;
            int    bytesRead;
            int    oldBytesRead;
            long   size;
            long   totalBytesRead = 0;

            using (Stream stream = File.OpenRead(fileName))
                using (HashAlgorithm hashAlgorithm = GetHashAlgorithm(ChecksumType.MD5)) {
                    size = stream.Length;

                    buffer          = new byte[4096];
                    bytesRead       = stream.Read(buffer, 0, buffer.Length);
                    totalBytesRead += bytesRead;

                    do
                    {
                        oldBytesRead = bytesRead;
                        oldBuffer    = buffer;

                        buffer          = new byte[4096];
                        bytesRead       = stream.Read(buffer, 0, buffer.Length);
                        totalBytesRead += bytesRead;

                        if (bytesRead == 0)
                        {
                            hashAlgorithm.TransformFinalBlock(oldBuffer, 0, oldBytesRead);
                        }
                        else
                        {
                            hashAlgorithm.TransformBlock(oldBuffer, 0, oldBytesRead, oldBuffer, 0);
                        }

                        int progress = (size == 0) ? 0 : (int)((double)totalBytesRead * 100 / size);
                        fileObj.Progress = progress;
                        userForm.ReportProgress(fileObj);
                    } while (bytesRead != 0);

                    fileObj.Hash = hashAlgorithm.Hash;
                    userForm.ReportHash(fileObj);
                }
        }
Пример #6
0
 public bool Equals(IUserForm other)
 {
     return(Equals(other as SafeComWrapper <VB.VBForm>));
 }
Пример #7
0
 public bool Equals(IUserForm other)
 {
     return(Equals(other as SafeComWrapper <Microsoft.Vbe.Interop.Forms.UserForm>));
 }