本文整理汇总了C#中System.Logger.AddInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.AddInfo方法的具体用法?C# Logger.AddInfo怎么用?C# Logger.AddInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Logger
的用法示例。
在下文中一共展示了Logger.AddInfo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RestoreFile
/// -----------------------------------------------------------------------------
/// <summary>
/// The RestoreFile method restores a file from the backup folder
/// </summary>
/// <param name="installFile">The file to restore</param>
/// <param name="basePath">The basePath to the file</param>
/// <param name="log">A Logger to log the result</param>
/// <history>
/// [cnurse] 08/03/2007 created
/// </history>
/// -----------------------------------------------------------------------------
public static void RestoreFile(InstallFile installFile, string basePath, Logger log)
{
string fullFileName = Path.Combine(basePath, installFile.FullName);
string backupFileName = Path.Combine(installFile.BackupPath, installFile.Name + ".config");
//Copy File back over install file
FileSystemUtils.CopyFile(backupFileName, fullFileName);
log.AddInfo(string.Format(FILE_RestoreBackup, installFile.FullName));
}
示例2: DeleteFile
/// -----------------------------------------------------------------------------
/// <summary>
/// The DeleteFile method deletes a file.
/// </summary>
/// <param name="fileName">The file to delete</param>
/// <param name="basePath">The basePath to the file</param>
/// <param name="log">A Logger to log the result</param>
/// <history>
/// [cnurse] 08/03/2007 created
/// </history>
/// -----------------------------------------------------------------------------
public static void DeleteFile(string fileName, string basePath, Logger log)
{
string fullFileName = Path.Combine(basePath, fileName);
if (File.Exists(fullFileName))
{
RetryableAction.RetryEverySecondFor30Seconds(() => FileSystemUtils.DeleteFile(fullFileName), "Delete file " + fullFileName);
log.AddInfo(string.Format(FILE_Deleted, fileName));
string folderName = Path.GetDirectoryName(fullFileName);
if (folderName != null)
{
var folder = new DirectoryInfo(folderName);
TryDeleteFolder(folder, log);
}
}
}
示例3: BackupFile
/// -----------------------------------------------------------------------------
/// <summary>
/// The BackupFile method backs up a file to the backup folder
/// </summary>
/// <param name="installFile">The file to backup</param>
/// <param name="basePath">The basePath to the file</param>
/// <param name="log">A Logger to log the result</param>
/// <history>
/// [cnurse] 08/03/2007 created
/// </history>
/// -----------------------------------------------------------------------------
public static void BackupFile(InstallFile installFile, string basePath, Logger log)
{
string fullFileName = Path.Combine(basePath, installFile.FullName);
string backupFileName = Path.Combine(installFile.BackupPath, installFile.Name + ".config");
//create the backup folder if neccessary
if (!Directory.Exists(installFile.BackupPath))
{
Directory.CreateDirectory(installFile.BackupPath);
}
//Copy file to backup location
RetryableAction.RetryEverySecondFor30Seconds(() => FileSystemUtils.CopyFile(fullFileName, backupFileName), "Backup file " + fullFileName);
log.AddInfo(string.Format(FILE_CreateBackup, installFile.FullName));
}
示例4: CopyFile
/// -----------------------------------------------------------------------------
/// <summary>
/// The CopyFile method copies a file from the temporary extract location.
/// </summary>
/// <param name="installFile">The file to copy</param>
/// <param name="basePath">The basePath to the file</param>
/// <param name="log">A Logger to log the result</param>
/// <history>
/// [cnurse] 08/03/2007 created
/// </history>
/// -----------------------------------------------------------------------------
public static void CopyFile(InstallFile installFile, string basePath, Logger log)
{
string filePath = Path.Combine(basePath, installFile.Path);
string fullFileName = Path.Combine(basePath, installFile.FullName);
//create the folder if neccessary
if (!Directory.Exists(filePath))
{
log.AddInfo(string.Format(FOLDER_Created, filePath));
Directory.CreateDirectory(filePath);
}
//Copy file from temp location
RetryableAction.RetryEverySecondFor30Seconds(() => FileSystemUtils.CopyFile(installFile.TempFileName, fullFileName), "Copy file to " + fullFileName);
log.AddInfo(string.Format(FILE_Created, installFile.FullName));
}
示例5: TryDeleteFolder
private static void TryDeleteFolder(DirectoryInfo folder, Logger log)
{
if (folder.GetFiles().Length == 0 && folder.GetDirectories().Length == 0)
{
folder.Delete();
log.AddInfo(string.Format(FOLDER_Deleted, folder.Name));
TryDeleteFolder(folder.Parent, log);
}
}