Пример #1
0
        bool HashFiles()
        {
            foreach (var fileSystemItem in fileSystemItems)
            {
                OnProgressChanged?.Invoke(this, fileSystemItem.name);
                manualResetEvent.WaitOne();
                if (backgroundWorker.CancellationPending)
                {
                    return(false);
                }

                if (fileSystemItem.type == FileSystemItemType.Directory || FileSystemItemAccess.Default != fileSystemItem.access)
                {
                    hashWriter.WriteResultLine(new HashedFileSystemItem(fileSystemItem, hash: null));
                }
                else
                {
                    if (!HashAndAddToResult(fileSystemItem))
                    {
                        return(false);
                    }
                }
            }

            hashWriter.CloseFile();
            return(true);
        }