public CreateListOfFilesToDeploy ( ) : List |
||
Результат | List |
/// <summary> /// Called after the execution of run/compile/check/prolint /// </summary> public static void OnSingleExecutionOk(ProExecution lastExec) { try { var treatedFile = lastExec.ListToCompile.First(); CurrentOperation currentOperation; if (!Enum.TryParse(lastExec.ExecutionType.ToString(), true, out currentOperation)) { currentOperation = CurrentOperation.Run; } var isCurrentFile = treatedFile.InputPath.EqualsCi(Plug.CurrentFilePath); var otherFilesInError = false; int nbWarnings = 0; int nbErrors = 0; // Read log info var errorList = lastExec.LoadErrorLog(); if (!errorList.Any()) { // the compiler messages are empty var fileInfo = new FileInfo(lastExec.LogPath); if (fileInfo.Length > 0) { // the .log is not empty, maybe something went wrong in the runner, display errors UserCommunication.Notify( "Something went wrong while " + currentOperation.GetAttribute <CurrentOperationAttr>().ActionText + " the following file:<br>" + treatedFile.InputPath.ToHtmlLink() + "<br>The progress compiler didn't return any errors but the log isn't empty, here is the content :" + Utils.ReadAndFormatLogToHtml(lastExec.LogPath), MessageImg.MsgError, "Critical error", "Action failed"); return; } } else { // count number of warnings/errors, loop through files > loop through errors in each file foreach (var keyValue in errorList) { foreach (var fileError in keyValue.Value) { if (fileError.Level <= ErrorLevel.StrongWarning) { nbWarnings++; } else { nbErrors++; } } otherFilesInError = otherFilesInError || !treatedFile.InputPath.EqualsCi(keyValue.Key); } } // Prepare the notification content var notifTitle = currentOperation.GetAttribute <CurrentOperationAttr>().Name; var notifImg = (nbErrors > 0) ? MessageImg.MsgError : ((nbWarnings > 0) ? MessageImg.MsgWarning : MessageImg.MsgOk); var notifTimeOut = (nbErrors > 0) ? 0 : ((nbWarnings > 0) ? 10 : 5); var notifSubtitle = lastExec.ExecutionType == ExecutionType.Prolint ? (nbErrors + nbWarnings) + " problem" + ((nbErrors + nbWarnings) > 1 ? "s" : "") + " detected" : (nbErrors > 0) ? nbErrors + " error" + (nbErrors > 1 ? "s" : "") + " found" : ((nbWarnings > 0) ? nbWarnings + " warning" + (nbWarnings > 1 ? "s" : "") + " found" : "Syntax correct"); // build the error list var errorsList = new List <FileError>(); foreach (var keyValue in errorList) { errorsList.AddRange(keyValue.Value); } // when compiling, transfering .r/.lst to compilation dir var listTransferFiles = new List <FileToDeploy>(); if (lastExec.ExecutionType == ExecutionType.Compile) { listTransferFiles = lastExec.CreateListOfFilesToDeploy(); listTransferFiles = lastExec.ProEnv.Deployer.DeployFiles(listTransferFiles); } // Notify the user, or not if (Config.Instance.CompileAlwaysShowNotification || !isCurrentFile || !Npp.GetFocus() || otherFilesInError) { UserCommunication.NotifyUnique(treatedFile.InputPath, "Was " + currentOperation.GetAttribute <CurrentOperationAttr>().ActionText + " :<br>" + ProCompilation.FormatCompilationResult(treatedFile.InputPath, errorsList, listTransferFiles), notifImg, notifTitle, notifSubtitle, null, notifTimeOut); } } catch (Exception e) { ErrorHandler.ShowErrors(e, "Error in OnExecutionOk"); } }
/// <summary> /// Called after the execution of run/compile/check/prolint /// </summary> public static void OnSingleExecutionOk(ProExecution lastExec) { try { var treatedFile = lastExec.ListToCompile.First(); CurrentOperation currentOperation; if (!Enum.TryParse(lastExec.ExecutionType.ToString(), true, out currentOperation)) currentOperation = CurrentOperation.Run; var isCurrentFile = treatedFile.InputPath.EqualsCi(Plug.CurrentFilePath); var otherFilesInError = false; int nbWarnings = 0; int nbErrors = 0; // Read log info var errorList = lastExec.LoadErrorLog(); if (!errorList.Any()) { // the compiler messages are empty var fileInfo = new FileInfo(lastExec.LogPath); if (fileInfo.Length > 0) { // the .log is not empty, maybe something went wrong in the runner, display errors UserCommunication.Notify( "Something went wrong while " + currentOperation.GetAttribute<CurrentOperationAttr>().ActionText + " the following file:<br>" + treatedFile.InputPath.ToHtmlLink() + "<br>The progress compiler didn't return any errors but the log isn't empty, here is the content :" + Utils.ReadAndFormatLogToHtml(lastExec.LogPath), MessageImg.MsgError, "Critical error", "Action failed"); return; } } else { // count number of warnings/errors, loop through files > loop through errors in each file foreach (var keyValue in errorList) { foreach (var fileError in keyValue.Value) { if (fileError.Level <= ErrorLevel.StrongWarning) nbWarnings++; else nbErrors++; } otherFilesInError = otherFilesInError || !treatedFile.InputPath.EqualsCi(keyValue.Key); } } // Prepare the notification content var notifTitle = currentOperation.GetAttribute<CurrentOperationAttr>().Name; var notifImg = (nbErrors > 0) ? MessageImg.MsgError : ((nbWarnings > 0) ? MessageImg.MsgWarning : MessageImg.MsgOk); var notifTimeOut = (nbErrors > 0) ? 0 : ((nbWarnings > 0) ? 10 : 5); var notifSubtitle = lastExec.ExecutionType == ExecutionType.Prolint ? (nbErrors + nbWarnings) + " problem" + ((nbErrors + nbWarnings) > 1 ? "s" : "") + " detected" : (nbErrors > 0) ? nbErrors + " error" + (nbErrors > 1 ? "s" : "") + " found" : ((nbWarnings > 0) ? nbWarnings + " warning" + (nbWarnings > 1 ? "s" : "") + " found" : "Syntax correct"); // build the error list var errorsList = new List<FileError>(); foreach (var keyValue in errorList) { errorsList.AddRange(keyValue.Value); } // when compiling, transfering .r/.lst to compilation dir var listTransferFiles = new List<FileToDeploy>(); if (lastExec.ExecutionType == ExecutionType.Compile) { listTransferFiles = lastExec.CreateListOfFilesToDeploy(); listTransferFiles = lastExec.ProEnv.Deployer.DeployFiles(listTransferFiles); } // Notify the user, or not if (Config.Instance.CompileAlwaysShowNotification || !isCurrentFile || !Npp.GetFocus() || otherFilesInError) UserCommunication.NotifyUnique(treatedFile.InputPath, "Was " + currentOperation.GetAttribute<CurrentOperationAttr>().ActionText + " :<br>" + ProCompilation.FormatCompilationResult(treatedFile.InputPath, errorsList, listTransferFiles), notifImg, notifTitle, notifSubtitle, null, notifTimeOut); } catch (Exception e) { ErrorHandler.ShowErrors(e, "Error in OnExecutionOk"); } }