Пример #1
0
 public RaceTower()
 {
     _tyreFactory   = new TyreFactory();
     _driverFactory = new DriveFactory();
     _racingDrivers = new List <Driver>();
     _failedDrivers = new Stack <Driver>();
 }
Пример #2
0
        public BaseRule(IConfiguration configuration, Browser browser)
        {
            this.configuration = configuration;
            this.browser       = browser;

            string path = null;

            // carrega os driver da maquina de acordo com o arquivo de configuração {appsettings.json}
            if (browser == Browser.Firefox)
            {
                path = configuration.GetSection("Drivers:Firefox").Value;
            }
            else
            {
                path = configuration.GetSection("Drivers:Chrome").Value;
            }

            // inicia o driver para inicio da automatização
            driver = DriveFactory.CreateDriver(browser, path, false);
        }
Пример #3
0
        private IEnumerable <IFileSystemItemModel> CreateFileSystemRootItems(IEnumerable <DriveInfo> drives, CancellationToken cancellationToken)
        {
            var rootItems = new List <IFileSystemItemModel>();

            foreach (DriveInfo drive in drives)
            {
                cancellationToken.ThrowIfCancellationRequested();
                var rootItem = DriveFactory.Invoke(drive);
                rootItems.Add(rootItem);
                IndexFileSystemItem(rootItem);

                if (rootItem.IsReady && !FileSystemRootChangeObservers.ContainsKey(rootItem.Info.FullName))
                {
                    var driveChangedObserver = new FileSystemWatcher(rootItem.Info.FullName);
                    driveChangedObserver.Changed     += OnFileSystemItemChanged;
                    driveChangedObserver.Renamed     += OnFileSystemItemRenamed;
                    driveChangedObserver.Created     += OnFileSystemItemCreated;
                    driveChangedObserver.Deleted     += OnFileSystemItemChanged;
                    driveChangedObserver.Error       += OnFileSystemWatcherError;
                    driveChangedObserver.NotifyFilter = NotifyFilters.Attributes
                                                        | NotifyFilters.CreationTime
                                                        | NotifyFilters.DirectoryName
                                                        | NotifyFilters.FileName
                                                        | NotifyFilters.LastAccess
                                                        | NotifyFilters.LastWrite
                                                        | NotifyFilters.Security
                                                        | NotifyFilters.Size;
                    driveChangedObserver.IncludeSubdirectories = true;
                    driveChangedObserver.InternalBufferSize    = 4096 * 4;
                    driveChangedObserver.EnableRaisingEvents   = true;

                    FileSystemRootChangeObservers.Add(rootItem.Info.FullName, driveChangedObserver);
                }
            }
            return(rootItems);
        }