本文整理汇总了C#中GLib.List.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# List.Contains方法的具体用法?C# List.Contains怎么用?C# List.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLib.List
的用法示例。
在下文中一共展示了List.Contains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplicationsFor
AppInfo[] ApplicationsFor(IEnumerable<string> types)
{
List<AppInfo> app_infos = new List<AppInfo> ();
List<string> existing_ids = new List<string> ();
foreach (string type in types)
foreach (AppInfo appinfo in AppInfoAdapter.GetAllForType (type)) {
if (existing_ids.Contains (appinfo.Id))
continue;
if (!appinfo.SupportsUris)
continue;
if (ignore_apps != null && ignore_apps.Contains (appinfo.Executable))
continue;
app_infos.Add (appinfo);
existing_ids.Add (appinfo.Id);
}
return app_infos.ToArray ();
}
示例2: FileIsMpeg
public static bool FileIsMpeg(string filepath)
{
string extension = Path.GetExtension(filepath).Replace(".", "").ToLower();
var extensions = new List<string> (MpegRemuxer.EXTENSIONS);
return extensions.Contains(extension);
}
示例3: reload_covers
private bool reload_covers()
{
if (Timeline != null) {
Timeline.Pause ();
}
HideAll ();
Show ();
if (covers != null && covers.Count != 0) {
Console.WriteLine("ClutterFlow - Reloading Covers");
// the old current index
int old_target_index = CurrentCover!=null ? covers.IndexOf (CurrentCover) : 0;
// the newly calculated index
int new_target_index = 0;
// whether or not to keep the current cover centered
bool keep_current = false;
List<ClutterFlowBaseActor> old_covers = new List<ClutterFlowBaseActor> (
SafeGetRange (covers, old_target_index - HalfVisCovers - 1, visibleCovers + 2));
foreach (ClutterFlowBaseActor actor in covers) {
if (actor.Data.ContainsKey ("isOldCover")) {
actor.Data.Remove ("isOldCover");
}
actor.Index = -1;
if (old_covers.Contains (actor)) {
actor.Data.Add ("isOldCover", true);
}
}
ResetLetterLookup ();
List<ClutterFlowBaseActor> persistent_covers = new List<ClutterFlowBaseActor>();
covers = actor_loader.GetActors (this);
covers.ForEach (delegate (ClutterFlowBaseActor actor) {
if (actor.Data.ContainsKey ("isOldCover")) {
persistent_covers.Add (actor);
}
if (CurrentCover==actor) {
keep_current = true;
}
UpdateLetterLookup (actor);
});
InvokeLetterLookupChanged ();
if (covers.Count == 0) {
InstallEmptyActor ();
if (old_covers.Contains (EmptyActor)) {
EmptyActor.Show ();
return false;
}
keep_current = true;
}
//recalculate timeline progression and the target index
if (covers.Count > 1) {
if (keep_current) {
new_target_index = CurrentCover.Index;
} else {
if (persistent_covers.Count==0) {
new_target_index = (int) Math.Round(Timeline.Progress * (covers.Count-1));
} else if (persistent_covers.Count==1) {
new_target_index = persistent_covers[0].Index;
} else {
new_target_index = persistent_covers[(int) (((float) persistent_covers.Count * 0.5f) - 1.0f)].Index;
}
}
}
TargetIndex = new_target_index;
Timeline.JumpToTarget ();
//Console.WriteLine ("Timeline progress set to " + Timeline.Progress + " Timeline.RelativeTarget is " + Timeline.RelativeTarget);
List<ClutterFlowBaseActor> truly_pers = new List<ClutterFlowBaseActor> ();
List<ClutterFlowBaseActor> new_covers = new List<ClutterFlowBaseActor>(SafeGetRange(covers, new_target_index - HalfVisCovers - 1, visibleCovers + 2));
foreach (ClutterFlowBaseActor actor in persistent_covers) {
if (actor != null) {
if (actor.Data.ContainsKey ("isOldCover")) {
actor.Data.Remove ("isOldCover");
}
if (new_covers.Contains (actor)) {
truly_pers.Add (actor);
new_covers.Remove (actor);
old_covers.Remove (actor);
actor.Show ();
}
}
}
foreach (ClutterFlowBaseActor actor in old_covers) {
if (actor != null) {
actor.Data.Remove ("isOldCover");
}
}
/*Console.WriteLine ("old_covers contains " + old_covers.Count + " elements:");
foreach (ClutterFlowBaseActor cover in old_covers)
Console.WriteLine("\t- " + cover.Label.Replace("\n", " - "));
Console.WriteLine ("persistent_covers contains " + truly_pers.Count + " elements");
foreach (ClutterFlowBaseActor cover in truly_pers)
Console.WriteLine("\t- " + cover.Label.Replace("\n", " - "));
//.........这里部分代码省略.........
示例4: Show
public void Show(Connection connection, LdapEntry entry, bool showAll)
{
displayAll = showAll;
conn = connection;
currentDN = entry.DN;
currentAttributes = new NameValueCollection ();
// FIXME: crashes after an apply if I don't re-create the store;
store = new ListStore (typeof (string), typeof(string));
store.SetSortColumnId (0, SortType.Ascending);
tv.Model = store;
// store.Clear ();
allAttrs = new List<string> ();
LdapAttribute a = entry.getAttribute ("objectClass");
for (int i = 0; i < a.StringValueArray.Length; i++) {
string o = (string) a.StringValueArray[i];
store.AppendValues ("objectClass", o);
currentAttributes.Add ("objectClass", o);
string[] attrs = conn.Data.GetAllAttributes (o);
if (attrs != null) {
foreach (string at in attrs)
if (!allAttrs.Contains (at))
allAttrs.Add (at);
} else {
Log.Debug("Could not retrieve any attribute for objectClass " + o);
}
}
LdapAttributeSet attributeSet = entry.getAttributeSet ();
// Fedora Directory Server supports an Access Control Item (ACI)
// but it is not listed as "allowed attribute" for any objectClass
// found in Fedora's LDAP schema.
if (showAll && conn.Settings.ServerType == LdapServerType.FedoraDirectory) {
LdapEntry[] acientries = conn.Data.Search( currentDN,
LdapConnection.SCOPE_BASE,
"objectclass=*",
new string[] {"aci"} );
if (acientries.Length > 0) {
LdapEntry acientry = acientries[0];
LdapAttribute aciattr = acientry.getAttribute("aci");
if (aciattr != null)
if (attributeSet.Add(aciattr) == false)
Log.Debug ("Could not add ACI attribute.");
}
}
foreach (LdapAttribute attr in attributeSet) {
if (allAttrs.Contains (attr.Name))
allAttrs.Remove (attr.Name);
if (attr.Name.ToLower() == "objectclass")
continue;
try {
foreach (string s in attr.StringValueArray) {
store.AppendValues (attr.Name, s);
currentAttributes.Add (attr.Name, s);
}
} catch (ArgumentOutOfRangeException e) {
// FIXME: this only happens with gmcs
store.AppendValues (attr.Name, "");
Log.Debug ("Show attribute arugment out of range: {0}", attr.Name);
Log.Debug (e.Message);
}
}
if (!showAll)
return;
foreach (string n in allAttrs)
store.AppendValues (n, "");
}