本文整理汇总了C#中MemberList.Search方法的典型用法代码示例。如果您正苦于以下问题:C# MemberList.Search方法的具体用法?C# MemberList.Search怎么用?C# MemberList.Search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemberList
的用法示例。
在下文中一共展示了MemberList.Search方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDocComments
private static void AddDocComments(MemberList members, BaseModel[] docMembers)
{
foreach (BaseModel docMember in docMembers)
{
MemberModel member = members.Search(docMember.Name, 0, 0);
if (member == null) continue;
member.Comments = docMember.Comment;
}
}
示例2: GetVisibleExternalElements
/// <summary>
/// Return the elements (package, types, etc) visible from the current file
/// </summary>
/// <param name="typesOnly">Return only packages & types</param>
/// <returns></returns>
public override MemberList GetVisibleExternalElements(bool typesOnly)
{
MemberList visibleElements = new MemberList();
if (!IsFileValid) return visibleElements;
// top-level elements
if (!typesOnly && topLevel != null)
{
if (topLevel.OutOfDate) InitTopLevelElements();
visibleElements.Add(topLevel.Members);
}
if (completionCache.IsDirty)
{
MemberList elements = new MemberList();
// root types & packages
FileModel baseElements = ResolvePackage(null, false);
if (baseElements != null)
{
elements.Add(baseElements.Imports);
elements.Add(baseElements.Members);
}
elements.Add(new MemberModel(features.voidKey, features.voidKey, FlagType.Class | FlagType.Intrinsic, 0));
bool qualify = Settings.CompletionShowQualifiedTypes && settings.GenerateImports;
// other classes in same package
if (features.hasPackages && cFile.Package != "")
{
FileModel packageElements = ResolvePackage(cFile.Package, false);
if (packageElements != null)
{
foreach (MemberModel member in packageElements.Imports)
{
if (member.Flags != FlagType.Package)
{
if (qualify) member.Name = member.Type;
elements.Add(member);
}
}
foreach (MemberModel member in packageElements.Members)
{
string pkg = member.InFile.Package;
if (qualify && pkg != "") member.Name = pkg + "." + member.Name;
elements.Add(member);
}
}
}
// other classes in same file
if (cFile.PrivateSectionIndex > 0)
{
if (inPrivateSection && cFile.Classes.Count > 1)
{
ClassModel mainClass = cFile.GetPublicClass();
if (!mainClass.IsVoid())
{
MemberModel toRemove = elements.Search(mainClass.Name, 0, 0);
if (toRemove != null && toRemove.Type == mainClass.QualifiedName)
elements.Remove(toRemove);
}
}
MemberModel member;
foreach (ClassModel aClass in cFile.Classes)
{
if (features.hasMultipleDefs || aClass.Access == Visibility.Private)
{
member = aClass.ToMemberModel();
elements.Add(member);
}
}
}
// imports
elements.Add(ResolveImports(CurrentModel));
// in cache
elements.Sort();
completionCache = new CompletionCache(this, elements);
// known classes colorization
if (!CommonSettings.DisableKnownTypesColoring && !settings.LazyClasspathExploration && CurSciControl != null)
{
try
{
CurSciControl.KeyWords(1, completionCache.Keywords); // additional-keywords index = 1
CurSciControl.Colourise(0, -1); // re-colorize the editor
}
catch (AccessViolationException){} // catch memory errors
}
}
visibleElements.Merge(completionCache.Elements);
return visibleElements;
}
示例3: PopulatePackageEntries
private void PopulatePackageEntries(string package, string path, MemberList memberList)
{
string[] dirEntries = null;
try
{
dirEntries = System.IO.Directory.GetDirectories(path);
}
catch { }
if (dirEntries == null) return;
string mname;
string type;
foreach (string entry in dirEntries)
{
mname = GetLastStringToken(entry, dirSeparator);
if (mname.Length > 0 && memberList.Search(mname, 0, 0) == null && re_token.IsMatch(mname))
{
type = mname;
if (package.Length > 0) type = package + "." + mname;
memberList.Add(new MemberModel(mname, type, FlagType.Package, Visibility.Public));
}
}
}
示例4: PopulateClassesEntries
private void PopulateClassesEntries(string package, string path, MemberList memberList)
{
string[] fileEntries = null;
try
{
fileEntries = System.IO.Directory.GetFiles(path, "*" + settings.DefaultExtension);
}
catch { }
if (fileEntries == null) return;
string mname;
string type;
FlagType flag = FlagType.Class | ((package == null) ? FlagType.Intrinsic : 0);
foreach (string entry in fileEntries)
{
mname = GetLastStringToken(entry, dirSeparator);
mname = mname.Substring(0, mname.LastIndexOf("."));
if (mname.Length > 0 && memberList.Search(mname, 0, 0) == null && re_token.IsMatch(mname))
{
type = mname;
if (package.Length > 0) type = package + "." + mname;
memberList.Add(new MemberModel(mname, type, flag, Visibility.Public));
}
}
}
示例5: GetBasePackages
/// <summary>
/// Search all base packages (com, net, org,...) in classpath
/// </summary>
/// <returns>Base packages list as members</returns>
public override MemberList GetBasePackages()
{
MemberList packages = new MemberList();
MemberModel package;
string[] dirEntries;
string[] fileEntries;
string cname;
string upPath;
string mmCP = MMClassPath.ToUpper();
string mtascCP = mtascRootFolder.ToUpper();
bool notMacromedia;
bool notMTASC;
foreach(string path in classPath)
try
{
upPath = path.ToUpper();
notMacromedia = (mmCP.Length == 0) || !upPath.StartsWith(mmCP);
notMTASC = (mtascCP.Length == 0) || !upPath.StartsWith(mtascCP);
// base classes
if (notMacromedia && notMTASC)
{
fileEntries = System.IO.Directory.GetFiles(path, "*.as");
if (fileEntries != null)
foreach(string entry in fileEntries)
{
cname = GetLastStringToken(entry, dirSeparator);
int p = cname.LastIndexOf('.');
cname = cname.Substring(0,p);
if (!cname.StartsWith("_") && (cname.IndexOf('.') < 0) && (cname.IndexOf(' ') < 0)
&& (packages.Search(cname, 0) == null))
{
//DebugConsole.Trace("Base class "+cname);
package = new MemberModel();
package.Flags = 0;
package.Type = package.Name = cname;
packages.Add(package);
}
}
}
// base packages
if (notMacromedia)
{
dirEntries = System.IO.Directory.GetDirectories(path);
if (dirEntries != null)
foreach(string entry in dirEntries)
{
cname = GetLastStringToken(entry, dirSeparator);
if (!cname.StartsWith("_") && (cname.IndexOf(' ') < 0) && (cname.IndexOf('.') < 0)
&& (packages.Search(cname, 0) == null))
{
//DebugConsole.Trace("Base package "+cname);
package = new MemberModel();
package.Flags = FlagType.Package;
package.Type = package.Name = cname;
packages.Add(package);
}
}
}
else if (packages.Search("mx", 0) == null)
{
package = new MemberModel();
package.Flags = FlagType.Package;
package.Type = package.Name = "mx";
packages.Add(package);
}
}
catch(Exception ex)
{
ErrorHandler.ShowError(ex.Message+"\n"+path, ex);
}
packages.Sort();
return packages;
}
示例6: FindPackage
/// <summary>
/// Find folder and classes in classpath
/// </summary>
/// <param name="folder">Path to eval</param>
/// <param name="completeContent">Return package content</param>
/// <returns>Package folders and classes</returns>
public override MemberList FindPackage(string folder, bool completeContent)
{
if ((folder == null) || (folder.Length == 0))
return null;
MemberList package = new MemberList();
MemberModel pathMember;
string[] dirEntries;
string cname;
foreach(string path in classPath)
try
{
if (System.IO.Directory.Exists(path+folder))
{
// continue parsing?
if (!completeContent) return package;
// add sub packages
dirEntries = System.IO.Directory.GetDirectories(path+folder);
if (dirEntries != null)
foreach(string entry in dirEntries)
{
cname = GetLastStringToken(entry, dirSeparator);
if ((cname.Length > 0) && !cname.StartsWith("_")
&& (cname.IndexOf(' ') < 0) && (cname.IndexOf('.') < 0)
&& (package.Search(cname, 0) == null))
{
pathMember = new MemberModel();
pathMember.Flags = FlagType.Package;
pathMember.Type = folder.Replace(dirSeparatorChar, '.')+"."+cname;
pathMember.Name = cname;
package.Add(pathMember);
}
}
// add sub classes
dirEntries = System.IO.Directory.GetFiles(path+folder);
if (dirEntries != null)
foreach(string entry in dirEntries)
if (entry.EndsWith(".as")) {
cname = GetLastStringToken(entry, dirSeparator);
cname = cname.Substring(0, cname.LastIndexOf("."));
pathMember = package.Search(cname, 0);
if ((pathMember == null) && (cname.Length > 0)
&& (cname.IndexOf(' ') < 0) && (cname.IndexOf('.') < 0))
{
pathMember = new MemberModel();
pathMember.Flags = 0;
pathMember.Type = folder.Replace(dirSeparatorChar,'.')+"."+cname;
pathMember.Name = cname;
package.Add(pathMember);
}
}
}
}
catch(Exception ex)
{
ErrorHandler.ShowError(ex.Message+"\n"+path+folder, ex);
}
// result
if (package.Count > 0)
{
package.Sort();
return package;
}
else return null;
}