예제 #1
0
 public void Create(string filePath, string options)
 {
     if (!File.Exists(filePath))
     {
         throw new Exception(string.Format(Res.FileNotFoundMessage, filePath));
     }
     var assembly = GetAssembly(filePath);
     if (assembly == null)
     {
         throw new Exception(string.Format(Res.FileNotAssemblyMessage, filePath));
     }
     var type = GetType(assembly);
     if (type == null)
     {
         throw new Exception(string.Format(Res.AssemblyDoesNotContainInterfaceImplementantionMessage,
             assembly.FullName, typeof(IIoDevice).Name));
     }
     var constructor = GetConstructor(type);
     if (constructor == null)
     {
         throw new Exception(string.Format(Res.TypeDoesNotHaveConstructorMessage, type.Name));
     }
     _ioDevice = (IIoDevice) constructor.Invoke(new object[] { options });
     _ioDevice.Open();
 }
예제 #2
0
        public void Create(string filePath, string options)
        {
            if (!File.Exists(filePath))
            {
                throw new Exception(string.Format(Res.FileNotFoundMessage, filePath));
            }
            var assembly = GetAssembly(filePath);

            if (assembly == null)
            {
                throw new Exception(string.Format(Res.FileNotAssemblyMessage, filePath));
            }
            var type = GetType(assembly);

            if (type == null)
            {
                throw new Exception(string.Format(Res.AssemblyDoesNotContainInterfaceImplementantionMessage,
                                                  assembly.FullName, typeof(IIoDevice).Name));
            }
            var constructor = GetConstructor(type);

            if (constructor == null)
            {
                throw new Exception(string.Format(Res.TypeDoesNotHaveConstructorMessage, type.Name));
            }
            _ioDevice = (IIoDevice)constructor.Invoke(new object[] { options });
            _ioDevice.Open();
        }
예제 #3
0
        public void Dispose()
        {
            IIoDevice ioDevice = _ioDevice;

            if (ioDevice != null)
            {
                ioDevice.Dispose();
            }
        }
        public void Initialize()
        {
            ioDevice = Substitute.For <IIoDevice>();
            var mockHandler = new MockHttpMessageHandler();
            var httpClient  = new HttpClient(mockHandler);

            pageDownloadService            = new PageDownloadService(ioDevice, httpClient);
            pageDownloadService.BaseAdress = "https://en.wikipedia.org";
        }
예제 #5
0
파일: Bus.cs 프로젝트: awsxdr/gbemu
        public void AttachDevice(ushort startAddress, ushort size, IIoDevice device)
        {
            var details = new AttachedDeviceDetails
            {
                StartAddress = startAddress,
                Size         = size,
                Device       = device,
            };

            _devices.Add(details);
            MapDevice(details);
        }
예제 #6
0
 public WikiReferencesCollector(
     IPageDownloadService pageDownloadService,
     IFileSystemService fileSystemService,
     IWikiReferencesParsingService wikiReferencesParser,
     IReferencesDbService referencesDbService,
     IIoDevice ioDevice)
 {
     this.folderPath                     = ConfigurationManager.AppSettings["FolderPath"];
     this.maxIterations                  = int.Parse(ConfigurationManager.AppSettings["MaxIterations"]);
     this.startPage                      = ConfigurationManager.AppSettings["StartPage"];
     this.pageDownloadService            = pageDownloadService;
     this.pageDownloadService.BaseAdress = ConfigurationManager.AppSettings["Uri"];
     this.fileSystemService              = fileSystemService;
     this.wikiReferencesParsingService   = wikiReferencesParser;
     this.referencesDbService            = referencesDbService;
     this.ioDevice = ioDevice;
     this.mutexObj = new Mutex(true, "ReferenceCollector", out canRun);
     dbLock        = new object();
 }
        public PageDownloadService(IIoDevice ioDevice, HttpClient httpClient)
        {
            this.httpClient = httpClient;

            this.ioDevice = ioDevice;
        }
예제 #8
0
파일: Bus.cs 프로젝트: awsxdr/gbemu
 public void RemoveDevice(IIoDevice device) => RemoveDevice(device.Id);