本文整理汇总了C#中IProgressMonitor.ReportSuccess方法的典型用法代码示例。如果您正苦于以下问题:C# IProgressMonitor.ReportSuccess方法的具体用法?C# IProgressMonitor.ReportSuccess怎么用?C# IProgressMonitor.ReportSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProgressMonitor
的用法示例。
在下文中一共展示了IProgressMonitor.ReportSuccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnRevertToRevision
protected override void OnRevertToRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
{
NGit.Repository repo = GetRepository (localPath);
NGit.Api.Git git = new NGit.Api.Git (repo);
GitRevision gitRev = (GitRevision)revision;
// Rewrite file data from selected revision.
foreach (var path in GetFilesInPaths (new FilePath[] { localPath })) {
MonoDevelop.Projects.Text.TextFile.WriteFile (path, GetCommitTextContent (gitRev.Commit, path), null);
}
monitor.ReportSuccess (GettextCatalog.GetString ("Successfully reverted {0} to revision {1}", localPath, gitRev));
}
示例2: UpdateCompleted
static bool UpdateCompleted (IProgressMonitor monitor, AggregatedOperationMonitor aggOp,
ProjectFile file, ProjectFile genFile, SingleFileCustomToolResult result,
bool runMultipleFiles)
{
monitor.EndTask ();
if (aggOp != null)
aggOp.Dispose ();
if (monitor.IsCancelRequested) {
monitor.ReportError (GettextCatalog.GetString ("Cancelled"), null);
monitor.Dispose ();
return false;
}
string genFileName;
try {
bool broken = false;
if (result.UnhandledException != null) {
broken = true;
string msg = GettextCatalog.GetString ("The '{0}' code generator crashed", file.Generator);
result.Errors.Add (new CompilerError (file.Name, 0, 0, "", msg + ": " + result.UnhandledException.Message));
monitor.ReportError (msg, result.UnhandledException);
LoggingService.LogError (msg, result.UnhandledException);
}
genFileName = result.GeneratedFilePath.IsNullOrEmpty?
null : result.GeneratedFilePath.ToRelative (file.FilePath.ParentDirectory);
if (!string.IsNullOrEmpty (genFileName)) {
bool validName = genFileName.IndexOfAny (new [] { '/', '\\' }) < 0
&& FileService.IsValidFileName (genFileName);
if (!broken && !validName) {
broken = true;
string msg = GettextCatalog.GetString ("The '{0}' code generator output invalid filename '{1}'",
file.Generator, result.GeneratedFilePath);
result.Errors.Add (new CompilerError (file.Name, 0, 0, "", msg));
monitor.ReportError (msg, null);
}
}
if (result.Errors.Count > 0) {
DispatchService.GuiDispatch (delegate {
foreach (CompilerError err in result.Errors)
TaskService.Errors.Add (new Task (file.FilePath, err.ErrorText, err.Column, err.Line,
err.IsWarning? TaskSeverity.Warning : TaskSeverity.Error,
TaskPriority.Normal, file.Project.ParentSolution, file));
});
}
if (broken)
return true;
if (!runMultipleFiles) {
if (result.Success)
monitor.ReportSuccess ("Generated file successfully.");
else if (result.SuccessWithWarnings)
monitor.ReportSuccess ("Warnings in file generation.");
else
monitor.ReportError ("Errors in file generation.", null);
}
} finally {
if (!runMultipleFiles)
monitor.Dispose ();
}
if (result.GeneratedFilePath.IsNullOrEmpty || !File.Exists (result.GeneratedFilePath))
return true;
// broadcast a change event so text editors etc reload the file
FileService.NotifyFileChanged (result.GeneratedFilePath);
// add file to project, update file properties, etc
Gtk.Application.Invoke (delegate {
bool projectChanged = false;
if (genFile == null) {
genFile = file.Project.AddFile (result.GeneratedFilePath, result.OverrideBuildAction);
projectChanged = true;
} else if (result.GeneratedFilePath != genFile.FilePath) {
genFile.Name = result.GeneratedFilePath;
projectChanged = true;
}
if (file.LastGenOutput != genFileName) {
file.LastGenOutput = genFileName;
projectChanged = true;
}
if (genFile.DependsOn != file.FilePath.FileName) {
genFile.DependsOn = file.FilePath.FileName;
projectChanged = true;
}
if (projectChanged)
IdeApp.ProjectOperations.Save (file.Project);
});
return true;
//.........这里部分代码省略.........
示例3: DoClean
protected override void DoClean(IProgressMonitor monitor, ConfigurationSelector configuration)
{
var cfg = GetConfiguration (configuration) as DProjectConfiguration;
// delete obj/res files
monitor.BeginTask ("Delete intermediate files", Files.Count);
foreach (var f in Files) {
try {
if (File.Exists (f.LastGenOutput))
File.Delete (f.LastGenOutput);
} catch (Exception ex) {
monitor.ReportError ("Error while removing " + f, ex);
} finally {
f.LastGenOutput = string.Empty;
monitor.Step (1);
}
}
monitor.EndTask ();
// delete target file
monitor.BeginTask ("Delete output file", 1);
if (File.Exists (cfg.CompiledOutputName))
File.Delete (cfg.CompiledOutputName);
monitor.EndTask ();
monitor.ReportSuccess ("Cleanup successful!");
}
示例4: BuildDone
void BuildDone (IProgressMonitor monitor, BuildResult result, IBuildTarget entry, ITimeTracker tt)
{
Task[] tasks = null;
tt.Trace ("Begin reporting build result");
try {
if (result != null) {
lastResult = result;
monitor.Log.WriteLine ();
monitor.Log.WriteLine (GettextCatalog.GetString ("---------------------- Done ----------------------"));
tt.Trace ("Updating task service");
tasks = new Task [result.Errors.Count];
for (int n=0; n<tasks.Length; n++) {
tasks [n] = new Task (result.Errors [n]);
tasks [n].Owner = this;
}
TaskService.Errors.AddRange (tasks);
TaskService.Errors.ResetLocationList ();
IdeApp.Workbench.ActiveLocationList = TaskService.Errors;
tt.Trace ("Reporting result");
string errorString = GettextCatalog.GetPluralString("{0} error", "{0} errors", result.ErrorCount, result.ErrorCount);
string warningString = GettextCatalog.GetPluralString("{0} warning", "{0} warnings", result.WarningCount, result.WarningCount);
if (result.ErrorCount == 0 && result.WarningCount == 0 && lastResult.FailedBuildCount == 0) {
monitor.ReportSuccess (GettextCatalog.GetString ("Build successful."));
} else if (result.ErrorCount == 0 && result.WarningCount > 0) {
monitor.ReportWarning(GettextCatalog.GetString("Build: ") + errorString + ", " + warningString);
} else if (result.ErrorCount > 0) {
monitor.ReportError(GettextCatalog.GetString("Build: ") + errorString + ", " + warningString, null);
} else {
monitor.ReportError(GettextCatalog.GetString("Build failed."), null);
}
tt.Trace ("End build event");
OnEndBuild (monitor, lastResult.FailedBuildCount == 0, lastResult, entry as SolutionItem);
} else {
tt.Trace ("End build event");
OnEndBuild (monitor, false);
}
tt.Trace ("Showing results pad");
try {
Pad errorsPad = IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> ();
switch (IdeApp.Preferences.ShowErrorPadAfterBuild) {
case BuildResultStates.Always:
if (!errorsPad.Visible)
errorsPad.IsOpenedAutomatically = true;
errorsPad.Visible = true;
errorsPad.BringToFront ();
break;
case BuildResultStates.Never:
break;
case BuildResultStates.OnErrors:
if (TaskService.Errors.Any (task => task.Severity == TaskSeverity.Error))
goto case BuildResultStates.Always;
goto case BuildResultStates.Never;
case BuildResultStates.OnErrorsOrWarnings:
if (TaskService.Errors.Any (task => task.Severity == TaskSeverity.Error || task.Severity == TaskSeverity.Warning))
goto case BuildResultStates.Always;
goto case BuildResultStates.Never;
}
} catch {}
if (tasks != null) {
Task jumpTask = null;
switch (IdeApp.Preferences.JumpToFirstErrorOrWarning) {
case JumpToFirst.Error:
jumpTask = tasks.FirstOrDefault (t => t.Severity == TaskSeverity.Error && TaskStore.IsProjectTaskFile (t));
break;
case JumpToFirst.ErrorOrWarning:
jumpTask = tasks.FirstOrDefault (t => (t.Severity == TaskSeverity.Error || t.Severity == TaskSeverity.Warning) && TaskStore.IsProjectTaskFile (t));
break;
}
if (jumpTask != null) {
tt.Trace ("Jumping to first result position");
jumpTask.JumpToPosition ();
}
}
} finally {
monitor.Dispose ();
tt.End ();
}
}
示例5: Compile
//.........这里部分代码省略.........
// Prevent duplicates e.g. when having the samely-named source files in different sub-packages
int i=2;
while(File.Exists(obj))
{
// Simply add a number between the obj name and its extension
obj= Path.Combine(objDir, Path.GetFileNameWithoutExtension(f.FilePath))+i + ObjectExtension;
i++;
}
// Create argument string for source file compilation.
var dmdArgs = FillInMacros(Arguments.CompilerArguments + " " + BuildConfig.ExtraCompilerArguments, new DCompilerMacroProvider
{
IncludePathConcatPattern=Commands.IncludePathPattern,
SourceFile = f.FilePath,
ObjectFile = obj,
Includes=SourceIncludePaths,
});
// b.Execute compiler
string dmdOutput;
int exitCode = ExecuteCommand(Commands.Compiler, dmdArgs, Project.BaseDirectory, monitor, out dmdOutput);
ParseCompilerOutput(dmdOutput, compilerResults);
CheckReturnCode(exitCode, compilerResults);
monitor.Step(1);
if (exitCode != 0)
{
buildResult.FailedBuildCount++;
succesfullyBuilt = false;
break;
}
else
{
f.LastGenOutput = obj;
buildResult.BuildCount++;
Project.LastModificationTimes[f] = File.GetLastWriteTime(f.FilePath);
// Especially when compiling large projects, do only add the relative part of the obj file due to command shortness
if (obj.StartsWith(Project.BaseDirectory))
BuiltObjects.Add(obj.Substring(Project.BaseDirectory.ToString().Length).TrimStart(Path.DirectorySeparatorChar));
else
BuiltObjects.Add(obj);
}
}
#endregion
#region Link files
if (succesfullyBuilt)
{
// a.
if ((!modificationsDone) && lastLinkerActionSuccessfull)
{
// Only return if build target is still existing
if (File.Exists(LinkTarget))
{
monitor.Step(1);
return new BuildResult(compilerResults, "");
}
}
// b.Build linker argument string
// Build argument preparation
/*
var libPaths=new List<string>(Compiler.DefaultLibPaths);
libPaths.AddRange(Project.LibraryPaths);
*/
var libs=new List<string>(Compiler.DefaultLibraries);
libs.AddRange(Project.ExtraLibraries);
var linkArgs = FillInMacros(Arguments.LinkerArguments + " "+BuildConfig.ExtraLinkerArguments,
new DLinkerMacroProvider {
ObjectsStringPattern=Commands.ObjectFileLinkPattern,
Objects=BuiltObjects.ToArray(),
TargetFile=LinkTarget,
RelativeTargetDirectory=BuildConfig.OutputDirectory.ToRelative(Project.BaseDirectory),
//LibraryPaths=libPaths,
Libraries=libs
});
var linkerOutput = "";
int exitCode = ExecuteCommand(Commands.Linker,linkArgs,Project.BaseDirectory,monitor,out linkerOutput);
compilerResults.NativeCompilerReturnValue = exitCode;
CheckReturnCode(exitCode, compilerResults);
lastLinkerActionSuccessfull = (exitCode == 0);
if (lastLinkerActionSuccessfull)
{
monitor.ReportSuccess("Build successful!");
monitor.Step(1);
}
}
#endregion
return new BuildResult(compilerResults,"");
}
示例6: Push
public void Push (IProgressMonitor monitor, string remote, string remoteBranch)
{
RemoteConfig remoteConfig = new RemoteConfig (RootRepository.GetConfig (), remote);
Transport tp = Transport.Open (RootRepository, remoteConfig);
string remoteRef = "refs/heads/" + remoteBranch;
RemoteRefUpdate rr = new RemoteRefUpdate (RootRepository, RootRepository.GetBranch (), remoteRef, false, null, null);
List<RemoteRefUpdate> list = new List<RemoteRefUpdate> ();
list.Add (rr);
using (var gm = new GitMonitor (monitor))
tp.Push (gm, list);
switch (rr.GetStatus ()) {
case RemoteRefUpdate.Status.UP_TO_DATE: monitor.ReportSuccess (GettextCatalog.GetString ("Remote branch is up to date.")); break;
case RemoteRefUpdate.Status.REJECTED_NODELETE: monitor.ReportError (GettextCatalog.GetString ("The server is configured to deny deletion of the branch"), null); break;
case RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD: monitor.ReportError (GettextCatalog.GetString ("The update is a non-fast-forward update. Merge the remote changes before pushing again."), null); break;
case RemoteRefUpdate.Status.OK:
monitor.ReportSuccess (GettextCatalog.GetString ("Push operation successfully completed."));
// Update the remote branch
ObjectId headId = rr.GetNewObjectId ();
RefUpdate updateRef = RootRepository.UpdateRef (Constants.R_REMOTES + remote + "/" + remoteBranch);
updateRef.SetNewObjectId(headId);
updateRef.Update();
break;
default:
string msg = rr.GetMessage ();
msg = !string.IsNullOrEmpty (msg) ? msg : GettextCatalog.GetString ("Push operation failed");
monitor.ReportError (msg, null);
break;
}
}
示例7: UpdateProject
// Note: This method may throw TimeoutException or AppleScriptException
public void UpdateProject (IProgressMonitor monitor, List<XcodeSyncedItem> allItems, XcodeProject emptyProject)
{
items = allItems;
monitor.BeginTask (GettextCatalog.GetString ("Updating Xcode project for {0}...", name), items.Count);
var ctx = new XcodeSyncContext (projectDir, syncTimeCache);
var toRemove = new HashSet<string> (itemMap.Keys);
var toClose = new HashSet<string> ();
var syncList = new List<XcodeSyncedItem> ();
bool updateProject = false;
foreach (var item in items) {
bool needsSync = item.NeedsSyncOut (monitor, ctx);
if (needsSync)
syncList.Add (item);
var files = item.GetTargetRelativeFileNames ();
foreach (var file in files) {
toRemove.Remove (file);
if (!itemMap.ContainsKey (file)) {
monitor.Log.WriteLine ("'{0}' needs to be updated.", file);
updateProject = true;
} else if (needsSync) {
monitor.Log.WriteLine ("'{0}' needs to be closed.", file);
toClose.Add (file);
}
itemMap[file] = item;
}
}
updateProject = updateProject || toRemove.Any ();
bool removedOldProject = false;
if (updateProject) {
if (pendingProjectWrite == null && ProjectExists ()) {
monitor.Log.WriteLine ("A project file needs to be updated, closing and removing old project.");
CloseProject ();
DeleteXcproj (monitor);
removedOldProject = true;
}
} else {
foreach (var f in toClose)
CloseFile (monitor, projectDir.Combine (f));
}
foreach (var f in toRemove) {
itemMap.Remove (f);
syncTimeCache.Remove (f);
var path = projectDir.Combine (f);
if (File.Exists (path))
File.Delete (path);
}
if (removedOldProject) {
HackRelocateProject (monitor);
ctx.ProjectDir = projectDir;
}
foreach (var item in items) {
if (updateProject)
item.AddToProject (emptyProject, projectDir);
}
foreach (var item in syncList) {
item.SyncOut (monitor, ctx);
monitor.Step (1);
}
if (updateProject) {
monitor.Log.WriteLine ("Queued write of '{0}'.", xcproj);
pendingProjectWrite = emptyProject;
}
monitor.EndTask ();
monitor.ReportSuccess (GettextCatalog.GetString ("Xcode project updated."));
}
示例8: RestorePackages
void RestorePackages (IProgressMonitor progressMonitor, ProgressMonitorStatusMessage progressMessage)
{
var msbuildTargetsMonitor = new MSBuildTargetsRestoredMonitor (packageManagementEvents);
using (msbuildTargetsMonitor) {
var action = new RestorePackagesAction (solution, packageManagementEvents);
if (project != null) {
action.Project = project;
}
action.Execute ();
}
RefreshProjectReferences (msbuildTargetsMonitor.AnyMSBuildTargetsRestored);
ForceCreationOfSharedRepositoriesConfigFile ();
progressMonitor.ReportSuccess (progressMessage.Success);
packageManagementEvents.OnPackagesRestored ();
}
示例9: Deploy
public bool Deploy ( DeployContext ctx, Solution solution, string defaultConf, string targetDir, bool generateFiles, IProgressMonitor monitor )
{
if (generateFiles) {
if ( !GenerateFiles ( ctx, solution, defaultConf, monitor ) )
return false;
}
monitor.BeginTask ( GettextCatalog.GetString( "Deploying Solution to Tarball" ) , 3 );
try
{
string baseDir = Path.GetDirectoryName ( solution.FileName);
ProcessWrapper ag_process = Runtime.ProcessService.StartProcess ( "sh",
generateAutotools ? "autogen.sh" : "configure",
baseDir,
monitor.Log,
monitor.Log,
null );
ag_process.WaitForOutput ();
if ( ag_process.ExitCode > 0 )
throw new Exception ( GettextCatalog.GetString ("An unspecified error occurred while running '{0}'", generateAutotools ? "autogen.sh" : "configure") );
monitor.Step ( 1 );
StringWriter sw = new StringWriter ();
LogTextWriter chainedOutput = new LogTextWriter ();
chainedOutput.ChainWriter (monitor.Log);
chainedOutput.ChainWriter (sw);
ProcessWrapper process = Runtime.ProcessService.StartProcess ( "make",
"dist",
baseDir,
chainedOutput,
monitor.Log,
null );
process.WaitForOutput ();
if ( process.ExitCode > 0 )
throw new Exception ( GettextCatalog.GetString ("An unspecified error occurred while running '{0}'", "make dist") );
monitor.Step ( 1 );
// FIXME: hackish way to get the created tarball's filename
string output = sw.ToString();
int targz = output.LastIndexOf ( "tar.gz" );
int begin = output.LastIndexOf ( '>', targz );
string filename = output.Substring ( begin + 1, (targz - begin) + 5 ).Trim ();
FileService.CopyFile (Path.Combine (baseDir, filename), Path.Combine (targetDir, filename));
monitor.Step ( 1 );
}
catch ( Exception e )
{
monitor.ReportError ( GettextCatalog.GetString ("Solution could not be deployed: "), e );
return false;
}
finally
{
monitor.EndTask ();
}
monitor.ReportSuccess (GettextCatalog.GetString ("Solution was successfully deployed."));
return true;
}
示例10: BuildDone
void BuildDone(IProgressMonitor monitor, ICompilerResult result)
{
lastResult = result;
monitor.Log.WriteLine ();
monitor.Log.WriteLine (String.Format (GettextCatalog.GetString ("---------------------- Done ----------------------")));
foreach (CompilerError err in result.CompilerResults.Errors) {
Runtime.TaskService.AddTask (new Task(null, err));
}
if (result.ErrorCount == 0 && result.WarningCount == 0 && lastResult.FailedBuildCount == 0) {
monitor.ReportSuccess (GettextCatalog.GetString ("Build successful."));
} else if (result.ErrorCount == 0 && result.WarningCount > 0) {
monitor.ReportWarning (String.Format (GettextCatalog.GetString ("Build: {0} errors, {1} warnings."), result.ErrorCount, result.WarningCount));
} else if (result.ErrorCount > 0) {
monitor.ReportError (String.Format (GettextCatalog.GetString ("Build: {0} errors, {1} warnings."), result.ErrorCount, result.WarningCount), null);
} else {
monitor.ReportError (String.Format (GettextCatalog.GetString ("Build failed.")), null);
}
OnEndBuild (lastResult.FailedBuildCount == 0);
}
示例11: Push
public void Push (IProgressMonitor monitor, string remote, string remoteBranch)
{
bool success = true;
var branch = RootRepository.Head;
if (branch.TrackedBranch == null) {
RootRepository.Branches.Update (branch, b => b.TrackedBranch = "refs/remotes/" + remote + "/" + remoteBranch);
}
RetryUntilSuccess (monitor, () =>
RootRepository.Network.Push (RootRepository.Network.Remotes [remote], "refs/heads/" + remoteBranch, new PushOptions {
OnPushStatusError = pushStatusErrors => success = false,
CredentialsProvider = GitCredentials.TryGet
})
);
if (!success)
return;
monitor.ReportSuccess (GettextCatalog.GetString ("Push operation successfully completed."));
}
示例12: Save
public override void Save(IProgressMonitor monitor)
{
monitor.ReportSuccess("Skip saving dub project.");
}
示例13: ReportOutcome
void ReportOutcome (
IAsyncOperation operation,
IProgressMonitor progressMonitor,
ProgressMonitorStatusMessage progressMessage)
{
if (operation.Success) {
progressMonitor.ReportSuccess (progressMessage.Success);
packageManagementEvents.OnPackagesRestored ();
} else {
progressMonitor.ReportError (progressMessage.Error, null);
progressMonitor.ShowPackageConsole ();
RestoreFailed = true;
}
}
示例14: CheckForPackageUpdates
void CheckForPackageUpdates (
IProgressMonitor progressMonitor,
ProgressMonitorStatusMessage progressMessage,
PackageUpdatesEventMonitor eventMonitor)
{
updatedPackagesInSolution.CheckForUpdates ();
if (updatedPackagesInSolution.AnyUpdates ()) {
progressMonitor.ReportSuccess (GettextCatalog.GetString ("Package updates are available."));
} else if (eventMonitor.WarningReported) {
progressMonitor.ReportWarning (progressMessage.Warning);
} else {
progressMonitor.ReportSuccess (progressMessage.Success);
}
}
示例15: Push
public void Push (IProgressMonitor monitor, string remote, string remoteBranch)
{
string remoteRef = "refs/heads/" + remoteBranch;
IEnumerable<PushResult> res;
var push = new NGit.Api.Git (RootRepository).Push ();
// We only have one pushed branch.
push.SetRemote (remote).SetRefSpecs (new RefSpec (remoteRef));
using (var gm = new GitMonitor (monitor)) {
push.SetProgressMonitor (gm);
res = push.Call ();
}
foreach (var pr in res) {
var remoteUpdate = pr.GetRemoteUpdate (remoteRef);
switch (remoteUpdate.GetStatus ()) {
case RemoteRefUpdate.Status.UP_TO_DATE: monitor.ReportSuccess (GettextCatalog.GetString ("Remote branch is up to date.")); break;
case RemoteRefUpdate.Status.REJECTED_NODELETE: monitor.ReportError (GettextCatalog.GetString ("The server is configured to deny deletion of the branch"), null); break;
case RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD: monitor.ReportError (GettextCatalog.GetString ("The update is a non-fast-forward update. Merge the remote changes before pushing again."), null); break;
case RemoteRefUpdate.Status.OK:
monitor.ReportSuccess (GettextCatalog.GetString ("Push operation successfully completed."));
// Update the remote branch
ObjectId headId = remoteUpdate.GetNewObjectId ();
RefUpdate updateRef = RootRepository.UpdateRef (Constants.R_REMOTES + remote + "/" + remoteBranch);
updateRef.SetNewObjectId(headId);
updateRef.Update();
break;
default:
string msg = remoteUpdate.GetMessage ();
msg = !string.IsNullOrEmpty (msg) ? msg : GettextCatalog.GetString ("Push operation failed");
monitor.ReportError (msg, null);
break;
}
}
}