本文整理汇总了C#中IProgressIndicator.Advance方法的典型用法代码示例。如果您正苦于以下问题:C# IProgressIndicator.Advance方法的具体用法?C# IProgressIndicator.Advance怎么用?C# IProgressIndicator.Advance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProgressIndicator
的用法示例。
在下文中一共展示了IProgressIndicator.Advance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deobfuscate
private FileSystemPath Deobfuscate(IObfuscatedFile obfuscatedFile, IProgressIndicator progressIndicator)
{
try
{
progressIndicator.Start(5);
progressIndicator.TaskName = "Deobfuscating...";
progressIndicator.CurrentItemText = string.Format("Saving to {0}", obfuscatedFile.NewFilename);
progressIndicator.Advance(1);
obfuscatedFile.deobfuscateBegin();
progressIndicator.Advance(1);
obfuscatedFile.deobfuscate();
progressIndicator.Advance(1);
obfuscatedFile.deobfuscateEnd();
// turn all flags on
RenamerFlags flags = RenamerFlags.DontCreateNewParamDefs | RenamerFlags.DontRenameDelegateFields |
RenamerFlags.RenameEvents |
RenamerFlags.RenameFields | RenamerFlags.RenameGenericParams |
RenamerFlags.RenameMethodArgs |
RenamerFlags.RenameMethods | RenamerFlags.RenameNamespaces |
RenamerFlags.RenameProperties |
RenamerFlags.RenameTypes | RenamerFlags.RestoreEvents |
RenamerFlags.RestoreEventsFromNames |
RenamerFlags.RestoreProperties | RenamerFlags.RestorePropertiesFromNames;
var renamer = new Renamer(obfuscatedFile.DeobfuscatorContext, new[] { obfuscatedFile }, flags);
progressIndicator.Advance(1);
renamer.rename();
progressIndicator.Advance(1);
obfuscatedFile.save();
}
finally
{
progressIndicator.Stop();
}
return new FileSystemPath(obfuscatedFile.NewFilename);
}
示例2: Search
public override ICollection<IOccurence> Search(IProgressIndicator progressIndicator)
{
// Create and configure utility class, which will perform search
var searcher = new StringSearcher(mySearchString, myCaseSensitive);
// Fetch all projects for solution, start progress
ICollection<IProject> projects = Solution.GetAllProjects();
progressIndicator.Start(projects.Count);
var items = new List<IOccurence>();
// visit each project and collect occurences
var visitor = new ProjectTextSearcher(searcher, items, mySearchFlags, myDocumentManager, mySolution);
foreach (IProject project in projects)
{
progressIndicator.CurrentItemText = string.Format("Scanning project '{0}'", project.Name);
project.Accept(visitor);
progressIndicator.Advance(1);
}
return items;
}
示例3: Rename
public override void Rename(RenameRefactoring executer, IProgressIndicator pi, bool hasConflictsWithDeclarations, IRefactoringDriver driver)
{
BuildDeclarations();
//Logger.Assert(myDeclarations.Count > 0, "myDeclarations.Count > 0");
IDeclaredElement declaredElement = myOriginalElementPointer.FindDeclaredElement();
if (declaredElement == null)
{
return;
}
IPsiServices psiServices = declaredElement.GetPsiServices();
IList<IReference> primaryReferences = executer.Workflow.GetElementReferences(PrimaryDeclaredElement);
List<Pair<IDeclaredElement, IList<IReference>>> secondaryElementWithReferences = SecondaryDeclaredElements.Select(x => Pair.Of(x, executer.Workflow.GetElementReferences(x))).ToList();
pi.Start(myDeclarations.Count + primaryReferences.Count);
foreach (IDeclaration declaration in myDeclarations)
{
InterruptableActivityCookie.CheckAndThrow(pi);
declaration.SetName(myNewName);
pi.Advance();
}
psiServices.PsiManager.UpdateCaches();
IDeclaredElement newDeclaredElement = null;
if (myDeclarations.Count > 0)
{
newDeclaredElement = myDeclarations[0].DeclaredElement;
}
Assertion.Assert(newDeclaredElement != null, "The condition (newDeclaredElement != null) is false.");
myNewElementPointer = newDeclaredElement.CreateElementPointer();
Assertion.Assert(newDeclaredElement.IsValid(), "myNewDeclaredElement.IsValid()");
myNewReferences.Clear();
OneToSetMap<PsiLanguageType, IReference> references = LanguageUtil.SortReferences(primaryReferences.Where(x => x.IsValid()));
IList<IReference> referencesToRename = new List<IReference>();
foreach (var pair in references)
{
List<IReference> sortedReferences = LanguageUtil.GetSortedReferences(pair.Value);
foreach (IReference reference in sortedReferences)
{
IReference oldReferenceForConflict = reference;
InterruptableActivityCookie.CheckAndThrow(pi);
if (reference.IsValid()) // reference may invalidate during additional reference processing
{
RenameHelperBase rename = executer.Workflow.LanguageSpecific[reference.GetTreeNode().Language];
IReference reference1 = rename.TransformProjectedInitializer(reference);
DeclaredElementInstance subst = GetSubst(newDeclaredElement, executer);
IReference newReference;
if (subst != null)
{
if (subst.Substitution.Domain.IsEmpty())
{
newReference = reference1.BindTo(subst.Element);
}
else
{
newReference = reference1.BindTo(subst.Element, subst.Substitution);
}
}
else
{
newReference = reference1.BindTo(newDeclaredElement);
}
if (!(newReference is IImplicitReference))
{
IDeclaredElement element = newReference.Resolve().DeclaredElement;
if (!hasConflictsWithDeclarations && !myDoNotShowBindingConflicts && (element == null || !element.Equals(newDeclaredElement)) && !rename.IsAlias(newDeclaredElement))
{
driver.AddLateConflict(() => new Conflict(newReference.GetTreeNode().GetSolution(), "Usage {0} can not be updated correctly.", ConflictSeverity.Error, oldReferenceForConflict), "not bound");
}
referencesToRename.Add(newReference);
}
myNewReferences.Insert(0, newReference);
rename.AdditionalReferenceProcessing(newDeclaredElement, newReference, myNewReferences);
}
pi.Advance();
}
}
foreach (var pair in secondaryElementWithReferences)
{
IDeclaredElement element = pair.First;
IList<IReference> secondaryReferences = pair.Second;
foreach (IReference reference in secondaryReferences)
{
InterruptableActivityCookie.CheckAndThrow(pi);
if (reference.IsValid())
{
reference.BindTo(element);
}
}
}
//.........这里部分代码省略.........