private IEnumerable <Transfer> AllTransfers(CancellationToken cancellationToken) { // return all existing transfers in subTransfers foreach (var transfer in this.subTransfers.GetEnumerator()) { Utils.CheckCancellation(cancellationToken); transfer.Context = this.Context; transfer.ContentType = this.ContentType; this.UpdateTransfer(transfer); yield return(transfer); } // list new transfers if (this.enumerateContinuationToken != null) { this.SourceEnumerator.EnumerateContinuationToken = this.enumerateContinuationToken.ListContinuationToken; } var enumerator = this.SourceEnumerator.EnumerateLocation(cancellationToken).GetEnumerator(); while (true) { Utils.CheckCancellation(cancellationToken); // lock enumerator if (!enumerator.MoveNext()) { yield break; } TransferEntry entry = enumerator.Current; ErrorEntry errorEntry = entry as ErrorEntry; if (errorEntry != null) { TransferException exception = errorEntry.Exception as TransferException; if (null != exception) { throw exception; } else { throw new TransferException( TransferErrorCode.FailToEnumerateDirectory, errorEntry.Exception.GetExceptionMessage(), errorEntry.Exception); } } Transfer transfer = this.CreateTransfer(entry); lock (this.lockEnumerateContinuationToken) { this.subTransfers.AddTransfer(transfer); this.enumerateContinuationToken = new SerializableListContinuationToken(entry.ContinuationToken); } yield return(transfer); } }
private Folder ToErrorFolder(ErrorEntry fsEntry) { ICloudDirectoryEntry rootFolder = null; try { rootFolder = RootFolder(); } catch (Exception) { } return(new Folder { ID = MakeId(fsEntry), ParentFolderID = null, CreateBy = GoogleDriveProviderInfo.Owner, CreateOn = fsEntry.Modified, FolderType = FolderType.DEFAULT, ModifiedBy = GoogleDriveProviderInfo.Owner, ModifiedOn = fsEntry.Modified, ProviderId = GoogleDriveProviderInfo.ID, ProviderKey = GoogleDriveProviderInfo.ProviderKey, RootFolderCreator = GoogleDriveProviderInfo.Owner, RootFolderId = MakeId(rootFolder), RootFolderType = GoogleDriveProviderInfo.RootFolderType, Shareable = false, Title = MakeTitle(fsEntry), TotalFiles = fsEntry.Count - 0, TotalSubFolders = 0, Error = fsEntry.Error }); }
protected void Page_Load(object sender, EventArgs e) { int errorId; if (int.TryParse(Request.QueryString["errorId"], out errorId) == false) { Debug.Assert(false, "No ErrorID passed to the error page."); errorId = Errors.ApplicationError; } ErrorEntry entry = Errors.Lookup(errorId); if (entry == null) { entry = new ErrorEntry(0, "Fallback error.", "Something has gone so wrong that I couldn't retreive the error information for you.", ""); } this.MessageLabel.Text = string.Format("{0} [{1}]", entry.Message, errorId); this.DescriptionLabel.Text = entry.Description; if ((entry.HelpURL == null) || (entry.HelpURL == string.Empty)) { this.MoreInformationLabel.Text = "None"; } else { this.MoreInformationLabel.Text = string.Format("<a href=\"{0}\">Support Site</a>", entry.HelpURL); } // TODO: Write out to the cause table }
private static void WriteError(ErrorEntry error) { System.Console.ForegroundColor = ConsoleColor.Yellow; if (error.Lines.Length > 1) { System.Console.WriteLine(error.Lines.First()); System.Console.CursorLeft = error.Span.Start.Column; System.Console.WriteLine(new string('^', error.Lines[0].Length - error.Span.Start.Column)); for (int i = 1; i < error.Lines.Length - 1; i++) { System.Console.WriteLine(error.Lines[i]); System.Console.WriteLine(new string('^', error.Lines[i].Length)); } System.Console.WriteLine(error.Lines.Last()); System.Console.WriteLine(new string('^', error.Lines.Last().Length - error.Span.End.Column)); } else { System.Console.WriteLine(error.Lines.First()); System.Console.CursorLeft = error.Span.Start.Column; System.Console.WriteLine(new string('^', error.Span.Length)); System.Console.WriteLine($"{error.Severity} {error.Span}: {error.Message}"); } System.Console.ForegroundColor = ConsoleColor.Gray; }
private Folder ToErrorFolder(ErrorEntry fsEntry) { if (fsEntry == null) { return(null); } return(new Folder { ID = MakeId(fsEntry), ParentFolderID = null, CreateBy = SharpBoxProviderInfo.Owner, CreateOn = fsEntry.Modified, FolderType = FolderType.DEFAULT, ModifiedBy = SharpBoxProviderInfo.Owner, ModifiedOn = fsEntry.Modified, ProviderId = SharpBoxProviderInfo.ID, ProviderKey = SharpBoxProviderInfo.ProviderKey, RootFolderCreator = SharpBoxProviderInfo.Owner, RootFolderId = MakeId(null), RootFolderType = SharpBoxProviderInfo.RootFolderType, Shareable = false, Title = MakeTitle(fsEntry), TotalFiles = 0, TotalSubFolders = 0, Error = fsEntry.Error }); }
/// <summary>Gets the ready drives.</summary> /// <returns>A list of ready drives.</returns> private static List <DriveDetails> GetReadyDrives(HealthcheckResult checkResult) { var readyDrivesDetails = new List <DriveDetails>(); IEnumerable <DriveInfo> readyDrives; try { readyDrives = DriveInfo.GetDrives().Where(d => d.IsReady); foreach (var drive in readyDrives) { var driveDetails = new DriveDetails(); driveDetails.DriveName = drive.Name; driveDetails.AvailableFreeSpace = drive.AvailableFreeSpace / BytesInGB; driveDetails.PercentageOfFreeSpace = (drive.AvailableFreeSpace / (double)drive.TotalSize) * 100; readyDrivesDetails.Add(driveDetails); } } catch (Exception exception) { checkResult.ErrorList.Entries.Add(ErrorEntry.CreateErrorEntry(exception.Message, exception)); return(null); } return(readyDrivesDetails); }
/// <summary> /// Occurs when the user performs a double click on the error entry. /// </summary> /// <param name="entry">The selected entry</param> private void SqlErrorControl_OnDoubleClick(ErrorEntry entry) { // INFO: Do not remove this method. ReSharper doesn't get it, that it's used in the ui SqlEditor.Focus(); SqlEditor.ScrollTo(entry.Line, entry.Column); SqlEditor.TextArea.Caret.Line = entry.Line; SqlEditor.TextArea.Caret.Column = entry.Column; }
private void ListNewTransfers(CancellationToken cancellationToken) { // list new transfers if (this.enumerateContinuationToken != null) { this.SourceEnumerator.EnumerateContinuationToken = this.enumerateContinuationToken.ListContinuationToken; } ShouldTransferCallbackAsync shouldTransferCallback = this.DirectoryContext?.ShouldTransferCallbackAsync; try { var enumerator = this.SourceEnumerator.EnumerateLocation(cancellationToken).GetEnumerator(); while (true) { Utils.CheckCancellation(cancellationToken); if (!enumerator.MoveNext()) { break; } TransferEntry entry = enumerator.Current; ErrorEntry errorEntry = entry as ErrorEntry; if (errorEntry != null) { TransferException exception = errorEntry.Exception as TransferException; if (null != exception) { throw exception; } else { throw new TransferException( TransferErrorCode.FailToEnumerateDirectory, errorEntry.Exception.GetExceptionMessage(), errorEntry.Exception); } } this.shouldTransferQueue.EnqueueJob(async() => { SingleObjectTransfer candidate = this.CreateTransfer(entry); bool shouldTransfer = shouldTransferCallback == null || await shouldTransferCallback(candidate.Source.Instance, candidate.Destination.Instance); return(new Tuple <SingleObjectTransfer, TransferEntry>(shouldTransfer ? candidate : null, entry)); }); } } finally { this.shouldTransferQueue.CompleteAdding(); } }
private void WriteLogEntries(AuditEventType eventType, ErrorEntry logEntry) { string message = string.Format("{0} - {1} - {2} - {3}", new object[] { eventType.ToString(), logEntry.ResultCode, logEntry.Source, logEntry.ErrorReason }); Debug.WriteLine(message); }
private static List <string> WriteError(ErrorEntry error) { var errorResult = new List <string> { error.Lines.First(), new string(' ', error.Span.Start.Column) + new string('^', error.Span.Length), $@"{error.Severity}: {error.Message} {error.Span}" }; return(errorResult); }
public override string Format(LogEntry log) { ErrorEntry errorEntry = log as ErrorEntry; if (errorEntry != null) { return("This is the string with the custom values: " + errorEntry.UserId); //use properties of ErrorEntry //populate returnString } return("Not supported"); }
private Folder <string> ToErrorFolder(ErrorEntry fsEntry) { if (fsEntry == null) { return(null); } var folder = GetErrorFolder(new Thirdparty.ErrorEntry(fsEntry.Error, null)); folder.ID = MakeId(fsEntry); folder.CreateOn = fsEntry.Modified; folder.ModifiedOn = fsEntry.Modified; folder.RootFolderId = MakeId(null); folder.Title = MakeTitle(fsEntry); return(folder); }
/// <summary> /// Get the list of exceptions /// </summary> /// <param name="clear">clear the list after retreival</param> /// <returns></returns> public static IEnumerable<ErrorEntry> GetErrors(bool clear) { List<ErrorEntry> entries = new List<ErrorEntry>(); Task.Run(async () => { if (await LocalStorageHelper.FileExistsInLocalFolderAsync(LogFile)) { Stream strm = await LocalStorageHelper.ReadStreamFromFileInLocalFolderAsync(LogFile); StreamReader sr = new StreamReader(strm); for ( string ln = sr.ReadLine(); ln != null; ln = sr.ReadLine()) { DateTime ts; if (DateTime.TryParse(ln, out ts)) { try { var currentErrorEntry = new ErrorEntry(); currentErrorEntry.Timestamp = ts; currentErrorEntry.Description = ReadItem(sr, Delimiter); currentErrorEntry.Exception = ReadItem(sr, Delimiter); ln = sr.ReadLine(); Debug.Assert(ln == Delimiter, "Expected delimiter"); entries.Add(currentErrorEntry); } catch { } } } if (clear) { await LocalStorageHelper.DeleteFileInLocalFolderAsync(LogFile); } } }); return entries; }
/// <summary> /// Get the list of exceptions /// </summary> /// <param name="clear">clear the list after retreival</param> /// <returns></returns> public static IEnumerable <ErrorEntry> GetErrors(bool clear) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(LogFile)) { var lf = store.OpenFile(LogFile, System.IO.FileMode.Open); StreamReader sr = new StreamReader(lf); List <ErrorEntry> entries = new List <ErrorEntry>(); for ( string ln = sr.ReadLine(); ln != null; ln = sr.ReadLine()) { DateTime ts; if (DateTime.TryParse(ln, out ts)) { try { var currentErrorEntry = new ErrorEntry(); currentErrorEntry.Timestamp = ts; currentErrorEntry.Description = ReadItem(sr, Delimiter); currentErrorEntry.Exception = ReadItem(sr, Delimiter); ln = sr.ReadLine(); Debug.Assert(ln == Delimiter, "Expected delimiter"); entries.Add(currentErrorEntry); } catch { } } } sr.Close(); if (clear) { store.DeleteFile(LogFile); } return(entries); } } return(new ErrorEntry[0]); }
private File <string> ToErrorFile(ErrorEntry fsEntry) { if (fsEntry == null) { return(null); } var file = GetErrorFile(new Thirdparty.ErrorEntry(fsEntry.Error, null)); file.ID = MakeId(fsEntry); file.CreateOn = fsEntry.Modified; file.ModifiedOn = fsEntry.Modified; file.RootFolderId = MakeId(null); file.Title = MakeTitle(fsEntry); return(file); }
private Files.Core.File ToErrorFile(ErrorEntry fsEntry) { return(new Files.Core.File { ID = MakeId(fsEntry), CreateBy = GoogleDriveProviderInfo.Owner, CreateOn = fsEntry.Modified, ModifiedBy = GoogleDriveProviderInfo.Owner, ModifiedOn = fsEntry.Modified, ProviderId = GoogleDriveProviderInfo.ID, ProviderKey = GoogleDriveProviderInfo.ProviderKey, RootFolderCreator = GoogleDriveProviderInfo.Owner, RootFolderId = MakeId(RootFolder()), RootFolderType = GoogleDriveProviderInfo.RootFolderType, Title = MakeTitle(fsEntry), Error = fsEntry.Error }); }
/// <summary> /// Get the list of exceptions /// </summary> /// <param name="clear">clear the list after retreival</param> /// <returns></returns> public static IEnumerable<ErrorEntry> GetErrors(bool clear) { List<ErrorEntry> entries = new List<ErrorEntry>(); if (File.Exists(LogFile)) { Stream strm = File.Open(LogFile,FileMode.Open); StreamReader sr = new StreamReader(strm); for ( string ln = sr.ReadLine(); ln != null; ln = sr.ReadLine()) { DateTime ts; if (DateTime.TryParse(ln, out ts)) { try { var currentErrorEntry = new ErrorEntry(); currentErrorEntry.Timestamp = ts; currentErrorEntry.Description = ReadItem(sr, Delimiter); currentErrorEntry.Exception = ReadItem(sr, Delimiter); ln = sr.ReadLine(); Debug.Assert(ln == Delimiter, "Expected delimiter"); entries.Add(currentErrorEntry); } catch { } } } if (clear) { File.Delete(LogFile); } } return entries; }
/// <summary> /// Get the list of exceptions /// </summary> /// <param name="clear">clear the list after retreival</param> /// <returns></returns> public static IEnumerable<ErrorEntry> GetErrors(bool clear) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(LogFile)) { var lf = store.OpenFile(LogFile, System.IO.FileMode.Open); StreamReader sr = new StreamReader(lf); List<ErrorEntry> entries = new List<ErrorEntry>(); for ( string ln = sr.ReadLine(); ln != null; ln = sr.ReadLine()) { DateTime ts; if (DateTime.TryParse(ln, out ts)) { try { var currentErrorEntry = new ErrorEntry(); currentErrorEntry.Timestamp = ts; currentErrorEntry.Description = ReadItem(sr, Delimiter); currentErrorEntry.Exception = ReadItem(sr, Delimiter); ln = sr.ReadLine(); Debug.Assert(ln == Delimiter, "Expected delimiter"); entries.Add(currentErrorEntry); } catch { } } } sr.Close(); if (clear) { store.DeleteFile(LogFile); } return entries; } } return new ErrorEntry[0]; }
public void SetError(Station sta, bool arrival, string text) { var err = errors.FirstOrDefault(e => e.Station == sta && e.Arrival == arrival); if (string.IsNullOrEmpty(text)) { if (err != null) { errors.Remove(err); } return; } if (err == null) { err = new ErrorEntry(sta, arrival, null); errors.Add(err); } err.Arrival = arrival; err.Text = text; }
protected ICloudDirectoryEntry GetFolderById(object folderId) { ICloudDirectoryEntry entry = null; Exception e = null; try { entry = GoogleDriveProviderInfo.Storage.GetFolder(MakePath(folderId)); } catch (Exception ex) { e = ex; } if (entry == null) { //Create error entry entry = new ErrorEntry(e, folderId); } return(entry); }
protected ICloudFileSystemEntry GetFileById(object fileId) { ICloudFileSystemEntry entry = null; Exception e = null; try { entry = GoogleDriveProviderInfo.Storage.GetFile(MakePath(fileId), RootFolder()); } catch (Exception ex) { e = ex; } if (entry == null) { //Create error entry entry = new ErrorEntry(e, fileId); } return(entry); }
protected void Page_Load( object sender, EventArgs e ) { int errorId; if( int.TryParse( Request.QueryString[ "errorId" ], out errorId ) == false ) { Debug.Assert( false, "No ErrorID passed to the error page." ); errorId = Errors.ApplicationError; } ErrorEntry entry = Errors.Lookup( errorId ); if( entry == null ) entry = new ErrorEntry( 0, "Fallback error.", "Something has gone so wrong that I couldn't retreive the error information for you.", "" ); this.MessageLabel.Text = string.Format( "{0} [{1}]", entry.Message, errorId ); this.DescriptionLabel.Text = entry.Description; if( ( entry.HelpURL == null ) || ( entry.HelpURL == string.Empty ) ) this.MoreInformationLabel.Text = "None"; else this.MoreInformationLabel.Text = string.Format( "<a href=\"{0}\">Support Site</a>", entry.HelpURL ); // TODO: Write out to the cause table }
private File ToErrorFile(ErrorEntry fsEntry) { if (fsEntry == null) { return(null); } return(new File { ID = MakeId(fsEntry), CreateBy = SharpBoxProviderInfo.Owner, CreateOn = fsEntry.Modified, ModifiedBy = SharpBoxProviderInfo.Owner, ModifiedOn = fsEntry.Modified, ProviderId = SharpBoxProviderInfo.ID, ProviderKey = SharpBoxProviderInfo.ProviderKey, RootFolderCreator = SharpBoxProviderInfo.Owner, RootFolderId = MakeId(null), RootFolderType = SharpBoxProviderInfo.RootFolderType, Title = MakeTitle(fsEntry), Error = fsEntry.Error }); }
/// <summary> /// 填充记录 要找到-----------------然后停止 /// </summary> /// <param name="operation"></param> private ErrorPathInfo Scan() { ErrorPathInfo epi = new ErrorPathInfo(); GetTop(epi); List <ErrorEntry> list = new List <ErrorEntry>(); //用于判断是否已经存在 HashSet <string> keyset = new HashSet <string>(); //扫描寻找关键字 string keyword = KeyUtil.ErrorKey; string retrykeyword = KeyUtil.RetryErrorKey; #region scan string errorContent = string.Empty; string content = string.Empty; while (!Reader.EndOfStream) { try { content = Reader.ReadLine().Replace("100%", "").Replace("0%", "").Trim(); if (string.IsNullOrWhiteSpace(content)) { continue; } //判断是否出错 if (content.Contains(keyword) && !content.Contains(retrykeyword)) { errorContent = content; #region 解析错误记录 ErrorEntry entry = new ErrorEntry(); //出错信息解析 entry.Time = content.Substring(0, content.IndexOf(keyword)).Trim(); #region 获取path /* * 当数据格式发生变化时,如下 * * 1.例子 * 2014/06/10 01:34:00 エラー 0 (0x00000000) \\10.0.5.105\Job5A-web\021阪急-その他\推進協力会\00_推進協力会運用中\BK\?_dj\ * この操作を正しく終了しました。 * * 2.例子 * 2014/11/15 01:41:08 エラー 123 (0x0000007B) コピー先ディレクトリを作成しています * 2014/11/15 01:41:08 エラー 123 (0x0000007B) ファイルをコピーしています * S:\Job1A-1ka\01-提案中\Theお宿リニューアル\カセットフォーマット\-素材\-Bあとすて\別紙C*\\\10.0.5.101\Job1A\01-提案中\阪急カレンダー2015\-オレの\2014年カレンダー案\2014-提案-A\Icon * 2014/11/15 01:41:08 エラー 123 (0x0000007B) コピー先ディレクトリを作成しています 2014/11/15 01:41:08 エラー 123 (0x0000007B) コピー先ディレクトリを作成しています S:\Job1A-1ka\01-提案中\Theお宿リニューアル\カセットフォーマット\-素材\-Bあとすて\別紙E*\S:\Job1A-1ka\01-提案中\Theお宿リニューアル\カセットフォーマット\-素材\-Bあとすて\別紙D*\ * ファイル名、ディレクトリ名、またはボリューム ラベルの構文が間違っています。 * * * ファイル名、ディレクトリ名、またはボリューム ラベルの構文が間違っています。 * * * ファイル名、ディレクトリ名、またはボリューム ラベルの構文が間違っています。 * * * ファイル名、ディレクトリ名、またはボリューム ラベルの構文が間違っています。 * * * エラー: 再試行が制限回数を超えました。 * */ //get index 此处content可能发生变化,直到找到路径信息 int index = content.IndexOf('\\'); while (index < 0) { //error cause entry.Cause = content; content = Reader.ReadLine().Replace("100%", "").Replace("0%", "").Trim().TrimEnd('\\'); index = content.IndexOf('\\'); } if (index == 0) { entry.Path = content; } else { if (content[index - 1] == ':') { entry.Path = content.Substring(index - 2).Trim().TrimEnd('\\'); /* * 特殊情况 * * 2014/11/15 01:41:08 エラー 123 (0x0000007B) ファイルをコピーしています * S:\Job1A-1ka\01-提案中\Theお宿リニューアル\カセットフォーマット\-素材\-Bあとすて\別紙C*\\\10.0.5.101\Job1A\01-提案中\阪急カレンダー2015\-オレの\2014年カレンダー案\2014-提案-A\Icon * * */ if (entry.Path.Contains("\\\\")) { entry.Path = entry.Path.Substring(0, entry.Path.IndexOf("\\\\")); } #region 转换路径 /* * コピー先路径转成コピー元路径 * * 2014/06/10 01:33:55 エラー 123 (0x0000007B) コピー先ディレクトリを作成しています S:\Job5A-web\021阪急-その他\推進協力会\00_推進協力会運用中\BK\?_dj\ * ファイル名、ディレクトリ名、またはボリューム ラベルの構文が間違っています。 * * 将S:\Job5A-web\021阪急-その他\ 替换为 类似\\10.0.5.105\Job5A-web\021阪急-その他\的路径 */ entry.Path = entry.Path.Replace(epi.destination, epi.source).TrimEnd('\\'); #endregion } else { entry.Path = content.Substring(index - 1).Trim().TrimEnd('\\'); } } #region 检验日志格式是否发生混乱 /* * 检验日志格式是否发生混乱 * 即:2014/06/10 01:31:46 エラー 123 (0x0000007B) ファイルをコピーしています \\10.0.5.105\Job5A-web\021阪急-その他\Iconファイル名、ディレクトリ名、またはボリューム ラベルの構文が間違っています。 * * 如上 异常原因与路径混到一块 */ int lastIndex = entry.Path.LastIndexOf('\\'); if (entry.Path.Substring(lastIndex).Contains(KeyUtil.CauseKey)) { entry.Path = entry.Path.Substring(0, entry.Path.LastIndexOf(KeyUtil.CauseKey)).TrimEnd('\\'); } if (entry.Path.Contains("0x0000007B")) { continue; } #endregion #endregion //获取错误原因 只向下读两行,如果没有符合条件的,则跳过 int i = 2; while (string.IsNullOrWhiteSpace(entry.Cause) && i-- > 0) { entry.Cause = Reader.ReadLine().Trim(); } if (keyset.Add(entry.Path)) { list.Add(entry); } continue; #endregion } } catch (System.Exception ex) { logger.Error(errorContent + " " + MessageUtil.GetExceptionMsg(ex, " ")); } } #endregion epi.PathList = list; //即时释放资源 this.Dispose(); return(epi); }
public async Task ExecuteAsync(CancellationToken cancellationToken) { await Task.Yield(); this.CreateDestinationDirectory(cancellationToken); var enumerator = this.transferEnumerator.EnumerateLocation(cancellationToken).GetEnumerator(); while (true) { if (!enumerator.MoveNext()) { break; } TransferEntry entry = enumerator.Current; ErrorEntry errorEntry = entry as ErrorEntry; if (errorEntry != null) { TransferException exception = errorEntry.Exception as TransferException; if (null != exception) { throw exception; } else { throw new TransferException( TransferErrorCode.FailToEnumerateDirectory, errorEntry.Exception.GetExceptionMessage(), errorEntry.Exception); } } if (entry.IsDirectory) { this.baseDirectoryTransfer.AddSubDir(entry.RelativePath, () => { var currentContinuationToken = new SerializableListContinuationToken(entry.ContinuationToken); currentContinuationToken.Journal = this.enumerateContinuationToken.Journal; currentContinuationToken.StreamJournalOffset = this.enumerateContinuationToken.StreamJournalOffset; this.enumerateContinuationToken = currentContinuationToken; return(this.enumerateContinuationToken); }); } else { SingleObjectTransfer transferItem = this.baseDirectoryTransfer.CreateTransfer(entry); #if DEBUG Utils.HandleFaultInjection(entry.RelativePath, transferItem); #endif this.CreateDestinationParentDirectoryRecursively(transferItem); this.baseDirectoryTransfer.AddSingleObjectTransfer(transferItem, () => { var currentContinuationToken = new SerializableListContinuationToken(entry.ContinuationToken); currentContinuationToken.Journal = this.enumerateContinuationToken.Journal; currentContinuationToken.StreamJournalOffset = this.enumerateContinuationToken.StreamJournalOffset; this.enumerateContinuationToken = currentContinuationToken; return(this.enumerateContinuationToken); }); } } }
public static HealthcheckResult RunHealthcheck(string _driveName, double _errorPercentageThreshold, double _warningPercentageThreshold) { var checkResult = new HealthcheckResult { LastCheckTime = DateTime.UtcNow, Status = Customization.HealthcheckStatus.Healthy, HealthyMessage = "Log files contain no errors", ErrorList = new ErrorList { Entries = new List <ErrorEntry>() } }; if (string.IsNullOrEmpty(_driveName)) { checkResult.Status = HealthcheckStatus.Warning; checkResult.ErrorList.Entries.Add(ErrorEntry.CreateErrorEntry("DriveName is not configured!")); return(checkResult); } var drives = GetReadyDrives(checkResult); if (drives == null) { checkResult.Status = HealthcheckStatus.Error; checkResult.ErrorList.Entries.Add(ErrorEntry.CreateErrorEntry("Error retriving drives info.")); return(checkResult); } else if (drives.Count() == 0) { checkResult.Status = HealthcheckStatus.Error; checkResult.ErrorList.Entries.Add(ErrorEntry.CreateErrorEntry("Drives aren't ready.")); return(checkResult); } drives = drives.Where(t => t.DriveName.Equals(_driveName, StringComparison.OrdinalIgnoreCase)).ToList(); if (!drives.Any()) { checkResult.Status = HealthcheckStatus.Warning; checkResult.ErrorList.Entries.Add(ErrorEntry.CreateErrorEntry($"Cannot find drive with name: {_driveName}")); return(checkResult); } var errorDrivesCapacity = drives.Where(d => d.PercentageOfFreeSpace < _errorPercentageThreshold); if (errorDrivesCapacity.Count() > 0) { checkResult.Status = HealthcheckStatus.Error; checkResult.ErrorList.Entries.Add(ErrorEntry.CreateErrorEntry(CreateStatusMessage(errorDrivesCapacity, $"Drive: {_driveName} is on very low capacity."))); return(checkResult); } var warningDrivesCapacity = drives.Where(d => d.PercentageOfFreeSpace < _warningPercentageThreshold); if (warningDrivesCapacity.Count() > 0) { checkResult.Status = HealthcheckStatus.Warning; checkResult.ErrorList.Entries.Add(ErrorEntry.CreateErrorEntry(CreateStatusMessage(warningDrivesCapacity, $"Drive: {_driveName} is on low capacity."))); return(checkResult); } checkResult.Status = HealthcheckStatus.Healthy; checkResult.HealthyMessage = CreateStatusMessage(drives, $"Drive, {_driveName} are in good capacity."); return(checkResult); }
public void WriteAuditLog(string transformId, ErrorEntry logEntry) { }
public void WriteAuditLog(ErrorEntry logEntry) { }
public CommitResult(string protocol, CommitContinuationContext context, ErrorEntry error) { _protocol = protocol; _context = context; _error = error; }
public void WriteAuditLog(string transformId, ErrorEntry logEntry, Transaction transactionBeingAudited) { }
private Files.Core.File ToErrorFile(ErrorEntry fsEntry) { return new Files.Core.File { ID = MakeId(fsEntry), CreateBy = SharpBoxProviderInfo.Owner, CreateOn = fsEntry.Modified, ModifiedBy = SharpBoxProviderInfo.Owner, ModifiedOn = fsEntry.Modified, ProviderId = SharpBoxProviderInfo.ID, ProviderKey = SharpBoxProviderInfo.ProviderKey, RootFolderCreator = SharpBoxProviderInfo.Owner, RootFolderId = MakeId(RootFolder()), RootFolderType = SharpBoxProviderInfo.RootFolderType, Title = MakeTitle(fsEntry), Error = fsEntry.Error }; }
private Folder ToErrorFolder(ErrorEntry fsEntry) { ICloudDirectoryEntry rootFolder = null; try { rootFolder = RootFolder(); } catch (Exception) { } return new Folder { ID = MakeId(fsEntry), ParentFolderID = null, CreateBy = SharpBoxProviderInfo.Owner, CreateOn = fsEntry.Modified, FolderType = FolderType.DEFAULT, ModifiedBy = SharpBoxProviderInfo.Owner, ModifiedOn = fsEntry.Modified, ProviderId = SharpBoxProviderInfo.ID, ProviderKey = SharpBoxProviderInfo.ProviderKey, RootFolderCreator = SharpBoxProviderInfo.Owner, RootFolderId = MakeId(rootFolder), RootFolderType = SharpBoxProviderInfo.RootFolderType, Shareable = false, Title = MakeTitle(fsEntry), TotalFiles = fsEntry.Count - 0, TotalSubFolders = 0, Error = fsEntry.Error }; }
/// <summary> /// Using the Abstract Syntax Tree, this method will create concreate Pattern's /// </summary> private static bool AbstractSyntaxTreeToPatterns(TestArgs args) { var noErrors = true; foreach (PatternDeclaration pd in args.AbstractSyntaxTree.Children.Where(n => n.Kind == SyntaxKind.PatternDeclaration)) { // Default ScanType scanType = ScanType.FirstOccurance; if (pd.Options.FirstOrDefault(n => n.Value == Keyword._Repeating) != null) { scanType = ScanType.Repeating; } var pc = new PatternComplex(pd.Name, scanType); foreach (var source in pd.Sources) { pc.Sources.Add(source.Value); } foreach (var option in pd.Options) { switch (option.Name) { case Keyword._TotalTime: pc.Options.TotalTimeOption = true; break; case Keyword._KnownIdle: pc.Options.KnownIdle = true; pc.Options.KnownIdleParameters = option.Parameters; break; case Keyword._UnknownIdle: pc.Options.UnknownIdle = true; pc.Options.UnknownIdleParameters = option.Parameters; break; case Keyword._IdleTime: pc.Options.IdleTimeOption = true; break; case Keyword._HidePattern: pc.Options.HidePattern = true; break; case Keyword._HideFilePath: pc.Options.HideFilePath = true; break; case Keyword._Unexpected: pc.Options.PatternUnexpected = true; break; default: break; } } foreach (var item in pd.Body.Contents) { try { var e = item as EventStatement; if (e == null) { var temp = DateTime.Now.ToShortTimeString(); throw new OptionException($@"{temp} {PATTERN_SYNTAX_ERROR} {new string(' ', temp.Length)} Unexpected '{item.GetType()}'.Expected 'EventStatement'", item.Span); } var regularExpression = LookupEvent(e.Event, e.Span); EventOption option = ParseOption(e); var regularExpressionBodyStop = string.Empty; if (option.BodyStop) { regularExpressionBodyStop = LookupEvent(option.BodyStopParameter, e.Span); } pc.AddEvent(new EventPattern(ConvertEventType(e.EventType), e.Event, regularExpression, regularExpressionBodyStop, option)); } catch (OptionException ex) { var e = new ErrorEntry(ex.Message, args.SourceCode.GetLines(ex.Span.Start.Line, ex.Span.End.Line), Severity.Fatal, ex.Span); args.Result.Log.AddRange(WriteError(e)); noErrors = false; } } args.Patterns.Add(pc); } return(noErrors); }
protected ICloudDirectoryEntry GetFolderById(object folderId) { ICloudDirectoryEntry entry = null; Exception e = null; try { entry = SharpBoxProviderInfo.Storage.GetFolder(MakePath(folderId)); } catch (Exception ex) { e = ex; } if (entry == null) { //Create error entry entry = new ErrorEntry(e, folderId); } return entry; }
protected ICloudFileSystemEntry GetFileById(object fileId) { ICloudFileSystemEntry entry = null; Exception e = null; try { entry = SharpBoxProviderInfo.Storage.GetFile(MakePath(fileId), RootFolder()); } catch (Exception ex) { e = ex; } if (entry == null) { //Create error entry entry = new ErrorEntry(e, fileId); } return entry; }