public async Task <IHttpActionResult> Post(Log log) { try { log.Address = GetHostAddress(); log.Id = Guid.NewGuid().ToString("N"); log.CreateDate = DateTime.Now; LogCache.Logs.Add(log); if (LogCache.Logs.Count >= 1000) { var task = Task.Run(() => { using (var dbContext = new AppDbContext()) { LogCache.CacheToDb(dbContext); } }); } } catch (Exception e) { return(BadRequest(e.Message)); } return(Ok()); }
private CachedLog HandelNewFile(string path) { var absolutPath = path; var bossID = GetBoss(path).ID; var date = File.GetCreationTime(absolutPath); var sizeKb = (int)Math.Ceiling(new FileInfo(absolutPath).Length / 1000.0); var newLog = new CachedLog(-1, bossID, absolutPath, null, null, null, sizeKb, date); newLog.ID = LogDBConnector.Insert(newLog.GetDBLog()); var taskName = newLog.BossName.Length > 17 ? newLog.BossName.Substring(0, Math.Min(17, newLog.BossName.Length)) + "..." : newLog.BossName; LogCache.Add(newLog); OnDataChanged(new EventArgs()); if (EnableAutoParsing && EnableAutoUpload) { ParseAndUpload(newLog.ID, $"{Language.Data.FooterProcessing} {taskName}"); } else if (EnableAutoParsing) { Parse(newLog.ID, $"{Language.Data.FooterParsing} {taskName}"); } else if (EnableAutoUpload) { Upload(newLog.ID, $"{Language.Data.FooterUploading} {taskName}"); } GC.Collect(); return(newLog); }
public UploadProcessor(DpsReportUploader dpsReportUploader, LogCache logCache) { DpsReportUploader = dpsReportUploader ?? throw new ArgumentNullException(nameof(dpsReportUploader)); LogCache = logCache ?? throw new ArgumentNullException(nameof(logCache)); DpsReportUserToken = Settings.DpsReportUserToken; Settings.DpsReportUserTokenChanged += (sender, args) => DpsReportUserToken = Settings.DpsReportUserToken; }
public void Setup() { _coreCache = new ClassTypeCache(); _coreCache.AddTypeWithAttribute <MonoBehaviourTwo, ValidateAttribute>(); _logCache = new LogCache(); _pValidatorManager = new ProjectAssetValidatorManager(_coreCache, _logCache); }
public void Setup() { _coreCache = new ClassTypeCache(); _coreCache.AddTypeWithAttribute <MonoBehaviourTwo, ValidateAttribute>(); _logCache = new LogCache(); _sValidatorManager = new ActiveSceneValidatorManager(_coreCache, _logCache); }
public Crawler(Web3Manager web3Manager, MongoClient mongoClient) { this.web3Manager = web3Manager; this.mongoClient = mongoClient; contractNeedModel = new ContractNeedCache(mongoClient.GetDatabase(Settings.Ins.mongodbDatabase)); logModel = new LogCache(mongoClient.GetDatabase(Settings.Ins.mongodbDatabase)); eventInfoModel = new EventInfoCache(mongoClient.GetDatabase(Settings.Ins.mongodbDatabase)); counterCache = new CounterCache(mongoClient.GetDatabase(Settings.Ins.mongodbDatabase)); }
public static LogCacheAutoSaver StartNew(LogCache cache, TimeSpan savePeriod) { var saver = new LogCacheAutoSaver(cache); var timer = new Timer(saver.Callback); timer.Change(savePeriod, savePeriod); saver.timer = timer; return(saver); }
static void DisposeSession(LogCache sessionCache) { try { sessionCache.Dispose(); } catch (Exception e) { Debug.LogException(e); } }
private void LoadManager() { var cache = LogCache.LoadFromFile(); Application.Instance.Invoke(() => { var managerForm = new ManagerForm(cache); Application.Instance.MainForm = managerForm; managerForm.Show(); Close(); }); }
public CachedLog QuickCacheLog(int id) { var log = LogCache.GetLog(id); if (log == null) { log = new CachedLog(LogDBConnector.GetByID(id)); LogCache.Add(log); } if (!File.Exists(log.EvtcPath)) { log.EvtcPath = null; LogDBConnector.Update(log.GetDBLog()); } return(log); }
static void CreateSession(bool rethrowInternalExceptions = false) { try { logCache = new LogCache(); } catch (Exception e) { if (rethrowInternalExceptions) { throw e; } Debug.LogException(e); } }
public CachedLog CacheLog(int id) { var log = QuickCacheLog(id); if (!string.IsNullOrWhiteSpace(log.JsonPath) && ((log.PlayersNew?.Count ?? 0) == 0)) { if (!File.Exists(log.JsonPath)) { return(log); } var jsonStr = GP.ReadJsonFile(log.JsonPath); var simpleLogJson = new SimpleLogJson(jsonStr); log.ApplySimpleLog(simpleLogJson); } GC.Collect(); LogCache.Add(log); return(log); }
/// <summary> /// Discover logs and process them. /// </summary> private void FindLogs(CancellationToken cancellationToken) { LogDataProcessor.UnscheduleAll(); // TODO: Fix the counters being off if a log is currently being processed LogDataProcessor.ResetTotalCounters(); try { var newLogs = new List <LogData>(); //foreach (var log in LogFinder.GetTesting()) foreach (var log in Settings.LogRootPaths.SelectMany(x => LogFinder.GetFromDirectory(x, LogCache))) { newLogs.Add(log); if (log.ParsingStatus == ParsingStatus.Parsed) { ApiProcessor.RegisterLog(log); } else { LogDataProcessor.Schedule(log); } cancellationToken.ThrowIfCancellationRequested(); } Application.Instance.Invoke(() => { logs.AddRange(newLogs); }); } catch (Exception e) when(!(e is OperationCanceledException)) { Application.Instance.Invoke(() => { MessageBox.Show(this, $"Logs could not be found.\nReason: {e.Message}", "Log Discovery Error", MessageBoxType.Error); }); } if (LogCache.ChangedSinceLastSave) { LogCache.SaveToFile(); } }
private void AddNewLog(string fullName) { if (logs.Any(x => x.FileInfo.FullName == fullName)) { return; } if (!LogCache.TryGetLogData(fullName, out var log)) { log = new LogData(new FileInfo(fullName)); } if (log.ParsingStatus != ParsingStatus.Parsed) { LogDataProcessor.Schedule(log); } logs.Add(log); }
public PackageState(PackageArgs args) { if (args == null) { throw new ArgumentNullException("args"); } _logCache = args.LogCache; foreach (string file in args.ProjectsToPackage.KeysAsFullPaths) { Logs.Add(LogCache.Get(file)); } _buildRoot = args.BuildRoot; _dontUseProjectDependencies = !args.UseProjectDependencies; if (!string.IsNullOrEmpty(BuildRoot)) { Files.BaseDirectory = args.BuildRoot; } }
public ManagerForm(LogCache logCache, ApiData apiData) { LogCache = logCache ?? throw new ArgumentNullException(nameof(logCache)); ApiData = apiData ?? throw new ArgumentNullException(nameof(apiData)); // Background processors var dpsReportUploader = new DpsReportUploader(); UploadProcessor = new UploadProcessor(dpsReportUploader, LogCache); ApiProcessor = new ApiProcessor(ApiData, new Gw2Client()); LogDataProcessor = new LogDataProcessor(LogCache, ApiProcessor, LogAnalytics); LogNameProvider = new TranslatedLogNameProvider(GameLanguage.English); LogCacheAutoSaver = LogCacheAutoSaver.StartNew(logCache, LogCacheAutoSavePeriod); LogDataProcessor.StoppingWithError += (sender, args) => { Application.Instance.InvokeAsync(() => MessageBox.Show(this, $"The background processor for logs has failed critically. " + $"Please report the following error:\n\nException: {args.Exception}", "Error", MessageBoxType.Error)); }; ApiProcessor.StoppingWithError += (sender, args) => { Application.Instance.InvokeAsync(() => MessageBox.Show(this, $"The background processor for API requests has failed critically. " + $"Please report the following error:\n\nException: {args.Exception}", "Error", MessageBoxType.Error)); }; UploadProcessor.StoppingWithError += (sender, args) => { Application.Instance.InvokeAsync(() => MessageBox.Show(this, $"The background processor for log uploads has failed critically. " + $"Please report the following error:\n\nException: {args.Exception}", "Error", MessageBoxType.Error)); }; Filters = new LogFilters(new SettingsFilters()); Filters.PropertyChanged += (sender, args) => logsFiltered.Refresh(); if (Settings.UseGW2Api) { ApiProcessor.StartBackgroundTask(); } Settings.UseGW2ApiChanged += (sender, args) => { if (Settings.UseGW2Api) { ApiProcessor.StartBackgroundTask(); } else { ApiProcessor.StopBackgroundTask(); } }; Settings.DpsReportDomainChanged += (sender, args) => { dpsReportUploader.Domain = Settings.DpsReportDomain; }; // Form layout Icon = Resources.GetProgramIcon(); Title = "arcdps Log Manager"; ClientSize = new Size(1300, 768); var formLayout = new DynamicLayout(); Content = formLayout; Menu = ConstructMenuBar(); formLayout.BeginVertical(new Padding(5), yscale: false); { formLayout.Add(ConstructMainSplitter(), yscale: true); formLayout.Add(ConstructStatusPanel()); } formLayout.EndVertical(); // Event handlers ApiProcessor.Processed += (sender, args) => { bool last = args.CurrentScheduledItems == 0; if (last) { ApiData.SaveDataToFile(); } }; Settings.LogRootPathChanged += (sender, args) => Application.Instance.Invoke(ReloadLogs); Closing += (sender, args) => { if (LogCache?.ChangedSinceLastSave ?? false) { LogCache?.SaveToFile(); } ApiData?.SaveDataToFile(); }; LogSearchFinished += (sender, args) => { var updates = LogDataUpdater.GetUpdates(logs).ToList(); if (updates.Count > 0) { new ProcessingUpdateDialog(LogDataProcessor, updates).ShowModal(this); } }; // Collection initialization logsFiltered = new FilterCollection <LogData>(logs); logsFiltered.CollectionChanged += (sender, args) => FilteredLogsUpdated?.Invoke(this, EventArgs.Empty); logsFiltered.Filter = Filters.FilterLog; LogCollectionsInitialized?.Invoke(this, EventArgs.Empty); LogDataProcessor.Processed += (sender, args) => { bool last = args.CurrentScheduledItems == 0; if (last) { Application.Instance.AsyncInvoke(logsFiltered.Refresh); } }; Shown += (sender, args) => ReloadLogs(); Shown += (sender, args) => CheckUpdates(); }
public GameDataCollecting(LogList logList, LogCache logCache, ApiData apiData, LogDataProcessor logProcessor, UploadProcessor uploadProcessor, ImageProvider imageProvider, ILogNameProvider nameProvider) { var gatherButton = new Button { Text = "Collect data" }; var cancelButton = new Button { Text = "Cancel" }; var exportSpeciesButton = new Button { Text = "Export species data to csv" }; var exportSkillsButton = new Button { Text = "Export skill data to csv" }; var progressBar = new ProgressBar(); var progressLabel = new Label { Text = "" }; var speciesGridView = new GridView <SpeciesData>(); var skillGridView = new GridView <SkillData>(); var dataTabs = new TabControl(); dataTabs.Pages.Add(new TabPage { Text = "Species", Content = speciesGridView }); dataTabs.Pages.Add(new TabPage { Text = "Skills", Content = skillGridView }); BeginVertical(new Padding(5), new Size(5, 5)); { AddCentered( "Collects a list of all different agent species and skills found in logs (uses current filters)."); AddCentered("Requires all logs to be processed again as this data is not cached."); BeginCentered(spacing: new Size(5, 5)); { AddRow(gatherButton, cancelButton); } EndCentered(); BeginCentered(spacing: new Size(5, 5)); { AddRow(progressBar); AddRow(progressLabel); } EndCentered(); BeginHorizontal(true); Add(dataTabs); EndHorizontal(); BeginCentered(spacing: new Size(5, 5)); { AddRow(exportSpeciesButton, exportSkillsButton); } EndCentered(); } EndVertical(); speciesGridView.Columns.Add(new GridColumn { HeaderText = "Species ID", DataCell = new TextBoxCell() { Binding = new DelegateBinding <SpeciesData, string>(x => x.SpeciesId.ToString()) } }); speciesGridView.Columns.Add(new GridColumn { HeaderText = "Name", DataCell = new TextBoxCell() { Binding = new DelegateBinding <SpeciesData, string>(x => x.Name) } }); speciesGridView.Columns.Add(new GridColumn { HeaderText = "Times seen", DataCell = new TextBoxCell() { Binding = new DelegateBinding <SpeciesData, string>(x => x.Logs.Count.ToString()) } }); var speciesLogsColumn = new GridColumn { HeaderText = "Logs", DataCell = new TextBoxCell() { Binding = new DelegateBinding <SpeciesData, string>(x => "Click me to open log list"), } }; speciesGridView.Columns.Add(speciesLogsColumn); speciesGridView.CellClick += (sender, args) => { if (args.GridColumn == speciesLogsColumn) { if (args.Item is SpeciesData speciesData) { var form = new Form { Content = new LogList(logCache, apiData, logProcessor, uploadProcessor, imageProvider, nameProvider) { DataStore = new FilterCollection <LogData>(speciesData.Logs) }, Width = 900, Height = 700, Title = $"arcdps Log Manager: logs containing species {speciesData.Name} (ID {speciesData.SpeciesId})" }; form.Show(); } } }; skillGridView.Columns.Add(new GridColumn { HeaderText = "Skill ID", DataCell = new TextBoxCell() { Binding = new DelegateBinding <SkillData, string>(x => x.SkillId.ToString()) } }); skillGridView.Columns.Add(new GridColumn { HeaderText = "Name", DataCell = new TextBoxCell() { Binding = new DelegateBinding <SkillData, string>(x => x.Name) } }); skillGridView.Columns.Add(new GridColumn { HeaderText = "Times seen", DataCell = new TextBoxCell() { Binding = new DelegateBinding <SkillData, string>(x => x.Logs.Count.ToString()) } }); var skillLogsColumn = new GridColumn { HeaderText = "Logs", DataCell = new TextBoxCell() { Binding = new DelegateBinding <SkillData, string>(x => "Click me to open log list"), } }; skillGridView.Columns.Add(skillLogsColumn); skillGridView.CellClick += (sender, args) => { if (args.GridColumn == skillLogsColumn) { if (args.Item is SkillData skillData) { var form = new Form { Content = new LogList(logCache, apiData, logProcessor, uploadProcessor, imageProvider, nameProvider) { DataStore = new FilterCollection <LogData>(skillData.Logs) }, Width = 900, Height = 700, Title = $"arcdps Log Manager: logs containing skill {skillData.Name} (ID {skillData.SkillId})" }; form.Show(); } } }; var speciesSorter = new GridViewSorter <SpeciesData>(speciesGridView); var skillSorter = new GridViewSorter <SkillData>(skillGridView); speciesSorter.EnableSorting(); skillSorter.EnableSorting(); cancelButton.Click += (sender, args) => cancellationTokenSource?.Cancel(); gatherButton.Click += (sender, args) => GatherData(logList, progressBar, progressLabel, speciesGridView, skillGridView, speciesSorter, skillSorter); exportSkillsButton.Click += (sender, args) => SaveToCsv(skillGridView.DataStore ?? Enumerable.Empty <SkillData>()); exportSpeciesButton.Click += (sender, args) => SaveToCsv(speciesGridView.DataStore ?? Enumerable.Empty <SpeciesData>()); }
protected override void InternalProcessRecord() { bool flag; if ("Exchange Control Panel".Equals(base.Host.Name, StringComparison.OrdinalIgnoreCase)) { flag = ServerCache.Instance.InitializeIfNeeded(HostId.ECPApplicationPool); } else { flag = ServerCache.Instance.InitializeIfNeeded(HostId.PowershellApplicationPool); } if (!flag) { Utils.HandleError(this, "Cannot initialize AD configuration", CoreStrings.TrackingErrorFailedToInitialize, this.BypassDelegateChecking, false, ErrorCategory.ObjectNotFound, null); } DirectoryContext directoryContext = null; int num = 0; MessageTrackingReport messageTrackingReport = null; TrackingEventBudget trackingEventBudget = null; try { TrackingEventBudget.AcquireThread(); if (this.TraceLevel == TraceLevel.High) { CommonDiagnosticsLogTracer traceWriter = new CommonDiagnosticsLogTracer(); TraceWrapper.SearchLibraryTracer.Register(traceWriter); BaseTrace.CurrentThreadSettings.EnableTracing(); } if (base.ExchangeRunspaceConfig == null) { ExTraceGlobals.TaskTracer.TraceError((long)this.GetHashCode(), "Get-MessageTrackingReport permissions cannot be retrieved because the ExchangeRunspaceConfiguration is null"); base.WriteError(new TrackingSearchException(CoreStrings.TrackingSearchNotAuthorized), ErrorCategory.InvalidOperation, this.Identity); } ReportConstraints reportConstraints = new ReportConstraints(); SmtpAddress[] recipientPathFilter = null; if (base.Fields.Contains("RecipientPathFilter")) { recipientPathFilter = new SmtpAddress[] { this.RecipientPathFilter }; } reportConstraints.BypassDelegateChecking = this.BypassDelegateChecking; reportConstraints.DetailLevel = this.DetailLevel; reportConstraints.DoNotResolve = this.DoNotResolve; reportConstraints.RecipientPathFilter = recipientPathFilter; reportConstraints.Recipients = this.Recipients; reportConstraints.ReportTemplate = this.ReportTemplate; reportConstraints.ResultSize = this.ResultSize; reportConstraints.TrackingAsSender = this.Identity.IsSender; reportConstraints.Sender = SmtpAddress.Empty; ReportConstraints reportConstraints2 = reportConstraints; _DeliveryStatus? deliveryStatus = this.status; int?num2 = (deliveryStatus != null) ? new int?((int)deliveryStatus.GetValueOrDefault()) : null; reportConstraints2.Status = ((num2 != null) ? new DeliveryStatus?((DeliveryStatus)num2.GetValueOrDefault()) : null); reportConstraints.ReturnQueueEvents = this.ShouldReturnQueueEvents(); if (this.Identity.IsSender) { ADRecipient adrecipient = base.TenantGlobalCatalogSession.FindByExchangeGuid(this.Identity.UserGuid); if (adrecipient != null) { reportConstraints.Sender = adrecipient.PrimarySmtpAddress; } } MultiValuedProperty <CultureInfo> executingUserLanguages = base.ExchangeRunspaceConfig.ExecutingUserLanguages; CultureInfo clientCulture = (executingUserLanguages != null && executingUserLanguages.Count > 0) ? executingUserLanguages[0] : CultureInfo.InvariantCulture; ClientContext clientContext = null; ClientSecurityContext clientSecurityContext = null; bool flag2 = false; try { clientSecurityContext = Utils.GetSecurityContextForUser(base.ExchangeRunspaceConfig.SecurityAccessToken, base.ExchangeRunspaceConfig.DelegatedPrincipal, this.trackedUser.ADUser); clientContext = ClientContext.Create(clientSecurityContext, base.CurrentOrganizationId, null, null, clientCulture, null); OrganizationId currentOrganizationId = base.TenantGlobalCatalogSession.SessionSettings.CurrentOrganizationId; TrackingErrorCollection errors = new TrackingErrorCollection(); TimeSpan timeout = Utils.GetTimeout(this.BypassDelegateChecking); trackingEventBudget = new TrackingEventBudget(errors, timeout); directoryContext = new DirectoryContext(clientContext, currentOrganizationId, base.GlobalConfigSession, this.ConfigurationSession, base.TenantGlobalCatalogSession, trackingEventBudget, SearchMessageTrackingReport.GetDiagnosticsLevel(this.TraceLevel, base.Fields.IsModified("TraceLevel")), errors, false); directoryContext.Acquire(); flag2 = true; directoryContext.DiagnosticsContext.AddProperty(DiagnosticProperty.Task, Names <DeliveryReportsTask> .Map[1]); directoryContext.DiagnosticsContext.AddProperty(DiagnosticProperty.OpType, Names <OpType> .Map[0]); directoryContext.DiagnosticsContext.AddProperty(DiagnosticProperty.Mid, this.Identity.ToString()); directoryContext.DiagnosticsContext.AddProperty(DiagnosticProperty.Data1, Names <ReportTemplate> .Map[(int)this.ReportTemplate]); directoryContext.DiagnosticsContext.AddProperty(DiagnosticProperty.Usr, this.trackedUser.SmtpAddress.ToString()); if (this.BypassDelegateChecking) { ADObjectId adobjectId; if (base.TryGetExecutingUserId(out adobjectId)) { directoryContext.DiagnosticsContext.AddProperty(DiagnosticProperty.ExUser, adobjectId.Name); } else { ExTraceGlobals.TaskTracer.TraceDebug((long)this.GetHashCode(), "ExecutingUserId is null."); } } directoryContext.DiagnosticsContext.WriteEvent(); LogCache logCache = new LogCache(DateTime.MinValue, DateTime.MaxValue, directoryContext.TrackingBudget); this.getMessageTrackingReport = new GetMessageTrackingReportImpl(directoryContext, SearchScope.World, this.Identity.InternalMessageTrackingReportId, logCache, reportConstraints); MessageTrackingReport messageTrackingReport2 = this.getMessageTrackingReport.Execute(); MultiValuedProperty <CultureInfo> userLanguages; if (this.executingUser != null) { userLanguages = (this.executingUser[ADUserSchema.Languages] as MultiValuedProperty <CultureInfo>); } else { userLanguages = new MultiValuedProperty <CultureInfo>(Thread.CurrentThread.CurrentUICulture); } bool flag3 = false; if (messageTrackingReport2 == null) { base.WriteError(new TrackingExceptionNoResultsDueToLogsExpired(), ErrorCategory.ObjectNotFound, this.Identity); } else { if (messageTrackingReport2.HasHandedOffPaths && !this.Identity.IsSender) { flag3 = true; bool flag4 = this.TryGetReportForRecipientOrganization(directoryContext, logCache, reportConstraints, userLanguages, out messageTrackingReport2); if (flag4 && messageTrackingReport2 == null) { base.WriteError(new TrackingExceptionNoResultsDueToUntrackableMessagePath(), ErrorCategory.ObjectNotFound, this.Identity); } else if (!flag4) { base.WriteError(new TrackingExceptionNoResultsDueToLogsNotFound(), ErrorCategory.ObjectNotFound, this.Identity); } } messageTrackingReport = MessageTrackingReport.Create(this.ConfigurationSession, base.TenantGlobalCatalogSession, userLanguages, this.ReportTemplate == ReportTemplate.Summary, this.DetailLevel == MessageTrackingDetailLevel.Verbose, this.Identity.IsSender, messageTrackingReport2, this.DoNotResolve, this.getMessageTrackingReport.Errors.Errors.Count == 0); if (messageTrackingReport == null) { ExTraceGlobals.TaskTracer.TraceDebug <int>((long)this.GetHashCode(), "Report is null while internalReport is not null and has {0} events", (messageTrackingReport2.RecipientTrackingEvents == null) ? 0 : messageTrackingReport2.RecipientTrackingEvents.Length); base.WriteError(new TrackingExceptionNoResultsDueToLogsNotFound(), ErrorCategory.ObjectNotFound, this.Identity); } else { num = ((messageTrackingReport.RecipientTrackingEvents == null) ? 0 : messageTrackingReport.RecipientTrackingEvents.Length); messageTrackingReport = this.FilterReport(messageTrackingReport); if (messageTrackingReport == null && !flag3 && !this.Identity.IsSender) { bool flag5 = this.TryGetReportForRecipientOrganization(directoryContext, logCache, reportConstraints, executingUserLanguages, out messageTrackingReport2); if (!flag5) { base.WriteError(new TrackingExceptionNoResultsDueToLogsNotFound(), ErrorCategory.ObjectNotFound, this.Identity); } else if (flag5 && messageTrackingReport2 == null) { base.WriteError(new TrackingExceptionNoResultsDueToUntrackableMessagePath(), ErrorCategory.ObjectNotFound, this.Identity); } else { messageTrackingReport = MessageTrackingReport.Create(this.ConfigurationSession, base.TenantGlobalCatalogSession, userLanguages, this.ReportTemplate == ReportTemplate.Summary, this.DetailLevel == MessageTrackingDetailLevel.Verbose, this.Identity.IsSender, messageTrackingReport2, this.DoNotResolve, this.getMessageTrackingReport.Errors.Errors.Count == 0); messageTrackingReport = this.FilterReport(messageTrackingReport); if (messageTrackingReport == null) { base.WriteError(new TrackingExceptionNoResultsDueToUntrackableMessagePath(), ErrorCategory.ObjectNotFound, this.Identity); } } } if (messageTrackingReport != null) { if (base.NeedSuppressingPiiData) { Utils.RedactRecipientTrackingEvents(messageTrackingReport.RecipientTrackingEvents, this); } this.WriteResult(messageTrackingReport); } } } } catch (AuthzException) { base.WriteError(new TrackingSearchException(CoreStrings.TrackingSearchNotAuthorized), ErrorCategory.InvalidOperation, this.Identity); } finally { if (directoryContext != null && flag2) { directoryContext.Yield(); } if (clientContext != null) { clientContext.Dispose(); } if (clientSecurityContext != null) { clientSecurityContext.Dispose(); } } } catch (TrackingTransientException ex) { Utils.HandleTrackingException(directoryContext, ex, this, false, this.BypassDelegateChecking); } catch (TrackingFatalException ex2) { Utils.HandleTrackingException(directoryContext, ex2, this, false, this.BypassDelegateChecking); } catch (DataSourceOperationException ex3) { Utils.HandleError(this, ex3.ToString(), ex3.LocalizedString, this.BypassDelegateChecking, false, ErrorCategory.InvalidData, null); } catch (DataValidationException ex4) { Utils.HandleError(this, ex4.ToString(), ex4.LocalizedString, this.BypassDelegateChecking, false, ErrorCategory.InvalidData, null); } catch (TransientException ex5) { Utils.HandleError(this, ex5.ToString(), ex5.LocalizedString, this.BypassDelegateChecking, true, ErrorCategory.InvalidData, null); } finally { if ((this.BypassDelegateChecking || this.ReportTemplate == ReportTemplate.RecipientPath || messageTrackingReport == null || messageTrackingReport.RecipientTrackingEvents == null || messageTrackingReport.RecipientTrackingEvents.Length == 0) && this.getMessageTrackingReport != null) { Utils.WriteWarnings(this, directoryContext, this.BypassDelegateChecking, this.getMessageTrackingReport.Errors.Errors); } if (trackingEventBudget != null) { trackingEventBudget.Dispose(); } if (directoryContext != null) { directoryContext.DiagnosticsContext.AddProperty(DiagnosticProperty.Task, Names <DeliveryReportsTask> .Map[1]); directoryContext.DiagnosticsContext.AddProperty(DiagnosticProperty.OpType, Names <OpType> .Map[1]); directoryContext.DiagnosticsContext.AddProperty(DiagnosticProperty.Cnt, num); directoryContext.DiagnosticsContext.WriteEvent(); Utils.WriteDiagnostics(this, directoryContext.DiagnosticsContext, base.NeedSuppressingPiiData); } if (this.TraceLevel == TraceLevel.High) { TraceWrapper.SearchLibraryTracer.Unregister(); BaseTrace.CurrentThreadSettings.DisableTracing(); } TrackingEventBudget.ReleaseThread(); if (directoryContext == null || Utils.AreAnyErrorsLocalToThisForest(directoryContext.Errors.Errors)) { PerfCounterData.ResultCounter.AddFailure(); } else { PerfCounterData.ResultCounter.AddSuccess(); } if (ServerCache.Instance.HostId == HostId.ECPApplicationPool) { InfoWorkerMessageTrackingPerformanceCounters.MessageTrackingFailureRateTask.RawValue = (long)PerfCounterData.ResultCounter.FailurePercentage; } } }
private bool TryGetReportForRecipientOrganization(DirectoryContext directoryContext, LogCache logCache, ReportConstraints constraints, IList <CultureInfo> userLanguages, out MessageTrackingReport report) { report = null; SearchMessageTrackingReportImpl searchMessageTrackingReportImpl = new SearchMessageTrackingReportImpl(directoryContext, SearchScope.Organization, null, null, null, new TrackedUser[] { this.trackedUser }, logCache, null, this.Identity.MessageId, this.ResultSize, false, true, true, false); List <MessageTrackingSearchResult> messages = searchMessageTrackingReportImpl.Execute(); List <MessageTrackingSearchResult> list = searchMessageTrackingReportImpl.FilterResultsBySubjectAndRecipients(messages, userLanguages); if (list != null && list.Count > 0) { MessageTrackingReportId messageTrackingReportId = list[0].MessageTrackingReportId; Guid exchangeGuid = this.trackedUser.ADUser.ExchangeGuid; MessageTrackingReportId messageTrackingReportId2 = new MessageTrackingReportId(messageTrackingReportId.MessageId, messageTrackingReportId.Server, messageTrackingReportId.InternalMessageId, exchangeGuid, messageTrackingReportId.Domain, false); GetMessageTrackingReportImpl getMessageTrackingReportImpl = new GetMessageTrackingReportImpl(directoryContext, SearchScope.Organization, messageTrackingReportId2, logCache, constraints); report = getMessageTrackingReportImpl.Execute(); return(true); } return(false); }
public LogDataProcessor(LogCache logCache, ApiProcessor apiProcessor, LogAnalytics analytics) { this.analytics = analytics ?? throw new ArgumentNullException(nameof(analytics)); this.logCache = logCache ?? throw new ArgumentNullException(nameof(logCache)); this.apiProcessor = apiProcessor ?? throw new ArgumentNullException(nameof(apiProcessor)); }
public ManagerForm(LogCache logCache, ApiData apiData) { LogCache = logCache ?? throw new ArgumentNullException(nameof(logCache)); ApiData = apiData ?? throw new ArgumentNullException(nameof(apiData)); // Background processors var dpsReportUploader = new DpsReportUploader(); UploadProcessor = new UploadProcessor(dpsReportUploader, LogCache); ApiProcessor = new ApiProcessor(ApiData, new Gw2Client()); LogDataProcessor = new LogDataProcessor(LogCache, ApiProcessor, LogAnalytics); LogNameProvider = new TranslatedLogNameProvider(GameLanguage.English); Filters = new LogFilters(new SettingsFilters()); Filters.PropertyChanged += (sender, args) => logsFiltered.Refresh(); if (Settings.UseGW2Api) { ApiProcessor.StartBackgroundTask(); } Settings.UseGW2ApiChanged += (sender, args) => { if (Settings.UseGW2Api) { ApiProcessor.StartBackgroundTask(); } else { ApiProcessor.StopBackgroundTask(); } }; Settings.DpsReportDomainChanged += (sender, args) => { dpsReportUploader.Domain = Settings.DpsReportDomain; }; // Form layout Icon = Resources.GetProgramIcon(); Title = "arcdps Log Manager"; ClientSize = new Size(1024, 768); var formLayout = new DynamicLayout(); Content = formLayout; Menu = ConstructMenuBar(); formLayout.BeginVertical(new Padding(5), yscale: false); { formLayout.Add(ConstructMainSplitter(), yscale: true); formLayout.Add(ConstructStatusPanel()); } formLayout.EndVertical(); // Event handlers ApiProcessor.Processed += (sender, args) => { bool last = args.CurrentScheduledItems == 0; if (last) { ApiData.SaveDataToFile(); } }; Settings.LogRootPathChanged += (sender, args) => Application.Instance.Invoke(ReloadLogs); Shown += (sender, args) => ReloadLogs(); Closing += (sender, args) => { if (LogCache?.ChangedSinceLastSave ?? false) { LogCache?.SaveToFile(); } ApiData?.SaveDataToFile(); }; LogCollectionsRecreated += (sender, args) => { logsFiltered.Filter = Filters.FilterLog; logsFiltered.Refresh(); }; LogSearchFinished += (sender, args) => { var updates = LogDataUpdater.GetUpdates(logs).ToList(); if (updates.Count > 0) { new UpdateDialog(LogDataProcessor, updates).ShowModal(this); } }; // Collection initialization RecreateLogCollections(new ObservableCollection <LogData>(logs)); }
private LogCacheAutoSaver(LogCache logCache) { this.logCache = logCache; }
private void LoadManager() { LogCache cache = null; ApiData apiData = null; do { try { cache = LogCache.LoadFromFile(); } catch (Exception e) { bool abort = false; Application.Instance.Invoke(() => { var result = MessageBox.Show("An error has occured while loading the stored log data. " + "This can be automatically resolved by deleting the cache file, " + "however, all logs will have to be processed again. Delete the cache?" + $"\n\nError: {e.Message}.", "Error loading the log cache.", MessageBoxButtons.YesNo, MessageBoxType.Error); if (result != DialogResult.Yes) { abort = true; } else { try { LogCache.DeleteFile(); } catch (Exception deletionException) { MessageBox.Show("An error has occured while deleting the log cache. " + $"\nError: {deletionException.Message}.", "Error deleting the log cache.", MessageBoxType.Error); abort = true; } } }); if (abort) { Application.Instance.Invoke(Close); return; } } } while (cache == null); do { try { apiData = ApiData.LoadFromFile(); } catch (Exception e) { bool abort = false; Application.Instance.Invoke(() => { var result = MessageBox.Show("An error has occured while loading the stored API data. " + "This can be automatically resolved by deleting the API cache file. " + " Delete the cache?" + $"\n\nError: {e.Message}.", "Error loading the API cache.", MessageBoxButtons.YesNo, MessageBoxType.Error); if (result != DialogResult.Yes) { abort = true; } else { try { ApiData.DeleteFile(); } catch (Exception deletionException) { MessageBox.Show("An error has occured while deleting the API cache. " + $"\nError: {deletionException.Message}.", "Error deleting the API cache.", MessageBoxType.Error); abort = true; } } }); if (abort) { Application.Instance.Invoke(Close); return; } } } while (apiData == null); Application.Instance.Invoke(() => { var managerForm = new ManagerForm(cache, apiData); Application.Instance.MainForm = managerForm; managerForm.Show(); Close(); }); }