public DataForNeuralNetworkContext(IDataCollector collector, IfDataNotExist ifDataNotExist, Func <Entity, double, double> converter) { IfDataNotExist = ifDataNotExist; Collector = collector; Converter = converter; }
private void SaveAllCarsForSource(IServiceProvider serviceProvider, SourceEnum source, bool newOnes) { int threads = 30; List <ModelSearchDto> list = serviceProvider.GetService <ModelFinder>().GetAll(source); IList <ModelSearchDto>[] bins = list.ToBins(threads); Thread[] thread = new Thread[threads]; IServiceScope[] scopes = new IServiceScope[threads]; try { for (int i = 0; i < bins.Length; i++) { scopes[i] = serviceProvider.CreateScope(); IDataCollector dataCollector = scopes[i].ServiceProvider.GetDataCollector(source); IServiceProvider scopedServiceProvider = scopes[i].ServiceProvider; IList <ModelSearchDto> bin = bins[i]; thread[i] = new Thread(() => SaveCars(dataCollector, bin, scopedServiceProvider, newOnes)); thread[i].Start(); } for (int i = 0; i < thread.Length; i++) { thread[i].Join(); } } finally { for (int i = 0; i < scopes.Length; i++) { scopes[i].Dispose(); } } }
internal StateController(IDataCollector sender, Labyrinth GameState, Player[] Players) { this.Phase = sender; this.Current = GameState; this.Players = Players; this.Chest = new Vector2((int)GameState.Board.GetLength(1) / 2, (int)GameState.Board.GetLength(0) / 2); }
public DataForNeuralNetworkContext(IDataCollector collector, IfDataNotExist ifDataNotExist, string extrapolatorName) { IfDataNotExist = ifDataNotExist; Collector = collector; Extrapolator = new NeuralExtrapolation(extrapolatorName); }
private void AddData(IDataCollector recorder) { if (recorder != null) { streamWriter.Write(recorder.Data() + separator); } }
public void Collect(IDataCollector collector) { collector.CreateFileEntry("Registry.csv"); try { _writer = new StreamWriter(collector.Stream); _writer.WriteLine(String.Concat("Key", Consts.CsvSeparator, "Error", Consts.CsvSeparator)); CollectRootKey(Registry.ClassesRoot, collector); CollectRootKey(Registry.CurrentUser, collector); CollectRootKey(Registry.LocalMachine, collector); CollectRootKey(Registry.Users, collector); CollectRootKey(Registry.CurrentConfig, collector); } catch (AbortException) { throw; } catch (Exception ex) { collector.ShowException(ex); } finally { collector.CloseFileEntry(); } }
/// <summary> /// Write the data collector to the database with no output messaging other than progress dots /// </summary> /// <param name="collector"></param> /// <param name="driver"></param> /// <returns></returns> public static List <IResultSummary> WriteIDataCollector(IDataCollector collector, IDriver driver, bool showprogressdots) { NeoQueryData collectionsdata = collector.CollectData(); List <IResultSummary> summaries = NeoWriter.RunQuery(collector.Query, collectionsdata, driver, showprogressdots); return(summaries); }
public Player(IDataCollector sender, Color PawnColor, Vector2 StartingPosition, int Index, bool HumanControlled = false) { this.Human = HumanControlled; this.Position = StartingPosition; this.PawnColor = PawnColor; this.PlayerIndex = Index; this.Phase = sender; }
public SearchWatchListCommand(IDataService dataService, IDataCollector dataCollector, IReader reader, IWriter writer) { this.dataService = dataService; this.dataCollector = dataCollector; this.reader = reader; this.writer = writer; this.collectedData = new List <string>(); }
public DataCollectorFacade() { _dataCollector = new DataCollector(CommonConstants.SelfMonitoringProductKey, "https://localhost"); _dataCollector.Initialize(true); _dataCollector.InitializeProcessMonitoring(true, true, true); InitializeSensors(); }
public DataForNeuralNetworkContext(IDataCollector collector, IfDataNotExist ifDataNotExist, Func <Entity, double, double> converter, string extrapolatorName) { IfDataNotExist = ifDataNotExist; Collector = collector; Converter = converter; Extrapolator = new NeuralExtrapolation(extrapolatorName); }
public TaskGraphService(IDataProvider <DataLayer.Models.TaskGraph, Guid> dataProvider, IDataCollector <DataLayer.Models.TaskGraph, DataLayer.Models.TaskGraph, DataLayer.Models.TaskGraph> dataCollector, IDataProvider <DataLayer.Models.Workspace, Guid> WsDataProvider) { this.dataCollector = dataCollector; this.dataProvider = dataProvider; this.WsDataProvider = WsDataProvider; }
public IThread Create(IScheduler scheduler, IScenarioHandler handler, IDataCollector collector) { IWork scenarioWork = new ScenarioWork(scheduler, handler, collector); IThread thread = new WorkerThread(scenarioWork, _prewait); _errorHandler.Register(thread); return(thread); }
public CovidDataCollectorController(ICosmosRepository cosmosRepository, IGitHubClient gitHubClient, IDataCollector dataCollector, DbConnection dbConnection, IOptions <GitHubConfig> gitHubConfig) { this.cosmosRepository = cosmosRepository; this.gitHubRepo = gitHubClient.Repository; this.dataCollector = dataCollector; this.dbConnection = (SqlConnection)dbConnection; this.gitHubConfig = gitHubConfig; covid19Services = cosmosRepository.CosmosServices["covid19-ita"].Value; }
/// <summary> /// Initializes a new instance of the StructureBuilder class /// </summary> public StructureBuilder(IDataCollector parent) { this.parent = parent; rootCollection = new ThreadLocal <DynamicResult[]>(); currentCallback = new ThreadLocal <ExecuteQuery>(); currentItem = new ThreadLocal <DynamicResult>(); currentConfiguration = new ThreadLocal <QueryConfigurationCollection>(); parents = new ThreadLocal <List <DynamicResult> >(); }
public Monitor( IDataCollector collector, IActivityProcessor processor, ILoggingConfiguration configuration, IMonitorBehaviorFactory behaviorFactory) { _applicationId = configuration.ApplicationId; _collector = collector; _processor = processor; _behaviorFactory = behaviorFactory; }
public void Collect(IDataCollector collector) { collector.CreateFileEntry("Files.csv"); try { _writer = new StreamWriter(collector.Stream); _writer.WriteLine(String.Concat("File", Consts.CsvSeparator , "Length", Consts.CsvSeparator , "Attributes", Consts.CsvSeparator , "CreationTime", Consts.CsvSeparator , "LastAccessTime", Consts.CsvSeparator , "LastWriteTime", Consts.CsvSeparator , "FileVersion", Consts.CsvSeparator , "CompanyName", Consts.CsvSeparator , "LegalCopyright", Consts.CsvSeparator , "LegalTrademarks", Consts.CsvSeparator , "Language", Consts.CsvSeparator , "FileDescription", Consts.CsvSeparator , "Comments", Consts.CsvSeparator , "Error", Consts.CsvSeparator)); foreach (DriveInfo drive in DriveInfo.GetDrives()) { try { if (drive.DriveType != DriveType.Fixed || !drive.IsReady) continue; CollectDrive(drive.RootDirectory.FullName, collector); } catch (AbortException) { throw; } catch (Exception ex) { collector.ShowException(ex); } } } catch (AbortException) { throw; } catch (Exception ex) { collector.ShowException(ex); } finally { collector.CloseFileEntry(); } }
public MainCollector( IConfigSetNameProvider configSetNameProvider, IDataCollectionsConfigProvider dataCollectionsConfigProvider, IDataCollector dataCollector, ICollectorModeProvider collectorModeProvider) { _configSetNameProvider = configSetNameProvider; _dataCollectionsConfigProvider = dataCollectionsConfigProvider; _dataCollector = dataCollector; _collectorModeProvider = collectorModeProvider; }
public IThread Create() { IIterationControl iterationContext = _iterationContextFactory.Create(); IReplayScenarioHandler handler = _scenarioHandlerFactory.Create(iterationContext); IScheduler scheduler = _schedulerFactory.Create(handler, iterationContext.ThreadId); IDataCollector collector = _dataCollectorFactory.Create(iterationContext); IThread thread = _threadFactory.Create(scheduler, handler, collector); return(thread); }
public void Collect(IDataCollector collector) { collector.CreateFileEntry("Services.csv"); try { collector.CurrentState = String.Empty; StreamWriter writer = new StreamWriter(collector.Stream); bool isRunFirst = true; using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Service")) { foreach (ManagementBaseObject obj in searcher.Get()) { if (isRunFirst) { foreach (PropertyData property in obj.Properties) { if (!IsDisplay(property)) continue; writer.Write(property.Name); writer.Write(Consts.CsvSeparator); } writer.WriteLine(); isRunFirst = false; } foreach (PropertyData property in obj.Properties) { if (!IsDisplay(property)) continue; writer.Write(property.Value); writer.Write(Consts.CsvSeparator); } writer.WriteLine(); collector.CheckIsStop(); } } } catch (AbortException) { throw; } catch (Exception ex) { collector.ShowException(ex); } finally { collector.CloseFileEntry(); } }
public IDataCollector getDataCollector(string name, Configuration.Options options, string connector = "") { Requested++; IDataCollector collector = dataCollectors_.Find(x => x.isSameCollector(name, options, connector)); if (collector != null) { return(collector); } return(createDataCollector(name, options, connector)); }
public void Start(IDataCollector dataCollector) { this.dataCollector = dataCollector; clientArgs = new SocketAsyncEventArgs(); client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); clientArgs.Completed += clientArgs_Completed; clientArgs.UserToken = client; clientArgs.RemoteEndPoint = GetIPEndPoint(); client.ConnectAsync(clientArgs); clientConnected.WaitOne(); }
public IThread Create() { IIterationControl iterationContext = _iterationContextFactory.Create(); // IScenario handler IScenarioHandler scenarioHandler = _scenarioHandlerFactory.Create(iterationContext); // Scheduler which will Sleep() thread if it needs to wait due to speed limiting strategy. IScheduler scheduler = _schedulerFactory.Create(iterationContext); // Data collector for results aggregation IDataCollector collector = _dataCollectorFactory.Create(iterationContext); IThread thread = _threadFactory.Create(scheduler, scenarioHandler, collector); return(thread); }
/// <summary> /// Creates a Labyrinth board with given dimensions. /// </summary> /// <param name="BoardSize">An integer defining the board dimensions. This number should be uneven! and greater than 4.</param> /// <param name="StraightBlocks">An integer defining the amount of Straight type blocks on both the board and reserves combined.</param> /// <param name="CornerBlocks">An integer defining the amount of Corner type blocks on both the board and reserves combined.</param> /// <param name="TSplitBlocks">An integer defining the amount of T-Split type blocks on both the board and reserves combined.</param> /// <param name="ReserveBlocks">An integer defining the amount of reserve blocks available. This value has a default of 5 and should be greater than 0.</param> internal Labyrinth(IDataCollector sender, Player[] Players, int BoardSize, int StraightBlocks, int CornerBlocks, int TSplitBlocks, int ReserveBlocks) { this.Players = Players; this.Phase = sender; Board = new LabyrinthBlock[BoardSize, BoardSize]; Reserves = new LabyrinthBlock[ReserveBlocks]; int TotalBlocks = BoardSize * BoardSize + ReserveBlocks - 5; // 5 = Corners + chest List<int> Blocks = new List<int>(){ StraightBlocks, CornerBlocks, TSplitBlocks }; // Start randomizer RandomizeBoard(Blocks); }
private void SaveCars(IDataCollector dataCollector, IList <ModelSearchDto> bin, IServiceProvider serviceProvider, bool newCars) { AutoDbContext dbContext = serviceProvider.GetService <AutoDbContext>(); foreach (ModelSearchDto model in bin) { IEnumerable <Car> cars = dataCollector.GetAllCars(model, newCars); foreach (Car car in cars) { dbContext.Cars.Add(car); } dbContext.SaveChanges(); } }
public void Collect(IDataCollector collector) { collector.CreateFileEntry("Msinfo.nfo"); try { collector.CurrentState = String.Empty; string fileName = Path.GetTempPath() + "msinfo.nfo"; Process process = Process.Start("msinfo32.exe", "/nfo " + String.Format("\"{0}\"", fileName)); if (process == null) throw new ApplicationException("Cannot start Msinfo32"); while (!process.WaitForExit(100)) collector.CheckIsStop(); if (!File.Exists(fileName)) throw new ApplicationException("Msinfo32 is failed or cancelled"); using (Stream fileStream = File.OpenRead(fileName)) StreamUtils.Copy(fileStream, collector.Stream, new byte[4096]); try { File.Delete(fileName); } catch { } } catch (AbortException) { throw; } catch (Exception ex) { collector.ShowException(ex); } finally { collector.CloseFileEntry(); } }
public ScenarioWork(IScheduler scheduler, IScenarioHandler handler, IDataCollector collector) { if (scheduler == null) { throw new ArgumentNullException(nameof(scheduler)); } if (handler == null) { throw new ArgumentNullException(nameof(handler)); } if (collector == null) { throw new ArgumentNullException(nameof(collector)); } _scheduler = scheduler; _handler = handler; _collector = collector; }
bool configCheckRemote(string key, string value, Configuration.Options options) { string name = value.ToLower(); if (graphic_.supportCheck(name)) { IDataCollector dataCollector = graphic_.CollectorManager.getDataCollector(name, options, options[0]); if (dataCollector != null) { graphic_.DataCollector = dataCollector; graphic_.DataCollector.MaxUpdateInterval = graphic_.MaxDCUpdateInterval; graphic_.DataAccessor = dataCollector.getDataAccessor(graphic_.DataAccessorName); return(true); } } else { graphic_.log(Console.LogType.Error, $"Check type {value} isn't supported"); } return(false); }
public SdkAnalyzerForm() { InitializeComponent(); m_collector = new DataCollector(); System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + _PATH.TRACER_PATH); tbxLogOutput.Text = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + _PATH.TRACER_PATH + _PATH.TRACER_LOG; m_collector.SetLog(tbxLogOutput.Text); m_collector.Create(); FileInfo log_path = new FileInfo(tbxLogOutput.Text); if (log_path.Exists) { button_Open.Enabled = true; btnDeleteLog.Enabled = true; } else { button_Open.Enabled = false; btnDeleteLog.Enabled = false; } }
public void Check(XtraReport report, IDataCollector dataCollector) { if (report == null || dataCollector == null) { return; } var dynamicTableCells = dataCollector.DynamicTableCellsCollector.DynamicTableCells; foreach (var table in report.AllControls <XRTable>()) { if (dynamicTableCells.ContainsKey(table.Name)) { var orgCell = table.Rows[0].Cells[0]; table.Rows.Clear(); var newRow = new XRTableRow(); table.Rows.Add(newRow); var orgWidth = table.Width; var columnCount = Math.Max(dynamicTableCells[table.Name].Count, 1); var newWidth = orgWidth / columnCount; foreach (var dynamicTableCell in dynamicTableCells[table.Name]) { var newCell = CreateNewTableCell(orgCell); SetDynamicTableCellProperties(newCell, dynamicTableCell); newRow.Cells.Add(newCell); } foreach (var cell in newRow.Cells) { ((XRTableCell)cell).WidthF = newWidth; } } } }
private void CollectRootKey(RegistryKey key, IDataCollector collector) { _keys.Clear(); _keys.Push(key); while (_keys.Count > 0) { RegistryKey currKey = _keys.Pop(); if (currKey == null) continue; string currKeyName = currKey.ToString(); collector.CurrentState = currKeyName; CollectKey(currKeyName, String.Empty); foreach (string keyName in currKey.GetSubKeyNames()) { try { _keys.Push(currKey.OpenSubKey(keyName)); } catch (Exception ex) { if (!IsValidException(ex)) throw; CollectKey(currKey + "\\" + keyName, ex.Message); } } currKey.Close(); collector.CheckIsStop(); } }
/// <summary> /// Initializes a new instance of the <see cref="ContextVariablesSetter" /> class. /// </summary> /// <param name="dataCollector">The data collector.</param> /// <param name="disableAutomaticSiteTitleSet">if set to <c>true</c> then automatic site title set will be disabled.</param> public ContextVariablesSetter(IDataCollector dataCollector, bool disableAutomaticSiteTitleSet) { _dataCollector = dataCollector; _disableAutomaticSiteTitleSet = disableAutomaticSiteTitleSet; }
private void CollectDrive(string drive, IDataCollector collector) { _directories.Clear(); _directories.Push(drive); while (_directories.Count > 0) { string currDir = _directories.Pop(); try { foreach (string file in Directory.GetFiles(currDir)) { try { CollectFile(file); } catch (Exception ex) { if (!IsValidException(ex)) throw; WriteError(currDir, ex); } } foreach (string dir in Directory.GetDirectories(currDir)) _directories.Push(dir); } catch (Exception ex) { if (!IsValidException(ex)) throw; WriteError(currDir, ex); } collector.CurrentState = currDir; collector.CheckIsStop(); } }
public TaskSetService(IDataProvider <TaskSetDataModel, Guid> dataProvider, IDataCollector <TaskSetDataModel, TaskSetDataModel, TaskSetDataModel> dataCollector) { this.dataCollector = dataCollector; this.dataProvider = dataProvider; }
/// <summary> /// Initializes a new instance of the <see cref="PageBuilder" /> class. /// </summary> /// <param name="templateFactory">The template factory.</param> /// <param name="dataCollector">The data collector.</param> public PageBuilder(ITemplateFactory templateFactory, IDataCollector dataCollector) { _templateFactory = templateFactory; _dataCollector = dataCollector; }
/// <summary> /// Initializes a new instance of the <see cref="MessageBoxHandler"/> class. /// </summary> /// <param name="templateFactory">The template factory.</param> /// <param name="stringTable">The string table.</param> /// <param name="dataCollector">The data collector.</param> public MessageBoxHandler(ITemplateFactory templateFactory, IStringTable stringTable, IDataCollector dataCollector) { _templateFactory = templateFactory; _stringTable = stringTable; _dataCollector = dataCollector; }
public CollectDataCommand(IDataCollector dataCollector) { this.dataCollector = dataCollector ?? throw new ArgumentNullException(nameof(dataCollector)); }
/// <summary> /// Initializes a new instance of the <see cref="MessageBox"/> class. /// </summary> /// <param name="templateFactory">The template factory.</param> /// <param name="stringTable">The string table.</param> /// <param name="dataCollector">The data collector.</param> public MessageBox(ITemplateFactory templateFactory, IStringTable stringTable, IDataCollector dataCollector) { _templateFactory = templateFactory; _stringTable = stringTable; _dataCollector = dataCollector; }
/// <summary> /// Initializes a new instance of the <see cref="StringTableItemsSetter"/> class. /// </summary> /// <param name="dataCollector">The data collector.</param> /// <param name="stringTable">The string table.</param> public StringTableItemsSetter(IDataCollector dataCollector, IStringTable stringTable) { _dataCollector = dataCollector; _stringTable = stringTable; }
public UsersService(IDataProvider <DataLayer.Models.User, Guid> dataProvider, IDataCollector <DataLayer.Models.User, DataLayer.Models.User, DataLayer.Models.User> dataCollector) { this.dataCollector = dataCollector; this.dataProvider = dataProvider; }
public RegistrationServer(IDataCollector dataCollector) { m_DataCollector = dataCollector; }
public ContextVariablesSetter(IDataCollector dataCollector, bool disableAutomaticSiteTitleSet) { _dataCollector = dataCollector; _disableAutomaticSiteTitleSet = disableAutomaticSiteTitleSet; }
public WorkspaceService(IDataProvider <DataTransfer.Models.Workspace> dataProvider, IDataCollector <DataTransfer.Models.Workspace> dataCollector) { this.dataProvider = dataProvider; this.dataCollector = dataCollector; }
public void Collect(IDataCollector collector) { try { byte[] buffer = new byte[4096]; foreach (EventLog eventLog in EventLog.GetEventLogs()) { collector.CurrentState = String.Format("{0}/{1}", eventLog.MachineName, eventLog.LogDisplayName); IntPtr handle = OpenEventLog(eventLog.MachineName, eventLog.Log); if (handle == IntPtr.Zero) throw new Win32Exception(Marshal.GetLastWin32Error()); try { string log = ZipEntry.CleanName(eventLog.Log); string backupFileName = Path.GetTempPath() + log + ".evt"; if (!BackupEventLog(handle, backupFileName)) throw new Win32Exception(Marshal.GetLastWin32Error()); collector.CreateFileEntry(log + ".evt"); try { using (Stream fileStream = File.OpenRead(backupFileName)) StreamUtils.Copy(fileStream, collector.Stream, buffer); } finally { collector.CloseFileEntry(); } try { File.Delete(backupFileName); } catch { } } catch (Exception ex) { collector.ShowException(ex); } finally { CloseEventLog(handle); } } } catch (AbortException) { throw; } catch (Exception ex) { collector.ShowException(ex); } #region Fully managed version - Commented //StreamWriter writer = new StreamWriter(collector.Stream); //writer.WriteLine(String.Concat("DisplayName", Consts.CsvSeparator // , "MachineName", Consts.CsvSeparator // , "Index", Consts.CsvSeparator // , "Category", Consts.CsvSeparator // , "EntryType", Consts.CsvSeparator // , "UserName", Consts.CsvSeparator // , "Source", Consts.CsvSeparator // , "TimeGenerated", Consts.CsvSeparator // , "TimeWritten", Consts.CsvSeparator // , "Message", Consts.CsvSeparator)); //foreach (EventLog eventLog in EventLog.GetEventLogs()) //{ // collector.CurrentState = eventLog.LogDisplayName; // foreach (EventLogEntry entry in eventLog.Entries) // { // StringBuilder msgBuilder = new StringBuilder(entry.Message); // msgBuilder.Replace("\"", "\"\""); // msgBuilder.Replace('\n', ' '); // writer.WriteLine(String.Concat(eventLog.LogDisplayName, Consts.CsvSeparator // , eventLog.MachineName, Consts.CsvSeparator // , entry.Index, Consts.CsvSeparator // , entry.Category, Consts.CsvSeparator // , entry.EntryType, Consts.CsvSeparator // , entry.UserName, Consts.CsvSeparator // , entry.Source, Consts.CsvSeparator // , entry.TimeGenerated, Consts.CsvSeparator // , entry.TimeWritten, Consts.CsvSeparator // , "\"" + msgBuilder + "\"", Consts.CsvSeparator)); // collector.CheckIsStop(); // } //} #endregion }