public static void AddDetector(IDetector instance) { if (!(Detectors as List <IDetector>).Contains(instance)) { (Detectors as List <IDetector>).Add(instance); } }
public void SetUp() { File.Delete(ProjectPath); _mockRepository = new MockRepository(); _inputFile1 = MockRepository.GenerateStub <IInputFile>(); _inputFile2 = MockRepository.GenerateStub <IInputFile>(); _detector1 = MockRepository.GenerateStub <IDetector>(); _detector2 = MockRepository.GenerateStub <IDetector>(); _dataBlock1 = MockRepository.GenerateStub <IDataBlock>(); _dataBlock2 = MockRepository.GenerateStub <IDataBlock>(); _dataBlock3 = MockRepository.GenerateStub <IDataBlock>(); _columnInfo1 = MockRepository.GenerateStub <IColumnInfo>(); _columnInfo2 = MockRepository.GenerateStub <IColumnInfo>(); _updatedColumnInfo = MockRepository.GenerateStub <IColumnInfo>(); _createInputFile = MockRepository.GenerateStub <Creator <IInputFile, IProject, string> >(); _inputFile1.Stub(x => x.Name).Return(DummyFileName); _inputFile1.Stub(x => x.Length).Return(DummyFileLength); _inputFile2.Stub(x => x.Name).Return(EmptyFileName); _inputFile2.Stub(x => x.Length).Return(EmptyFileLength); _dataBlock1.Stub(x => x.InputFile).Return(_inputFile1); _dataBlock2.Stub(x => x.InputFile).Return(_inputFile2); _dataBlock3.Stub(x => x.InputFile).Return(_inputFile2); _columnInfo1.Stub(x => x.Name).Return(ColumnName1); _columnInfo1.Stub(x => x.Width).Return(ColumnWidth1); _columnInfo2.Stub(x => x.Name).Return(ColumnName2); _columnInfo2.Stub(x => x.Width).Return(ColumnWidth2); _project = new Project(_createInputFile, ProjectPath); _createInputFile.Stub(x => x(_project, FileName1)).Return(_inputFile1); _createInputFile.Stub(x => x(_project, FileName2)).Return(_inputFile2); }
public void SerializeProjectDetectorConfiguration() { // Open a project IProject project1 = TestFramework.ProjectManager.CreateProject(ProjectPath, ProjectInvestigator, DateTime.Now, ProjectDescription); // Change detector configuration IDetector mockConfigurableDetector = TestFramework.DetectorFactory.Detectors.Single(detector => detector.Name == "MockConfigurableDetector"); IConfigurationItem configurationItem = (mockConfigurableDetector as IConfigurable).Configuration.ElementAt(0); Assert.That((int)configurationItem.Value, Is.EqualTo(123)); configurationItem.SetUserValue("456"); Assert.That((int)configurationItem.Value, Is.EqualTo(456)); // Save the project containing the detector configuration TestFramework.ProjectManager.SaveProject(project1); TestFramework.ProjectManager.CloseProject(project1); // Change the detector configuration configurationItem.SetUserValue("123"); // Check the change made Assert.That((int)configurationItem.Value, Is.EqualTo(123)); // Open project IProject project2 = TestFramework.ProjectManager.OpenProject(ProjectPath); // Check the detector configuration Assert.That((int)configurationItem.Value, Is.EqualTo(456)); TestFramework.ProjectManager.CloseProject(project2); }
public void TestSubstDETMultipleDetectors() { String parameters = "-a [DET]"; IResultNode top1 = MockRepository.GenerateStub <IResultNode>(); IResultNode top2 = MockRepository.GenerateStub <IResultNode>(); IResultNode child1 = MockRepository.GenerateStub <IResultNode>(); top1.Stub(t => t.Children).Return(new IResultNode[] { child1 }); child1.Stub(c => c.Children).Return(new IResultNode[0]); top2.Stub(t => t.Children).Return(new IResultNode[0]); _selection.Stub(s => s.Results).Return(new IResultNode[] { top1, top2 }); ICodecDetector okDetector = MockRepository.GenerateStub <ICodecDetector>(); okDetector.Stub(d => d.Name).Return("ok detector"); IDetector notOkDetector = MockRepository.GenerateStub <IDetector>(); notOkDetector.Stub(d => d.Name).Return("not ok detector"); top1.Stub(t => t.Detectors).Return(new IDetector[] { okDetector }); top2.Stub(t => t.Detectors).Return(new IDetector[] { notOkDetector }); child1.Stub(t => t.Detectors).Return(new IDetector[] { okDetector }); String subst = _checker.Substitute(parameters, _selection, _dataPacket, outputFilename); Assert.AreEqual(subst, "-a \"ok detector\""); }
public void AddVisibleColumn(IDetector detector, IColumnInfo visibleColumn) { if (detector == null) { throw new ArgumentNullException("detector"); } if (visibleColumn == null) { throw new ArgumentNullException("visibleColumn"); } List <IColumnInfo> visibleColumns; if (_visibleColumns.TryGetValue(detector, out visibleColumns)) { visibleColumns.Add(visibleColumn); } else { visibleColumns = new List <IColumnInfo>(); visibleColumns.Add(visibleColumn); _visibleColumns.Add(detector, visibleColumns); } UpdateProject(ProjectChangedType.VisibleColumnsChanged, detector); }
public void UpdateColumnWidth(IDetector detector, string columnName, int columnWidth) { // TODO: detector should be in project; create unit test PreConditions.Argument("detector").Value(detector).IsNotNull(); PreConditions.Argument("columnName").Value(columnName).IsNotNull().And.IsNotEmpty(); if (columnWidth < 0) { throw new ArgumentOutOfRangeException("columnWidth"); } List <IColumnInfo> columns; if (_visibleColumns.TryGetValue(detector, out columns)) { for (int i = 0; i < columns.Count; i++) { IColumnInfo columnInfo = columns[i]; if (columnInfo.Name == columnName) { IColumnInfo updatedColumnInfo = columnInfo.UpdateWidth(columnWidth); if (updatedColumnInfo != columnInfo) { columns[i] = updatedColumnInfo; UpdateProject(ProjectChangedType.VisibleColumnsChanged, detector); } return; } } } throw new ArgumentException(string.Format("'{0}' is not a visible column.", columnName), "columnName"); }
public static IDetector DetectDetector(Stream stream) { string pre = null; IDetector foundDetector = null; while (true) { bool found = false; foreach (var detector in from d in Detectors where d.Precondition == pre select d) { stream.Position = 0; if (detector.Detect(stream)) { found = true; foundDetector = detector; pre = detector.Extension; break; } } if (!found) { break; } } return(foundDetector); }
public static IDetectorPlugin UpdateDetector(IOpenRPAClient client, IDetector entity) { foreach (var d in detectorPluginTypes) { if (d.Key == entity.Plugin) { IDetectorPlugin plugin = Plugins.detectorPlugins.Where(x => x.Entity._id == entity._id).FirstOrDefault(); if (plugin == null) { return(AddDetector(client, entity)); } try { plugin.Stop(); plugin.Entity = entity; if (string.IsNullOrEmpty(entity.name)) { entity.name = plugin.Name; } plugin.Start(); return(plugin); } catch (Exception ex) { Log.Error("OpenRPA.Interfaces.Plugins.AddDetector: " + ex.ToString()); } } } return(null); }
/// <summary> /// 刷新触发器 /// </summary> /// <param name="detector">触发器</param> public void RefreshDetector(IDetector detector) { if (!m_IsInitialized) { return; } m_RefreshTime += Time.deltaTime; //达到刷新时间才刷新,避免区域更新频繁 if (m_RefreshTime > m_MaxRefreshTime) { m_OldRefreshPosition = detector.Position; m_RefreshTime = 0; m_CurrentDetector = detector; //进行触发检测 m_QuadTree.Trigger(detector, m_TriggerHandle); //标记超出区域的物体 MarkOutofBoundsObjs(); //m_IsInitLoadComplete = true; } if (m_PreDestroyObjectQueue != null && m_PreDestroyObjectQueue.Count > m_MinCreateCount) { m_DestroyRefreshTime += Time.deltaTime; if (m_DestroyRefreshTime > m_MaxDestroyTime) { // m_OldDestroyRefreshPosition = detector.Position; m_DestroyRefreshTime = 0; //删除超出区域的物体 DestroyOutOfBoundsObjs(); } } }
public void Trigger(IDetector detector, TriggerHandle <T> handle) { if (handle == null) { return; } for (int i = 0; i < m_ChildNodes.Length; i++) { var node = m_ChildNodes[i]; if (node != null) { node.Trigger(detector, handle); } } if (detector.IsDetected(m_Bounds)) { var node = m_ObjectList.First; while (node != null) { if (detector.IsDetected(node.Value.Bounds)) { handle(node.Value); } node = node.Next; } } }
public MockResult(IResultNode parent, IDataReader dataReader, long offset, long length, string name) { if (parent == null) { throw new ArgumentNullException("parent"); } if (dataReader == null) { throw new ArgumentNullException("dataReader"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset"); } if (length <= 0) { throw new ArgumentOutOfRangeException("length"); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } _name = name; _attributes = new List <IResultAttribute>(); _dataPacket = dataReader.GetDataPacket(offset, length); _detector = parent.Detectors.First(); Offset = offset; parent.AddChild(this); }
public void TestInitializePlugins() { TestFramework.DetectorFactory.Initialize("."); IDetector detector = TestFramework.DetectorFactory.GetDetector(typeof(MockDetectorReaderWriter)); Assert.AreEqual("TestDefraser.MockDetectorReaderWriter", detector.Name, "IDetector.Name"); Assert.AreEqual("Wrapped detector: TestDefraser.MockDetectorReaderWriter", detector.ToString(), "IDetector.ToString()"); Assert.AreEqual("The dummy plug-in to test the framework.", detector.Description, "IDetector.Description"); //string[] columns = Framework.GetCustomColumnNames(detector); //Assert.AreEqual(5, columns.Length, "DetectorInfo.GetColumns().Length"); //Assert.AreEqual("General first", columns[0], "DetectorInfo.GetColumns()[0]"); //Assert.AreEqual("Type1 specific second", columns[3], "DetectorInfo.GetColumns()[3]"); //Assert.AreEqual("Type2 specific second", columns[4], "DetectorInfo.GetColumns()[4]"); //Assert.AreEqual("General third", columns[2], "DetectorInfo.GetColumns()[2]"); //Assert.AreEqual("General fourth", columns[1], "DetectorInfo.GetColumns()[1]"); Assert.AreEqual(".dat", detector.OutputFileExtension, "DetectorInfo.OutputFileExtension"); Assert.IsTrue(detector.ColumnInHeader("correct type 1", "General first"), "DetectorInfo.ColumnInHeader()"); Assert.IsTrue(detector.ColumnInHeader("correct type 1", "Type1 specific second"), "DetectorInfo.ColumnInHeader()"); Assert.IsFalse(detector.ColumnInHeader("correct type 1", "Type2 specific second"), "DetectorInfo.ColumnInHeader()"); Assert.IsTrue(detector.ColumnInHeader("correct type 1", "General third"), "DetectorInfo.ColumnInHeader()"); Assert.IsTrue(detector.ColumnInHeader("correct type 1", "General fourth"), "DetectorInfo.ColumnInHeader()"); Assert.IsTrue(detector.ColumnInHeader("correct type 2", "Type2 specific second"), "DetectorInfo.ColumnInHeader()"); Assert.IsFalse(detector.ColumnInHeader("correct type 1", "Something"), "DetectorInfo.ColumnInHeader()"); detector = Util.FindDetector(TestFramework.DetectorFactory.Detectors, "TestDefraser.MockDetectorSave"); Assert.AreEqual("TestDefraser.MockDetectorSave", detector.Name, "IDetector.Name"); Assert.AreEqual("Wrapped detector: Defraser.Test.MockDetectorSave", detector.ToString(), "IDetector.ToString()"); Assert.AreEqual("The mock detector to test data block and result saving.", detector.Description, "IDetector.Description"); //columns = Framework.GetCustomColumnNames(detector); //Assert.AreEqual(0, columns.Length, "DetectorInfo.GetColumns().Length"); //Assert.AreEqual(".dat", detector.OutputFileExtension, "DetectorInfo.OutputFileExtension"); }
private void AddColumn(IDetector detector, IColumnInfo columnInfo, bool visible) { if (!ContainsColumn(columnInfo.Name)) { Column column = new Column(); column.Caption = columnInfo.Caption; column.DataField = (detector == null) ? string.Empty : detector.Name; column.Name = columnInfo.Name; // Now you can use Columns[Column.Name] to get a column column.Active = visible; column.HeaderStyle.HorzAlignment = columnInfo.HorizontalAlignment; column.CellStyle.HorzAlignment = columnInfo.HorizontalAlignment; column.Width = columnInfo.Width; Columns.Add(column); if (column.Name == HeaderPanel.SortColumnName) { column.Active = true; HeaderPanel.SortColumn = column; } } else { Column column = Columns[columnInfo.Name]; if (column != null) { column.Active = visible; column.Width = columnInfo.Width; } } }
public WcfProcessor(IDetector detector, IDependencyValidator dependencyValidator, IConfigFileAppender fileAppender, IFileMover assemblyMover) { this.detector = detector; this.dependencyValidator = dependencyValidator; this.fileAppender = fileAppender; this.assemblyMover = assemblyMover; }
private void TriggerToNode(IDetector detector, TriggerHandle <T> handle, int depth, float centerx, float centerz, float sizex, float sizez) { if (depth == m_MaxDepth) { uint m = Morton2FromWorldPos(centerx, centerz); if (m_Nodes.ContainsKey(m) && m_Nodes[m] != null) { m_Nodes[m].Trigger(detector, handle); } } else { int colider = detector.GetDetectedCode(centerx, m_Bounds.center.y, centerz, true); float sx = sizex * 0.5f, sz = sizez * 0.5f; if ((colider & 1) != 0) { TriggerToNode(detector, handle, depth + 1, centerx - sx * 0.5f, centerz - sz * 0.5f, sx, sz); } if ((colider & 2) != 0) { TriggerToNode(detector, handle, depth + 1, centerx - sx * 0.5f, centerz + sz * 0.5f, sx, sz); } if ((colider & 4) != 0) { TriggerToNode(detector, handle, depth + 1, centerx + sx * 0.5f, centerz - sz * 0.5f, sx, sz); } if ((colider & 8) != 0) { TriggerToNode(detector, handle, depth + 1, centerx + sx * 0.5f, centerz + sz * 0.5f, sx, sz); } } }
private void TriggerDetectorNearToFar(IDetector detector, TriggerHandle <T> handle) { uint row = (uint)Mathf.FloorToInt((detector.Position.x - m_Bounds.min.x) / m_DeltaWidth); uint col = (uint)Mathf.FloorToInt((detector.Position.z - m_Bounds.min.z) / m_DeltaHeight); uint maxcol = (uint)Mathf.Pow(2, m_MaxDepth); float bias = Mathf.Cos(22.5f * Mathf.Deg2Rad); int direct = 1; if (detector.Rotation != null) { direct = Mathf.FloorToInt(((detector.Rotation.y + 360.0f) % 360.0f + 22.5f) / 45.0f) + 1; } //完整遍历的最大N int circleN = (int)Mathf.Min(maxcol - row, maxcol - col, row, col); TriggerOneCircleNodes(detector, (int)row, (int)col, 0, direct, (int)maxcol, handle); /* * if (row <= maxcol && col <= maxcol) * { * uint m = MortonCodeUtil.EncodeMorton2(row, col); * if (m_Nodes.ContainsKey(m) && m_Nodes[m] != null) * { * m_Nodes[m].Trigger(detector, handle); * } * } * for (int i = 1; i < 9; i++) * { * uint nrow = row + (uint)directs[i].x; * uint ncol = col + (uint)directs[i].y; * TriggerOneNode(detector, nrow, ncol, i, maxcol, handle); * }*/ }
/// <summary> /// Refresh detector /// </summary> /// <param name="detector">the detector</param> public void RefreshDetector(IDetector detector) { if (!m_IsInitialized) { return; } // only when the position changes, it refreshes if (m_OldRefreshPosition != detector.Position) { m_RefreshTime += Time.deltaTime; //Also the refresh interval needs to be reached too if (m_RefreshTime > m_MaxRefreshTime) { m_OldRefreshPosition = detector.Position; m_RefreshTime = 0; m_CurrentDetector = detector; // detect this character bounding box with the nodes in quadtree m_QuadTree.Trigger(detector, m_TriggerHandle); //mark the out of bound objects MarkOutofBoundsObjs(); } if (m_PreDestroyObjectQueue != null) //if (m_PreDestroyObjectList != null && m_PreDestroyObjectList.Count >= m_MaxCreateCount) { m_DestroyRefreshTime += Time.deltaTime; if (m_DestroyRefreshTime > m_MaxDestroyTime) { m_OldDestroyRefreshPosition = detector.Position; m_DestroyRefreshTime = 0; //Delete out of bound objects DestroyOutOfBoundsObjs(); } } } }
public void Initialize(IOpenRPAClient client, IDetector InEntity) { this.client = client; Entity = InEntity; watcher = new FileSystemWatcher(); Start(); }
public Detector AddDetector(string type) { IDetector d = null; switch (type) { case "NPC": d = new NPCDetector(settings); break; case "Object": d = new ObjectDetector(settings); break; case "FarmAnimal": d = new FarmAnimalDetector(settings); break; case "WaterEntity": d = new WaterEntityDetector(settings); break; case null: return(this); } detectors.Add(type, d); return(this); }
public void Trigger(IDetector detector, TriggerHandler handle) { if (handle == null) { return; } if (mChildren != null) { for (int i = 0; i < mChildren.Length; i++) { var node = mChildren[i]; if (node != null) { node.Trigger(detector, handle); } } } if (detector.IsDetected(mBounds)) { var node = mEntities.First; while (node != null) { if (detector.IsDetected(node.Value.bounds)) { handle(node.Value); } node = node.Next; } } }
private static ILearner LoadLearner(IObjectModel objectModel, IDetector detector) { // initial positive patch synthesis info WarpInfo initPosPatchWarpInfo = new WarpInfo(0.01f, 0.01f, 10); PositivePatchSynthesisInfo initPosPatchSynthesisInfo = new PositivePatchSynthesisInfo( 100, 10, initPosPatchWarpInfo, 0.2 ); WarpInfo runtimePosPatchWarpInfo = new WarpInfo(0.01f, 0.01f, 10); PositivePatchSynthesisInfo runtimePosPatchSynthesisInfo = new PositivePatchSynthesisInfo( 100, 10, runtimePosPatchWarpInfo, 0.2 ); // initial negative patch picking info NegativePatchPickingInfo initNegPatchPickInfo = new NegativePatchPickingInfo(50, 10, 0.2f); NegativePatchPickingInfo runtimeNegPatchPickInfo = new NegativePatchPickingInfo(100, 10, 0.2f); Learner learner = new Learner( objectModel, detector, initPosPatchSynthesisInfo, initNegPatchPickInfo, runtimePosPatchSynthesisInfo, runtimeNegPatchPickInfo, 0.95f, 0.57f ); return(learner); }
public void Trigger(IDetector detector, TriggerHandle <T> handle) { if (handle == null) { return; } //bool isInView = false; if (!detector.IsDetected(m_Bounds)) { return; } //触发当前节点下的所有物体 var node = m_ObjectList.First; while (node != null) { //如果是最大节点, 就不检测了,直接触发 if (m_CurrentDepth == m_MaxDepth || detector.IsDetected(node.Value.Bounds)) { handle(node.Value); } node = node.Next; } for (int i = 0; i < m_ChildNodes.Length; i++) { if (m_ChildNodes[i] != null) { m_ChildNodes[i].Trigger(detector, handle); } } }
public void Initialize(IOpenRPAClient client, IDetector InEntity) { Entity = InEntity; recEngine.SetInputToDefaultAudioDevice(); recEngine.SpeechRecognized += SpeechRecognized; Start(); }
private void GetCellDataFragment(IFragment fragment, Column column, CellData cellData) { if (column == columnName) { cellData.Value = (ResultBeingRetrieved == fragment) ? string.Format("Retrieving data {0}%", RetrieveResultProgressPercentage) : fragment.GetDescriptiveName(); } else if (column == columnDetector) { IDetector detector = fragment.Detectors.First(); cellData.Value = IsUnknownDetector(detector) ? "Not available" : detector.Name; } else if (column == columnDetectorVersion) { cellData.Value = GetDetectorVersion(fragment.Detectors.First()); } else if (column == columnOffset) { if (fragment is IDataBlock) { cellData.Format = _numericColumnFormat; cellData.Value = fragment.StartOffset; } } else if (column == columnLength) { cellData.Format = _numericColumnFormat; cellData.Value = fragment.Length; } }
/// <summary> /// Reset one configuration item /// </summary> /// <param name="detector">the detector to set the configuration item on</param> /// <param name="configurationItemKey">The configuration item to reset to its default value</param> public static void ResetConfigurationItem(this IDetector detector, string configurationItemKey) { PreConditions.Argument("detector").Value(detector).IsNotNull(); PreConditions.Argument("configurationItemKey").Value(configurationItemKey).IsNotNull().And.IsNotEmpty(); GetConfigurationItem(detector, configurationItemKey).ResetDefault(); }
public static IDetectorPlugin AddDetector(IOpenRPAClient client, IDetector entity) { foreach (var d in detectorPluginTypes) { if (d.Key == entity.Plugin) { try { IDetectorPlugin plugin = (IDetectorPlugin)Activator.CreateInstance(d.Value); if (string.IsNullOrEmpty(entity.name)) { entity.name = plugin.Name; } plugin.Initialize(client, entity); IDetectorPlugin exists = Plugins.detectorPlugins.Where(x => x.Entity._id == entity._id).FirstOrDefault(); if (exists == null) { Plugins.detectorPlugins.Add(plugin); } return(plugin); } catch (Exception ex) { Log.Error("OpenRPA.Interfaces.Plugins.AddDetector: " + ex.ToString()); } } } return(null); }
private void init_inters() { this.inters = new Intersection[this.inter_num]; ISignalControllerContainer scContain = this.vissim.Net.SignalControllers; ISignalController[] SC = new ISignalController[this.inter_num]; this.dc = this.vissim.Net.Detectors; Dictionary <int, int> portno_key = new Dictionary <int, int>(); for (int i = 1; i <= this.dc.Count; i++) { IDetector det = this.dc.get_ItemByKey(i); int id = det.get_AttValue("PORTNO"); portno_key[id] = i; } int[] real_key = new int[this.dc.Count]; for (int i = 0; i < this.dc.Count; i++) { real_key[i] = portno_key[i + 1]; } for (int i = 0; i < this.inter_num; i++) { SC[i] = scContain.get_ItemByKey(i + 1); this.inters[i] = new Intersection(this.vissim, i + 1, this.dc, this.stpln_det_config[i], this.overflow_det_config[i], SC[i], this.inter_graph, real_key); } foreach (var inter in this.inters) { inter.init_neighbors(this.inters); } }
private void CompleteDeserialization(IDetectorFactory detectorFactory) { if (Detector != null) { _detector = detectorFactory.GetDetector(Detector.DetectorType) ?? Detector; } }
public void SetUp() { File.Delete(ProjectPath); _mockRepository = new MockRepository(); _inputFile1 = MockRepository.GenerateStub <IInputFile>(); _inputFile2 = MockRepository.GenerateStub <IInputFile>(); _detector1 = MockRepository.GenerateStub <IDetector>(); _detector2 = MockRepository.GenerateStub <IDetector>(); _dataBlock1 = MockRepository.GenerateStub <IDataBlock>(); _dataBlock2 = MockRepository.GenerateStub <IDataBlock>(); _dataBlock3 = MockRepository.GenerateStub <IDataBlock>(); _columnInfo1 = MockRepository.GenerateStub <IColumnInfo>(); _columnInfo2 = MockRepository.GenerateStub <IColumnInfo>(); _updatedColumnInfo = MockRepository.GenerateStub <IColumnInfo>(); _projectChangedEventHandler = _mockRepository.StrictMock <EventHandler <ProjectChangedEventArgs> >(); _propertyChangedEventHandler = _mockRepository.StrictMock <PropertyChangedEventHandler>(); _createInputFile = MockRepository.GenerateStub <Creator <IInputFile, IProject, string> >(); _inputFile1.Stub(x => x.Name).Return(FileName1); _inputFile2.Stub(x => x.Name).Return(FileName2); _dataBlock1.Stub(x => x.InputFile).Return(_inputFile1); _dataBlock2.Stub(x => x.InputFile).Return(_inputFile2); _dataBlock3.Stub(x => x.InputFile).Return(_inputFile2); _columnInfo1.Stub(x => x.Name).Return(ColumnName1); _columnInfo1.Stub(x => x.Width).Return(ColumnWidth1); _columnInfo2.Stub(x => x.Name).Return(ColumnName2); _columnInfo2.Stub(x => x.Width).Return(ColumnWidth2); _project = new Project(_createInputFile, ProjectPath); _createInputFile.Stub(x => x(_project, FileName1)).Return(_inputFile1); _createInputFile.Stub(x => x(_project, FileName2)).Return(_inputFile2); }
internal CodecStream(CodecStreamBuilder builder) { _dataFormat = builder.DataFormat; _detector = builder.Detector; _dataPacket = builder.Data; _streamNumber = builder.StreamNumber; _name = RemoveIllegalCharatersForXml(builder.Name); _dataBlock = builder.DataBlock; _absoluteStartOffset = builder.AbsoluteStartOffset; _referenceHeaderOffset = builder.ReferenceHeaderOffset; _referenceHeader = builder.ReferenceHeader; IsFragmented = builder.IsFragmented; // Check for previous fragment and connect if one exists IFragment previousFragment = builder.PreviousFragment; if ((previousFragment != null) && previousFragment.IsFragmented) { FragmentContainer = previousFragment.FragmentContainer; if (FragmentContainer == null) { FragmentContainer = new FragmentContainer(); FragmentContainer.Add(previousFragment); previousFragment.FragmentContainer = FragmentContainer; } FragmentContainer.Add(this); FragmentIndex = previousFragment.FragmentIndex + 1; } }
public MocksTests() { _Detector = DetectorCreator.GetDefaultDetector(); var InFiles = Directory.GetFiles(@"Mocks\", "*.in"); var OutFiles = Directory.GetFiles(@"Mocks\", "*.out"); foreach (var OutputFile in OutFiles) { using (var OpenedFile = File.OpenRead(OutputFile)) { StreamReader Reader = new StreamReader(OpenedFile); var Data = Reader.ReadToEnd(); TestOut.Add(OutputFile, Data.Trim()); } } foreach (var InputFile in InFiles) { List<string> Viruses = new List<string>(); using (var OpenedFile = File.OpenRead(InputFile)) { StreamReader Reader = new StreamReader(OpenedFile); var Data = Reader.ReadToEnd(); var Lines = Data.Split('\n'); foreach (var LoopLine in Lines) { if (LoopLine.Length > 0) { Viruses.Add(LoopLine.Trim()); } } } TestIns.Add(InputFile, Viruses); Debug.WriteLine("{0} - Viruses: {1}\n", InputFile, Viruses.Count); } }
public AlarmTriggerdEvent(IDetector detector) { _detector = detector; }
public DotNetVersionWriter(IDetector detector) { _detector = detector; }
/// <summary> /// Detects is there Dwm in container. /// </summary> /// <param name="detector">Detecting algorithm.</param> /// <param name="inputStream">Conteiner file stream.</param> /// <returns>True if Dwm exists in container or false if it is not.</returns> public static bool DetectDwm(IDetector detector, Stream inputStream) { Container container = new Container(inputStream); return detector.Detect(container); }
public DetectorTests() { _Detector = DetectorCreator.GetDefaultDetector(); }
public DetectorTriggerdCommand(IDetector detector) { _detector = detector; }
public void AssignCaptureSource(string source, string detector) { _detector = DetectorFactory.GetDetector(detector).Value; _capture = SourceFactory.GetCaptureDevice(source, FrameProcessor).Value; }
public void AssignDetector(string detector) { _detector = DetectorFactory.GetDetector(detector).Value; }