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(); }
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(); }
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"; }
public void AttachDevice(ushort startAddress, ushort size, IIoDevice device) { var details = new AttachedDeviceDetails { StartAddress = startAddress, Size = size, Device = device, }; _devices.Add(details); MapDevice(details); }
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; }
public void RemoveDevice(IIoDevice device) => RemoveDevice(device.Id);